Audio plugin host https://kx.studio/carla
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.

1129 lines
32KB

  1. cmake_minimum_required(VERSION 3.15)
  2. project(carla)
  3. set(PROJECT_VERSION 2.6.0-alpha1)
  4. set(CMAKE_POLICY_DEFAULT_CMP0025 NEW)
  5. set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
  6. set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
  7. set(CMAKE_C_STANDARD 11)
  8. set(CMAKE_CXX_STANDARD 11)
  9. set(CMAKE_C_VISIBILITY_PRESET hidden)
  10. set(CMAKE_CXX_VISIBILITY_PRESET hidden)
  11. set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE)
  12. set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
  13. #######################################################################################################################
  14. # fix compat with cmake < 3.26
  15. if(CMAKE_VERSION VERSION_LESS 3.26)
  16. if(MSVC)
  17. set(CMAKE_C_COMPILER_FRONTEND_VARIANT "MSVC")
  18. else()
  19. set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
  20. endif()
  21. mark_as_advanced(CMAKE_C_COMPILER_FRONTEND_VARIANT)
  22. endif()
  23. #######################################################################################################################
  24. # build options
  25. if(MSVC)
  26. set(CARLA_USE_JACK_DEFAULT FALSE)
  27. set(CARLA_USE_OSC_DEFAULT FALSE)
  28. else()
  29. set(CARLA_USE_JACK_DEFAULT TRUE)
  30. set(CARLA_USE_OSC_DEFAULT TRUE)
  31. endif()
  32. set(CARLA_BUILD_FRAMEWORKS FALSE CACHE BOOL "Build libraries as macOS frameworks")
  33. set(CARLA_ENABLE_JSFX TRUE CACHE BOOL "Enable JSFX")
  34. set(CARLA_USE_JACK ${CARLA_USE_JACK_DEFAULT} CACHE BOOL "Enable JACK")
  35. set(CARLA_USE_OSC ${CARLA_USE_OSC_DEFAULT} CACHE BOOL "Enable OSC")
  36. if(${CARLA_BUILD_FRAMEWORKS} AND NOT APPLE)
  37. set(CARLA_BUILD_FRAMEWORKS FALSE)
  38. mark_as_advanced(CARLA_BUILD_FRAMEWORKS)
  39. endif()
  40. #######################################################################################################################
  41. # required dependencies
  42. include(GNUInstallDirs)
  43. find_package(Threads REQUIRED)
  44. if(NOT (APPLE OR HAIKU OR WIN32))
  45. set(CARLA_LIBDL dl)
  46. set(CARLA_LIBM m)
  47. set(CARLA_LIBRT rt)
  48. endif()
  49. #######################################################################################################################
  50. # optional dependencies
  51. find_package(PkgConfig QUIET)
  52. # homebrew does not support universal binaries, disable external deps if it is in use
  53. if(APPLE)
  54. find_program(HOMEBREW brew)
  55. if(HOMEBREW)
  56. set(PKGCONFIG_FOUND FALSE)
  57. mark_as_advanced(PKGCONFIG_FOUND)
  58. endif()
  59. endif()
  60. if(PKGCONFIG_FOUND)
  61. pkg_check_modules(FLUIDSYNTH IMPORTED_TARGET fluidsynth)
  62. pkg_check_modules(SNDFILE IMPORTED_TARGET sndfile)
  63. else()
  64. set(FLUIDSYNTH_FOUND FALSE)
  65. set(SNDFILE_FOUND FALSE)
  66. endif()
  67. if(PKGCONFIG_FOUND AND CARLA_USE_OSC)
  68. pkg_check_modules(LIBLO IMPORTED_TARGET liblo)
  69. else()
  70. set(LIBLO_FOUND FALSE)
  71. endif()
  72. if(PKGCONFIG_FOUND AND NOT WIN32)
  73. pkg_check_modules(LIBMAGIC IMPORTED_TARGET libmagic)
  74. else()
  75. set(LIBMAGIC_FOUND FALSE)
  76. endif()
  77. if(PKGCONFIG_FOUND AND NOT (APPLE OR WIN32))
  78. pkg_check_modules(X11 IMPORTED_TARGET x11)
  79. else()
  80. set(X11_FOUND FALSE)
  81. endif()
  82. add_library(carla-none INTERFACE)
  83. if(NOT FLUIDSYNTH_FOUND)
  84. add_library(PkgConfig::FLUIDSYNTH ALIAS carla-none)
  85. endif()
  86. if(NOT LIBLO_FOUND)
  87. add_library(PkgConfig::LIBLO ALIAS carla-none)
  88. endif()
  89. if(NOT LIBMAGIC_FOUND)
  90. add_library(PkgConfig::LIBMAGIC ALIAS carla-none)
  91. endif()
  92. if(NOT SNDFILE_FOUND)
  93. add_library(PkgConfig::SNDFILE ALIAS carla-none)
  94. endif()
  95. if(NOT X11_FOUND)
  96. add_library(PkgConfig::X11 ALIAS carla-none)
  97. endif()
  98. #######################################################################################################################
  99. # utilities
  100. if(WIN32)
  101. set(CARLA_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
  102. else()
  103. set(CARLA_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/carla)
  104. endif()
  105. mark_as_advanced(CARLA_INSTALL_LIBDIR)
  106. function(set_common_target_properties TARGET)
  107. target_compile_definitions(${TARGET}
  108. PRIVATE
  109. BUILDING_CARLA
  110. $<$<BOOL:${CARLA_ENABLE_JSFX}>:HAVE_YSFX>
  111. $<$<BOOL:${CARLA_USE_JACK}>:HAVE_JACK>
  112. $<$<BOOL:${FLUIDSYNTH_FOUND}>:HAVE_FLUIDSYNTH>
  113. $<$<BOOL:${LIBLO_FOUND}>:HAVE_LIBLO>
  114. $<$<BOOL:${LIBMAGIC_FOUND}>:HAVE_LIBMAGIC>
  115. $<$<BOOL:${SNDFILE_FOUND}>:HAVE_SNDFILE>
  116. $<$<BOOL:${X11_FOUND}>:HAVE_X11>
  117. )
  118. target_compile_options(${TARGET}
  119. PRIVATE
  120. $<$<BOOL:${MSVC}>:/wd4244>
  121. $<$<BOOL:${MSVC}>:/wd4267>
  122. $<$<BOOL:${MSVC}>:/wd4273>
  123. )
  124. target_link_options(${TARGET}
  125. PRIVATE
  126. $<$<C_COMPILER_ID:GNU>:-Wl,--no-undefined>
  127. )
  128. set_property(TARGET ${TARGET} PROPERTY POSITION_INDEPENDENT_CODE ON)
  129. if(APPLE)
  130. set_property(TARGET ${TARGET} APPEND PROPERTY OSX_ARCHITECTURES arm64)
  131. set_property(TARGET ${TARGET} APPEND PROPERTY OSX_ARCHITECTURES x86_64)
  132. endif()
  133. endfunction()
  134. #######################################################################################################################
  135. # setup pthreads for msvc
  136. if(MSVC)
  137. include(FetchContent)
  138. FetchContent_Declare(pthreads4w
  139. GIT_REPOSITORY https://git.code.sf.net/p/pthreads4w/code
  140. GIT_TAG f12b445b336ee0117b43fca1d4b9f22c9af82c36
  141. )
  142. FetchContent_MakeAvailable(pthreads4w)
  143. add_library(pthreads4w STATIC)
  144. add_library(carla::pthreads4w ALIAS pthreads4w)
  145. target_sources(pthreads4w PRIVATE ${pthreads4w_SOURCE_DIR}/pthread.c)
  146. target_compile_definitions(pthreads4w
  147. PRIVATE
  148. HAVE_CONFIG_H
  149. HAVE_STDINT_H=1
  150. _POSIX_C_SOURCE=200112L
  151. PUBLIC
  152. INCLUDE_NP
  153. PTW32_DLLPORT
  154. __PTW32_STATIC_LIB
  155. )
  156. target_include_directories(pthreads4w
  157. PUBLIC
  158. ${pthreads4w_SOURCE_DIR}
  159. )
  160. set(CARLA_PTHREADS carla::pthreads4w)
  161. else()
  162. set(CARLA_PTHREADS ${CMAKE_THREAD_LIBS_INIT})
  163. endif()
  164. #######################################################################################################################
  165. # audio_decoder
  166. add_library(carla-audio-decoder STATIC)
  167. add_library(carla::audio-decoder ALIAS carla-audio-decoder)
  168. set_common_target_properties(carla-audio-decoder)
  169. target_include_directories(carla-audio-decoder
  170. PRIVATE
  171. ../source/includes
  172. ../source/modules
  173. ../source/utils
  174. )
  175. target_link_libraries(carla-audio-decoder
  176. PRIVATE
  177. PkgConfig::SNDFILE
  178. )
  179. target_sources(carla-audio-decoder
  180. PRIVATE
  181. ../source/modules/audio_decoder/ad_dr_mp3.c
  182. ../source/modules/audio_decoder/ad_ffmpeg.c
  183. ../source/modules/audio_decoder/ad_minimp3.c
  184. ../source/modules/audio_decoder/ad_plugin.c
  185. ../source/modules/audio_decoder/ad_soundfile.c
  186. )
  187. #######################################################################################################################
  188. # jackbridge
  189. add_library(carla-jackbridge STATIC)
  190. add_library(carla::jackbridge ALIAS carla-jackbridge)
  191. set_common_target_properties(carla-jackbridge)
  192. target_include_directories(carla-jackbridge
  193. PRIVATE
  194. ../source/includes
  195. ../source/utils
  196. )
  197. target_link_libraries(carla-jackbridge
  198. PRIVATE
  199. ${CARLA_LIBDL}
  200. ${CARLA_LIBRT}
  201. )
  202. target_sources(carla-jackbridge
  203. PRIVATE
  204. ../source/jackbridge/JackBridge1.cpp
  205. ../source/jackbridge/JackBridge2.cpp
  206. )
  207. #######################################################################################################################
  208. # lilv
  209. # serd
  210. add_library(carla-lilv_serd STATIC)
  211. set_common_target_properties(carla-lilv_serd)
  212. target_compile_options(carla-lilv_serd
  213. PRIVATE
  214. $<$<BOOL:${MSVC}>:/wd4005>
  215. $<$<BOOL:${MSVC}>:/wd4090>
  216. $<$<BOOL:${MSVC}>:/wd4133>
  217. $<$<C_COMPILER_ID:GNU>:-Wno-format-overflow>
  218. $<$<C_COMPILER_ID:GNU>:-Wno-implicit-fallthrough>
  219. )
  220. target_include_directories(carla-lilv_serd
  221. PRIVATE
  222. ../source/includes
  223. ../source/modules/lilv/config
  224. ../source/modules/lilv/serd-0.24.0
  225. )
  226. target_sources(carla-lilv_serd
  227. PRIVATE
  228. ../source/modules/lilv/serd.c
  229. )
  230. # sord
  231. add_library(carla-lilv_sord STATIC)
  232. set_common_target_properties(carla-lilv_sord)
  233. target_compile_options(carla-lilv_sord
  234. PRIVATE
  235. $<$<BOOL:${MSVC}>:/wd4005>
  236. $<$<BOOL:${MSVC}>:/wd4090>
  237. $<$<BOOL:${MSVC}>:/wd4133>
  238. $<$<C_COMPILER_ID:GNU>:-Wno-maybe-uninitialized>
  239. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-unused-parameter>
  240. # workaround compiler bug, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109585
  241. $<$<C_COMPILER_ID:GNU>:-fno-strict-aliasing>
  242. )
  243. target_include_directories(carla-lilv_sord
  244. PRIVATE
  245. ../source/includes
  246. ../source/modules/lilv/config
  247. ../source/modules/lilv/sord-0.16.0
  248. ../source/modules/lilv/sord-0.16.0/src
  249. )
  250. target_link_libraries(carla-lilv_sord
  251. PRIVATE
  252. carla-lilv_serd
  253. )
  254. target_sources(carla-lilv_sord
  255. PRIVATE
  256. ../source/modules/lilv/sord.c
  257. )
  258. # sratom
  259. add_library(carla-lilv_sratom STATIC)
  260. set_common_target_properties(carla-lilv_sratom)
  261. target_compile_options(carla-lilv_sratom
  262. PRIVATE
  263. $<$<BOOL:${MSVC}>:/wd4005>
  264. $<$<BOOL:${MSVC}>:/wd4090>
  265. $<$<BOOL:${MSVC}>:/wd4133>
  266. )
  267. target_include_directories(carla-lilv_sratom
  268. PRIVATE
  269. ../source/includes
  270. ../source/modules/lilv/config
  271. ../source/modules/lilv/sratom-0.6.0
  272. )
  273. target_link_libraries(carla-lilv_sratom
  274. PRIVATE
  275. carla-lilv_serd
  276. )
  277. target_sources(carla-lilv_sratom
  278. PRIVATE
  279. ../source/modules/lilv/sratom.c
  280. )
  281. # lilv
  282. add_library(carla-lilv_lilv STATIC)
  283. set_common_target_properties(carla-lilv_lilv)
  284. target_compile_options(carla-lilv_lilv
  285. PRIVATE
  286. $<$<BOOL:${MSVC}>:/wd4005>
  287. $<$<BOOL:${MSVC}>:/wd4090>
  288. $<$<BOOL:${MSVC}>:/wd4133>
  289. $<$<C_COMPILER_ID:AppleClang>:-Wno-incompatible-pointer-types-discards-qualifiers>
  290. $<$<C_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
  291. $<$<C_COMPILER_ID:GNU>:-Wno-discarded-qualifiers>
  292. $<$<C_COMPILER_ID:GNU>:-Wno-format-overflow>
  293. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-unused-parameter>
  294. )
  295. target_include_directories(carla-lilv_lilv
  296. PRIVATE
  297. ../source/includes
  298. ../source/modules/lilv/config
  299. ../source/modules/lilv/lilv-0.24.0
  300. ../source/modules/lilv/lilv-0.24.0/src
  301. )
  302. target_link_libraries(carla-lilv_lilv
  303. PRIVATE
  304. carla-lilv_serd
  305. carla-lilv_sord
  306. carla-lilv_sratom
  307. )
  308. target_sources(carla-lilv_lilv
  309. PRIVATE
  310. ../source/modules/lilv/lilv.c
  311. )
  312. # combined target
  313. add_library(carla-lilv INTERFACE)
  314. add_library(carla::lilv ALIAS carla-lilv)
  315. target_link_libraries(carla-lilv
  316. INTERFACE
  317. carla-lilv_serd
  318. carla-lilv_sord
  319. carla-lilv_sratom
  320. carla-lilv_lilv
  321. ${CARLA_LIBDL}
  322. ${CARLA_LIBM}
  323. ${CARLA_LIBRT}
  324. )
  325. #######################################################################################################################
  326. # native-plugins
  327. add_library(carla-native-plugins STATIC)
  328. add_library(carla::native-plugins ALIAS carla-native-plugins)
  329. set_common_target_properties(carla-native-plugins)
  330. target_compile_definitions(carla-native-plugins
  331. PRIVATE
  332. $<$<BOOL:${MSVC}>:_USE_MATH_DEFINES>
  333. )
  334. target_include_directories(carla-native-plugins
  335. PRIVATE
  336. ../source/includes
  337. ../source/modules
  338. ../source/utils
  339. )
  340. target_link_libraries(carla-native-plugins
  341. PRIVATE
  342. ${CARLA_PTHREADS}
  343. )
  344. target_sources(carla-native-plugins
  345. PRIVATE
  346. ../source/native-plugins/_all.c
  347. ../source/native-plugins/_data.cpp
  348. ../source/native-plugins/audio-gain.c
  349. ../source/native-plugins/bypass.c
  350. ../source/native-plugins/cv-to-audio.c
  351. ../source/native-plugins/lfo.c
  352. ../source/native-plugins/midi-channel-filter.c
  353. ../source/native-plugins/midi-channel-ab.c
  354. ../source/native-plugins/midi-channelize.c
  355. ../source/native-plugins/midi-gain.c
  356. ../source/native-plugins/midi-join.c
  357. ../source/native-plugins/midi-split.c
  358. ../source/native-plugins/midi-to-cv.c
  359. ../source/native-plugins/midi-through.c
  360. ../source/native-plugins/midi-transpose.c
  361. ../source/native-plugins/audio-file.cpp
  362. ../source/native-plugins/midi-file.cpp
  363. # these rely on PyQt, skip them
  364. # ../source/native-plugins/bigmeter.cpp
  365. # ../source/native-plugins/midi-pattern.cpp
  366. # ../source/native-plugins/notes.cpp
  367. # ../source/native-plugins/xycontroller.cpp
  368. )
  369. #######################################################################################################################
  370. # rtmempool
  371. add_library(carla-rtmempool STATIC)
  372. add_library(carla::rtmempool ALIAS carla-rtmempool)
  373. set_common_target_properties(carla-rtmempool)
  374. target_include_directories(carla-rtmempool
  375. PRIVATE
  376. ../source/includes
  377. ../source/utils
  378. )
  379. target_link_libraries(carla-rtmempool
  380. PRIVATE
  381. ${CARLA_LIBDL}
  382. ${CARLA_LIBRT}
  383. ${CARLA_PTHREADS}
  384. )
  385. target_sources(carla-rtmempool
  386. PRIVATE
  387. ../source/modules/rtmempool/rtmempool.c
  388. )
  389. #######################################################################################################################
  390. # sfzero
  391. add_library(carla-sfzero STATIC)
  392. add_library(carla::sfzero ALIAS carla-sfzero)
  393. set_common_target_properties(carla-sfzero)
  394. target_include_directories(carla-sfzero
  395. PRIVATE
  396. ../source/includes
  397. ../source/modules
  398. ../source/utils
  399. )
  400. target_link_libraries(carla-sfzero
  401. PRIVATE
  402. carla-audio-decoder
  403. ${CARLA_PTHREADS}
  404. )
  405. target_sources(carla-sfzero
  406. PRIVATE
  407. ../source/modules/sfzero/SFZero.cpp
  408. )
  409. #######################################################################################################################
  410. # water
  411. add_library(carla-water STATIC)
  412. add_library(carla::water ALIAS carla-water)
  413. set_common_target_properties(carla-water)
  414. target_compile_options(carla-water
  415. PRIVATE
  416. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-deprecated-copy>
  417. )
  418. target_include_directories(carla-water
  419. PRIVATE
  420. ../source/includes
  421. ../source/utils
  422. )
  423. target_link_libraries(carla-water
  424. PRIVATE
  425. $<$<BOOL:${APPLE}>:$<LINK_LIBRARY:FRAMEWORK,AppKit.framework>>
  426. $<$<BOOL:${WIN32}>:comdlg32>
  427. $<$<BOOL:${WIN32}>:ole32>
  428. $<$<BOOL:${WIN32}>:winmm>
  429. ${CARLA_LIBDL}
  430. ${CARLA_LIBRT}
  431. ${CARLA_PTHREADS}
  432. )
  433. target_sources(carla-water
  434. PRIVATE
  435. ../source/modules/water/water.cpp
  436. )
  437. #######################################################################################################################
  438. # water-files
  439. add_library(carla-water-files STATIC)
  440. add_library(carla::water-files ALIAS carla-water-files)
  441. set_common_target_properties(carla-water-files)
  442. target_compile_options(carla-water-files
  443. PRIVATE
  444. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-deprecated-copy>
  445. )
  446. target_include_directories(carla-water-files
  447. PRIVATE
  448. ../source/includes
  449. ../source/utils
  450. )
  451. target_link_libraries(carla-water-files
  452. PRIVATE
  453. $<$<BOOL:${APPLE}>:$<LINK_LIBRARY:FRAMEWORK,AppKit.framework>>
  454. $<$<BOOL:${WIN32}>:ole32>
  455. $<$<BOOL:${WIN32}>:winmm>
  456. ${CARLA_LIBDL}
  457. )
  458. target_sources(carla-water-files
  459. PRIVATE
  460. ../source/modules/water/water.files.cpp
  461. )
  462. #######################################################################################################################
  463. # ysfx
  464. if(${CARLA_ENABLE_JSFX})
  465. add_library(carla-ysfx STATIC)
  466. add_library(carla::ysfx ALIAS carla-ysfx)
  467. set_common_target_properties(carla-ysfx)
  468. # YSFX_FTS_LACKS_LFS_SUPPORT
  469. target_compile_definitions(carla-ysfx
  470. PRIVATE
  471. EEL_TARGET_PORTABLE
  472. EELSCRIPT_NO_NET
  473. EELSCRIPT_NO_LICE
  474. NSEEL_ATOF=ysfx_wdl_atof
  475. WDL_FFT_REALSIZE=8
  476. WDL_LINEPARSE_ATOF=ysfx_wdl_atof
  477. WDL_WIN32_UTF8_NO_UI_IMPL
  478. YSFX_API=
  479. YSFX_NO_GFX
  480. YSFX_NO_STANDARD_MUTEX
  481. $<$<BOOL:${WIN32}>:NOMINMAX>
  482. $<$<NOT:$<BOOL:${MINGW}>>:_FILE_OFFSET_BITS=64>
  483. )
  484. # NOTE ugly -U /U due to cmake not supporting `target_remove_definitions`
  485. # see https://gitlab.kitware.com/cmake/cmake/-/issues/19796
  486. target_compile_options(carla-ysfx
  487. PRIVATE
  488. $<$<BOOL:${MINGW}>:-UUNICODE>
  489. $<$<BOOL:${MINGW}>:-U_UNICODE>
  490. $<$<BOOL:${MSVC}>:/wd4018>
  491. $<$<BOOL:${MSVC}>:/wd4297>
  492. $<$<BOOL:${MSVC}>:/UUNICODE>
  493. $<$<BOOL:${MSVC}>:/U_UNICODE>
  494. $<$<C_COMPILER_ID:AppleClang>:-Wno-newline-eof>
  495. $<$<C_COMPILER_ID:GNU>:-Wno-extra>
  496. $<$<C_COMPILER_ID:GNU>:-Wno-ignored-attributes>
  497. $<$<C_COMPILER_ID:GNU>:-Wno-unused-function>
  498. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-fsigned-char>
  499. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-sign-compare>
  500. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-unused-parameter>
  501. $<$<AND:$<COMPILE_LANGUAGE:C>,$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>>:-Wno-missing-field-initializers>
  502. $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:GNU>>:-Wno-deprecated-copy>
  503. )
  504. target_include_directories(carla-ysfx
  505. PRIVATE
  506. ../source/modules/ysfx/include
  507. ../source/modules/ysfx/sources
  508. ../source/modules/ysfx/thirdparty/dr_libs
  509. ../source/modules/ysfx/thirdparty/stb
  510. ../source/modules/ysfx/thirdparty/WDL/source
  511. )
  512. target_sources(carla-ysfx
  513. PRIVATE
  514. ../source/modules/ysfx/sources/ysfx.cpp
  515. ../source/modules/ysfx/sources/ysfx_api_eel.cpp
  516. ../source/modules/ysfx/sources/ysfx_api_file.cpp
  517. ../source/modules/ysfx/sources/ysfx_api_gfx.cpp
  518. ../source/modules/ysfx/sources/ysfx_api_reaper.cpp
  519. ../source/modules/ysfx/sources/ysfx_audio_flac.cpp
  520. ../source/modules/ysfx/sources/ysfx_audio_wav.cpp
  521. ../source/modules/ysfx/sources/ysfx_config.cpp
  522. ../source/modules/ysfx/sources/ysfx_eel_utils.cpp
  523. ../source/modules/ysfx/sources/ysfx_midi.cpp
  524. ../source/modules/ysfx/sources/ysfx_parse.cpp
  525. ../source/modules/ysfx/sources/ysfx_reader.cpp
  526. ../source/modules/ysfx/sources/ysfx_utils.cpp
  527. ../source/modules/ysfx/sources/ysfx_utils_fts.cpp
  528. ../source/modules/ysfx/sources/eel2-gas/sources/asm-nseel-x64-sse.S
  529. ../source/modules/ysfx/thirdparty/WDL/source/WDL/eel2/nseel-caltab.c
  530. ../source/modules/ysfx/thirdparty/WDL/source/WDL/eel2/nseel-cfunc.c
  531. ../source/modules/ysfx/thirdparty/WDL/source/WDL/eel2/nseel-compiler.c
  532. ../source/modules/ysfx/thirdparty/WDL/source/WDL/eel2/nseel-eval.c
  533. ../source/modules/ysfx/thirdparty/WDL/source/WDL/eel2/nseel-lextab.c
  534. ../source/modules/ysfx/thirdparty/WDL/source/WDL/eel2/nseel-ram.c
  535. ../source/modules/ysfx/thirdparty/WDL/source/WDL/eel2/nseel-yylex.c
  536. ../source/modules/ysfx/thirdparty/WDL/source/WDL/fft.c
  537. $<$<BOOL:${WIN32}>:../source/modules/ysfx/thirdparty/WDL/source/WDL/win32_utf8.c>
  538. )
  539. endif(${CARLA_ENABLE_JSFX})
  540. #######################################################################################################################
  541. # zita-resampler
  542. add_library(carla-zita-resampler STATIC)
  543. add_library(carla::zita-resampler ALIAS carla-zita-resampler)
  544. set_common_target_properties(carla-zita-resampler)
  545. target_compile_definitions(carla-zita-resampler
  546. PRIVATE
  547. $<$<BOOL:${MSVC}>:_USE_MATH_DEFINES>
  548. )
  549. target_include_directories(carla-zita-resampler
  550. PRIVATE
  551. ../source/includes
  552. )
  553. target_link_libraries(carla-zita-resampler
  554. PRIVATE
  555. ${CARLA_PTHREADS}
  556. )
  557. target_sources(carla-zita-resampler
  558. PRIVATE
  559. ../source/modules/zita-resampler/cresampler.cc
  560. ../source/modules/zita-resampler/resampler-table.cc
  561. ../source/modules/zita-resampler/resampler.cc
  562. ../source/modules/zita-resampler/vresampler.cc
  563. )
  564. #######################################################################################################################
  565. # carla bridge
  566. add_executable(carla-bridge-native)
  567. set_common_target_properties(carla-bridge-native)
  568. if(NOT ${CARLA_BUILD_FRAMEWORKS})
  569. install(TARGETS carla-bridge-native
  570. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  571. )
  572. endif()
  573. target_compile_definitions(carla-bridge-native
  574. PRIVATE
  575. BUILD_BRIDGE
  576. CARLA_LIB_EXT="${CMAKE_SHARED_LIBRARY_SUFFIX}"
  577. )
  578. # FIXME
  579. target_compile_options(carla-bridge-native
  580. PRIVATE
  581. $<$<C_COMPILER_ID:AppleClang>:-Wno-unused-but-set-variable>
  582. $<$<C_COMPILER_ID:GNU>:-Wno-format-truncation>
  583. $<$<C_COMPILER_ID:GNU>:-Wno-stringop-overflow>
  584. $<$<C_COMPILER_ID:GNU>:-Wno-unused-parameter>
  585. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-unused-parameter>
  586. )
  587. target_include_directories(carla-bridge-native
  588. PRIVATE
  589. ../source
  590. ../source/backend
  591. ../source/backend/engine
  592. ../source/backend/plugin
  593. ../source/includes
  594. ../source/modules
  595. ../source/utils
  596. )
  597. target_link_libraries(carla-bridge-native
  598. PRIVATE
  599. carla-audio-decoder
  600. carla-jackbridge
  601. carla-lilv
  602. carla-native-plugins
  603. carla-rtmempool
  604. carla-sfzero
  605. carla-water
  606. $<$<BOOL:${CARLA_ENABLE_JSFX}>:carla-ysfx>
  607. carla-zita-resampler
  608. PkgConfig::FLUIDSYNTH
  609. PkgConfig::LIBLO
  610. PkgConfig::LIBMAGIC
  611. PkgConfig::X11
  612. $<$<BOOL:${APPLE}>:$<LINK_LIBRARY:FRAMEWORK,Cocoa.framework>>
  613. ${CARLA_PTHREADS}
  614. )
  615. target_sources(carla-bridge-native
  616. PRIVATE
  617. ../source/bridges-plugin/CarlaBridgePlugin.cpp
  618. ../source/backend/CarlaStandalone.cpp
  619. ../source/backend/engine/CarlaEngine.cpp
  620. ../source/backend/engine/CarlaEngineBridge.cpp
  621. ../source/backend/engine/CarlaEngineClient.cpp
  622. ../source/backend/engine/CarlaEngineDummy.cpp
  623. ../source/backend/engine/CarlaEngineData.cpp
  624. ../source/backend/engine/CarlaEngineGraph.cpp
  625. ../source/backend/engine/CarlaEngineInternal.cpp
  626. ../source/backend/engine/CarlaEnginePorts.cpp
  627. ../source/backend/engine/CarlaEngineRunner.cpp
  628. ../source/backend/plugin/CarlaPlugin.cpp
  629. ../source/backend/plugin/CarlaPluginBridge.cpp
  630. ../source/backend/plugin/CarlaPluginInternal.cpp
  631. ../source/backend/plugin/CarlaPluginAU.cpp
  632. ../source/backend/plugin/CarlaPluginCLAP.cpp
  633. ../source/backend/plugin/CarlaPluginFluidSynth.cpp
  634. ../source/backend/plugin/CarlaPluginJuce.cpp
  635. ../source/backend/plugin/CarlaPluginJSFX.cpp
  636. ../source/backend/plugin/CarlaPluginLADSPADSSI.cpp
  637. ../source/backend/plugin/CarlaPluginLV2.cpp
  638. ../source/backend/plugin/CarlaPluginNative.cpp
  639. ../source/backend/plugin/CarlaPluginSFZero.cpp
  640. ../source/backend/plugin/CarlaPluginVST2.cpp
  641. ../source/backend/plugin/CarlaPluginVST3.cpp
  642. $<$<BOOL:${CARLA_USE_JACK}>:../source/backend/engine/CarlaEngineJack.cpp>
  643. $<$<BOOL:${CARLA_USE_JACK}>:../source/backend/plugin/CarlaPluginJack.cpp>
  644. )
  645. #######################################################################################################################
  646. # carla discovery
  647. add_executable(carla-discovery-native)
  648. set_common_target_properties(carla-discovery-native)
  649. if(NOT ${CARLA_BUILD_FRAMEWORKS})
  650. install(TARGETS carla-discovery-native
  651. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  652. )
  653. endif()
  654. target_include_directories(carla-discovery-native
  655. PRIVATE
  656. ../source/backend
  657. ../source/includes
  658. ../source/modules
  659. ../source/utils
  660. )
  661. target_link_libraries(carla-discovery-native
  662. PRIVATE
  663. carla-lilv
  664. carla-water-files
  665. $<$<BOOL:${CARLA_ENABLE_JSFX}>:carla-ysfx>
  666. PkgConfig::FLUIDSYNTH
  667. ${CARLA_PTHREADS}
  668. )
  669. target_sources(carla-discovery-native
  670. PRIVATE
  671. ../source/discovery/carla-discovery.cpp
  672. )
  673. #######################################################################################################################
  674. # carla standalone
  675. add_library(carla-standalone SHARED)
  676. add_library(carla::standalone ALIAS carla-standalone)
  677. set_common_target_properties(carla-standalone)
  678. if(${CARLA_BUILD_FRAMEWORKS})
  679. set(carla-standalone-public-headers
  680. ../source/backend/CarlaBackend.h
  681. ../source/backend/CarlaHost.h
  682. ../source/backend/CarlaEngine.hpp
  683. ../source/backend/CarlaPlugin.hpp
  684. ../source/backend/CarlaPluginPtr.hpp
  685. ../source/includes/CarlaDefines.h
  686. ../source/utils/CarlaUtils.hpp
  687. )
  688. set_target_properties(carla-standalone
  689. PROPERTIES
  690. FRAMEWORK TRUE
  691. OUTPUT_NAME carla-standalone
  692. PUBLIC_HEADER "${carla-standalone-public-headers}"
  693. )
  694. else()
  695. set_target_properties(carla-standalone
  696. PROPERTIES
  697. OUTPUT_NAME carla_standalone2
  698. IMPORT_PREFIX lib
  699. PREFIX lib
  700. )
  701. endif()
  702. target_compile_definitions(carla-standalone
  703. PRIVATE
  704. CARLA_LIB_EXT="${CMAKE_SHARED_LIBRARY_SUFFIX}"
  705. )
  706. # FIXME
  707. target_compile_options(carla-standalone
  708. PRIVATE
  709. $<$<C_COMPILER_ID:AppleClang>:-Wno-unused-but-set-variable>
  710. $<$<C_COMPILER_ID:GNU>:-Wno-format-truncation>
  711. $<$<C_COMPILER_ID:GNU>:-Wno-stringop-overflow>
  712. $<$<C_COMPILER_ID:GNU>:-Wno-error=cpp>
  713. $<$<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},GNU>:-Wno-unused-parameter>
  714. )
  715. target_include_directories(carla-standalone
  716. PRIVATE
  717. ../source
  718. ../source/backend
  719. ../source/includes
  720. ../source/modules
  721. ../source/utils
  722. )
  723. target_link_libraries(carla-standalone
  724. PRIVATE
  725. carla-jackbridge
  726. carla-lilv
  727. carla-native-plugins
  728. carla-rtmempool
  729. carla-sfzero
  730. carla-water
  731. $<$<BOOL:${CARLA_ENABLE_JSFX}>:carla-ysfx>
  732. carla-zita-resampler
  733. PkgConfig::FLUIDSYNTH
  734. PkgConfig::LIBLO
  735. PkgConfig::LIBMAGIC
  736. PkgConfig::X11
  737. $<$<BOOL:${APPLE}>:$<LINK_LIBRARY:FRAMEWORK,Cocoa.framework>>
  738. ${CARLA_PTHREADS}
  739. )
  740. target_sources(carla-standalone
  741. PRIVATE
  742. ../source/backend/CarlaStandalone.cpp
  743. ../source/backend/CarlaStandaloneNSM.cpp
  744. ../source/backend/engine/CarlaEngine.cpp
  745. ../source/backend/engine/CarlaEngineClient.cpp
  746. ../source/backend/engine/CarlaEngineDummy.cpp
  747. ../source/backend/engine/CarlaEngineData.cpp
  748. ../source/backend/engine/CarlaEngineGraph.cpp
  749. ../source/backend/engine/CarlaEngineInternal.cpp
  750. ../source/backend/engine/CarlaEngineNative.cpp
  751. ../source/backend/engine/CarlaEngineOsc.cpp
  752. ../source/backend/engine/CarlaEngineOscHandlers.cpp
  753. ../source/backend/engine/CarlaEngineOscSend.cpp
  754. ../source/backend/engine/CarlaEnginePorts.cpp
  755. ../source/backend/engine/CarlaEngineRunner.cpp
  756. ../source/backend/plugin/CarlaPlugin.cpp
  757. ../source/backend/plugin/CarlaPluginBridge.cpp
  758. ../source/backend/plugin/CarlaPluginInternal.cpp
  759. ../source/backend/plugin/CarlaPluginAU.cpp
  760. ../source/backend/plugin/CarlaPluginCLAP.cpp
  761. ../source/backend/plugin/CarlaPluginFluidSynth.cpp
  762. ../source/backend/plugin/CarlaPluginJuce.cpp
  763. ../source/backend/plugin/CarlaPluginJSFX.cpp
  764. ../source/backend/plugin/CarlaPluginLADSPADSSI.cpp
  765. ../source/backend/plugin/CarlaPluginLV2.cpp
  766. ../source/backend/plugin/CarlaPluginNative.cpp
  767. ../source/backend/plugin/CarlaPluginSFZero.cpp
  768. ../source/backend/plugin/CarlaPluginVST2.cpp
  769. ../source/backend/plugin/CarlaPluginVST3.cpp
  770. $<$<BOOL:${CARLA_USE_JACK}>:../source/backend/engine/CarlaEngineJack.cpp>
  771. $<$<BOOL:${CARLA_USE_JACK}>:../source/backend/plugin/CarlaPluginJack.cpp>
  772. PUBLIC
  773. ${carla-standalone-public-headers}
  774. )
  775. install(TARGETS carla-standalone
  776. ARCHIVE DESTINATION ${CARLA_INSTALL_LIBDIR}
  777. LIBRARY DESTINATION ${CARLA_INSTALL_LIBDIR}
  778. FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
  779. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  780. )
  781. if(${CARLA_BUILD_FRAMEWORKS})
  782. install(TARGETS
  783. carla-bridge-native
  784. carla-discovery-native
  785. DESTINATION ${CMAKE_INSTALL_LIBDIR}/carla-standalone.framework)
  786. endif()
  787. #######################################################################################################################
  788. # carla utils
  789. add_library(carla-utils SHARED)
  790. add_library(carla::utils ALIAS carla-utils)
  791. set_common_target_properties(carla-utils)
  792. if(${CARLA_BUILD_FRAMEWORKS})
  793. set(carla-utils-public-headers
  794. ../source/backend/CarlaBackend.h
  795. ../source/backend/CarlaUtils.h
  796. ../source/includes/CarlaDefines.h
  797. ../source/includes/CarlaMIDI.h
  798. ../source/utils/CarlaBackendUtils.hpp
  799. ../source/utils/CarlaBase64Utils.hpp
  800. ../source/utils/CarlaBinaryUtils.hpp
  801. ../source/utils/CarlaBridgeDefines.hpp
  802. ../source/utils/CarlaBridgeUtils.hpp
  803. ../source/utils/CarlaMacUtils.hpp
  804. ../source/utils/CarlaMathUtils.hpp
  805. ../source/utils/CarlaMutex.hpp
  806. ../source/utils/CarlaRingBuffer.hpp
  807. ../source/utils/CarlaProcessUtils.hpp
  808. ../source/utils/CarlaRunner.hpp
  809. ../source/utils/CarlaScopeUtils.hpp
  810. ../source/utils/CarlaSemUtils.hpp
  811. ../source/utils/CarlaSha1Utils.hpp
  812. ../source/utils/CarlaShmUtils.hpp
  813. ../source/utils/CarlaString.hpp
  814. ../source/utils/CarlaThread.hpp
  815. ../source/utils/CarlaTimeUtils.hpp
  816. ../source/utils/CarlaUtils.hpp
  817. )
  818. set_target_properties(carla-utils
  819. PROPERTIES
  820. FRAMEWORK TRUE
  821. OUTPUT_NAME carla-utils
  822. PUBLIC_HEADER "${carla-utils-public-headers}"
  823. )
  824. else()
  825. set_target_properties(carla-utils
  826. PROPERTIES
  827. OUTPUT_NAME carla_utils
  828. IMPORT_PREFIX lib
  829. PREFIX lib
  830. )
  831. endif()
  832. target_include_directories(carla-utils
  833. PRIVATE
  834. ../source
  835. ../source/backend
  836. ../source/includes
  837. ../source/modules
  838. ../source/utils
  839. )
  840. target_link_libraries(carla-utils
  841. PRIVATE
  842. carla-jackbridge
  843. carla-lilv
  844. carla-water-files
  845. $<$<BOOL:${CARLA_ENABLE_JSFX}>:carla-ysfx>
  846. PkgConfig::FLUIDSYNTH
  847. PkgConfig::X11
  848. $<$<BOOL:${APPLE}>:$<LINK_LIBRARY:FRAMEWORK,Cocoa.framework>>
  849. ${CARLA_PTHREADS}
  850. PUBLIC
  851. $<$<BOOL:${WIN32}>:winmm>
  852. )
  853. target_sources(carla-utils
  854. PRIVATE
  855. ../source/backend/utils/CachedPlugins.cpp
  856. ../source/backend/utils/CarlaUtils.cpp
  857. ../source/backend/utils/Information.cpp
  858. ../source/backend/utils/JUCE.cpp
  859. ../source/backend/utils/PipeClient.cpp
  860. ../source/backend/utils/PluginDiscovery.cpp
  861. ../source/backend/utils/System.cpp
  862. ../source/backend/utils/Windows.cpp
  863. PUBLIC
  864. ${carla-utils-public-headers}
  865. )
  866. install(TARGETS carla-utils
  867. ARCHIVE DESTINATION ${CARLA_INSTALL_LIBDIR}
  868. LIBRARY DESTINATION ${CARLA_INSTALL_LIBDIR}
  869. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  870. FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
  871. )
  872. if(${CARLA_BUILD_FRAMEWORKS})
  873. install(TARGETS
  874. carla-bridge-native
  875. carla-discovery-native
  876. DESTINATION ${CMAKE_INSTALL_LIBDIR}/carla-utils.framework)
  877. endif()
  878. #######################################################################################################################
  879. if(APPLE)
  880. set_source_files_properties(
  881. ../source/backend/CarlaStandalone.cpp
  882. ../source/backend/plugin/CarlaPluginCLAP.cpp
  883. ../source/backend/plugin/CarlaPluginVST2.cpp
  884. ../source/backend/plugin/CarlaPluginVST3.cpp
  885. ../source/backend/utils/CarlaUtils.cpp
  886. ../source/backend/utils/Windows.cpp
  887. ../source/bridges-plugin/CarlaBridgePlugin.cpp
  888. ../source/discovery/carla-discovery.cpp
  889. ../source/modules/water/water.cpp
  890. ../source/modules/water/water.files.cpp
  891. PROPERTIES COMPILE_FLAGS -ObjC++)
  892. endif()
  893. #######################################################################################################################
  894. # install code headers
  895. add_library(carla-headers-backend INTERFACE)
  896. add_library(carla-headers-includes INTERFACE)
  897. add_library(carla-headers-utils INTERFACE)
  898. set_property(TARGET carla-headers-backend
  899. PROPERTY PUBLIC_HEADER
  900. ../source/backend/CarlaBackend.h
  901. ../source/backend/CarlaHost.h
  902. ../source/backend/CarlaUtils.h
  903. ../source/backend/CarlaEngine.hpp
  904. ../source/backend/CarlaPlugin.hpp
  905. ../source/backend/CarlaPluginPtr.hpp
  906. )
  907. set_property(TARGET carla-headers-includes
  908. PROPERTY PUBLIC_HEADER
  909. ../source/includes/CarlaDefines.h
  910. ../source/includes/CarlaMIDI.h
  911. ../source/includes/CarlaNative.h
  912. ../source/includes/CarlaNativePlugin.h
  913. )
  914. set_property(TARGET carla-headers-utils
  915. PROPERTY PUBLIC_HEADER
  916. ../source/utils/CarlaBackendUtils.hpp
  917. ../source/utils/CarlaBase64Utils.hpp
  918. ../source/utils/CarlaBinaryUtils.hpp
  919. ../source/utils/CarlaBridgeDefines.hpp
  920. ../source/utils/CarlaBridgeUtils.hpp
  921. ../source/utils/CarlaMacUtils.hpp
  922. ../source/utils/CarlaMathUtils.hpp
  923. ../source/utils/CarlaMutex.hpp
  924. ../source/utils/CarlaRingBuffer.hpp
  925. ../source/utils/CarlaProcessUtils.hpp
  926. ../source/utils/CarlaRunner.hpp
  927. ../source/utils/CarlaScopeUtils.hpp
  928. ../source/utils/CarlaSemUtils.hpp
  929. ../source/utils/CarlaSha1Utils.hpp
  930. ../source/utils/CarlaShmUtils.hpp
  931. ../source/utils/CarlaString.hpp
  932. ../source/utils/CarlaThread.hpp
  933. ../source/utils/CarlaTimeUtils.hpp
  934. ../source/utils/CarlaUtils.hpp
  935. )
  936. install(TARGETS carla-headers-backend PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/carla)
  937. install(TARGETS carla-headers-includes PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/carla/includes)
  938. install(TARGETS carla-headers-utils PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/carla/utils)
  939. #######################################################################################################################
  940. # pkg-config stuff
  941. if(NOT ${CARLA_BUILD_FRAMEWORKS})
  942. configure_file(carla-utils.pc.in carla-utils.pc @ONLY)
  943. install(FILES
  944. ${CMAKE_CURRENT_BINARY_DIR}/carla-utils.pc
  945. DESTINATION
  946. ${CMAKE_INSTALL_LIBDIR}/pkgconfig
  947. )
  948. endif()
  949. #######################################################################################################################