From 0b7ed05a8163761a63a52f9052f2c28dce97a9dd Mon Sep 17 00:00:00 2001 From: redtide Date: Wed, 10 Jan 2024 14:42:31 +0100 Subject: [PATCH] CMake clean up: - use a different namespace for plugins - avoid unneeded virtual directories --- CMakeLists.txt | 3 ++ plugins/CMakeLists.txt | 51 +++++++++++++-------- plugins/editor/CMakeLists.txt | 58 +++++++++++++----------- plugins/editor/cmake/Vstgui.cmake | 32 +++++++------- plugins/lv2/CMakeLists.txt | 43 ++++++++++++------ plugins/puredata/CMakeLists.txt | 17 ++++--- plugins/vst/CMakeLists.txt | 73 +++++++++++++++++++------------ plugins/vst/cmake/Vst3.cmake | 2 +- 8 files changed, 173 insertions(+), 106 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aade7ad8..b543ffcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,9 @@ option_ex(PLUGIN_VST3 "Enable VST3 plug-in build" ON) option_ex(SFIZZ_USE_SYSTEM_LV2 "Use LV2 headers preinstalled on system" OFF) option_ex(SFIZZ_USE_SYSTEM_VST3SDK "Use VST3SDK source files preinstalled on system" OFF) +# This is useful with some IDE like QtCreator to avoid them to create additional virtual directories +option_ex(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS "Use CMake source_group by passing empty name" OFF) + set(MIDI_CC_COUNT 512 CACHE STRING "Maximum amount of Control Change Messages") if(PLUGIN_LV2 AND SFIZZ_SNDFILE_STATIC) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index a8d8943f..0eefd2db 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -15,28 +15,38 @@ set(PLUGINSCOMMON_SOURCES common/plugin/SfizzSettings.h common/plugin/SfizzSettings.cpp ) -source_group("Sources" FILES ${PLUGINSCOMMON_SOURCES}) -add_library(plugins-common STATIC EXCLUDE_FROM_ALL ${PLUGINSCOMMON_SOURCES}) +if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${PLUGINSCOMMON_SOURCES}) +endif() +add_library(plugins_common STATIC EXCLUDE_FROM_ALL ${PLUGINSCOMMON_SOURCES}) if(APPLE) - target_sources(plugins-common PRIVATE + target_sources(plugins_common PRIVATE + "common/plugin/SfizzForeignPaths.mm" + "common/plugin/SfizzSettings.mm" + "common/plugin/NativeHelpers.mm" + ) + set_property(SOURCE "common/plugin/SfizzForeignPaths.mm" "common/plugin/SfizzSettings.mm" - "common/plugin/NativeHelpers.mm") - set_property( - SOURCE "common/plugin/SfizzForeignPaths.mm" - "common/plugin/SfizzSettings.mm" - "common/plugin/NativeHelpers.mm" + "common/plugin/NativeHelpers.mm" APPEND_STRING - PROPERTY COMPILE_FLAGS " -fobjc-arc") + PROPERTY COMPILE_FLAGS " -fobjc-arc" + ) endif() -target_include_directories(plugins-common PUBLIC "common") -target_link_libraries(plugins-common - PUBLIC sfizz::spin_mutex - PUBLIC sfizz::simde sfizz::filesystem absl::strings - PRIVATE sfizz::pugixml - PRIVATE sfizz::internal sfizz::sfizz) -add_library(sfizz::plugins-common ALIAS plugins-common) +target_include_directories(plugins_common PUBLIC "common") +target_link_libraries(plugins_common + PUBLIC + sfizz::spin_mutex + sfizz::simde + sfizz::filesystem + absl::strings + PRIVATE + sfizz::pugixml + sfizz::internal + sfizz::sfizz +) +add_library(plugins::common ALIAS plugins_common) add_custom_target(generate_plugins_git_build_id COMMAND @@ -48,10 +58,15 @@ add_custom_target(generate_plugins_git_build_id BYPRODUCTS "${PROJECT_BINARY_DIR}/git-build-id/PluginGitBuildId.c" ) -add_library(plugins_git_build_id STATIC EXCLUDE_FROM_ALL +set(PLUGINS_GIT_BUILD_ID_SOURCES "${PROJECT_SOURCE_DIR}/plugins/git-build-id/PluginGitBuildId.h" "${PROJECT_BINARY_DIR}/git-build-id/PluginGitBuildId.c" ) +if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${PLUGINS_GIT_BUILD_ID_SOURCES}) +endif() + +add_library(plugins_git_build_id STATIC EXCLUDE_FROM_ALL ${PLUGINS_GIT_BUILD_ID_SOURCES}) target_include_directories(plugins_git_build_id PUBLIC "${PROJECT_SOURCE_DIR}/plugins/git-build-id") add_dependencies(plugins_git_build_id generate_plugins_git_build_id) add_library(plugins::git_build_id ALIAS plugins_git_build_id) @@ -60,7 +75,7 @@ add_library(plugins::git_build_id ALIAS plugins_git_build_id) if(WIN32) elseif(ANDROID) elseif(APPLE) - target_link_libraries(plugins-common PRIVATE + target_link_libraries(plugins_common PRIVATE "${APPLE_FOUNDATION_LIBRARY}") else() endif() diff --git a/plugins/editor/CMakeLists.txt b/plugins/editor/CMakeLists.txt index 23dd8de0..35bae924 100644 --- a/plugins/editor/CMakeLists.txt +++ b/plugins/editor/CMakeLists.txt @@ -88,47 +88,52 @@ set(EDITOR_SOURCES src/editor/utility/vstgui_after.h src/editor/utility/vstgui_before.h ) -source_group("Sources" FILES ${EDITOR_SOURCES}) -source_group("Editor UI" FILES ${EDITOR_UI_FILES}) -source_group("Editor Themes" FILES ${EDITOR_THEMES}) +if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${EDITOR_SOURCES}) + source_group("" FILES ${EDITOR_UI_FILES}) + source_group("" FILES ${EDITOR_THEMES}) +endif() -add_library(sfizz_editor STATIC EXCLUDE_FROM_ALL +add_library(plugins_editor STATIC EXCLUDE_FROM_ALL ${EDITOR_SOURCES} ${EDITOR_THEMES} ${EDITOR_UI_FILES} ) -add_library(sfizz::editor ALIAS sfizz_editor) +add_library(plugins::editor ALIAS plugins_editor) -target_include_directories(sfizz_editor PUBLIC src) -target_link_libraries(sfizz_editor PUBLIC sfizz::messaging sfizz::plugins-common) -target_link_libraries(sfizz_editor PRIVATE - sfizz::vstgui +target_include_directories(plugins_editor PUBLIC src) +target_link_libraries(plugins_editor PUBLIC + sfizz::messaging + plugins::common +) +target_link_libraries(plugins_editor PRIVATE + plugins::vstgui plugins::git_build_id ) -target_compile_definitions(sfizz_editor PRIVATE +target_compile_definitions(plugins_editor PRIVATE "SFIZZ_VERSION=\"${CMAKE_PROJECT_VERSION}\"") if(APPLE) find_library(APPLE_APPKIT_LIBRARY "AppKit") find_library(APPLE_CORESERVICES_LIBRARY "CoreServices") find_library(APPLE_FOUNDATION_LIBRARY "Foundation") - target_sources(sfizz_editor PRIVATE + target_sources(plugins_editor PRIVATE src/editor/NativeHelpers.mm src/editor/VSTGUIHelpers.mm) - target_link_libraries(sfizz_editor PRIVATE + target_link_libraries(plugins_editor PRIVATE "${APPLE_APPKIT_LIBRARY}" "${APPLE_CORESERVICES_LIBRARY}" "${APPLE_FOUNDATION_LIBRARY}") - target_compile_options(sfizz_editor PRIVATE "-fobjc-arc") + target_compile_options(plugins_editor PRIVATE "-fobjc-arc") endif() # dependencies -add_library(sfizz_colorspaces INTERFACE) -add_library(sfizz::colorspaces ALIAS sfizz_colorspaces) -target_include_directories(sfizz_colorspaces INTERFACE "external/color-spaces") +add_library(plugins_colorspaces INTERFACE) +add_library(plugins::colorspaces ALIAS plugins_colorspaces) +target_include_directories(plugins_colorspaces INTERFACE "external/color-spaces") -add_library(sfizz_stb_image INTERFACE) -add_library(sfizz::stb_image ALIAS sfizz_stb_image) -target_include_directories(sfizz_stb_image INTERFACE "external/stb_image") +add_library(plugins_stb_image INTERFACE) +add_library(plugins::stb_image ALIAS plugins_stb_image) +target_include_directories(plugins_stb_image INTERFACE "external/stb_image") if(WIN32) # @@ -137,12 +142,12 @@ elseif(APPLE) else() find_package(PkgConfig REQUIRED) pkg_check_modules(sfizz-gio "gio-2.0" REQUIRED) - target_include_directories(sfizz_editor PRIVATE ${sfizz-gio_INCLUDE_DIRS}) - target_link_libraries(sfizz_editor PRIVATE ${sfizz-gio_LIBRARIES}) + target_include_directories(plugins_editor PRIVATE ${sfizz-gio_INCLUDE_DIRS}) + target_link_libraries(plugins_editor PRIVATE ${sfizz-gio_LIBRARIES}) endif() -target_link_libraries(sfizz_editor PRIVATE - sfizz::colorspaces - sfizz::stb_image +target_link_libraries(plugins_editor PRIVATE + plugins::colorspaces + plugins::stb_image sfizz::bit_array sfizz::filesystem sfizz::pugixml @@ -155,7 +160,10 @@ if(NOT CMAKE_CROSSCOMPILING) tools/layout-maker/sources/reader.h tools/layout-maker/sources/main.cpp ) - source_group("Sources" FILES ${LAYOUTMAKER_SOURCES}) + if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${LAYOUTMAKER_SOURCES}) + endif() + add_executable(layout-maker ${LAYOUTMAKER_SOURCES}) target_link_libraries(layout-maker PRIVATE absl::strings) diff --git a/plugins/editor/cmake/Vstgui.cmake b/plugins/editor/cmake/Vstgui.cmake index 9fa73450..5ee68635 100644 --- a/plugins/editor/cmake/Vstgui.cmake +++ b/plugins/editor/cmake/Vstgui.cmake @@ -6,7 +6,7 @@ string(REGEX MATCH "\#define VSTGUI_VERSION_MINOR ([0-9]*)" _ ${VSTGUIBASE_HEAD set(VSTGUI_VERSION_MINOR ${CMAKE_MATCH_1}) set(VSTGUI_VERSION "${VSTGUI_VERSION_MAJOR}.${VSTGUI_VERSION_MINOR}") -add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL +add_library(plugins_vstgui STATIC EXCLUDE_FROM_ALL "${VSTGUI_BASEDIR}/vstgui/lib/animation/animations.cpp" "${VSTGUI_BASEDIR}/vstgui/lib/animation/animator.cpp" "${VSTGUI_BASEDIR}/vstgui/lib/animation/timingfunctions.cpp" @@ -72,10 +72,10 @@ add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL "${VSTGUI_BASEDIR}/vstgui/lib/vstguidebug.cpp" "${VSTGUI_BASEDIR}/vstgui/lib/vstguiinit.cpp" ) -add_library(sfizz::vstgui ALIAS sfizz_vstgui) +add_library(plugins::vstgui ALIAS plugins_vstgui) if(WIN32) - target_sources(sfizz_vstgui PRIVATE + target_sources(plugins_vstgui PRIVATE "${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dbitmap.cpp" "${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dbitmapcache.cpp" "${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2ddrawcontext.cpp" @@ -98,7 +98,7 @@ if(WIN32) "${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/wintimer.cpp" ) elseif(APPLE) - target_sources(sfizz_vstgui PRIVATE + target_sources(plugins_vstgui PRIVATE "${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/autoreleasepool.mm" "${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoahelpers.mm" "${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoaopenglview.mm" @@ -119,7 +119,7 @@ elseif(APPLE) "${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/quartzgraphicspath.cpp" ) else() - target_sources(sfizz_vstgui PRIVATE + target_sources(plugins_vstgui PRIVATE "${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairobitmap.cpp" "${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairocontext.cpp" "${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairofont.cpp" @@ -136,12 +136,12 @@ else() ) endif() -target_include_directories(sfizz_vstgui PUBLIC "${VSTGUI_BASEDIR}") +target_include_directories(plugins_vstgui PUBLIC "${VSTGUI_BASEDIR}") if(WIN32) if (NOT MSVC) # autolinked on MSVC with pragmas - target_link_libraries(sfizz_vstgui PRIVATE + target_link_libraries(plugins_vstgui PRIVATE "opengl32" "d2d1" "dwrite" @@ -151,7 +151,7 @@ if(WIN32) ) endif() elseif(APPLE) - target_link_libraries(sfizz_vstgui PRIVATE + target_link_libraries(plugins_vstgui PRIVATE "${APPLE_COREFOUNDATION_LIBRARY}" "${APPLE_FOUNDATION_LIBRARY}" "${APPLE_COCOA_LIBRARY}" @@ -178,7 +178,7 @@ else() pkg_check_modules(PANGO REQUIRED pangocairo pangoft2) pkg_check_modules(FONTCONFIG REQUIRED fontconfig) pkg_check_modules(GLIB REQUIRED glib-2.0) - target_include_directories(sfizz_vstgui PRIVATE + target_include_directories(plugins_vstgui PRIVATE ${X11_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ${LIBXCB_INCLUDE_DIRS} @@ -193,7 +193,7 @@ else() ${FONTCONFIG_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ) - target_link_libraries(sfizz_vstgui PRIVATE + target_link_libraries(plugins_vstgui PRIVATE ${X11_LIBRARIES} ${FREETYPE_LIBRARIES} ${LIBXCB_LIBRARIES} @@ -210,21 +210,21 @@ else() ) find_library(DL_LIBRARY "dl") if(DL_LIBRARY) - target_link_libraries(sfizz_vstgui PRIVATE "${DL_LIBRARY}") + target_link_libraries(plugins_vstgui PRIVATE "${DL_LIBRARY}") endif() endif() if(${CMAKE_BUILD_TYPE} MATCHES "Debug") - target_compile_definitions(sfizz_vstgui PUBLIC "DEVELOPMENT") + target_compile_definitions(plugins_vstgui PUBLIC "DEVELOPMENT") endif() if(${CMAKE_BUILD_TYPE} MATCHES "Release") - target_compile_definitions(sfizz_vstgui PUBLIC "RELEASE") + target_compile_definitions(plugins_vstgui PUBLIC "RELEASE") endif() if(CMAKE_SYSTEM_NAME STREQUAL "Windows") # Windows 10 RS2 DDI for custom fonts - target_compile_definitions(sfizz_vstgui PRIVATE "NTDDI_VERSION=0x0A000003") + target_compile_definitions(plugins_vstgui PRIVATE "NTDDI_VERSION=0x0A000003") # disable custom fonts if dwrite3 API is unavailable in MinGW if(MINGW) check_cxx_source_compiles(" @@ -240,13 +240,13 @@ int main() }" SFIZZ_MINGW_SUPPORTS_DWRITE3) if(NOT SFIZZ_MINGW_SUPPORTS_DWRITE3) message(WARNING "This version of MinGW does not support DirectWrite 3. Custom font support is disabled.") - target_compile_definitions(sfizz_vstgui PRIVATE "VSTGUI_WIN32_CUSTOMFONT_SUPPORT=0") + target_compile_definitions(plugins_vstgui PRIVATE "VSTGUI_WIN32_CUSTOMFONT_SUPPORT=0") endif() endif() endif() if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - gw_target_warn(sfizz_vstgui PRIVATE + gw_target_warn(plugins_vstgui PRIVATE "-Wno-deprecated-copy" "-Wno-deprecated-declarations" "-Wno-extra" diff --git a/plugins/lv2/CMakeLists.txt b/plugins/lv2/CMakeLists.txt index 1e7ea249..7778a5bf 100644 --- a/plugins/lv2/CMakeLists.txt +++ b/plugins/lv2/CMakeLists.txt @@ -1,4 +1,4 @@ -set(LV2_PLUGIN_PRJ_NAME "${PROJECT_NAME}_lv2") +set(LV2_PLUGIN_PRJ_NAME "plugins_lv2") # Set the build directory as /lv2/.lv2/ set(PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.lv2") @@ -7,30 +7,47 @@ set(PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.lv2") include(LV2Config) # Keep non build turtle files in IDE -set(LV2_PLUGIN_TTL_SRC_FILES +set(LV2_PLUGIN_TTL_SOURCES manifest.ttl.in ${PROJECT_NAME}.ttl.in ) if(PLUGIN_LV2_UI) - list(APPEND LV2_PLUGIN_TTL_SRC_FILES - ${PROJECT_NAME}_ui.ttl.in) + list(APPEND LV2_PLUGIN_TTL_SOURCES ${PROJECT_NAME}_ui.ttl.in) endif() -source_group("Turtle Files" FILES - ${LV2_PLUGIN_TTL_SRC_FILES} -) -add_library(${LV2_PLUGIN_PRJ_NAME} MODULE +set(LV2_PLUGIN_SOURCES ${PROJECT_NAME}.cpp ${PROJECT_NAME}_lv2_common.cpp - ${LV2_PLUGIN_TTL_SRC_FILES}) -target_link_libraries(${LV2_PLUGIN_PRJ_NAME} PRIVATE sfizz::sfizz sfizz::import sfizz::plugins-common) + ${LV2_PLUGIN_TTL_SOURCES} +) +if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${LV2_PLUGIN_SOURCES}) +endif() +source_group("Turtle Files" FILES ${LV2_PLUGIN_TTL_SOURCES}) +add_library(${LV2_PLUGIN_PRJ_NAME} MODULE ${LV2_PLUGIN_SOURCES}) +target_link_libraries(${LV2_PLUGIN_PRJ_NAME} PRIVATE + sfizz::sfizz + sfizz::import + plugins::common +) if(PLUGIN_LV2_UI) - add_library(${LV2_PLUGIN_PRJ_NAME}_ui MODULE + set(LV2_PLUGIN_UI_FILES ${PROJECT_NAME}_ui.cpp ${PROJECT_NAME}_lv2_common.cpp vstgui_helpers.h - vstgui_helpers.cpp) - target_link_libraries(${LV2_PLUGIN_PRJ_NAME}_ui PRIVATE sfizz::editor sfizz::vstgui sfizz::plugins-common) + vstgui_helpers.cpp + ) + if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${LV2_PLUGIN_UI_FILES}) + endif() + + add_library(${LV2_PLUGIN_PRJ_NAME}_ui MODULE ${LV2_PLUGIN_UI_FILES}) + + target_link_libraries(${LV2_PLUGIN_PRJ_NAME}_ui PRIVATE + plugins::editor + plugins::vstgui + plugins::common + ) endif() if(PLUGIN_LV2_PSA) diff --git a/plugins/puredata/CMakeLists.txt b/plugins/puredata/CMakeLists.txt index 2e4eb35e..7fb75227 100644 --- a/plugins/puredata/CMakeLists.txt +++ b/plugins/puredata/CMakeLists.txt @@ -23,27 +23,32 @@ function(copy_puredata_resources TARGET SOURCE_DIR DESTINATION_DIR) add_dependencies("${TARGET}" "${TARGET}_puredata_resources") endfunction() -add_pd_external(sfizz_puredata "sfizz_puredata.c") -target_compile_definitions(sfizz_puredata PRIVATE +add_pd_external(plugins_puredata "sfizz_puredata.c") + +if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES sfizz_puredata.c) +endif() + +target_compile_definitions(plugins_puredata PRIVATE "MIDI_CC_COUNT=${MIDI_CC_COUNT}" "SFIZZ_VERSION=\"${CMAKE_PROJECT_VERSION}\"" ) -target_link_libraries(sfizz_puredata PRIVATE +target_link_libraries(plugins_puredata PRIVATE sfizz::import sfizz::sfizz plugins::git_build_id ) -set_target_properties(sfizz_puredata PROPERTIES +set_target_properties(plugins_puredata PROPERTIES OUTPUT_NAME "sfizz" LIBRARY_OUTPUT_DIRECTORY "${PUREDATA_BINARY_DIR}/$<0:>") if(MINGW) - set_property(TARGET sfizz_puredata APPEND_STRING + set_property(TARGET plugins_puredata APPEND_STRING PROPERTY LINK_FLAGS " -static") endif() # Copy resources -copy_puredata_resources(sfizz_puredata +copy_puredata_resources(plugins_puredata "${CMAKE_CURRENT_SOURCE_DIR}" "${PUREDATA_BINARY_DIR}") diff --git a/plugins/vst/CMakeLists.txt b/plugins/vst/CMakeLists.txt index 5e291f96..7ecb4fca 100644 --- a/plugins/vst/CMakeLists.txt +++ b/plugins/vst/CMakeLists.txt @@ -18,18 +18,21 @@ configure_file(VstPluginDefs.h.in "${CMAKE_CURRENT_BINARY_DIR}/VstPluginDefs.h") include("cmake/Vst3.cmake") # Add the ring buffer -set(RINGBUFFER_HEADERS +set(RINGBUFFER_SOURCES "external/ring_buffer/ring_buffer/ring_buffer.h" - "external/ring_buffer/ring_buffer/ring_buffer.tcc") -add_library(sfizz-ring-buffer STATIC EXCLUDE_FROM_ALL + "external/ring_buffer/ring_buffer/ring_buffer.tcc" "external/ring_buffer/ring_buffer/ring_buffer.cpp" - ${RINGBUFFER_HEADERS}) -source_group("Header Files" FILES ${RINGBUFFER_HEADERS}) -target_include_directories(sfizz-ring-buffer PUBLIC "external/ring_buffer") -add_library(sfizz::ring-buffer ALIAS sfizz-ring-buffer) +) +if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${RINGBUFFER_SOURCES}) +endif() + +add_library(plugins_ring_buffer STATIC EXCLUDE_FROM_ALL ${RINGBUFFER_SOURCES}) +target_include_directories(plugins_ring_buffer PUBLIC "external/ring_buffer") +add_library(plugins::ring-buffer ALIAS plugins_ring_buffer) # Build the VST shared code -add_library(sfizz-vst3-core STATIC EXCLUDE_FROM_ALL +set(VST3_CORE_SOURCES SfizzVstProcessor.cpp SfizzVstProcessor.h SfizzVstController.cpp @@ -47,38 +50,54 @@ add_library(sfizz-vst3-core STATIC EXCLUDE_FROM_ALL OrderedEventProcessor.hpp IdleUpdateHandler.h X11RunLoop.h - X11RunLoop.cpp) -target_include_directories(sfizz-vst3-core - PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") -target_link_libraries(sfizz-vst3-core - PRIVATE sfizz::sfizz - PRIVATE sfizz::import - PRIVATE sfizz::editor - PRIVATE sfizz::plugins-common - PRIVATE sfizz::pugixml sfizz::filesystem - PRIVATE sfizz::ring-buffer - PRIVATE absl::strings absl::optional absl::container_common + X11RunLoop.cpp +) +if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES ${VST3_CORE_SOURCES}) +endif() + +add_library(plugins_vst3_core STATIC EXCLUDE_FROM_ALL ${VST3_CORE_SOURCES}) + +target_include_directories(plugins_vst3_core PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") +target_link_libraries(plugins_vst3_core PRIVATE + sfizz::sfizz + sfizz::filesystem + sfizz::import + sfizz::pugixml + plugins::common + plugins::editor + plugins::ring-buffer + absl::strings + absl::optional + absl::container_common vst3sdk - vst3sdk_vstgui) -gw_target_warn(sfizz-vst3-core PRIVATE + vst3sdk_vstgui +) +gw_target_warn(plugins_vst3_core PRIVATE "-Wno-ignored-qualifiers" "-Wno-unused-parameter") -add_library(sfizz::vst3-core ALIAS sfizz-vst3-core) +add_library(plugins::vst3_core ALIAS plugins_vst3_core) # --- VST3 plugin --- # if(PLUGIN_VST3) - set(VST3_PLUGIN_PRJ_NAME "${PROJECT_NAME}_vst3") + set(VST3_PLUGIN_PRJ_NAME "plugins_vst3") set(VST3_PLUGIN_BUNDLE_NAME "${PROJECT_NAME}.vst3") + if(SFIZZ_CMAKE_USE_EMPTY_SOURCE_GROUPS) + source_group("" FILES VstPluginFactory.cpp) + endif() + add_library(${VST3_PLUGIN_PRJ_NAME} MODULE "VstPluginFactory.cpp") + if(WIN32) target_sources(${VST3_PLUGIN_PRJ_NAME} PRIVATE vst3.def) endif() + target_include_directories(${VST3_PLUGIN_PRJ_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") target_link_libraries(${VST3_PLUGIN_PRJ_NAME} - PRIVATE sfizz-vst3-core) + PRIVATE plugins_vst3_core) set_target_properties(${VST3_PLUGIN_PRJ_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}" PREFIX "") @@ -156,7 +175,7 @@ endif() if(PLUGIN_AU AND NOT APPLE) message(WARNING "Audio Unit is available only for macOS builds") elseif(PLUGIN_AU) - set(AU_PLUGIN_PRJ_NAME "${PROJECT_NAME}_au") + set(AU_PLUGIN_PRJ_NAME "plugins_au") set(AU_PLUGIN_BUNDLE_NAME "${PROJECT_NAME}.component") add_library(${AU_PLUGIN_PRJ_NAME} MODULE @@ -179,7 +198,7 @@ elseif(PLUGIN_AU) "${APPLE_COREMIDI_LIBRARY}") target_link_libraries(${AU_PLUGIN_PRJ_NAME} - PRIVATE sfizz-vst3-core) + PRIVATE plugins_vst3_core) set_target_properties(${AU_PLUGIN_PRJ_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}" PREFIX "") @@ -331,7 +350,7 @@ if(PLUGIN_VST2) endif() target_link_libraries(${VST2_PLUGIN_PRJ_NAME} - PRIVATE sfizz-vst3-core) + PRIVATE plugins_vst3_core) set_target_properties(${VST2_PLUGIN_PRJ_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}" PREFIX "") diff --git a/plugins/vst/cmake/Vst3.cmake b/plugins/vst/cmake/Vst3.cmake index f461453f..b94e5dfd 100644 --- a/plugins/vst/cmake/Vst3.cmake +++ b/plugins/vst/cmake/Vst3.cmake @@ -106,7 +106,7 @@ if(WIN32) "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstgui_win32_bundle_support.cpp") target_compile_definitions(vst3sdk_vstgui PRIVATE "SMTG_MODULE_IS_BUNDLE=1") endif() -target_link_libraries(vst3sdk_vstgui PUBLIC vst3sdk sfizz::vstgui) +target_link_libraries(vst3sdk_vstgui PUBLIC vst3sdk plugins::vstgui) function(plugin_add_vstgui NAME) target_link_libraries("${NAME}" PRIVATE vst3sdk_vstgui)