zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 084d48dac6dc2878ad2837054ba93e4bbf5a2123
parent 62614bd9feaa31b5992566c0accb9f41f0a9c434
Author: fundamental <[email protected]>
Date:   Mon, 20 Jul 2009 18:03:49 -0400

Cmake system updates

Various modifications too cmake and fixes to allow for a proper compile of the
FLTK version or the no GUI versions

Diffstat:
MCMakeLists.txt | 3++-
Acmake/Findfftw.cmake | 33+++++++++++++++++++++++++++++++++
Dcmake/Findfftw3.cmake | 31-------------------------------
Acmake/Findzlib.cmake | 30++++++++++++++++++++++++++++++
Msrc/CMakeLists.txt | 64+++++++++++++++++++++++++++++++++++++++-------------------------
Msrc/DSP/CMakeLists.txt | 2+-
Msrc/Effects/CMakeLists.txt | 2+-
Msrc/Input/CMakeLists.txt | 11++++-------
Msrc/Misc/CMakeLists.txt | 9+--------
Msrc/Output/CMakeLists.txt | 6+++---
Msrc/Params/CMakeLists.txt | 2+-
Msrc/Samples/CMakeLists.txt | 1-
Msrc/Seq/CMakeLists.txt | 2+-
Msrc/Synth/CMakeLists.txt | 2+-
Msrc/UI/CMakeLists.txt | 6++----
15 files changed, 119 insertions(+), 85 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -1,5 +1,6 @@ - cmake_minimum_required(VERSION 2.6) +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") project(zynaddsubfx) +#Currently the only directory that uses cmake add_subdirectory(src) diff --git a/cmake/Findfftw.cmake b/cmake/Findfftw.cmake @@ -0,0 +1,33 @@ +# - Try to find fftw +# Once done this will define: +# fftw_FOUND - system has fftw +# fftw_INCLUDE_DIR - incude paths to use fftw +# fftw_LIBRARIES - Link these to use fftw +# fftw_VERSION - Version of fftw found + +SET(fftw_FOUND 0) + +IF(UNIX) + FIND_PATH(fftw_INCLUDE_DIR + fftw3.h + /usr/include + ) + + FIND_LIBRARY(fftw_LIBRARIES + fftw3 + /usr/lib + ) + +ENDIF(UNIX) + +# handle the QUIETLY and REQUIRED arguments and set fftw_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(fftw DEFAULT_MSG fftw_LIBRARIES fftw_INCLUDE_DIR) + +set(fftw_VERSION 3) #only one option for now [TODO]:extend for version two + +MARK_AS_ADVANCED( + fftw_INCLUDE_DIR + fftw_LIBRARIES +) diff --git a/cmake/Findfftw3.cmake b/cmake/Findfftw3.cmake @@ -1,31 +0,0 @@ -# - Try to find Motif (or lesstif) -# Once done this will define: -# fftw3_FOUND - system has fftw3 -# fftw3_INCLUDE_DIR - incude paths to use Motif -# fftw3_LIBRARIES - Link these to use Motif - -SET(fftw3_FOUND 0) - -IF(UNIX) - FIND_PATH(fftw3_INCLUDE_DIR - fftw3.h - /usr/include - ) - - FIND_LIBRARY(fftw3_LIBRARIES - fftw3 - /usr/lib - ) - -ENDIF(UNIX) - -# handle the QUIETLY and REQUIRED arguments and set fftw3_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(fftw3 DEFAULT_MSG fftw3_LIBRARIES fftw3_INCLUDE_DIR) - - -MARK_AS_ADVANCED( - fftw3_INCLUDE_DIR - fftw3_LIBRARIES -) diff --git a/cmake/Findzlib.cmake b/cmake/Findzlib.cmake @@ -0,0 +1,30 @@ +# Try to find zlib +# Once done this will define: +# zlib_FOUND - system has ZLIB +# zlib_INCLUDE_DIR - incude paths for zlib +# zlib_LIBRARIES - Link these to use zlib + +SET(zlib_FOUND 0) + +IF(UNIX) + FIND_PATH(zlib_INCLUDE_DIR + zlib.h + /usr/include + ) + FIND_LIBRARY(zlib_LIBRARIES + NAMES z zlib + PATHS/usr/lib /usr/local/lib + ) + +ENDIF(UNIX) + +# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(zlib DEFAULT_MSG zlib_LIBRARIES zlib_INCLUDE_DIR) + + +MARK_AS_ADVANCED( + zlib_INCLUDE_DIR + zlib_LIBRARIES +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt @@ -1,29 +1,41 @@ +#Dependency check +find_package(zlib REQUIRED) +find_package(fftw REQUIRED) +find_package(MXML REQUIRED) +#find_package(pthread REQUIRED) +find_package(Alsa) +find_package(JACK) +find_package(PortAudio) +find_package(FLTK) + ######### Settings ########### # NOTE: These cache variables should normallly not be changed in this # file, but either in in CMakeCache.txt before compile, or by passing # parameters directly into cmake using the -D flag. SET (FFTW_VERSION 3 CACHE STRING "Version number of FFTW") -SET (OutputModule jack CACHE STRING "Output module, either alsa, jack or portaudio") +SET (OutputModule alsa CACHE STRING "Output module, either alsa, jack or portaudio") SET (GuiModule fltk CACHE STRING "GUI module, either fltk, qt or off") # Now, handle the incoming settings and set define flags/variables based # on this -if (GuiModule STREQUAL qt) +if (GuiModule STREQUAL qt AND QT_FOUND) set (QtGui TRUE) -elseif(GuiModule STREQUAL fltk) +elseif(GuiModule STREQUAL fltk AND FLTK_FOUND) set (FltkGui TRUE) elseif(GuiModule STREQUAL off) - add_definitions(-DDISABLE_GUI) + add_definitions(-DDISABLE_GUI) else () - message(FATAL_ERROR "GUI module must be either fltk, qt or off") + set (GuiModule off CACHE STRING "GUI module, either fltk, qt or off") + add_definitions(-DDISABLE_GUI) + message(STATUS "GUI module defaulting to off") endif() -if (OutputModule STREQUAL alsa) +if (OutputModule STREQUAL alsa AND ALSA_FOUND) set(AlsaMidiOutput TRUE) -elseif(OutputModule STREQUAL jack) +elseif(OutputModule STREQUAL jack AND JACK_FOUND) set(JackOutput TRUE) -elseif(OutputModule STREQUAL portaudio) +elseif(OutputModule STREQUAL portaudio AND PortAudio_FOUND) set(PortAudioOutput TRUE) else () message(FATAL_ERROR "OutputModule must be either alsa, jack or portaudio") @@ -33,23 +45,21 @@ endif() # From here on, the setting variables have been prepared so concentrate # on the actual compiling. -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") - if(AlsaMidiOutput) - FIND_PACKAGE(Alsa) add_definitions(-DOSSAUDIOOUT) + set(AUDIO_LIBRARIES ${AUDIO_LIBRARIES} ${ASOUND_LIBRARY}) endif() if(JackOutput) - FIND_PACKAGE(JACK) include_directories(${JACK_INCLUDE_DIR}) add_definitions(-DJACKAUDIOOUT) + set(AUDIO_LIBRARIES ${AUDIO_LIBRARIES} ${JACK_LIBRARIES}) endif() if(PortAudioOutput) - FIND_PACKAGE(PortAudio) include_directories(${PORTAUDIO_INCLUDE_DIR}) add_definitions(-DPAAUDIOOUT) + set(AUDIO_LIBRARIES ${AUDIO_LIBRARIES} ${PORTAUDIO_LIBRARIES}) endif() add_definitions(-DFFTW_VERSION_${FFTW_VERSION} @@ -59,12 +69,16 @@ add_definitions(-DFFTW_VERSION_${FFTW_VERSION} ) -if(FltkGui) # Check for FLTK - find_package(FLTK REQUIRED) - # message(STATUS "FLTK_LIBRARIES: ${FLTK_LIBRARIES}") - # message("FLTK_MATH_LIBRARY: ${FLTK_MATH_LIBRARY}") - # message("FLTK_LIBRARIES: ${FLTK_LIBRARIES}") +if(FltkGui) + #message(STATUS "FLTK_LIBRARIES: ${FLTK_LIBRARIES}") + #message(STATUS "FLTK_MATH_LIBRARY: ${FLTK_MATH_LIBRARY}") + #UGLY WORKAROUND + find_program (MYFLTK_CONFIG fltk-config) + if (MYFLTK_CONFIG) + execute_process (COMMAND ${MYFLTK_CONFIG} --ldflags OUTPUT_VARIABLE MYFLTK_LDFLAGS) + string(STRIP ${MYFLTK_LDFLAGS} MYFLTK_LIBRARIES) + endif() mark_as_advanced(FORCE FLTK_BASE_LIBRARY) mark_as_advanced(FORCE FLTK_CONFIG_SCRIPT) mark_as_advanced(FORCE FLTK_DIR) @@ -76,18 +90,14 @@ if(FltkGui) # Check for FLTK mark_as_advanced(FORCE FLTK_MATH_LIBRARY) - set(GUI_LIBRARIES - ${FLTK_BASE_LIBRARY} ${FLTK_MATH_LIBRARY} ${FLTK_FORMS_LIBRARY} - ${FLTK_IMAGES_LIBRARY} ${FLTK_GL_LIBRARY} - zynaddsubfx_gui - ) + set(GUI_LIBRARIES ${FLTK_LIBRARIES} ${MYFLTK_LIBRARIES} zynaddsubfx_gui) add_definitions(-DFLTK_GUI) message(STATUS "Will build fltk gui") include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/UI - ${CMAKE_CURRENT_BINARY_DIR}/UI + "${CMAKE_CURRENT_SOURCE_DIR}/UI" + "${CMAKE_CURRENT_BINARY_DIR}/UI" ) add_subdirectory(UI) @@ -134,5 +144,9 @@ target_link_libraries(zynaddsubfx zynaddsubfx_samples zynaddsubfx_controls ${GUI_LIBRARIES} + ${zlib_LIBRARIES} + ${fftw_LIBRARIES} + ${MXML_LIBRARIES} + ${AUDIO_LIBRARIES} ) diff --git a/src/DSP/CMakeLists.txt b/src/DSP/CMakeLists.txt @@ -10,4 +10,4 @@ add_library(zynaddsubfx_dsp STATIC ${zynaddsubfx_dsp_SRCS} ) -target_link_libraries(zynaddsubfx_dsp ${ASOUND_LIBRARY}) +target_link_libraries(zynaddsubfx_dsp) diff --git a/src/Effects/CMakeLists.txt b/src/Effects/CMakeLists.txt @@ -16,4 +16,4 @@ add_library(zynaddsubfx_effect STATIC ${zynaddsubfx_effect_SRCS} ) -target_link_libraries(zynaddsubfx_effect ${ASOUND_LIBRARY}) +target_link_libraries(zynaddsubfx_effect) diff --git a/src/Input/CMakeLists.txt b/src/Input/CMakeLists.txt @@ -1,22 +1,19 @@ -SET (AlsaMidiInput On CACHE BOOL "Include ALSA Midi input") +set(AlsaMidiInput On CACHE BOOL "Include ALSA Midi input") set(zynaddsubfx_input_SRCS MidiIn.cpp NULLMidiIn.cpp - #OSSMidiIn.cpp - #WINMidiIn.cpp + #OSSMidiIn.cpp #[TODO] get OSS midi detection and + #WINMidiIn.cpp # Win midi detection working ) -FIND_PACKAGE(Alsa) if(AlsaMidiInput) set(zynaddsubfx_input_SRCS ${zynaddsubfx_input_SRCS} ALSAMidiIn.cpp ) - message("Alsa midi input enabled") + message(STATUS "Alsa midi input enabled") endif(AlsaMidiInput) add_library(zynaddsubfx_input STATIC ${zynaddsubfx_input_SRCS} ) - -target_link_libraries(zynaddsubfx_input ${QT_LIBRARIES} ${ASOUND_LIBRARY}) diff --git a/src/Misc/CMakeLists.txt b/src/Misc/CMakeLists.txt @@ -1,6 +1,3 @@ -find_package(MXML) -find_package(fftw3) - include_directories(${MXML_INCLUDE_DIR}) set(zynaddsubfx_misc_SRCS @@ -18,8 +15,4 @@ add_library(zynaddsubfx_misc STATIC ${zynaddsubfx_misc_SRCS} ) -target_link_libraries(zynaddsubfx_misc - zynaddsubfx_output - ${MXML_LIBRARIES} - ${fftw3_LIBRARIES} - ) +target_link_libraries(zynaddsubfx_misc zynaddsubfx_output) diff --git a/src/Output/CMakeLists.txt b/src/Output/CMakeLists.txt @@ -7,7 +7,7 @@ if(AlsaMidiOutput) set(zynaddsubfx_output_SRCS ${zynaddsubfx_output_SRCS} OSSaudiooutput.cpp) - set(zynaddsubfx_output_lib ${ASOUND_LIBRARY}) + set(zynaddsubfx_output_lib ${ASOUND_LIBRARY}) endif(AlsaMidiOutput) if(JackOutput) @@ -15,7 +15,7 @@ if(JackOutput) set(zynaddsubfx_output_SRCS ${zynaddsubfx_output_SRCS} JACKaudiooutput.cpp) - set(zynaddsubfx_output_lib ${JACK_LIBRARIES}) + set(zynaddsubfx_output_lib ${JACK_LIBRARIES}) endif(JackOutput) if(PortAudioOutput) @@ -23,7 +23,7 @@ if(PortAudioOutput) set(zynaddsubfx_output_SRCS ${zynaddsubfx_output_SRCS} PAaudiooutput.cpp) - set(zynaddsubfx_output_lib ${PORTAUDIO_LIBRARIES}) + set(zynaddsubfx_output_lib ${PORTAUDIO_LIBRARIES}) endif(PortAudioOutput) add_library(zynaddsubfx_output STATIC diff --git a/src/Params/CMakeLists.txt b/src/Params/CMakeLists.txt @@ -15,4 +15,4 @@ add_library(zynaddsubfx_params STATIC ${zynaddsubfx_params_SRCS} ) -target_link_libraries(zynaddsubfx_params ${ASOUND_LIBRARY}) +target_link_libraries(zynaddsubfx_params)# ${ASOUND_LIBRARY}) diff --git a/src/Samples/CMakeLists.txt b/src/Samples/CMakeLists.txt @@ -2,7 +2,6 @@ set(zynaddsubfx_samples_SRCS AuSample.cpp FqSample.cpp Sample.cpp - #StereoSample.cpp ) add_library(zynaddsubfx_samples STATIC diff --git a/src/Seq/CMakeLists.txt b/src/Seq/CMakeLists.txt @@ -8,4 +8,4 @@ add_library(zynaddsubfx_seq STATIC ${zynaddsubfx_seq_SRCS} ) -target_link_libraries(zynaddsubfx_seq ${ASOUND_LIBRARY}) +target_link_libraries(zynaddsubfx_seq) diff --git a/src/Synth/CMakeLists.txt b/src/Synth/CMakeLists.txt @@ -12,4 +12,4 @@ add_library(zynaddsubfx_synth STATIC ${zynaddsubfx_synth_SRCS} ) -target_link_libraries(zynaddsubfx_synth ${ASOUND_LIBRARY}) +target_link_libraries(zynaddsubfx_synth) diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt @@ -1,6 +1,3 @@ - -set(UI_cpp_files GuiThread.cpp PARENT_SCOPE) - set(UI_fl_files ADnoteUI.fl BankUI.fl @@ -31,4 +28,5 @@ add_library(zynaddsubfx_gui STATIC ${UI_objs} ${zynaddsubfx_gui_FLTK_UI_SRCS} ) -target_link_libraries(zynaddsubfx_gui) + +target_link_libraries(zynaddsubfx_gui ${FLTK_LIBRARIES} ${MYFLTK_LIBRARIES})