forked from WohlSoft/SDL-Mixer-X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusic_midi_edmidi.cmake
53 lines (49 loc) · 2.13 KB
/
music_midi_edmidi.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
option(USE_MIDI_EDMIDI "Build with libEDMIDI OPLL, PSG, and SCC Emulator based MIDI sequencer support" ON)
if(USE_MIDI_EDMIDI)
option(USE_MIDI_EDMIDI_DYNAMIC "Use dynamical loading of libEDMIDI library" OFF)
option(USE_SYSTEM_EDMIDI "Use the library from the system even USE_SYSTEM_AUDIO_LIBRARIES is unset" OFF)
if(USE_SYSTEM_AUDIO_LIBRARIES OR USE_SYSTEM_EDMIDI)
find_package(EDMIDI QUIET)
message("EDMIDI: [${EDMIDI_FOUND}] ${EDMIDI_INCLUDE_DIRS} ${EDMIDI_LIBRARIES}")
if(USE_MIDI_EDMIDI_DYNAMIC)
list(APPEND SDL_MIXER_DEFINITIONS -DEDMIDI_DYNAMIC=\"${EDMIDI_DYNAMIC_LIBRARY}\")
message("Dynamic libEDMIDI: ${EDMIDI_DYNAMIC_LIBRARY}")
endif()
if(EDMIDI_FOUND)
cpp_needed(${SDLMixerX_SOURCE_DIR}/cmake/tests/cpp_needed/edmidi.c
""
${EDMIDI_INCLUDE_DIRS}
"${EDMIDI_LIBRARIES};${M_LIBRARY}"
STDCPP_NEEDED
)
endif()
else()
if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY)
set(EDMIDI_LIBRARIES EDMIDI${MIX_DEBUG_SUFFIX})
else()
find_library(EDMIDI_LIBRARIES NAMES EDMIDI HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib")
endif()
if(EDMIDI_LIBRARIES)
set(EDMIDI_FOUND 1)
set(STDCPP_NEEDED 1) # Statically linking EDMIDI which is C++ library
endif()
set(EDMIDI_INCLUDE_DIRS "${AUDIO_CODECS_PATH}/libEDMIDI/include")
endif()
if(EDMIDI_FOUND)
message("== using EDMIDI (Zlib) ==")
setLicense(LICENSE_ZLIB)
list(APPEND SDL_MIXER_DEFINITIONS -DMUSIC_MID_EDMIDI)
set(LIBMATH_NEEDED 1)
list(APPEND SDL_MIXER_INCLUDE_PATHS ${EDMIDI_INCLUDE_DIRS})
if(NOT USE_SYSTEM_AUDIO_LIBRARIES OR NOT USE_MIDI_EDMIDI_DYNAMIC)
list(APPEND SDLMixerX_LINK_LIBS ${EDMIDI_LIBRARIES})
endif()
list(APPEND SDLMixerX_SOURCES
${CMAKE_CURRENT_LIST_DIR}/music_midi_edmidi.c
${CMAKE_CURRENT_LIST_DIR}/music_midi_edmidi.h
)
appendMidiFormats("MIDI;RIFF MIDI;XMI;MUS")
else()
message("-- skipping EDMIDI --")
endif()
endif()