diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2018-12-13 02:28:57 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2018-12-13 02:29:16 +0300 |
commit | 68c03edbb563983b6ac3e81a826871bfdf9e3bd4 (patch) | |
tree | c9bdcb2dfeaa60cececdd602b8a9f5fdb0b815fa /utils/midiplay/CMakeLists.txt | |
parent | d89084d6eaf3bb65c134201f61449656226cbf80 (diff) | |
download | libADLMIDI-68c03edbb563983b6ac3e81a826871bfdf9e3bd4.tar.gz libADLMIDI-68c03edbb563983b6ac3e81a826871bfdf9e3bd4.tar.bz2 libADLMIDI-68c03edbb563983b6ac3e81a826871bfdf9e3bd4.zip |
Build: Splid the main CMake build script
Keep it have library code only but no utils and examples are will be built independently
#196
Diffstat (limited to 'utils/midiplay/CMakeLists.txt')
-rw-r--r-- | utils/midiplay/CMakeLists.txt | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/utils/midiplay/CMakeLists.txt b/utils/midiplay/CMakeLists.txt new file mode 100644 index 0000000..ac5d4c2 --- /dev/null +++ b/utils/midiplay/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required (VERSION 3.2) +project(adlmidiplay CXX) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +if(NOT MSDOS AND NOT DJGPP AND NOT MIDIPLAY_WAVE_ONLY) + find_library(SDL2_LIBRARY SDL2 REQUIRED) + include_directories(${SDL2_INCLUDE_DIR}) + message("Found ${SDL2_LIBRARY}") +else() + unset(SDL2_LIBRARY) +endif() + +add_executable(adlmidiplay + adlmidiplay.cpp + wave_writer.c +) + +if(MIDIPLAY_WAVE_ONLY) + target_compile_definitions(adlmidiplay PUBLIC "-DOUTPUT_WAVE_ONLY") + message("Demo tool will only output WAVE file, no playing support.") +endif() + +if(MSDOS OR DJGPP) + target_compile_definitions(adlmidiplay PUBLIC "-DHARDWARE_OPL3") + message("Turn on hardware OPL3 support on demo tool") +endif() + +if(WIN32) + if(MSVC) + target_link_libraries(adlmidiplay ADLMIDI_IF ${SDL2_LIBRARY}) + else() + target_link_libraries(adlmidiplay ADLMIDI_IF ${SDL2_LIBRARY} pthread) + endif() +else() + if(MSDOS OR DJGPP) + target_link_libraries(adlmidiplay ADLMIDI_IF) + else() + set(ADLMIDIPLAY_LIBS ADLMIDI_IF ${SDL2_LIBRARY} pthread dl m stdc++) + if(OPENBSD_LOCALBASE) + list(REMOVE_ITEM ADLMIDIPLAY_LIBS dl) + endif() + target_link_libraries(adlmidiplay ${ADLMIDIPLAY_LIBS}) + endif() +endif() + +if(MSDOS OR DJGPP) + set_target_properties(adlmidiplay PROPERTIES OUTPUT_NAME adlmidi) +endif() + +if(libADLMIDI_SHARED) + add_dependencies(adlmidiplay ADLMIDI_shared) +else() + if(NOT libADLMIDI_STATIC) + message(FATAL_ERROR "libADLMIDI is required to be built!") + endif() + add_dependencies(adlmidiplay ADLMIDI_static) +endif() + +install(TARGETS adlmidiplay + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + |