CMakeLists.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. INCLUDE(BuildPlugin)
  2. # definitions for ZynAddSubFX
  3. IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE OR LMMS_BUILD_OPENBSD OR LMMS_BUILD_FREEBSD)
  4. FIND_PACKAGE(X11)
  5. INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
  6. ADD_DEFINITIONS(-DOS_LINUX)
  7. ELSE()
  8. ADD_DEFINITIONS(-DOS_WINDOWS)
  9. ENDIF()
  10. # do not conflict with LMMS' Controller class
  11. ADD_DEFINITIONS(-DController=ZynController)
  12. # use asm optimizations when on x86 or x86_64
  13. IF(LMMS_HOST_X86 OR LMMS_HOST_X86_64)
  14. ADD_DEFINITIONS(-DASM_F2I_YES)
  15. ENDIF(LMMS_HOST_X86 OR LMMS_HOST_X86_64)
  16. # build ZynAddSubFX with full optimizations
  17. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wno-write-strings -Wno-deprecated-declarations -fpermissive")
  18. IF(LMMS_BUILD_WIN32)
  19. # link system-libraries
  20. ADD_DEFINITIONS(-DPTW32_STATIC_LIB)
  21. # fix X11 headers errors caused by bug with mingw + c++11
  22. REMOVE_DEFINITIONS(-std=c++0x)
  23. ADD_DEFINITIONS(-std=gnu++0x)
  24. ENDIF(LMMS_BUILD_WIN32)
  25. SET(FLTK_SKIP_OPENGL TRUE)
  26. SET(FLTK_SKIP_FORMS TRUE)
  27. SET(FLTK_SKIP_IMAGES TRUE)
  28. SET(FLTK_SKIP_MATH TRUE)
  29. IF(MINGW_PREFIX)
  30. SET(FLTK_SKIP_FLUID TRUE)
  31. ENDIF()
  32. IF(NOT FLTK_FOUND)
  33. RETURN()
  34. ENDIF()
  35. IF(MINGW_PREFIX)
  36. SET(FLTK_FLUID_EXECUTABLE "${MINGW_PREFIX}/bin/fluid")
  37. ENDIF()
  38. IF(NOT EXISTS ${FLTK_FLUID_EXECUTABLE})
  39. # Try to detect full path anyway
  40. EXECUTE_PROCESS(COMMAND which fluid OUTPUT_VARIABLE FLTK_FLUID_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE)
  41. IF(NOT EXISTS ${FLTK_FLUID_EXECUTABLE})
  42. MESSAGE(FATAL_ERROR "Please install the fluid binary which is part of FLTK.")
  43. ENDIF()
  44. ENDIF()
  45. INCLUDE_DIRECTORIES("${FLTK_INCLUDE_DIR}"
  46. "${CMAKE_CURRENT_SOURCE_DIR}"
  47. ${FFTW3F_INCLUDE_DIRS}
  48. "${CMAKE_CURRENT_BINARY_DIR}"
  49. "${CMAKE_BINARY_DIR}")
  50. include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/zynaddsubfx/src/UI)
  51. ADD_DEFINITIONS(-DPLUGINVERSION) # removes exit confirmation dialogs etc. in MasterUI.fl
  52. add_subdirectory(zynaddsubfx/src/Nio)
  53. add_subdirectory(zynaddsubfx/src/UI)
  54. SET(zynaddsubfx_core_SRCS
  55. zynaddsubfx/src/DSP/AnalogFilter.cpp
  56. zynaddsubfx/src/DSP/FFTwrapper.cpp
  57. zynaddsubfx/src/DSP/Filter.cpp
  58. zynaddsubfx/src/DSP/FormantFilter.cpp
  59. zynaddsubfx/src/DSP/SVFilter.cpp
  60. zynaddsubfx/src/DSP/Unison.cpp
  61. zynaddsubfx/src/Effects/Alienwah.cpp
  62. zynaddsubfx/src/Effects/Chorus.cpp
  63. zynaddsubfx/src/Effects/Distorsion.cpp
  64. zynaddsubfx/src/Effects/DynamicFilter.cpp
  65. zynaddsubfx/src/Effects/Echo.cpp
  66. zynaddsubfx/src/Effects/Effect.cpp
  67. zynaddsubfx/src/Effects/EffectLFO.cpp
  68. zynaddsubfx/src/Effects/EffectMgr.cpp
  69. zynaddsubfx/src/Effects/EQ.cpp
  70. zynaddsubfx/src/Effects/Phaser.cpp
  71. zynaddsubfx/src/Effects/Reverb.cpp
  72. zynaddsubfx/src/Misc/Bank.cpp
  73. zynaddsubfx/src/Misc/Config.cpp
  74. zynaddsubfx/src/Misc/Dump.cpp
  75. zynaddsubfx/src/Misc/Master.cpp
  76. zynaddsubfx/src/Misc/Microtonal.cpp
  77. zynaddsubfx/src/Misc/Part.cpp
  78. zynaddsubfx/src/Misc/Util.cpp
  79. zynaddsubfx/src/Misc/QtXmlWrapper.cpp
  80. zynaddsubfx/src/Misc/Recorder.cpp
  81. zynaddsubfx/src/Misc/WavFile.cpp
  82. zynaddsubfx/src/Misc/WaveShapeSmps.cpp
  83. zynaddsubfx/src/Params/ADnoteParameters.cpp
  84. zynaddsubfx/src/Params/Controller.cpp
  85. zynaddsubfx/src/Params/EnvelopeParams.cpp
  86. zynaddsubfx/src/Params/FilterParams.cpp
  87. zynaddsubfx/src/Params/LFOParams.cpp
  88. zynaddsubfx/src/Params/PADnoteParameters.cpp
  89. zynaddsubfx/src/Params/Presets.cpp
  90. zynaddsubfx/src/Params/PresetsArray.cpp
  91. zynaddsubfx/src/Params/PresetsStore.cpp
  92. zynaddsubfx/src/Params/SUBnoteParameters.cpp
  93. zynaddsubfx/src/Synth/SynthNote.cpp
  94. zynaddsubfx/src/Synth/ADnote.cpp
  95. zynaddsubfx/src/Synth/Envelope.cpp
  96. zynaddsubfx/src/Synth/LFO.cpp
  97. zynaddsubfx/src/Synth/OscilGen.cpp
  98. zynaddsubfx/src/Synth/PADnote.cpp
  99. zynaddsubfx/src/Synth/Resonance.cpp
  100. zynaddsubfx/src/Synth/SUBnote.cpp
  101. )
  102. IF(LMMS_BUILD_LINUX)
  103. ADD_LIBRARY(ZynAddSubFxCore MODULE LocalZynAddSubFx.cpp ${zynaddsubfx_core_SRCS})
  104. ELSE()
  105. ADD_LIBRARY(ZynAddSubFxCore SHARED LocalZynAddSubFx.cpp ${zynaddsubfx_core_SRCS})
  106. ENDIF()
  107. TARGET_LINK_LIBRARIES(ZynAddSubFxCore zynaddsubfx_nio ${FFTW3F_LIBRARIES} ${QT_LIBRARIES} -lz -lpthread)
  108. # required libs for debug msys builds
  109. IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
  110. TARGET_LINK_LIBRARIES(ZynAddSubFxCore QtCore4 QtGui4 QtXml4)
  111. ENDIF()
  112. IF(QT5)
  113. TARGET_LINK_LIBRARIES(ZynAddSubFxCore Qt5::Widgets Qt5::Xml)
  114. ENDIF()
  115. IF(LMMS_BUILD_WIN32)
  116. TARGET_LINK_LIBRARIES(ZynAddSubFxCore -lws2_32)
  117. INSTALL(TARGETS ZynAddSubFxCore RUNTIME DESTINATION "${PLUGIN_DIR}")
  118. ELSE(LMMS_BUILD_WIN32)
  119. INSTALL(TARGETS ZynAddSubFxCore LIBRARY DESTINATION "${PLUGIN_DIR}")
  120. ENDIF(LMMS_BUILD_WIN32)
  121. LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/..")
  122. IF(LMMS_BUILD_LINUX)
  123. LINK_LIBRARIES(-Wl,--enable-new-dtags)
  124. SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
  125. SET(CMAKE_INSTALL_RPATH "$ORIGIN")
  126. ELSE()
  127. SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PLUGIN_DIR}")
  128. ENDIF()
  129. BUILD_PLUGIN(zynaddsubfx ZynAddSubFx.cpp ZynAddSubFx.h MOCFILES ZynAddSubFx.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
  130. TARGET_LINK_LIBRARIES(zynaddsubfx -lZynAddSubFxCore)
  131. ADD_DEPENDENCIES(zynaddsubfx ZynAddSubFxCore)
  132. IF(WIN32)
  133. SET(WINRC "${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfxrc.obj")
  134. ADD_CUSTOM_COMMAND(OUTPUT "${WINRC}"
  135. COMMAND "${WINDRES}"
  136. "-I\"${CMAKE_CURRENT_SOURCE_DIR}\""
  137. "-o\"${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfxrc.obj\""
  138. "-i\"${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfx.rc\""
  139. DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/zynaddsubfx.rc")
  140. ENDIF(WIN32)
  141. # Use libraries in non-standard directories (e.g., another version of Qt)
  142. SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  143. ADD_EXECUTABLE(RemoteZynAddSubFx RemoteZynAddSubFx.cpp "${WINRC}")
  144. INSTALL(TARGETS RemoteZynAddSubFx RUNTIME DESTINATION "${PLUGIN_DIR}")
  145. IF(LMMS_BUILD_WIN32)
  146. SET_TARGET_PROPERTIES(RemoteZynAddSubFx PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows")
  147. ENDIF(LMMS_BUILD_WIN32)
  148. # Remove useless dependencies from FLTK. Use fltk-config to avoid static library
  149. # in older environments
  150. SET(FLTK_FILTERED_LDFLAGS ${FLTK_LIBRARIES})
  151. FIND_PROGRAM(FLTK_CONFIG fltk-config)
  152. IF(FLTK_CONFIG AND NOT (LMMS_BUILD_APPLE OR LMMS_BUILD_WIN32))
  153. EXECUTE_PROCESS(COMMAND ${FLTK_CONFIG} --ldflags OUTPUT_VARIABLE FLTK_FILTERED_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
  154. STRING(REPLACE " " ";" FLTK_FILTERED_LDFLAGS ${FLTK_FILTERED_LDFLAGS})
  155. LIST(REMOVE_ITEM FLTK_FILTERED_LDFLAGS -lX11)
  156. ENDIF()
  157. TARGET_LINK_LIBRARIES(RemoteZynAddSubFx zynaddsubfx_gui -lZynAddSubFxCore ${FLTK_FILTERED_LDFLAGS} -lpthread )
  158. ADD_DEPENDENCIES(RemoteZynAddSubFx ZynAddSubFxCore)
  159. # Support qt_version_tag in Qt 5.6
  160. IF(QT5)
  161. TARGET_LINK_LIBRARIES(RemoteZynAddSubFx Qt5::Core)
  162. ENDIF(QT5)
  163. # link Qt libraries when on win32
  164. IF(LMMS_BUILD_WIN32)
  165. TARGET_LINK_LIBRARIES(RemoteZynAddSubFx ${QT_LIBRARIES})
  166. ENDIF(LMMS_BUILD_WIN32)
  167. IF(LMMS_BUILD_WIN32)
  168. ADD_CUSTOM_COMMAND(TARGET ZynAddSubFxCore POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:ZynAddSubFxCore>\")
  169. ADD_CUSTOM_COMMAND(TARGET RemoteZynAddSubFx POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:RemoteZynAddSubFx>\")
  170. ENDIF(LMMS_BUILD_WIN32)