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.

221 lines
8.9KB

  1. cmake_minimum_required (VERSION 3.4.3)
  2. #-------------------------------------------------------------------------------
  3. # Includes
  4. #-------------------------------------------------------------------------------
  5. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
  6. include(Global)
  7. include(AddVST3Library)
  8. include(Bundle)
  9. include(ExportedSymbols)
  10. include(PrefixHeader)
  11. include(PlatformIOS)
  12. # do not build VST2 by default
  13. option(SMTG_CREATE_VST2_VERSION "Use VST2" OFF)
  14. #-------------------------------------------------------------------------------
  15. # SDK Project
  16. #-------------------------------------------------------------------------------
  17. set(VST_SDK TRUE)
  18. project(vstsdk)
  19. if (LINUX)
  20. option(SMTG_ADD_ADDRESS_SANITIZER_CONFIG "Add AddressSanitizer Config (Linux only)" OFF)
  21. if(SMTG_ADD_ADDRESS_SANITIZER_CONFIG)
  22. set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES};ASan")
  23. add_compile_options($<$<CONFIG:ASan>:-DDEVELOPMENT=1>)
  24. add_compile_options($<$<CONFIG:ASan>:-fsanitize=address>)
  25. add_compile_options($<$<CONFIG:ASan>:-DVSTGUI_LIVE_EDITING=1>)
  26. add_compile_options($<$<CONFIG:ASan>:-g>)
  27. add_compile_options($<$<CONFIG:ASan>:-O0>)
  28. set(ASAN_LIBRARY asan)
  29. link_libraries($<$<CONFIG:ASan>:${ASAN_LIBRARY}>)
  30. endif()
  31. endif()
  32. if(UNIX)
  33. if(XCODE)
  34. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
  35. set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
  36. elseif(APPLE)
  37. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
  38. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -stdlib=libc++")
  39. link_libraries(c++)
  40. else()
  41. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
  42. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar")
  43. link_libraries(stdc++fs pthread dl)
  44. endif()
  45. elseif(WIN)
  46. add_definitions(-D_UNICODE)
  47. add_compile_options(/fp:fast)
  48. add_compile_options($<$<CONFIG:Release>:/Oi>) # Enable Intrinsic Functions (Yes)
  49. add_compile_options($<$<CONFIG:Release>:/Ot>) # Favor Size Or Speed (Favor fast code)
  50. #add_compile_options($<$<CONFIG:Release>:/Ox>) # Optimization (/O2: Maximise Speed /0x: Full Optimization)
  51. add_compile_options($<$<CONFIG:Release>:/GF>) # Enable String Pooling
  52. add_compile_options($<$<CONFIG:Release>:/EHa>) # Enable C++ Exceptions
  53. add_compile_options($<$<CONFIG:Release>:/Oy>) # Omit Frame Pointers
  54. endif()
  55. set(ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
  56. # here you can define where the VST3 SDK is located
  57. set(SDK_ROOT "${ROOT}")
  58. # here you can define where the VSTGUI is located
  59. set(VSTGUI_ROOT "${ROOT}")
  60. include_directories(${ROOT} ${SDK_ROOT})
  61. set(SDK_IDE_LIBS_FOLDER FOLDER "Libraries")
  62. set(SDK_IDE_PLUGIN_EXAMPLES_FOLDER FOLDER "PlugInExamples")
  63. set(SDK_IDE_HOSTING_EXAMPLES_FOLDER FOLDER "HostingExamples")
  64. #-------------------------------------------------------------------------------
  65. if(MAC AND XCODE)
  66. if(NOT SMTG_COREAUDIO_SDK_PATH)
  67. # Check if the CoreAudio SDK is next to the VST3SDK:
  68. if(EXISTS "${SDK_ROOT}/../CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp")
  69. set(SMTG_COREAUDIO_SDK_PATH "${SDK_ROOT}/../CoreAudio")
  70. else()
  71. if(EXISTS "${SDK_ROOT}/external.apple.coreaudio/AudioUnits/AUPublic/AUBase/AUBase.cpp")
  72. set(SMTG_COREAUDIO_SDK_PATH "${SDK_ROOT}/external.apple.coreaudio")
  73. endif()
  74. endif()
  75. else()
  76. if(NOT IS_ABSOLUTE ${SMTG_COREAUDIO_SDK_PATH})
  77. get_filename_component(SMTG_COREAUDIO_SDK_PATH "${SDK_ROOT}/${SMTG_COREAUDIO_SDK_PATH}" ABSOLUTE)
  78. endif()
  79. if(NOT EXISTS "${SMTG_COREAUDIO_SDK_PATH}/AudioUnits/AUPublic/AUBase/AUBase.cpp")
  80. message(FATAL_ERROR "SMTG_COREAUDIO_SDK_PATH is set but does not point to an expected location")
  81. endif()
  82. endif()
  83. if(SMTG_COREAUDIO_SDK_PATH)
  84. message(STATUS "SMTG_COREAUDIO_SDK_PATH is set to : " ${SMTG_COREAUDIO_SDK_PATH})
  85. endif()
  86. endif()
  87. #-------------------------------------------------------------------------------
  88. # Projects
  89. #-------------------------------------------------------------------------------
  90. add_subdirectory(base)
  91. add_subdirectory(public.sdk)
  92. add_subdirectory(public.sdk/source/vst/auwrapper)
  93. add_subdirectory(public.sdk/source/vst/auwrapper/again)
  94. add_subdirectory(public.sdk/source/vst/interappaudio)
  95. add_subdirectory(public.sdk/samples/vst/again)
  96. add_subdirectory(public.sdk/samples/vst/adelay)
  97. add_subdirectory(public.sdk/samples/vst/channelcontext)
  98. add_subdirectory(public.sdk/samples/vst/hostchecker)
  99. add_subdirectory(public.sdk/samples/vst/editorhost)
  100. add_subdirectory(public.sdk/samples/vst/mda-vst3)
  101. add_subdirectory(public.sdk/samples/vst/note_expression_synth)
  102. add_subdirectory(public.sdk/samples/vst/note_expression_text)
  103. add_subdirectory(public.sdk/samples/vst/pitchnames)
  104. add_subdirectory(public.sdk/samples/vst/prefetchablesupport)
  105. add_subdirectory(public.sdk/samples/vst/programchange)
  106. add_subdirectory(public.sdk/samples/vst/validator)
  107. add_subdirectory(public.sdk/samples/vst/InterAppAudio)
  108. set(VSTGUI_DISABLE_UNITTESTS 1)
  109. add_subdirectory(vstgui4/vstgui)
  110. #-------------------------------------------------------------------------------
  111. # VSTGUI Support Library
  112. #-------------------------------------------------------------------------------
  113. add_compile_options($<$<CONFIG:Debug>:-DVSTGUI_LIVE_EDITING=1>)
  114. set(VST3_VSTGUI_SOURCES
  115. ${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.cpp
  116. ${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.h
  117. ${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3padcontroller.cpp
  118. ${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3padcontroller.h
  119. ${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3editor.cpp
  120. ${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3editor.h
  121. ${SDK_ROOT}/public.sdk/source/vst/vstguieditor.cpp
  122. )
  123. add_library(vstgui_support STATIC ${VST3_VSTGUI_SOURCES})
  124. target_include_directories(vstgui_support PUBLIC ${VSTGUI_ROOT}/vstgui4)
  125. target_link_libraries(vstgui_support PRIVATE vstgui_uidescription)
  126. if(MAC)
  127. if(XCODE)
  128. target_link_libraries(vstgui_support PRIVATE "-framework Cocoa" "-framework OpenGL" "-framework Accelerate" "-framework QuartzCore" "-framework Carbon")
  129. else()
  130. find_library(COREFOUNDATION_FRAMEWORK CoreFoundation)
  131. find_library(COCOA_FRAMEWORK Cocoa)
  132. find_library(OPENGL_FRAMEWORK OpenGL)
  133. find_library(ACCELERATE_FRAMEWORK Accelerate)
  134. find_library(QUARTZCORE_FRAMEWORK QuartzCore)
  135. find_library(CARBON_FRAMEWORK Carbon)
  136. target_link_libraries(vstgui_support PRIVATE ${COREFOUNDATION_FRAMEWORK} ${COCOA_FRAMEWORK} ${OPENGL_FRAMEWORK} ${ACCELERATE_FRAMEWORK} ${QUARTZCORE_FRAMEWORK} ${CARBON_FRAMEWORK})
  137. endif()
  138. endif()
  139. #-------------------------------------------------------------------------------
  140. # IDE sorting
  141. #-------------------------------------------------------------------------------
  142. set_target_properties(vstgui_support PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  143. set_target_properties(sdk PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  144. set_target_properties(base PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  145. set_target_properties(vstgui PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  146. set_target_properties(vstgui_uidescription PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  147. if (TARGET again)
  148. set_target_properties(again PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  149. endif()
  150. if (TARGET againsimple)
  151. set_target_properties(againsimple PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  152. endif()
  153. if (TARGET adelay)
  154. set_target_properties(adelay PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  155. endif()
  156. if (TARGET channelcontext)
  157. set_target_properties(channelcontext PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  158. endif()
  159. if (TARGET hostchecker)
  160. set_target_properties(hostchecker PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  161. endif()
  162. if (TARGET mda-vst3)
  163. set_target_properties(mda-vst3 PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  164. endif()
  165. if (TARGET noteexpressionsynth)
  166. set_target_properties(noteexpressionsynth PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  167. endif()
  168. if (TARGET noteexpressiontext)
  169. set_target_properties(noteexpressiontext PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  170. endif()
  171. if (TARGET pitchnames)
  172. set_target_properties(pitchnames PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  173. endif()
  174. if (TARGET prefetchablesupport)
  175. set_target_properties(prefetchablesupport PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  176. endif()
  177. if (TARGET programchange)
  178. set_target_properties(programchange PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  179. endif()
  180. if (TARGET editorhost)
  181. set_target_properties(editorhost PROPERTIES ${SDK_IDE_HOSTING_EXAMPLES_FOLDER})
  182. endif()
  183. if (TARGET validator)
  184. set_target_properties(validator PROPERTIES ${SDK_IDE_HOSTING_EXAMPLES_FOLDER})
  185. endif ()
  186. if(MAC AND XCODE)
  187. if(SMTG_COREAUDIO_SDK_PATH)
  188. set_target_properties(auwrapper PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  189. set_target_properties(again_au PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  190. endif()
  191. if(IOS_DEVELOPMENT_TEAM)
  192. set_target_properties(sdk_ios PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  193. set_target_properties(base_ios PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  194. set_target_properties(interappaudio PROPERTIES ${SDK_IDE_LIBS_FOLDER})
  195. set_target_properties(noteexpressionsynth_ios PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
  196. endif()
  197. endif()