You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

393 lines
12KB

  1. cmake_minimum_required(VERSION 3.15)
  2. project(Cardinal VERSION 22.08)
  3. add_subdirectory(JUCE)
  4. # Config
  5. set(CMAKE_C_VISIBILITY_PRESET hidden)
  6. set(CMAKE_CXX_VISIBILITY_PRESET hidden)
  7. # Define static libs
  8. add_library(dgl STATIC IMPORTED)
  9. set_property(TARGET dgl PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../dpf/build/libdgl-opengl.a")
  10. add_library(carla_host_plugin STATIC IMPORTED)
  11. set_property(TARGET carla_host_plugin PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/plugin/Release/carla-host-plugin.cpp.o")
  12. add_library(carla_engine_plugin STATIC IMPORTED)
  13. set_property(TARGET carla_engine_plugin PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/carla_engine_plugin.a")
  14. add_library(carla_plugin STATIC IMPORTED)
  15. set_property(TARGET carla_plugin PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/carla_plugin.a")
  16. add_library(native_plugins STATIC IMPORTED)
  17. set_property(TARGET native_plugins PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/native-plugins.a")
  18. add_library(audio_decoder STATIC IMPORTED)
  19. set_property(TARGET audio_decoder PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/audio_decoder.a")
  20. add_library(jackbridge STATIC IMPORTED)
  21. set_property(TARGET jackbridge PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/jackbridge.min.a")
  22. add_library(lilv STATIC IMPORTED)
  23. set_property(TARGET lilv PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/lilv.a")
  24. add_library(rtmempool STATIC IMPORTED)
  25. set_property(TARGET rtmempool PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/rtmempool.a")
  26. add_library(sfzero STATIC IMPORTED)
  27. set_property(TARGET sfzero PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/sfzero.a")
  28. add_library(water STATIC IMPORTED)
  29. set_property(TARGET water PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/water.a")
  30. add_library(ysfx STATIC IMPORTED)
  31. set_property(TARGET ysfx PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/ysfx.a")
  32. add_library(zita_resampler STATIC IMPORTED)
  33. set_property(TARGET zita_resampler PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/zita-resampler.a")
  34. add_library(sCardinal STATIC IMPORTED)
  35. set_property(TARGET sCardinal PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../bin/Cardinal.a")
  36. add_library(sCardinalFX STATIC IMPORTED)
  37. set_property(TARGET sCardinalFX PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../bin/CardinalFX.a")
  38. add_library(sCardinalSynth STATIC IMPORTED)
  39. set_property(TARGET sCardinalSynth PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../bin/CardinalSynth.a")
  40. add_library(sPlugins STATIC IMPORTED)
  41. set_property(TARGET sPlugins PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../plugins/plugins.a")
  42. add_library(sRack STATIC IMPORTED)
  43. set_property(TARGET sRack PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/rack.a")
  44. add_library(libaubio STATIC IMPORTED)
  45. set_property(TARGET libaubio PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../deps/aubio/libaubio.a")
  46. add_library(libarchive STATIC IMPORTED)
  47. if (WIN32)
  48. set_property(TARGET libarchive PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libarchive_static.a")
  49. else (WIN32)
  50. set_property(TARGET libarchive PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libarchive.a")
  51. endif (WIN32)
  52. add_library(libjansson STATIC IMPORTED)
  53. set_property(TARGET libjansson PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libjansson.a")
  54. add_library(libquickjs STATIC IMPORTED)
  55. set_property(TARGET libquickjs PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libquickjs.a")
  56. add_library(libsamplerate STATIC IMPORTED)
  57. set_property(TARGET libsamplerate PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libsamplerate.a")
  58. add_library(libspeexdsp STATIC IMPORTED)
  59. set_property(TARGET libspeexdsp PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libspeexdsp.a")
  60. add_library(libzstd STATIC IMPORTED)
  61. set_property(TARGET libzstd PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libzstd.a")
  62. # dependencies
  63. find_package(PkgConfig REQUIRED)
  64. pkg_check_modules(FFTW3F REQUIRED fftw3f)
  65. pkg_check_modules(LIBLO REQUIRED liblo)
  66. pkg_check_modules(SNDFILE REQUIRED sndfile)
  67. if (APPLE)
  68. set(EXTRA_LIBS "-lz")
  69. set(GL_LIBRARIES "-framework OpenGL")
  70. set(PLUGIN_FORMATS AU)
  71. else (APPLE)
  72. pkg_check_modules(DBUS REQUIRED dbus-1)
  73. pkg_check_modules(GL REQUIRED gl)
  74. pkg_check_modules(X11 REQUIRED x11)
  75. pkg_check_modules(XCURSOR REQUIRED xcursor)
  76. pkg_check_modules(XEXT REQUIRED xext)
  77. pkg_check_modules(XRANDR REQUIRED xrandr)
  78. set(EXTRA_LIBS "-lrt")
  79. set(STATIC_LIBS_START "-Wl,--whole-archive")
  80. set(STATIC_LIBS_END "-Wl,--no-whole-archive")
  81. set(PLUGIN_FORMATS Standalone VST3)
  82. endif (APPLE)
  83. # Main variant
  84. #[[
  85. juce_add_plugin(Cardinal
  86. AU_MAIN_TYPE kAudioUnitType_MusicEffect
  87. COMPANY_COPYRIGHT "GPL-3.0-or-later"
  88. COMPANY_NAME "DISTRHO"
  89. COMPANY_WEBSITE "https://github.com/DISTRHO/Cardinal"
  90. DESCRIPTION "Virtual modular synthesizer plugin"
  91. EDITOR_WANTS_KEYBOARD_FOCUS FALSE
  92. FORMATS ${PLUGIN_FORMATS}
  93. IS_MIDI_EFFECT FALSE
  94. IS_SYNTH FALSE
  95. NEEDS_MIDI_INPUT TRUE
  96. NEEDS_MIDI_OUTPUT TRUE
  97. PLUGIN_CODE DcnM
  98. PLUGIN_MANUFACTURER_CODE Dstr
  99. PRODUCT_NAME "Cardinal")
  100. target_sources(Cardinal
  101. PRIVATE
  102. CardinalWrapper.cpp)
  103. target_include_directories(Cardinal
  104. PRIVATE
  105. ../dpf/distrho
  106. ../src/Cardinal)
  107. target_compile_definitions(Cardinal
  108. PUBLIC
  109. DISTRHO_NAMESPACE=CardinalDISTRHO
  110. DGL_NAMESPACE=CardinalDGL
  111. JucePlugin_PreferredChannelConfigurations=8,8
  112. JUCE_CHECK_MEMORY_LEAKS=0
  113. JUCE_DISABLE_NATIVE_FILECHOOSERS=1
  114. JUCE_DISPLAY_SPLASH_SCREEN=0
  115. JUCE_MODAL_LOOPS_PERMITTED=0
  116. JUCE_USE_CURL=0
  117. JUCE_USE_FLAC=0
  118. JUCE_USE_OGGVORBIS=0
  119. JUCE_USE_XINERAMA=0
  120. JUCE_VST3_CAN_REPLACE_VST2=0
  121. JUCE_ALSA=1
  122. JUCE_DIRECTSOUND=0
  123. JUCE_JACK=1
  124. JUCE_WASAPI=0
  125. JUCE_WEB_BROWSER=0)
  126. target_link_libraries(Cardinal
  127. PRIVATE
  128. juce::juce_audio_utils
  129. ${STATIC_LIBS_START}
  130. sPlugins
  131. sCardinal
  132. sRack
  133. carla_host_plugin
  134. carla_engine_plugin
  135. carla_plugin
  136. native_plugins
  137. audio_decoder
  138. jackbridge
  139. lilv
  140. rtmempool
  141. sfzero
  142. water
  143. ysfx
  144. zita_resampler
  145. dgl
  146. libaubio
  147. libarchive
  148. libjansson
  149. libquickjs
  150. libsamplerate
  151. libspeexdsp
  152. libzstd
  153. ${STATIC_LIBS_END}
  154. ${GL_LIBRARIES}
  155. ${DBUS_LIBRARIES}
  156. -L${LIBLO_LIBRARY_DIRS}
  157. ${FFTW3F_LIBRARIES}
  158. ${LIBLO_LIBRARIES}
  159. ${SNDFILE_LIBRARIES}
  160. ${X11_LIBRARIES}
  161. ${XCURSOR_LIBRARIES}
  162. ${XEXT_LIBRARIES}
  163. ${XRANDR_LIBRARIES}
  164. ${EXTRA_LIBS}
  165. -lmagic
  166. PUBLIC
  167. juce::juce_recommended_config_flags
  168. juce::juce_recommended_lto_flags
  169. juce::juce_recommended_warning_flags)
  170. #]]
  171. # FX variant
  172. juce_add_plugin(CardinalFX
  173. AU_MAIN_TYPE kAudioUnitType_MusicEffect
  174. COMPANY_COPYRIGHT "GPL-3.0-or-later"
  175. COMPANY_NAME "DISTRHO"
  176. COMPANY_WEBSITE "https://github.com/DISTRHO/Cardinal"
  177. DESCRIPTION "Virtual modular synthesizer plugin"
  178. EDITOR_WANTS_KEYBOARD_FOCUS FALSE
  179. FORMATS ${PLUGIN_FORMATS}
  180. IS_MIDI_EFFECT FALSE
  181. IS_SYNTH FALSE
  182. NEEDS_MIDI_INPUT TRUE
  183. NEEDS_MIDI_OUTPUT TRUE
  184. PLUGIN_CODE DcnF
  185. PLUGIN_MANUFACTURER_CODE Dstr
  186. PRODUCT_NAME "CardinalFX")
  187. target_sources(CardinalFX
  188. PRIVATE
  189. CardinalWrapper.cpp)
  190. target_include_directories(CardinalFX
  191. PRIVATE
  192. ../dpf/distrho
  193. ../src/CardinalFX)
  194. target_compile_definitions(CardinalFX
  195. PUBLIC
  196. DISTRHO_NAMESPACE=CardinalDISTRHO
  197. DGL_NAMESPACE=CardinalDGL
  198. JucePlugin_PreferredChannelConfigurations=2,2
  199. JUCE_CHECK_MEMORY_LEAKS=0
  200. JUCE_DISABLE_NATIVE_FILECHOOSERS=1
  201. JUCE_DISPLAY_SPLASH_SCREEN=0
  202. JUCE_MODAL_LOOPS_PERMITTED=0
  203. JUCE_USE_CURL=0
  204. JUCE_USE_FLAC=0
  205. JUCE_USE_OGGVORBIS=0
  206. JUCE_USE_XINERAMA=0
  207. JUCE_VST3_CAN_REPLACE_VST2=0
  208. JUCE_ALSA=1
  209. JUCE_DIRECTSOUND=0
  210. JUCE_JACK=1
  211. JUCE_WASAPI=0
  212. JUCE_WEB_BROWSER=0)
  213. target_link_libraries(CardinalFX
  214. PRIVATE
  215. juce::juce_audio_utils
  216. ${STATIC_LIBS_START}
  217. sPlugins
  218. sCardinalFX
  219. sRack
  220. carla_host_plugin
  221. carla_engine_plugin
  222. carla_plugin
  223. native_plugins
  224. audio_decoder
  225. jackbridge
  226. lilv
  227. rtmempool
  228. sfzero
  229. water
  230. ysfx
  231. zita_resampler
  232. dgl
  233. libaubio
  234. libarchive
  235. libjansson
  236. libquickjs
  237. libsamplerate
  238. libspeexdsp
  239. libzstd
  240. ${STATIC_LIBS_END}
  241. ${GL_LIBRARIES}
  242. ${DBUS_LIBRARIES}
  243. -L${LIBLO_LIBRARY_DIRS}
  244. ${FFTW3F_LIBRARIES}
  245. ${LIBLO_LIBRARIES}
  246. ${SNDFILE_LIBRARIES}
  247. ${X11_LIBRARIES}
  248. ${XCURSOR_LIBRARIES}
  249. ${XEXT_LIBRARIES}
  250. ${XRANDR_LIBRARIES}
  251. ${EXTRA_LIBS}
  252. -lmagic
  253. PUBLIC
  254. juce::juce_recommended_config_flags
  255. juce::juce_recommended_lto_flags
  256. juce::juce_recommended_warning_flags)
  257. # Synth variant
  258. juce_add_plugin(CardinalSynth
  259. AU_MAIN_TYPE kAudioUnitType_MusicDevice
  260. COMPANY_COPYRIGHT "GPL-3.0-or-later"
  261. COMPANY_NAME "DISTRHO"
  262. COMPANY_WEBSITE "https://github.com/DISTRHO/Cardinal"
  263. DESCRIPTION "Virtual modular synthesizer plugin"
  264. EDITOR_WANTS_KEYBOARD_FOCUS FALSE
  265. FORMATS ${PLUGIN_FORMATS}
  266. IS_MIDI_EFFECT FALSE
  267. IS_SYNTH TRUE
  268. NEEDS_MIDI_INPUT TRUE
  269. NEEDS_MIDI_OUTPUT TRUE
  270. PLUGIN_CODE DcnS
  271. PLUGIN_MANUFACTURER_CODE Dstr
  272. PRODUCT_NAME "CardinalSynth")
  273. target_sources(CardinalSynth
  274. PRIVATE
  275. CardinalWrapper.cpp)
  276. target_include_directories(CardinalSynth
  277. PRIVATE
  278. ../dpf/distrho
  279. ../src/CardinalSynth)
  280. target_compile_definitions(CardinalSynth
  281. PUBLIC
  282. DISTRHO_NAMESPACE=CardinalDISTRHO
  283. DGL_NAMESPACE=CardinalDGL
  284. JucePlugin_PreferredChannelConfigurations=0,2
  285. JUCE_CHECK_MEMORY_LEAKS=0
  286. JUCE_DISABLE_NATIVE_FILECHOOSERS=1
  287. JUCE_DISPLAY_SPLASH_SCREEN=0
  288. JUCE_MODAL_LOOPS_PERMITTED=0
  289. JUCE_USE_CURL=0
  290. JUCE_USE_FLAC=0
  291. JUCE_USE_OGGVORBIS=0
  292. JUCE_USE_XINERAMA=0
  293. JUCE_VST3_CAN_REPLACE_VST2=0
  294. JUCE_ALSA=1
  295. JUCE_DIRECTSOUND=0
  296. JUCE_JACK=1
  297. JUCE_WASAPI=0
  298. JUCE_WEB_BROWSER=0)
  299. target_link_libraries(CardinalSynth
  300. PRIVATE
  301. juce::juce_audio_utils
  302. ${STATIC_LIBS_START}
  303. sPlugins
  304. sCardinalSynth
  305. sRack
  306. carla_host_plugin
  307. carla_engine_plugin
  308. carla_plugin
  309. native_plugins
  310. audio_decoder
  311. jackbridge
  312. lilv
  313. rtmempool
  314. sfzero
  315. water
  316. ysfx
  317. zita_resampler
  318. dgl
  319. libaubio
  320. libarchive
  321. libjansson
  322. libquickjs
  323. libsamplerate
  324. libspeexdsp
  325. libzstd
  326. ${STATIC_LIBS_END}
  327. ${GL_LIBRARIES}
  328. ${DBUS_LIBRARIES}
  329. -L${LIBLO_LIBRARY_DIRS}
  330. ${FFTW3F_LIBRARIES}
  331. ${LIBLO_LIBRARIES}
  332. ${SNDFILE_LIBRARIES}
  333. ${X11_LIBRARIES}
  334. ${XCURSOR_LIBRARIES}
  335. ${XEXT_LIBRARIES}
  336. ${XRANDR_LIBRARIES}
  337. ${EXTRA_LIBS}
  338. -lmagic
  339. PUBLIC
  340. juce::juce_recommended_config_flags
  341. juce::juce_recommended_lto_flags
  342. juce::juce_recommended_warning_flags)