zynaddsubfx

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

commit 9a4919a8743c925bf7183f7f7a3d9774b51259fd
parent 008bfc290d88c3fec1f1591dbcb86bc189dd8a1e
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Sun, 22 Apr 2012 13:39:28 -0400

CMake: fixed breaks in version 2.8.8

- Code now more directly relies on pkg-config

Diffstat:
Dcmake/FindMXML.cmake | 17-----------------
Dcmake/FindPortAudio.cmake | 19-------------------
Dcmake/Findfftw.cmake | 17-----------------
Dcmake/LibFindMacros.cmake | 93-------------------------------------------------------------------------------
Msrc/CMakeLists.txt | 19++++++++-----------
Msrc/Tests/CMakeLists.txt | 2+-
6 files changed, 9 insertions(+), 158 deletions(-)

diff --git a/cmake/FindMXML.cmake b/cmake/FindMXML.cmake @@ -1,17 +0,0 @@ -#Find mxml (mini xml library) - -include(LibFindMacros) -libfind_pkg_check_modules(MXML mxml) -find_path(MXML_INCLUDE_DIR - NAMES mxml.h - PATHS ${MXML_INCLUDE_DIRS} - ) - -find_library(MXML_LIBRARY - NAMES mxml - PATHS ${MXML_LIBRARY_DIRS} - ) - -set(MXML_PROCESS_INCLUDES MXML_INCLUDE_DIR) -set(MXML_PROCESS_LIBS MXML_LIBRARY) -libfind_process(MXML) diff --git a/cmake/FindPortAudio.cmake b/cmake/FindPortAudio.cmake @@ -1,19 +0,0 @@ -#Find Port Audio - - -include(LibFindMacros) -libfind_pkg_check_modules(PORTAUDIO portaudio-2.0>=19) - -find_path(PORTAUDIO_INCLUDE_DIR - NAMES portaudio.h - PATHS ${PortAudio_INCLUDE_DIRS} - ) - -find_library(PORTAUDIO_LIBRARY - NAMES portaudio - PATHS ${PortAudio_LIBRARY_DIRS} - ) - -set(PORTAUDIO_PROCESS_INCLUDES PORTAUDIO_INCLUDE_DIR) -set(PORTAUDIO_PROCESS_LIBS PORTAUDIO_LIBRARY) -libfind_process(PORTAUDIO) diff --git a/cmake/Findfftw.cmake b/cmake/Findfftw.cmake @@ -1,17 +0,0 @@ -#Find fftw (FFT algorithm library) - -include(LibFindMacros) -libfind_pkg_check_modules(FFTW fftw3) -find_path(FFTW_INCLUDE_DIR - NAMES fftw3.h - PATHS ${FFTW_INCLUDE_DIRS} - ) - -find_library(FFTW_LIBRARY - NAMES fftw3 - PATHS ${FFTW_LIBRARY_DIRS} - ) - -set(FFTW_PROCESS_INCLUDES FFTW_INCLUDE_DIR) -set(FFTW_PROCESS_LIBS FFTW_LIBRARY) -libfind_process(FFTW) diff --git a/cmake/LibFindMacros.cmake b/cmake/LibFindMacros.cmake @@ -1,93 +0,0 @@ -# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments -# used for the current package. For this to work, the first parameter must be the -# prefix of the current package, then the prefix of the new package etc, which are -# passed to find_package. -macro (libfind_package PREFIX) - set (LIBFIND_PACKAGE_ARGS ${ARGN}) - if (${PREFIX}_FIND_QUIETLY) - set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET) - endif (${PREFIX}_FIND_QUIETLY) - if (${PREFIX}_FIND_REQUIRED) - set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED) - endif (${PREFIX}_FIND_REQUIRED) - find_package(${LIBFIND_PACKAGE_ARGS}) -endmacro (libfind_package) - -# CMake developers made the UsePkgConfig system deprecated in the same release (2.6) -# where they added pkg_check_modules. Consequently I need to support both in my scripts -# to avoid those deprecated warnings. Here's a helper that does just that. -# Works identically to pkg_check_modules, except that no checks are needed prior to use. -macro (libfind_pkg_check_modules PREFIX PKGNAME) - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - include(UsePkgConfig) - pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(${PREFIX} ${PKGNAME}) - endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) -endmacro (libfind_pkg_check_modules) - -# Do the final processing once the paths have been detected. -# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain -# all the variables, each of which contain one include directory. -# Ditto for ${PREFIX}_PROCESS_LIBS and library files. -# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. -# Also handles errors in case library detection was required, etc. -macro (libfind_process PREFIX) - # Process all includes and set _FOUND to false if any are missing - foreach (i ${${PREFIX}_PROCESS_INCLUDES}) - if (${i}) - set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}}) - mark_as_advanced(${i}) - else (${i}) - set (${PREFIX}_FOUND FALSE) - endif (${i}) - endforeach (i) - - # Process all libraries and set _FOUND to false if any are missing - foreach (i ${${PREFIX}_PROCESS_LIBS}) - if (${i}) - set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}}) - mark_as_advanced(${i}) - else (${i}) - set (${PREFIX}_FOUND FALSE) - endif (${i}) - endforeach (i) - - # Print message and/or exit on fatal error - if (${PREFIX}_FOUND) - if (NOT ${PREFIX}_FIND_QUIETLY) - message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") - endif (NOT ${PREFIX}_FIND_QUIETLY) - else (${PREFIX}_FOUND) - if (${PREFIX}_FIND_REQUIRED) - foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) - message("${i}=${${i}}") - endforeach (i) - message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.") - endif (${PREFIX}_FIND_REQUIRED) - endif (${PREFIX}_FOUND) -endmacro (libfind_process) - -macro(libfind_library PREFIX basename) - set(TMP "") - if(MSVC80) - set(TMP -vc80) - endif(MSVC80) - if(MSVC90) - set(TMP -vc90) - endif(MSVC90) - set(${PREFIX}_LIBNAMES ${basename}${TMP}) - if(${ARGC} GREATER 2) - set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2}) - string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES}) - set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP}) - endif(${ARGC} GREATER 2) - find_library(${PREFIX}_LIBRARY - NAMES ${${PREFIX}_LIBNAMES} - PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS} - ) -endmacro(libfind_library) - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt @@ -3,15 +3,15 @@ message(STATUS "Checking Include Path" $ENV{CMAKE_INCLUDE_PATH} ${CMAKE_INCLUDE_ message(STATUS "Checking Library Path" $ENV{CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH}) #Dependency check -find_package(zlib REQUIRED) -find_package(fftw REQUIRED) -find_package(MXML REQUIRED) find_package(PkgConfig REQUIRED) +find_package(zlib REQUIRED) +pkg_check_modules(FFTW REQUIRED fftw3) +pkg_check_modules(MXML REQUIRED mxml) find_package(Threads REQUIRED) find_package(OSS) find_package(Alsa) -find_package(JACK) -find_package(PortAudio) +pkg_check_modules(JACK jack) +pkg_check_modules(PORTAUDIO portaudio-2.0>=19) set(FLTK_SKIP_OPENGL true) find_package(FLTK) find_package(OpenGL) #for FLTK @@ -26,7 +26,7 @@ mark_as_advanced(DSSI_LIBRARIES) # NOTE: These cache variables should normally 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 (DefaultOutput oss CACHE STRING +SET (DefaultOutput alsa CACHE STRING "Default Output module: [null, alsa, oss, jack, portaudio]") SET (GuiModule fltk CACHE STRING "GUI module, either fltk, qt or off") SET (CompileTests ${CXXTEST_FOUND} CACHE BOOL "whether tests should be compiled in or not") @@ -62,9 +62,6 @@ else () message(STATUS "GUI module defaulting to off") endif() -if(NOT PKG_CONFIG_FOUND) - message(FATAL_ERROR "pkg-config not found") -endif(NOT PKG_CONFIG_FOUND) #Build Flags option (BuildForAMD_X86_64 "Build for AMD x86_64 system" OFF) @@ -265,7 +262,7 @@ if (DssiEnable) ${NONGUI_LIBRARIES} ${ZLIB_LIBRARIES} ${FFTW_LIBRARY} - ${MXML_LIBRARY} + ${MXML_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES} ${OS_LIBRARIES} @@ -277,7 +274,7 @@ if (DssiEnable) endif () endif() -message(STATUS "Link libraries: ${ZLIB_LIBRARY} ${FFTW_LIBRARY} ${MXML_LIBRARY} ${AUDIO_LIBRARIES} ${OS_LIBRARIES}") +message(STATUS "Link libraries: ${ZLIB_LIBRARY} ${FFTW_LIBRARY} ${MXML_LIBRARIES} ${AUDIO_LIBRARIES} ${OS_LIBRARIES}") install(TARGETS zynaddsubfx RUNTIME DESTINATION bin ) diff --git a/src/Tests/CMakeLists.txt b/src/Tests/CMakeLists.txt @@ -12,7 +12,7 @@ CXXTEST_ADD_TEST(SUBnoteTest SubNoteTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SubNote CXXTEST_ADD_TEST(OscilGenTest OscilGenTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/OscilGenTest.h) CXXTEST_ADD_TEST(RandTest RandTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/RandTest.h) -set(test_lib ${NONGUI_LIBRARIES} ${ZLIB_LIBRARY} ${FFTW_LIBRARY} ${MXML_LIBRARY} pthread) +set(test_lib ${NONGUI_LIBRARIES} ${ZLIB_LIBRARY} ${FFTW_LIBRARIES} ${MXML_LIBRARIES} pthread) message(STATUS "Linking tests with: ${test_lib}") target_link_libraries(ADnoteTest ${test_lib}) target_link_libraries(SUBnoteTest ${test_lib})