From fa3c7f569a7fd257f8c4990c29414884ff386819 Mon Sep 17 00:00:00 2001 From: Matthias von Faber Date: Wed, 15 Sep 2021 18:00:46 +0200 Subject: [PATCH] CMake: Refactor into subdirectories, projects Our CMakeLists.txt is pushing 1.5k lines of spaghetti and has become unmaintainable. This change splits Surge into subprojects to try and: - Increase readability (targets & properties instead of variables) - Reduce and gain insight into dependencies - Reduce redundancy, potential for regressions and merge conflicts - Make building things optional via SURGE_BUILD_* cache variables Behavior shouldn't have changed too noticeably. Some targets were merged or renamed to declutter the IDE a bit. The pluginval stuff still needs cleaning up, but I didn't want to make this even bigger. --- CMakeLists.txt | 1479 ++--------------- README.md | 2 +- azure-pipelines.yml | 22 +- cmake/FindLibSndFile.cmake | 40 - libs/strnatcmp/CMakeLists.txt | 9 + resources/CMakeLists.txt | 20 + .../{surge-x86.iss => surge32.iss} | 0 .../installer_win/{surge.iss => surge64.iss} | 0 src/CMakeLists.txt | 169 ++ {cmake => src/cmake}/get-asio.cmake | 0 src/cmake/lib.cmake | 89 + src/common/CMakeLists.txt | 325 ++++ src/gui/CMakeLists.txt | 134 ++ src/headless/CMakeLists.txt | 40 + src/headless/HeadlessNonTestFunctions.cpp | 7 - src/headless/HeadlessUtils.cpp | 23 - src/headless/HeadlessUtils.h | 2 - src/python_bindings/CMakeLists.txt | 25 + src/surge_effects_bank/CMakeLists.txt | 62 + src/surge_synth_juce/CMakeLists.txt | 80 + ...nsions.cpp => SurgeSynthVSTExtensions.cpp} | 0 21 files changed, 1097 insertions(+), 1431 deletions(-) delete mode 100644 cmake/FindLibSndFile.cmake create mode 100644 libs/strnatcmp/CMakeLists.txt create mode 100644 resources/CMakeLists.txt rename scripts/installer_win/{surge-x86.iss => surge32.iss} (100%) rename scripts/installer_win/{surge.iss => surge64.iss} (100%) create mode 100644 src/CMakeLists.txt rename {cmake => src/cmake}/get-asio.cmake (100%) create mode 100644 src/cmake/lib.cmake create mode 100644 src/common/CMakeLists.txt create mode 100644 src/gui/CMakeLists.txt create mode 100644 src/headless/CMakeLists.txt create mode 100644 src/python_bindings/CMakeLists.txt create mode 100644 src/surge_effects_bank/CMakeLists.txt create mode 100644 src/surge_synth_juce/CMakeLists.txt rename src/surge_synth_juce/{SurgeSynthVST2Extensions.cpp => SurgeSynthVSTExtensions.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bac4e9bff3..54a2dfda915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,57 +1,60 @@ -# Surge CMake file -# Exports targets for each of our builds -# - +# vi:set sw=2 et: cmake_minimum_required(VERSION 3.15) cmake_policy(SET CMP0091 NEW) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "Build for 10.9") +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "Minimum macOS version") set(CMAKE_POSITION_INDEPENDENT_CODE ON) -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) -endif () -message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}") +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) +endif() -if (NOT BUILD_TESTING) - set(BUILD_TESTING "False" CACHE STRING "" FORCE) -endif () +if(NOT BUILD_TESTING) + option(BUILD_TESTING "" OFF) +endif() -project(Surge-XT VERSION 0.9.0 LANGUAGES C CXX ASM) +project(Surge VERSION 0.9.0 LANGUAGES C CXX ASM) +# Banner {{{ message(STATUS "Its Surge-XT Folks! Version is ${PROJECT_VERSION}") - +message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}") +message(STATUS "CMake Version is ${CMAKE_VERSION}") +message(STATUS "Compiler Version is ${CMAKE_CXX_COMPILER_VERSION}") +math(EXPR SURGE_BITNESS "${CMAKE_SIZEOF_VOID_P} * 8" OUTPUT_FORMAT DECIMAL) +message(STATUS "Targeting ${SURGE_BITNESS} bit configuration") +# }}} +# Global compiler/linker settings {{{ set(CMAKE_CXX_EXTENSIONS OFF) -if (APPLE) - set(CMAKE_CXX_STANDARD 14) -else () - set(CMAKE_CXX_STANDARD 17) -endif () - -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") - # Any Clang or any GCC - add_compile_options( - -Wno-multichar - # Targetting Windows with GCC/Clang is experimental - $<$>:-Werror> - - # PE/COFF doesn't support visibility - $<$>:-fvisibility=hidden> - # Inlines visibility is only relevant with C++ - $<$>,$>:-fvisibility-inlines-hidden> - - # BP note: If you want to turn on llvm/gcc santize undo this and the link options below - # -fsanitize=address -fsanitize=undefined - ) - - add_link_options( - # -fsanitize=address -fsanitize=undefinec - ) - - # Enable SSE2 on x86-32 only. It's implied on x86-64 and N/A elsewhere. - if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) - include(CheckCXXSourceCompiles) - check_cxx_source_compiles("#ifndef __i386__ +if(APPLE) + set(CMAKE_CXX_STANDARD 14) +else() + set(CMAKE_CXX_STANDARD 17) +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + # Any Clang or any GCC + add_compile_options( + -Wno-multichar + # Targetting Windows with GCC/Clang is experimental + $<$>:-Werror> + + # PE/COFF doesn't support visibility + $<$>:-fvisibility=hidden> + # Inlines visibility is only relevant with C++ + $<$>,$>:-fvisibility-inlines-hidden> + + # BP note: If you want to turn on llvm/gcc santize undo this and the link options below + # -fsanitize=address -fsanitize=undefined + ) + + add_link_options( + # -fsanitize=address -fsanitize=undefinec + ) + + # Enable SSE2 on x86-32 only. It's implied on x86-64 and N/A elsewhere. + if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) + include(CheckCXXSourceCompiles) + check_cxx_source_compiles("#ifndef __i386__ #error #endif int main() {}" SURGE_ARCH_I386) @@ -69,1306 +72,85 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") #endif #endif int main() {}" COMPILER_HAS_AVX_OR_IS_ARM) - if (NOT COMPILER_HAS_AVX_OR_IS_ARM) - message(STATUS "Holding off on AVX support. See #4479 for the strategy") - # add_compile_options("-mavx") - endif () + if (NOT COMPILER_HAS_AVX_OR_IS_ARM) + message(STATUS "Holding off on AVX support. See #4479 for the strategy" ) + # add_compile_options("-mavx") + endif() - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # Any Clang - add_compile_options( - -Wno-deprecated-declarations - -Werror=inconsistent-missing-override - -Werror=logical-op-parentheses - -Werror=dynamic-class-memaccess - -Werror=undefined-bool-conversion - -Werror=bitwise-op-parentheses - -Werror=pointer-bool-conversion - ) - if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$") - # Apple Clang only - add_compile_options( - -fasm-blocks - ) - endif () - elseif (CMAKE_CXX_COMPILER_ID MATCHES "^GNU$") - # GCC only - add_compile_options( - -Wformat-truncation=0 # squelch warning about snprintf truncating strings (see PR #3977) - -Wno-free-nonheap-object # https://github.com/surge-synthesizer/surge/issues/4251 - -Wno-return-local-addr # squelch sqlite3 error: function may return address of local variable - ) - endif () -endif () - -if (MSVC) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Any Clang add_compile_options( - -WX # treat all warnings as errors - - # MSVC-only warnings, Clang-cl silently ignores these - /wd4244 # float to double - /wd4305 # truncation of variable - /wd4267 # int and size_t - /wd4018 # signed unsigned mismatch - /wd4388 # signed unsigned mismatch in comparison - /wd4065 # standalone default in a switch with no case - /wd4702 # unreachable code. I generally do if( a ) return foo else return bar; return nullptr so don't warn on that - - # Clang-cl-only warnings - $<$:-Wno-microsoft-exception-spec> - $<$:-Wno-pragma-pack> - - /Zc:alignedNew - /bigobj - - # /arch:AVX - - # Build with Multiple Processes (Clang-cl builds use Ninja instead) - $<$:/MP> - # Set source and executable charsets to UTF-8 - $<$:/utf-8> + -Wno-deprecated-declarations + -Werror=inconsistent-missing-override + -Werror=logical-op-parentheses + -Werror=dynamic-class-memaccess + -Werror=undefined-bool-conversion + -Werror=bitwise-op-parentheses + -Werror=pointer-bool-conversion ) -endif () - -message(STATUS "CMake Version is ${CMAKE_VERSION}") -message(STATUS "Compiler Version is ${CMAKE_CXX_COMPILER_VERSION}") -if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) - message(STATUS "Building in 32 bit configuration") -else () - message(STATUS "Building in 64 bit configuration") -endif () - -if (NOT SURGE_COPY_AFTER_BUILD) - set(SURGE_COPY_AFTER_BUILD False) -else () - message(STATUS "Surge Copy After Build activated") -endif () - -if (SURGE_ALTERNATE_JUCE) - message(STATUS "Using *Alternate* JUCE from ${SURGE_ALTERNATE_JUCE}") - add_subdirectory(${SURGE_ALTERNATE_JUCE} ${CMAKE_BINARY_DIR}/alternate-juce EXCLUDE_FROM_ALL) - set(SURGE_JUCE_LOCATION ${SURGE_ALTERNATE_JUCE}) -else () - message(STATUS "Using JUCE from submodule libs/JUCE") - add_subdirectory(libs/JUCE EXCLUDE_FROM_ALL) - set(SURGE_JUCE_LOCATION ${CMAKE_SOURCE_DIR}/libs/JUCE) -endif () - -if (EXISTS ${SURGE_JUCE_LOCATION}/README.surge) - message(STATUS "Using the SURGE fork of JUCE.") -endif () - -include(cmake/stage-extra-content.cmake) - -add_library(surge-shared) -add_library(surge-tests INTERFACE) - -add_subdirectory(libs/airwindows) -add_subdirectory(libs/catch2) -add_subdirectory(libs/eurorack) -add_subdirectory(libs/filesystem) -add_subdirectory(libs/fmt) -add_subdirectory(libs/tinyxml) -add_subdirectory(libs/oddsound-mts) -if (MINGW) - set(HAVE_VISIBILITY 0 CACHE INTERNAL "Force-disable libsamplerate's visibility check on MinGW") -endif () -add_subdirectory(libs/libsamplerate EXCLUDE_FROM_ALL) -add_subdirectory(libs/tuning-library EXCLUDE_FROM_ALL) -add_subdirectory(libs/sqlite-3.23.3) -add_subdirectory(libs/LuaJitLib) - -juce_add_binary_data(surge-shared-binary - NAMESPACE SurgeSharedBinary - HEADER_NAME SurgeSharedBinary.h - SOURCES - resources/surge-shared/configuration.xml - resources/surge-shared/README_UserArea.txt - resources/surge-shared/memoryWavetable.wt - resources/surge-shared/windows.wt - resources/surge-shared/paramdocumentation.xml - - # I know this looks odd, but (1) its src and (2) I need it at runtime - src/lua/surge_prelude.lua - src/lua/surge_prelude_test.lua - ) - -target_link_libraries(surge-shared PUBLIC - luajit-5.1 - surge::airwindows - surge::eurorack - surge::sqlite - surge::filesystem - surge::tinyxml - surge::oddsound-mts - samplerate - surge-shared-binary - tuning-library - fmt - ) - -# We want to run this once alas, since JUCE needs it even though it is a byproduct of a phase to build the -# JUCE Cmake file list. -set(SURGE_COMPILER_INFO "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}") -execute_process( - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -D PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} -D PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR} - -D SURGESRC=${CMAKE_SOURCE_DIR} -D SURGEBLD=${CMAKE_BINARY_DIR} - -D AZURE_PIPELINE=${AZURE_PIPELINE} - -D WIN32=${WIN32} - -D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -D SURGE_COMPILER_INFO="${SURGE_COMPILER_INFO}" - -P ${CMAKE_SOURCE_DIR}/cmake/versiontools.cmake -) -add_custom_target(git-info BYPRODUCTS ${CMAKE_BINARY_DIR}/geninclude/version.cpp - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -D PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} -D PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR} - -D SURGESRC=${CMAKE_SOURCE_DIR} -D SURGEBLD=${CMAKE_BINARY_DIR} - -D AZURE_PIPELINE=${AZURE_PIPELINE} - -D WIN32=${WIN32} - -D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -D SURGE_COMPILER_INFO="${SURGE_COMPILER_INFO}" - -P ${CMAKE_SOURCE_DIR}/cmake/versiontools.cmake - ) -add_dependencies(surge-shared git-info) - -# Set up external packages -list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/") - -set(BUILD_SURGE_XT TRUE) -set(BUILD_SURGE_EFFECTS_BANK TRUE) -set(BUILD_HEADLESS TRUE) - -# Enumerate the sources into groups -# SURGE_SHARED_SOURCES - these are used to make the synth-free ui-free dsp and param lib -# SURGE_SYNTH_SOURCES - these are the synth classes which are target type dependant -# SURGE_GUI_SOURCES -# SURGE_GUI_LIBRARY_SOURCES -# SURGE_(target)_SOURCES e.g. SURGE_HEADLESS_SOURCES -# SURGE_(target)_LIBRARY_SOURCES e.g. SURGE_VST3_LIBRARY_SOURCES -# SURGE_(os)_SOURCES - -set(SURGE_SHARED_SOURCES - src/common/dsp/effects/BBDEnsembleEffect.cpp - src/common/dsp/effects/ChorusEffectImpl.h - src/common/dsp/effects/CombulatorEffect.cpp - src/common/dsp/effects/ConditionerEffect.cpp - src/common/dsp/effects/DistortionEffect.cpp - src/common/dsp/effects/DelayEffect.cpp - src/common/dsp/effects/FrequencyShifterEffect.cpp - src/common/dsp/effects/FlangerEffect.cpp - src/common/dsp/effects/GraphicEQ11BandEffect.cpp - src/common/dsp/effects/NimbusEffect.cpp - src/common/dsp/effects/ParametricEQ3BandEffect.cpp - src/common/dsp/effects/PhaserEffect.cpp - src/common/dsp/effects/ResonatorEffect.cpp - src/common/dsp/effects/Reverb1Effect.cpp - src/common/dsp/effects/Reverb2Effect.cpp - src/common/dsp/effects/RingModulatorEffect.cpp - src/common/dsp/effects/RotarySpeakerEffect.cpp - src/common/dsp/effects/TreemonsterEffect.cpp - src/common/dsp/effects/VocoderEffect.cpp - src/common/dsp/effects/WaveShaperEffect.cpp - src/common/dsp/effects/airwindows/AirWindowsEffect.cpp - src/common/dsp/effects/airwindows/AirWindowsEffect.h - src/common/dsp/effects/chowdsp/CHOWEffect.cpp - src/common/dsp/effects/chowdsp/ExciterEffect.cpp - src/common/dsp/effects/chowdsp/NeuronEffect.cpp - src/common/dsp/effects/chowdsp/TapeEffect.cpp - src/common/dsp/effects/chowdsp/bbd_utils/BBDDelayLine.cpp - src/common/dsp/effects/chowdsp/exciter/LevelDetector.cpp - src/common/dsp/effects/chowdsp/shared/DelayLine.cpp - src/common/dsp/effects/chowdsp/tape/ChewProcessor.cpp - src/common/dsp/effects/chowdsp/tape/DegradeProcessor.cpp - src/common/dsp/effects/chowdsp/tape/HysteresisProcessing.cpp - src/common/dsp/effects/chowdsp/tape/HysteresisProcessor.cpp - src/common/dsp/effects/chowdsp/tape/LossFilter.cpp - src/common/dsp/effects/chowdsp/tape/ToneControl.cpp - src/common/dsp/filters/AllpassFilter.h - src/common/dsp/filters/BiquadFilter.cpp - src/common/dsp/filters/BiquadFilterSSE2.cpp - src/common/dsp/filters/DiodeLadder.cpp - src/common/dsp/filters/FilterCoefficientMaker.cpp - src/common/dsp/filters/K35Filter.cpp - src/common/dsp/filters/NonlinearFeedback.cpp - src/common/dsp/filters/NonlinearStates.cpp - src/common/dsp/filters/OBXDFilter.cpp - src/common/dsp/filters/ThreelerFilter.cpp - src/common/dsp/filters/VectorizedSVFilter.cpp - src/common/dsp/filters/VintageLadders.cpp - src/common/dsp/oscillators/AliasOscillator.cpp - src/common/dsp/oscillators/AudioInputOscillator.cpp - src/common/dsp/oscillators/ClassicOscillator.cpp - src/common/dsp/oscillators/FM2Oscillator.cpp - src/common/dsp/oscillators/FM3Oscillator.cpp - src/common/dsp/oscillators/ModernOscillator.cpp - src/common/dsp/oscillators/OscillatorBase.h - src/common/dsp/oscillators/OscillatorCommonFunctions.h - src/common/dsp/oscillators/SampleAndHoldOscillator.cpp - src/common/dsp/oscillators/SineOscillator.cpp - src/common/dsp/oscillators/StringOscillator.cpp - src/common/dsp/oscillators/TwistOscillator.cpp - src/common/dsp/oscillators/WavetableOscillator.cpp - src/common/dsp/oscillators/WindowOscillator.cpp - src/common/dsp/modulators/ADSRModulationSource.h - src/common/dsp/modulators/FormulaModulationHelper.cpp - src/common/dsp/modulators/LFOModulationSource.cpp - src/common/dsp/modulators/MSEGModulationHelper.cpp - src/common/dsp/utilities/DSPUtils.cpp - src/common/dsp/utilities/FastMath.h - src/common/dsp/utilities/SSEComplex.h - src/common/dsp/utilities/SSESincDelayLine.h - src/common/dsp/utilities/LanczosResampler.cpp - src/common/dsp/vembertech/basic_dsp.cpp - src/common/dsp/vembertech/halfratefilter.cpp - src/common/dsp/vembertech/lipol.cpp - src/common/dsp/Effect.cpp - src/common/dsp/Oscillator.cpp - src/common/dsp/SurgeVoice.cpp - src/common/dsp/QuadFilterChain.cpp - src/common/dsp/QuadFilterUnit.cpp - src/common/dsp/QuadFilterWaveshapers.cpp - src/common/dsp/SurgeVoiceState.h - src/common/dsp/Wavetable.cpp - src/common/dsp/WavetableScriptEvaluator.cpp - src/common/CPUFeatures.cpp - src/common/DebugHelpers.cpp - src/common/FxPresetAndClipboardManager.cpp - src/common/LuaSupport.cpp - src/common/ModulatorPresetManager.cpp - src/common/Parameter.cpp - src/common/PatchDB.cpp - src/common/SkinModel.cpp - src/common/SkinModelImpl.cpp - src/common/SkinColors.cpp - src/common/SkinFonts.cpp - src/common/SurgePatch.cpp - src/common/SurgeStorage.cpp - src/common/UserDefaults.cpp - src/common/WAVFileSupport.cpp - - libs/strnatcmp/strnatcmp.cpp - ) - -set(SURGE_SYNTH_SOURCES - src/common/SurgeSynthesizer.cpp - src/common/SurgeSynthesizerIO.cpp - ) - -set(SURGE_GENERATED_SOURCES - ${CMAKE_BINARY_DIR}/geninclude/version.cpp - ) - -set(SURGE_GUI_SOURCES - src/gui/SurgeImage.cpp - src/gui/RuntimeFont.cpp - src/gui/SkinFontLoader.cpp - src/gui/SkinImageMaps.h - src/gui/SkinSupport.cpp - src/gui/SurgeImageStore.cpp - src/gui/SurgeGUIEditor.cpp - src/gui/SurgeGUIEditorHtmlGenerators.cpp - src/gui/SurgeGUIEditorInfowindow.cpp - src/gui/SurgeGUIEditorOverlays.cpp - src/gui/SurgeGUIEditorValueCallbacks.cpp - src/gui/SurgeGUIUtils.cpp - src/gui/SurgeJUCELookAndFeel.cpp - src/gui/UIInstrumentation.cpp - - src/gui/overlays/AboutScreen.cpp - src/gui/overlays/CoveringMessageOverlay.cpp - src/gui/overlays/LuaEditors.cpp - src/gui/overlays/MiniEdit.cpp - src/gui/overlays/ModulationEditor.cpp - src/gui/overlays/MSEGEditor.cpp - src/gui/overlays/PatchDBViewer.cpp - src/gui/overlays/TuningOverlays.cpp - src/gui/overlays/TypeinParamEditor.cpp - src/gui/overlays/OverlayWrapper.cpp - src/gui/overlays/PatchStoreDialog.cpp - src/gui/overlays/WaveShaperAnalysis.cpp - - src/gui/widgets/EffectChooser.cpp - src/gui/widgets/LFOAndStepDisplay.cpp - src/gui/widgets/MainFrame.cpp - src/gui/widgets/MenuForDiscreteParams.cpp - src/gui/widgets/MultiSwitch.cpp - src/gui/widgets/ModulationSourceButton.cpp - src/gui/widgets/ModulatableSlider.cpp - src/gui/widgets/MenuCustomComponents.cpp - src/gui/widgets/NumberField.cpp - src/gui/widgets/OscillatorWaveformDisplay.cpp - src/gui/widgets/ParameterInfowindow.cpp - src/gui/widgets/PatchSelector.cpp - src/gui/widgets/Switch.cpp - src/gui/widgets/VerticalLabel.cpp - src/gui/widgets/VuMeter.cpp - src/gui/widgets/WaveShaperSelector.cpp - src/gui/widgets/XMLConfiguredMenus.cpp - ) - -# Includes and Compiler Flags -set(SURGE_COMMON_INCLUDES - libs/ - libs/strnatcmp - - src/common - src/common/dsp - src/common/dsp/effects - src/common/dsp/filters - src/common/dsp/oscillators - src/common/dsp/modulators - src/common/dsp/utilities - src/common/dsp/vembertech - ) - -set(SURGE_GUI_INCLUDES - src/gui - ) - -### OS SPECIFIC SECTION -if (APPLE) - set(SURGE_OS_SOURCES) - - set(SURGE_OS_GUI_SOURCES) - - set(OS_INCLUDE_DIRECTORIES - libs/simde - ) - set(OS_COMPILE_DEFINITIONS - MAC=1 - MAC_COCOA=1 - COCOA=1 - OBJC_OLD_DISPATCH_PROTOTYPES=1 - ) - set(OS_LINK_LIBRARIES_NOGUI - "-framework CoreServices" - "-framework CoreFoundation" - "-framework Foundation" - ) - set(OS_LINK_LIBRARIES - ${OS_LINK_LIBRARIES_NOGUI} - "-framework Accelerate" - "-framework ApplicationServices" - "-framework AudioUnit" - "-framework AudioToolbox" - "-framework Carbon" - "-framework CoreAudio" - "-framework CoreAudioKit" - "-framework CoreServices" - "-framework CoreText" - "-framework Cocoa" - "-framework CoreFoundation" - "-framework OpenGL" - "-framework QuartzCore" - ) - -elseif (UNIX AND NOT APPLE) - set(SURGE_OS_GUI_SOURCES - ) - - find_package(PkgConfig REQUIRED) - if (NOT LINUX_ON_ARM) - # pkg_check_modules(CURL REQUIRED libcurl) - endif () - - if (LINUX_ON_ARM) - set(ARCH_COMPILE_DEFINITIONS ARM_NEON=1 NOCURL=1) - set(ARCH_INCLUDE_DIRECTORIES libs/simde) - endif () - - set(OS_COMPILE_DEFINITIONS - ${ARCH_COMPILE_DEFINITIONS} - LINUX=1 - ) - - set(OS_INCLUDE_DIRECTORIES - ${CMAKE_BINARY_DIR}/lintemp - - ${ARCH_INCLUDE_DIRECTORIES} - ) - - set(OS_LINK_LIBRARIES_NOGUI - pthread - dl - -Wl,--no-undefined - ) - set(OS_LINK_LIBRARIES - ${OS_LINK_LIBRARIES_NOGUI} - ) - - if (CMAKE_SYSTEM_NAME MATCHES "BSD") - set(OS_LINK_LIBRARIES ${OS_LINK_LIBRARIES} execinfo) - endif () - -elseif (WIN32) - - set(SURGE_OS_GUI_SOURCES - ) - - set(OS_COMPILE_DEFINITIONS - WINDOWS=1 - NOMINMAX=1 - WIN32 - _USE_MATH_DEFINES - _WIN32_WINNT=0x0601 - _USRDLL - VA_SUBTRACTIVE_EXPORTS - USE_LIBPNG - _CRT_SECURE_NO_WARNINGS=1 - UNICODE - _UNICODE - ) - - set(OS_INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR}/geninclude - ) - - set(OS_LINK_LIBRARIES_NOGUI - shell32 - user32 - ) # winhttp - - set(OS_LINK_LIBRARIES - ${OS_LINK_LIBRARIES_NOGUI} - winmm - gdi32 - gdiplus - comdlg32 - comctl32 - ) - - if (MINGW) - list(APPEND OS_LINK_LIBRARIES - d2d1 - dwmapi - dwrite - opengl32 - shlwapi - windowscodecs - ) - endif () - -else () - message(FATAL_ERROR "UNKNOWN OS. Please use lin mac or win") -endif () - -# Source Groups -source_group("Libraries" REGULAR_EXPRESSION "libs/") -source_group("AirWindows" REGULAR_EXPRESSION "libs/airwindows/") -source_group("Surge Core" REGULAR_EXPRESSION "src/common/.*\.cpp") -source_group("Surge DSP" REGULAR_EXPRESSION "src/common/dsp") -source_group("Surge FX" REGULAR_EXPRESSION "src/common/dsp/effects") -source_group("Surge GUI" REGULAR_EXPRESSION "src/gui") -source_group("Generated Code" REGULAR_EXPRESSION "version.cpp") -source_group("AU Plugin" REGULAR_EXPRESSION "src/au") -source_group("Headless" REGULAR_EXPRESSION "src/headless") -source_group("Surge XT Juce" REGULAR_EXPRESSION "src/surge_synth_juce") -source_group("Surge FX Juce" REGULAR_EXPRESSION "src/surge_effects_bank") - -# -# SURGE Core -# - -target_sources(surge-shared PRIVATE ${SURGE_SHARED_SOURCES} ${SURGE_SYNTH_SOURCES} ${SURGE_OS_SHARED_SOURCES}) -target_include_directories(surge-shared - PRIVATE - ${SURGE_COMMON_INCLUDES} - ${OS_INCLUDE_DIRECTORIES} - ) -target_compile_definitions(surge-shared PUBLIC ${OS_COMPILE_DEFINITIONS}) - -if (BUILD_HEADLESS) - add_executable(surge-headless - ${SURGE_OS_SOURCES} - ${SURGE_GENERATED_SOURCES} - src/headless/main.cpp - src/headless/HeadlessUtils.cpp - src/headless/Player.cpp - src/headless/UnitTests.cpp - src/headless/UnitTestUtilities.cpp - src/headless/UnitTestsDSP.cpp - src/headless/UnitTestsFLT.cpp - src/headless/UnitTestsFX.cpp - src/headless/UnitTestsINFRA.cpp - src/headless/UnitTestsIO.cpp - src/headless/UnitTestsMIDI.cpp - src/headless/UnitTestsMOD.cpp - src/headless/UnitTestsMSEG.cpp - src/headless/UnitTestsPARAM.cpp - src/headless/UnitTestsTUN.cpp - src/headless/UnitTestsLUA.cpp - src/headless/HeadlessNonTestFunctions.cpp - src/headless/HeadlessNonTestFunctions.h) - - target_compile_definitions(surge-headless - PRIVATE - ${OS_COMPILE_DEFINITIONS} - $,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1 - ) - - target_include_directories(surge-headless - PRIVATE - ${SURGE_COMMON_INCLUDES} - ${OS_INCLUDE_DIRECTORIES} - src/headless - ) - - # Temporarily disable libsndfile which we don't use anyway, but we don't have a link for on arm - # find_package(LibSndFile ${PACKAGE_OPTION}) - if (NOT LIBSNDFILE_FOUND) - #message("-- LibSndFile not installed; building without wav support") - #message("-- You can 'brew install libsndfile' or 'apt-get install libsndfile1-dev'") - else () - target_compile_definitions(surge-headless - PRIVATE - LIBSNDFILE=1 - ) - target_link_libraries(surge-headless PRIVATE ${LIBSNDFILE_LIBRARIES}) - target_include_directories(surge-headless PRIVATE ${LIBSNDFILE_INCLUDE_DIRS}) - endif () - - target_link_libraries(surge-headless - PRIVATE - surge-shared - surge-tests - surge::catch2 - ${OS_LINK_LIBRARIES_NOGUI} - ) - - if (UNIX AND NOT APPLE) - find_package(Threads REQUIRED) - target_link_libraries(surge-headless - PRIVATE - Threads::Threads - ) - - if (CMAKE_SYSTEM_NAME MATCHES "BSD") - target_link_libraries(surge-headless PRIVATE execinfo) - endif () - endif () -endif () - -if (DEFINED ENV{VST2SDK_DIR}) - file(TO_CMAKE_PATH "$ENV{VST2SDK_DIR}" JUCE_VST2_DIR) - juce_set_vst2_sdk_path(${JUCE_VST2_DIR}) - set(SURGE_JUCE_FORMATS AU VST3 VST Standalone) - message(STATUS "JUCE VST2 SDK Path is $ENV{VST2SDK_DIR}") - # VST2 headers are invalid UTF-8 - add_compile_options($<$:/wd4828>) -else () - set(SURGE_JUCE_FORMATS AU VST3 Standalone) -endif () - -if (SURGE_XT_BUILD_AUV3) - list(APPEND SURGE_JUCE_FORMATS AUv3) -endif () - -if (JUCE_SUPPORTS_LV2) - list(APPEND SURGE_JUCE_FORMATS LV2) - message(STATUS "Including JUCE LV2 support. You will need a different JUCE than the submodule") - message(STATUS "Turning off deprecation warning to error since JUCE LV2 uses deprecated APIs") + if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$") + # Apple Clang only + add_compile_options( + -fasm-blocks + ) + endif() + elseif(CMAKE_CXX_COMPILER_ID MATCHES "^GNU$") + # GCC only add_compile_options( - -Wno-error=deprecated-declarations - ) -endif () - -set(SURGE_JUCE_ACCESSIBLE FALSE) -if (EXISTS ${SURGE_JUCE_LOCATION}/modules/juce_gui_basics/accessibility/juce_AccessibilityHandler.h) - set(SURGE_JUCE_ACCESSIBLE TRUE) - message(STATUS "Including JUCE Accessibility Support") -else () - message(STATUS "No JUCE Accessibility Support in this version") -endif () - -set(SURGE_JUCE_HOST_CONTEXT FALSE) -if (EXISTS ${SURGE_JUCE_LOCATION}/modules/juce_audio_processors/processors/juce_AudioProcessorEditorHostContext.h) - set(SURGE_JUCE_HOST_CONTEXT TRUE) - message(STATUS "Including JUCE Host Context Support") -else () - message(STATUS "No JUCE Host Context Support in this version") -endif () - -set(SURGE_JUCE_VST3_EXTENSIONS FALSE) -if (EXISTS ${SURGE_JUCE_LOCATION}/modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h) - set(SURGE_JUCE_VST3_EXTENSIONS TRUE) - message(STATUS "Including JUCE VST3 Client Extensions") -else () - message(STATUS "No JUCE VST3 Client Extensions") -endif () - - -set(JUCE_ASIO_SUPPORT FALSE) -if (BUILD_USING_MY_ASIO_LICENSE) - message(STATUS "** BUILD WITH YOUR ASIO LICENSE **") - message(STATUS " Downloading ASIO SDK from Steinberg") - message(STATUS " The resulting Surge Standalones are not licensed for distribution") - - add_custom_target(surge-get-local-asio) - add_custom_command( - TARGET surge-get-local-asio - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/asio - COMMAND ${CMAKE_COMMAND} -D ASIO_SDK_DESTINATION=${CMAKE_BINARY_DIR}/asio -P cmake/get-asio.cmake - ) - set(ASIOSDK_DIR ${CMAKE_BINARY_DIR}/asio/asiosdk) - set(JUCE_ASIO_SUPPORT TRUE) - add_dependencies(surge-shared surge-get-local-asio) -endif () - -message(STATUS "Building Surge JUCE as ${SURGE_JUCE_FORMATS}") -if (DEFINED ENV{ASIOSDK_DIR}) - file(TO_CMAKE_PATH "$ENV{ASIOSDK_DIR}" ASIOSDK_DIR) - message(STATUS "ASIO SDK found at ${ASIOSDK_DIR}") - set(JUCE_ASIO_SUPPORT TRUE) -endif () - - -set(SURGE_PRODUCT_DIR ${CMAKE_BINARY_DIR}/surge_xt_products) -file(MAKE_DIRECTORY ${SURGE_PRODUCT_DIR}) -add_custom_target(surge-staged-assets) - -if (BUILD_SURGE_EFFECTS_BANK) - - if (WIN32 AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(SURGE_FX_PRODUCT_NAME "Surge XT Effects (32-bit)") - else () - set(SURGE_FX_PRODUCT_NAME "Surge XT Effects") - endif () - - juce_add_plugin(surge-fx - PRODUCT_NAME ${SURGE_FX_PRODUCT_NAME} - COMPANY_NAME "Surge Synth Team" - COMPANY_WEBSITE "https://surge-synth-team.org/" - BUNDLE_ID "org.surge-synth-team.surge-xt-fx" - PLUGIN_MANUFACTURER_CODE VmbA - PLUGIN_CODE SFXT - - ICON_BIG "resources/surge_effects_bank/SurgeFXLogo.png" - - IS_SYNTH FALSE - NEEDS_MIDI_INPUT FALSE - NEEDS_MIDI_OUTPUT FALSE - IS_MIDI_EFFECT FALSE - - COPY_PLUGIN_AFTER_BUILD ${SURGE_COPY_AFTER_BUILD} - - VST3_CATEGORIES Fx - VST2_CATEGORY kPlugCategEffect - AU_MAIN_TYPE kAudioUnitType_Effect - - LV2_URI https://surge-synthesizer.github.io/lv2/surge-xt-fx - LV2_SHARED_LIBRARY_NAME SurgeXT_FX - - FORMATS ${SURGE_JUCE_FORMATS} - ) - - file(GLOB SURGE_FX_BANK_RESOURCES_GLOB - resources/surge_effects_bank/*.svg - resources/surge_effects_bank/icons/*.svg - ) - - juce_add_binary_data(surge-fx-binary - SOURCES ${SURGE_FX_BANK_RESOURCES_GLOB} - ) - set_target_properties(surge-fx-binary PROPERTIES - POSITION_INDEPENDENT_CODE TRUE - ) - - target_compile_definitions(surge-fx PUBLIC - JUCE_ALLOW_STATIC_NULL_VARIABLES=0 - JUCE_STRICT_REFCOUNTEDPOINTER=1 - - JUCE_VST3_CAN_REPLACE_VST2=0 - JUCE_USE_CURL=0 - JUCE_WEB_BROWSER=0 - JUCE_USE_CAMERA=disabled - - JUCE_DISPLAY_SPLASH_SCREEN=0 - JUCE_REPORT_APP_USAGE=0 - - JUCE_MODAL_LOOPS_PERMITTED=0 - - JUCE_COREGRAPHICS_DRAW_ASYNC=1 - - JUCE_ALSA=1 - JUCE_JACK=1 - - JUCE_WASAPI=1 - JUCE_DIRECTSOUND=1 - ) - - if (JUCE_ASIO_SUPPORT) - target_compile_definitions(surge-fx PUBLIC - JUCE_ASIO=1 - ) - endif () - - target_sources(surge-fx PRIVATE - src/surge_effects_bank/SurgeFXEditor.cpp - src/surge_effects_bank/SurgeFXProcessor.cpp - src/surge_effects_bank/SurgeLookAndFeel.h - ${SURGE_GENERATED_SOURCES} - ${SURGE_OS_SOURCES} - ) - - target_link_libraries(surge-fx PRIVATE - surge::airwindows - surge::filesystem - surge::tinyxml - - surge-shared - surge-fx-binary - - juce::juce_audio_utils - juce::juce_audio_processors - ) - - target_include_directories(surge-fx PRIVATE - src/surge_effects_bank - ${SURGE_COMMON_INCLUDES} - ${OS_INCLUDE_DIRECTORIES} - ) - - if (JUCE_ASIO_SUPPORT) - target_include_directories(surge-fx PRIVATE - ${ASIOSDK_DIR}/common - ) - endif () - - target_compile_definitions(surge-fx PRIVATE ${OS_COMPILE_DEFINITIONS}) - - get_target_property(SURGE_FX_OUTPUT_DIR surge-fx RUNTIME_OUTPUT_DIRECTORY) - - add_custom_target(Surge-Effects-Bank-Packaged ALL) - add_dependencies(Surge-Effects-Bank-Packaged surge-fx_All) - add_dependencies(Surge-Effects-Bank-Packaged surge-fx_VST3) - add_dependencies(Surge-Effects-Bank-Packaged surge-fx_Standalone) - - add_custom_command( - TARGET Surge-Effects-Bank-Packaged - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Re-locating VST3 and Standalone components" - COMMAND ${CMAKE_COMMAND} -E copy_directory ${SURGE_FX_OUTPUT_DIR}/VST3 ${SURGE_PRODUCT_DIR}/ - COMMAND ${CMAKE_COMMAND} -E copy_directory ${SURGE_FX_OUTPUT_DIR}/Standalone ${SURGE_PRODUCT_DIR}/ + -Wformat-truncation=0 # squelch warning about snprintf truncating strings (see PR #3977) + -Wno-free-nonheap-object # https://github.com/surge-synthesizer/surge/issues/4251 + -Wno-return-local-addr # squelch sqlite3 error: function may return address of local variable ) - - if (APPLE) - add_dependencies(Surge-Effects-Bank-Packaged surge-fx_AU) - - add_custom_command( - TARGET Surge-Effects-Bank-Packaged - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Re-locating AU components" - COMMAND ${CMAKE_COMMAND} -E copy_directory ${SURGE_FX_OUTPUT_DIR}/AU ${SURGE_PRODUCT_DIR}/ - ) - endif () - - add_dependencies(surge-staged-assets Surge-Effects-Bank-Packaged) -endif () # build surge effects bank - -if (BUILD_SURGE_XT) - - if (WIN32 AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(SURGE_XT_PRODUCT_NAME "Surge XT (32-bit)") - else () - set(SURGE_XT_PRODUCT_NAME "Surge XT") - endif () - - juce_add_plugin(surge-xt - PRODUCT_NAME ${SURGE_XT_PRODUCT_NAME} - COMPANY_NAME "Surge Synth Team" - COMPANY_WEBSITE "https://surge-synth-team.org/" - BUNDLE_ID "org.surge-synth-team.surge-xt" - PLUGIN_MANUFACTURER_CODE VmbA - PLUGIN_CODE SgXT - - ICON_BIG "resources/surge-xt/SurgeLogo.png" - - IS_SYNTH TRUE - NEEDS_MIDI_INPUT TRUE - NEEDS_MIDI_OUTPUT FALSE - IS_MIDI_EFFECT FALSE - - COPY_PLUGIN_AFTER_BUILD ${SURGE_COPY_AFTER_BUILD} - - VST3_CATEGORIES Instrument Synth - VST2_CATEGORY kPlugCategSynth - AU_MAIN_TYPE kAudioUnitType_MusicDevice - - LV2_URI https://surge-synthesizer.github.io/lv2/surge-xt - LV2_SHARED_LIBRARY_NAME SurgeXT - - FORMATS ${SURGE_JUCE_FORMATS} - ) - - file(GLOB SURGE_SYNTH_JUCE_RESOURCES_GLOB - resources/classic-skin-svgs/*.svg - resources/fonts/Lato*ttf - resources/fonts/IndieFlower.ttf - resources/fonts/FiraMono-Regular.ttf - resources/surge-xt/memory-skin.xml - ) - - juce_add_binary_data(surge-xt-binary - NAMESPACE SurgeXTBinary - HEADER_NAME SurgeXTBinary.h - - SOURCES ${SURGE_SYNTH_JUCE_RESOURCES_GLOB} - ) - set_target_properties(surge-xt-binary PROPERTIES - POSITION_INDEPENDENT_CODE TRUE - ) - - if (${SURGE_JUCE_ACCESSIBLE}) - set(SURGE_JUCE_ACCESSIBLE_DEFINE 1) - else () - set(SURGE_JUCE_ACCESSIBLE_DEFINE 0) - endif () - - if (${SURGE_JUCE_HOST_CONTEXT}) - set(SURGE_JUCE_HOST_CONTEXT_DEFINE 1) - else () - set(SURGE_JUCE_HOST_CONTEXT_DEFINE 0) - endif () - - if (${SURGE_JUCE_VST3_EXTENSIONS}) - set(SURGE_JUCE_VST3_EXTENSIONS 1) - else () - set(SURGE_JUCE_VST3_EXTENSIONS 0) - endif () - - - target_compile_definitions(surge-xt PUBLIC - JUCE_ALLOW_STATIC_NULL_VARIABLES=0 - JUCE_STRICT_REFCOUNTEDPOINTER=1 - - JUCE_VST3_CAN_REPLACE_VST2=0 - JUCE_USE_CURL=0 - JUCE_WEB_BROWSER=0 - JUCE_USE_CAMERA=disabled - - JUCE_DISPLAY_SPLASH_SCREEN=0 - JUCE_REPORT_APP_USAGE=0 - - JUCE_MODAL_LOOPS_PERMITTED=0 - - JUCE_COREGRAPHICS_DRAW_ASYNC=1 - - JUCE_ALSA=1 - JUCE_JACK=1 - - JUCE_WASAPI=1 - JUCE_DIRECTSOUND=1 - - JUCE_CATCH_UNHANDLED_EXCEPTIONS=$,1,0> - - SURGE_JUCE_ACCESSIBLE=${SURGE_JUCE_ACCESSIBLE_DEFINE} - SURGE_JUCE_HOST_CONTEXT=${SURGE_JUCE_HOST_CONTEXT_DEFINE} - SURGE_JUCE_VST3_EXTENSIONS=${SURGE_JUCE_VST3_EXTENSIONS} - - $,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1 - ) - - if (JUCE_ASIO_SUPPORT) - target_compile_definitions(surge-xt PUBLIC - JUCE_ASIO=1 - ) - endif () - - set(SURGE_SYNTH_JUCE_GUI_SOURCES - ${SURGE_GUI_SOURCES} - ) - - target_sources(surge-xt PRIVATE - src/surge_synth_juce/SurgeSynthEditor.cpp - src/surge_synth_juce/SurgeSynthProcessor.cpp - ${SURGE_GENERATED_SOURCES} - ${SURGE_OS_SOURCES} - - ${SURGE_SYNTH_JUCE_GUI_SOURCES} - ) - - target_sources(surge-xt_VST3 PRIVATE - src/surge_synth_juce/SurgeSynthVST3Extensions.cpp - ) - - target_sources(surge-xt_Standalone PRIVATE - src/surge_synth_juce/SurgeSynthStandaloneExtensions.cpp - ) - - if (JUCE_SUPPORTS_LV2) - target_sources(surge-xt_LV2 PRIVATE - src/surge_synth_juce/SurgeSynthLV2Extensions.cpp - ) - endif () - if (DEFINED ENV{VST2SDK_DIR}) - target_sources(surge-xt_VST PRIVATE - src/surge_synth_juce/SurgeSynthVST2Extensions.cpp - ) - endif () - - if (APPLE) - target_sources(surge-xt_AU PRIVATE - src/surge_synth_juce/SurgeSynthAUExtensions.cpp - ) - if (TARGET surge-xt_AUv3) - target_sources(surge-xt_AUv3 PRIVATE - src/surge_synth_juce/SurgeSynthAUv3Extensions.cpp - ) - endif () - endif () - - target_link_libraries(surge-xt PRIVATE - surge::airwindows - surge::filesystem - surge::tinyxml - - surge-shared - - juce::juce_audio_utils - juce::juce_audio_processors - juce::juce_audio_plugin_client - - surge-xt-binary - ) - - target_include_directories(surge-xt PUBLIC - src/surge_synth_juce - src/headless - ${SURGE_COMMON_INCLUDES} - ${SURGE_GUI_INCLUDES} - ${OS_INCLUDE_DIRECTORIES} - ) - - if (JUCE_ASIO_SUPPORT) - target_include_directories(surge-xt PUBLIC - ${ASIOSDK_DIR}/common - ) - endif () - - get_target_property(SURGE_XT_OUTPUT_DIR surge-xt RUNTIME_OUTPUT_DIRECTORY) - - # Really just a little convnience for BP on lin and win - add_custom_target(surge-xt-run-standalone) - add_dependencies(surge-xt-run-standalone surge-xt_Standalone) - add_custom_command(TARGET surge-xt-run-standalone - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND "${SURGE_XT_OUTPUT_DIR}/Standalone/Surge XT") - - add_custom_target(Surge-XT-Packaged ALL) - add_dependencies(Surge-XT-Packaged surge-xt_All) - add_dependencies(Surge-XT-Packaged surge-xt_VST3) - add_dependencies(Surge-XT-Packaged surge-xt_Standalone) - - add_custom_command( - TARGET Surge-XT-Packaged - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Re-locating VST3 and Standalone components" - COMMAND ${CMAKE_COMMAND} -E copy_directory ${SURGE_XT_OUTPUT_DIR}/VST3 ${SURGE_PRODUCT_DIR}/ - COMMAND ${CMAKE_COMMAND} -E copy_directory ${SURGE_XT_OUTPUT_DIR}/Standalone ${SURGE_PRODUCT_DIR}/ - ) - - if (APPLE) - add_dependencies(Surge-XT-Packaged surge-xt_AU) - - add_custom_command( - TARGET Surge-XT-Packaged - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Re-locating AU components" - COMMAND ${CMAKE_COMMAND} -E copy_directory ${SURGE_XT_OUTPUT_DIR}/AU ${SURGE_PRODUCT_DIR}/ - ) - endif () - add_dependencies(surge-staged-assets Surge-XT-Packaged) -endif () - -add_custom_target(surge-staged-nonbuilt-assets) -add_custom_command(TARGET surge-staged-nonbuilt-assets - POST_BUILD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/resources/surge-xt/README.txt ${SURGE_PRODUCT_DIR} - ) -add_dependencies(surge-staged-assets surge-staged-nonbuilt-assets) - -add_custom_target(surge-xt-distribution) -add_dependencies(surge-xt-distribution surge-staged-assets) - -if (DEFINED ENV{SURGE_VERSION}) - set(SXTVER $ENV{SURGE_VERSION}) -else () - set(SXTVER "LOCAL") -endif () - -if (APPLE) - set(SXTOS "macOS") -elseif (UNIX) - set(SXTOS "linux") -else () - if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(SXTOS "win32") - else () - set(SXTOS "win64") - endif () -endif () - -set(SURGE_XT_DIST_OUTPUT_DIR surge-xt-dist) -set(SURGE_XT_DIST_TARGET_BASE surge-xt-alpha-${SXTVER}-${SXTOS}) - -add_custom_command(TARGET surge-xt-distribution - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_TARGET_BASE} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${SURGE_PRODUCT_DIR}/ ${SURGE_XT_DIST_TARGET_BASE} - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR} - ) - -if (WIN32) - # Windows gets the zips but only windows - add_custom_command(TARGET surge-xt-distribution - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E tar cvf ${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}/surge-xt-${SXTOS}-${SXTVER}-vst3-standalone-only-no-content.zip --format=zip ${SURGE_XT_DIST_TARGET_BASE} - ) -endif () - -# Build OS specific installers -if (APPLE) - add_custom_command(TARGET surge-xt-distribution - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_SOURCE_DIR}/installer_mac/make_installer.sh "${SURGE_PRODUCT_DIR}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" "${SXTVER}" - COMMAND ${CMAKE_SOURCE_DIR}/scripts/installer_mac/make_installer.sh "${SURGE_PRODUCT_DIR}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" "${SXTVER}" - ) -endif () - -if (UNIX AND NOT APPLE) - add_custom_command(TARGET surge-xt-distribution - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_SOURCE_DIR}/installer_linux/make_deb.sh "${SURGE_PRODUCT_DIR}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" "${SXTVER}" - COMMAND ${CMAKE_SOURCE_DIR}/scripts/installer_linux/make_deb.sh "${SURGE_PRODUCT_DIR}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" "${SXTVER}" - ) - - add_custom_target(surge-xt-rpm) - add_dependencies(surge-xt-rpm surge-staged-assets) - - add_custom_command(TARGET surge-xt-rpm - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_SOURCE_DIR}/installer_linux/make_rpm.sh "${SURGE_PRODUCT_DIR}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" "${SXTVER}" - COMMAND ${CMAKE_SOURCE_DIR}/scripts/installer_linux/make_rpm.sh "${SURGE_PRODUCT_DIR}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" "${SXTVER}" - ) -endif () - -if (WIN32) - find_program(SURGE_NUGET_EXE nuget.exe PATHS ENV "PATH") - if (NOT SURGE_NUGET_EXE) - message(STATUS "Cant find NUGET; cmake won't make an installer image with inno") - else () - message(STATUS "Using NUGET from ${SURGE_NUGET_EXE}") - if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) - add_custom_command(TARGET surge-xt-distribution - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND ${SURGE_NUGET_EXE} install Tools.InnoSetup -version 6.1.2 - COMMAND ${CMAKE_COMMAND} -E echo Tools.InnoSetup.6.1.2/tools/iscc.exe /DSURGE_SRC="${CMAKE_SOURCE_DIR}" /DSURGE_BIN="${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/scripts/installer_win/surge.iss" - COMMAND Tools.InnoSetup.6.1.2/tools/iscc.exe /O"${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" /DSURGE_SRC="${CMAKE_SOURCE_DIR}" /DSURGE_BIN="${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/scripts/installer_win/surge-x86.iss" - ) - else () - add_custom_command(TARGET surge-xt-distribution - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND ${SURGE_NUGET_EXE} install Tools.InnoSetup -version 6.1.2 - COMMAND ${CMAKE_COMMAND} -E echo Tools.InnoSetup.6.1.2/tools/iscc.exe /DSURGE_SRC="${CMAKE_SOURCE_DIR}" /DSURGE_BIN="${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/scripts/installer_win/surge.iss" - COMMAND Tools.InnoSetup.6.1.2/tools/iscc.exe /O"${CMAKE_BINARY_DIR}/${SURGE_XT_DIST_OUTPUT_DIR}" /DSURGE_SRC="${CMAKE_SOURCE_DIR}" /DSURGE_BIN="${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/scripts/installer_win/surge.iss" - ) - endif () - endif () -endif () - -# Add CMake Install rules for LINUX only right now (mac and win use an installer) -if (UNIX AND NOT APPLE) - if (BUILD_SURGE_XT) - install(TARGETS surge-xt_Standalone DESTINATION bin) - # Alas you would think you could just say - # install(TARGETS surge-xt_VST3 DESTINATION lib/vst3 ) - # but you can't because surge-xt_VST3 points to the .so inside the VST3 bundle so instead say - install(DIRECTORY "${SURGE_XT_OUTPUT_DIR}/VST3/Surge XT.vst3" DESTINATION lib/vst3) - if (JUCE_SUPPORTS_LV2) - install(DIRECTORY "${SURGE_XT_OUTPUT_DIR}/LV2/Surge XT.lv2" DESTINATION lib/lv2) - endif () - endif () - if (BUILD_SURGE_EFFECTS_BANK) - install(TARGETS surge-fx_Standalone DESTINATION bin) - # and again - # install(TARGETS surge-fx_VST3 DESTINATION lib/vst3 ) - install(DIRECTORY "${SURGE_FX_OUTPUT_DIR}/VST3/Surge XT Effects.vst3" DESTINATION lib/vst3) - - if (JUCE_SUPPORTS_LV2) - install(DIRECTORY "${SURGE_FX_OUTPUT_DIR}/LV2/Surge XT Effects.lv2" DESTINATION lib/lv2) - endif () - endif () - install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources/data/ DESTINATION share/surge-xt) -endif () - -if (APPLE) - message(STATUS "Validate me! Please!") - add_custom_target(stage-pluginval) - add_custom_command(TARGET stage-pluginval - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND cmake -E make_directory pluginval - COMMAND curl -L "https://github.com/Tracktion/pluginval/releases/download/latest_release/pluginval_macOS.zip" -o pluginval/pluginval.zip - COMMAND cd pluginval && unzip -o pluginval.zip - ) - add_custom_target(surge-xt-pluginval-vst3) - add_dependencies(surge-xt-pluginval-vst3 surge-xt_VST3) - add_dependencies(surge-xt-pluginval-vst3 stage-pluginval) - add_custom_command(TARGET surge-xt-pluginval-vst3 - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_FX_OUTPUT_DIR}/VST3/Surge XT.vst3" || exit 1 - ) - - add_custom_target(surge-xt-pluginval-au) - add_dependencies(surge-xt-pluginval-au surge-xt_AU) - add_dependencies(surge-xt-pluginval-au stage-pluginval) - add_custom_command(TARGET surge-xt-pluginval-au - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_XT_OUTPUT_DIR}/AU/Surge XT.component" || exit 1 - ) - - add_custom_target(surge-fx-pluginval-vst3) - add_dependencies(surge-fx-pluginval-vst3 surge-fx_VST3) - add_dependencies(surge-fx-pluginval-vst3 stage-pluginval) - add_custom_command(TARGET surge-fx-pluginval-vst3 - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_FX_OUTPUT_DIR}/VST3/${SURGE_FX_PRODUCT_NAME}.vst3" || exit 1 - ) - - add_custom_target(surge-fx-pluginval-au) - add_dependencies(surge-fx-pluginval-au surge-fx_AU) - add_dependencies(surge-fx-pluginval-au stage-pluginval) - add_custom_command(TARGET surge-fx-pluginval-au - POST_BUILD - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_FX_OUTPUT_DIR}/AU/${SURGE_FX_PRODUCT_NAME}.component" || exit 1 - ) - - -endif () - -if (${BUILD_SURGE_PYTHON_BINDINGS}) - message(STATUS "Building Surge Python bindings with pybind11") - add_subdirectory(libs/pybind11) - set(PYSRCD src/python_bindings) - set(PYSRC) - pybind11_add_module(surgepy) - - target_sources(surgepy PRIVATE - ${SURGE_OS_SOURCES} - ${SURGE_GENERATED_SOURCES} - - ${PYSRCD}/surgepy.cpp - src/headless/HeadlessUtils.cpp - ) - - target_compile_definitions(surgepy - PRIVATE - ${OS_COMPILE_DEFINITIONS} - $,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1 - ) - - target_include_directories(surgepy - PRIVATE - ${SURGE_COMMON_INCLUDES} - ${OS_INCLUDE_DIRECTORIES} - src/headless - ${PYSRCD} - ) - - target_link_libraries(surgepy - PRIVATE - surge-shared - ${OS_LINK_LIBRARIES_NOGUI} - ) - - if (UNIX AND NOT APPLE) - message(STATUS "Manually adding ${PYTHON_LIBRARIES} to surgepy target") - find_package(Threads REQUIRED) - target_link_libraries(surgepy - PRIVATE - Threads::Threads - ${PYTHON_LIBRARIES} - ) - - if (CMAKE_SYSTEM_NAME MATCHES "BSD") - target_link_libraries(surgepy PRIVATE execinfo) - endif () - endif () -else () - message(STATUS "Python bindings disabled") -endif () - -# This is the custom target for the CI pipeline -add_custom_target(ci-pull-req) -add_dependencies(ci-pull-req surge-xt_All) -add_dependencies(ci-pull-req surge-fx_All) - - -# -# INSTALL RULES - currently implemented on APPLE and LINUX only -# -if (APPLE) - add_custom_target(install-resources-local) - add_custom_command( - TARGET install-resources-local - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Installing local resources" - COMMAND rsync -r --delete "resources/data/" "$ENV{HOME}/Library/Application Support/Surge XT/" - ) - - add_custom_target(install-resources-global) - add_custom_command( - TARGET install-resources-global - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Installing global resources" - COMMAND rsync -r --delete "resources/data/" "/Library/Application Support/Surge XT/" - ) - -elseif (UNIX AND NOT APPLE) - add_custom_target(install-resources-local) - add_custom_command( - TARGET install-resources-local - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Installing local resources into ~/.local/share/surge-xt" - COMMAND ${CMAKE_COMMAND} -E make_directory "$ENV{HOME}/.local/share/surge-xt/" - COMMAND rsync -r --delete "resources/data/" "$ENV{HOME}/.local/share/surge-xt/" - ) - - add_custom_target(install-resources-global) - add_custom_command( - TARGET install-resources-global - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND echo "Installing local resources into ${CMAKE_INSTALL_PREFIX}/share/surge-xt" - COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_INSTALL_PREFIX}/share/surge-xt" - COMMAND rsync -r --delete "resources/data/" "${CMAKE_INSTALL_PREFIX}/share/surge-xt/" - ) -endif () - + endif() +endif() + +if(MSVC) + add_compile_options( + -WX # treat all warnings as errors + + # MSVC-only warnings, Clang-cl silently ignores these + /wd4244 # float to double + /wd4305 # truncation of variable + /wd4267 # int and size_t + /wd4018 # signed unsigned mismatch + /wd4388 # signed unsigned mismatch in comparison + /wd4065 # standalone default in a switch with no case + /wd4702 # unreachable code. I generally do if( a ) return foo else return bar; return nullptr so don't warn on that + + # Clang-cl-only warnings + $<$:-Wno-microsoft-exception-spec> + $<$:-Wno-pragma-pack> + + /Zc:alignedNew + /bigobj + + # /arch:AVX + + # Build with Multiple Processes (Clang-cl builds use Ninja instead) + $<$:/MP> + # Set source and executable charsets to UTF-8 + $<$:/utf-8> + ) +endif() +# }}} +# Source Groups {{{ +source_group( "Libraries" REGULAR_EXPRESSION "libs/" ) +source_group( "AirWindows" REGULAR_EXPRESSION "libs/airwindows/" ) +source_group( "Surge Core" REGULAR_EXPRESSION "src/common/.*\.cpp" ) +source_group( "Surge DSP" REGULAR_EXPRESSION "src/common/dsp" ) +source_group( "Surge FX" REGULAR_EXPRESSION "src/common/dsp/effects" ) +source_group( "Surge GUI" REGULAR_EXPRESSION "src/gui" ) +source_group( "Generated Code" REGULAR_EXPRESSION "version.cpp" ) +source_group( "Headless" REGULAR_EXPRESSION "src/headless" ) +source_group( "Surge XT Juce" REGULAR_EXPRESSION "src/surge_synth_juce" ) +source_group( "Surge FX Juce" REGULAR_EXPRESSION "src/surge_effects_bank" ) +# }}} + +add_subdirectory(resources) +add_subdirectory(src) + +# CI Pipeline {{{ +include(cmake/stage-extra-content.cmake) # We have a special target here which the PR pipeline uses to make sure things # are of the appropriate code quality. This allows us to write CMAKE rules which @@ -1380,17 +162,18 @@ add_custom_target(code-quality-pipeline-checks) # Check 1: The extra content is properly specified. add_dependencies(code-quality-pipeline-checks download-extra-content) -# Coming in 1.9: CLang Format checks and others +# Clang Format checks set(CLANG_FORMAT_DIRS src) set(CLANG_FORMAT_EXTS cpp h) foreach (dir ${CLANG_FORMAT_DIRS}) - foreach (ext ${CLANG_FORMAT_EXTS}) - list(APPEND CLANG_FORMAT_GLOBS "':(glob)${dir}/**/*.${ext}'") - endforeach () + foreach (ext ${CLANG_FORMAT_EXTS}) + list(APPEND CLANG_FORMAT_GLOBS "':(glob)${dir}/**/*.${ext}'") + endforeach () endforeach () add_custom_command(TARGET code-quality-pipeline-checks - POST_BUILD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E echo About to check clang-format - COMMAND git ls-files -- ${CLANG_FORMAT_GLOBS} | xargs clang-format --dry-run --Werror - ) + POST_BUILD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E echo About to check clang-format + COMMAND git ls-files -- ${CLANG_FORMAT_GLOBS} | xargs clang-format --dry-run --Werror +) +# }}} diff --git a/README.md b/README.md index 93b30a488eb..b33c516f37b 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ git clone --branch lv2 https://github.com/lv2-porting-project/JUCE JUCE-lv2 then run a fresh CMake to (1) point to that JUCE fork and (2) activate LV2 ``` -cmake -Bbuild_lv2 -DCMAKE_BUILD_TYPE=Release -DJUCE_SUPPORTS_LV2=True -DSURGE_ALTERNATE_JUCE=/some/location/JUCE-lv2/ +cmake -Bbuild_lv2 -DCMAKE_BUILD_TYPE=Release -DJUCE_SUPPORTS_LV2=True -DSURGE_JUCE_PATH=/some/location/JUCE-lv2/ cmake --build build_lv2 --config Release --target surge-xt_LV2 --parallel 4 cmake --build build_lv2 --config Release --target surge-fx_LV2 --parallel 4 ``` diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1fabf247799..b7455bbf4f1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,6 +12,8 @@ pr: jobs: - job: Build + variables: + defaultTargets: "surge-xt_Packaged surge-fx_Packaged" strategy: matrix: macOS-unit-test: @@ -27,7 +29,7 @@ jobs: isMac: True isMacFat: True cmakeArguments: "-GXcode -DCMAKE_BUILD_TYPE=Debug -D\"CMAKE_OSX_ARCHITECTURES=x86_64\"" - cmakeTarget: "ci-pull-req" + cmakeTarget: $(defaultTargets) cmakeConfig: "Debug" xcodePath: "/Applications/Xcode_12.2.app" macOS-arm: @@ -35,7 +37,7 @@ jobs: isMac: True isMacFat: True cmakeArguments: "-GXcode -DCMAKE_BUILD_TYPE=Debug -D\"CMAKE_OSX_ARCHITECTURES=arm64\"" - cmakeTarget: "ci-pull-req" + cmakeTarget: $(defaultTargets) cmakeConfig: "Debug" xcodePath: "/Applications/Xcode_12.2.app" windows-x64: @@ -43,13 +45,13 @@ jobs: isWindows: True cmakeArguments: "-A x64 -DCMAKE_BUILD_TYPE=Debug" cmakeConfig: "Debug" - cmakeTarget: "ci-pull-req" + cmakeTarget: $(defaultTargets) windows-x86-vs2017: imageName: 'vs2017-win2016' isWindows: True cmakeArguments: "-A Win32 -DCMAKE_BUILD_TYPE=Debug" cmakeConfig: "Debug" - cmakeTarget: "ci-pull-req" + cmakeTarget: $(defaultTargets) windows-unittest: imageName: 'vs2017-win2016' isWindows: True @@ -68,7 +70,7 @@ jobs: imageName: 'ubuntu-20.04' isLinux: True aptGetExtras: "" - cmakeArguments: "-GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_SURGE_PYTHON_BINDINGS=True" + cmakeArguments: "-GNinja -DCMAKE_BUILD_TYPE=Debug -DSURGE_BUILD_PYTHON_BINDINGS=True" cmakeTarget: "surgepy" cmakeConfig: "Debug" linux-clang-juce: @@ -89,7 +91,7 @@ jobs: imageName: 'ubuntu-18.04' isLinux: True cmakeArguments: "-GNinja -DCMAKE_BUILD_TYPE=Debug" - cmakeTarget: "ci-pull-req" + cmakeTarget: $(defaultTargets) cmakeConfig: "Debug" linux-unittest: imageName: 'ubuntu-20.04' @@ -102,7 +104,7 @@ jobs: imageName: 'ubuntu-20.04' isLinux: True needsLV2: True - cmakeArguments: "-DCMAKE_BUILD_TYPE=Release -DJUCE_SUPPORTS_LV2=True -DSURGE_ALTERNATE_JUCE=libs/JUCE-lv2" + cmakeArguments: "-DCMAKE_BUILD_TYPE=Release -DJUCE_SUPPORTS_LV2=True -DSURGE_JUCE_PATH=$PWD/libs/JUCE-lv2" cmakeConfig: "Release" cmakeTarget: "surge-xt_LV2" @@ -228,7 +230,7 @@ jobs: ls -l "${LOCALAPPDATA}/Surge XT/" - build/Release/surge-headless.exe + build/src/headless/Release/surge-headless.exe condition: variables.isWindowsUnitTest displayName: windows - run unit tests @@ -244,7 +246,7 @@ jobs: mkdir -p $XDG_DATA_HOME rsync -r --delete "resources/data/" "$XDG_DATA_HOME/surge-xt/" - ./build/surge-headless + ./build/src/headless/surge-headless condition: variables.isLinuxUnitTest displayName: linux - run unit test @@ -256,7 +258,7 @@ jobs: mkdir "$HOME/Library/Application Support/Surge XT" rsync -r --delete "resources/data/" "$HOME/Library/Application Support/Surge XT/" - ./build/Release/surge-headless + ./build/src/headless/Release/surge-headless condition: variables.isMacUnitTest displayName: macOS - run unit tests diff --git a/cmake/FindLibSndFile.cmake b/cmake/FindLibSndFile.cmake deleted file mode 100644 index 167155e59bf..00000000000 --- a/cmake/FindLibSndFile.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# LICENSE TERMS: -# -# This file is copied from https://github.com/neXyon/audaspace/blob/master/cmake/FindLibSndFile.cmake -# which is licensed under the Apache 2.0 license https://github.com/neXyon/audaspace/blob/master/LICENSE -# and as such this file, unlike the rest of Surge, is a goverend under Apache 2.0. -# -# - Try to find libsndfile -# Once done, this will define -# -# LIBSNDFILE_FOUND - system has libsndfile -# LIBSNDFILE_INCLUDE_DIRS - the libsndfile include directories -# LIBSNDFILE_LIBRARIES - link these to use libsndfile - -# Use pkg-config to get hints about paths -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(LIBSNDFILE_PKGCONF sndfile) -endif(PKG_CONFIG_FOUND) - -# Include dir -find_path(LIBSNDFILE_INCLUDE_DIR - NAMES sndfile.h - PATHS ${LIBSNDFILE_PKGCONF_INCLUDE_DIRS} -) - -# Library -find_library(LIBSNDFILE_LIBRARY - NAMES sndfile libsndfile-1 - PATHS ${LIBSNDFILE_PKGCONF_LIBRARY_DIRS} -) - -find_package(PackageHandleStandardArgs) -find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR) - -if(LIBSNDFILE_FOUND) - set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY}) - set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR}) -endif(LIBSNDFILE_FOUND) - -mark_as_advanced(LIBSNDFILE_LIBRARY LIBSNDFILE_LIBRARIES LIBSNDFILE_INCLUDE_DIR LIBSNDFILE_INCLUDE_DIRS) diff --git a/libs/strnatcmp/CMakeLists.txt b/libs/strnatcmp/CMakeLists.txt new file mode 100644 index 00000000000..56acb745e33 --- /dev/null +++ b/libs/strnatcmp/CMakeLists.txt @@ -0,0 +1,9 @@ +# vi:set sw=2 et: +project(strnatcmp) + +add_library(${PROJECT_NAME} + strnatcmp.cpp + strnatcmp.h +) +add_library(surge::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt new file mode 100644 index 00000000000..3b6d7429e40 --- /dev/null +++ b/resources/CMakeLists.txt @@ -0,0 +1,20 @@ +# vi:set sw=2 et: +function(surge_install_resources scope dst) + add_custom_target(install-resources-${scope}) + add_custom_command( + TARGET install-resources-${scope} + POST_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND echo "Installing resources to ${dst}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${dst}" + COMMAND rsync -r --delete "data/" "${dst}" + ) +endfunction() + +if(APPLE) + surge_install_resources(local "$ENV{HOME}/Library/Application Support/Surge XT/") + surge_install_resources(global "/Library/Application Support/Surge XT/") +elseif(UNIX) + surge_install_resources(local "$ENV{HOME}/.local/share/surge-xt/") + surge_install_resources(global "${CMAKE_INSTALL_PREFIX}/share/surge-xt/") +endif() diff --git a/scripts/installer_win/surge-x86.iss b/scripts/installer_win/surge32.iss similarity index 100% rename from scripts/installer_win/surge-x86.iss rename to scripts/installer_win/surge32.iss diff --git a/scripts/installer_win/surge.iss b/scripts/installer_win/surge64.iss similarity index 100% rename from scripts/installer_win/surge.iss rename to scripts/installer_win/surge64.iss diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000000..c13d00cdec5 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,169 @@ +# vi:set sw=2 et: +option(SURGE_BUILD_HEADLESS "Build Surge headless unit test runner" ON) +option(SURGE_BUILD_FX "Build Surge FX bank" ON) +option(SURGE_BUILD_XT "Build Surge XT synth" ON) +option(SURGE_BUILD_PYTHON_BINDINGS "Build Surge Python bindings with pybind11" OFF) +option(SURGE_COPY_AFTER_BUILD "Copy JUCE plugins after build" OFF) + +set(SURGE_JUCE_PATH "${CMAKE_SOURCE_DIR}/libs/JUCE" CACHE STRING "Path to JUCE library source tree") + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(cmake/lib.cmake) + +message(STATUS "Using JUCE from ${SURGE_JUCE_PATH}") +add_subdirectory(${SURGE_JUCE_PATH} ${CMAKE_BINARY_DIR}/JUCE EXCLUDE_FROM_ALL) + +add_library(simde INTERFACE) +target_include_directories(simde INTERFACE ${CMAKE_SOURCE_DIR}/libs/simde) +add_library(surge::simde ALIAS simde) + +add_library(surge-juce INTERFACE) +target_compile_definitions(surge-juce INTERFACE + JUCE_ALLOW_STATIC_NULL_VARIABLES=0 + JUCE_STRICT_REFCOUNTEDPOINTER=1 + + JUCE_VST3_CAN_REPLACE_VST2=0 + JUCE_USE_CURL=0 + JUCE_WEB_BROWSER=0 + JUCE_USE_CAMERA=disabled + + JUCE_DISPLAY_SPLASH_SCREEN=0 + JUCE_REPORT_APP_USAGE=0 + + JUCE_MODAL_LOOPS_PERMITTED=0 + + JUCE_COREGRAPHICS_DRAW_ASYNC=1 + + JUCE_ALSA=1 + JUCE_JACK=1 + + JUCE_WASAPI=1 + JUCE_DIRECTSOUND=1 + + JUCE_CATCH_UNHANDLED_EXCEPTIONS=$ +) + +set(SURGE_JUCE_FORMATS VST3 Standalone) +if(APPLE) + list(APPEND SURGE_JUCE_FORMATS AU) +endif() + +if(SURGE_XT_BUILD_AUV3) + list(APPEND SURGE_JUCE_FORMATS AUv3) +endif() + +if(DEFINED ENV{VST2SDK_DIR}) + file(TO_CMAKE_PATH "$ENV{VST2SDK_DIR}" JUCE_VST2_DIR) + juce_set_vst2_sdk_path(${JUCE_VST2_DIR}) + list(APPEND SURGE_JUCE_FORMATS VST) + message(STATUS "JUCE VST2 SDK Path is $ENV{VST2SDK_DIR}") + # VST2 headers are invalid UTF-8 + add_compile_options($<$:/wd4828>) +endif() + +if(JUCE_SUPPORTS_LV2) + list(APPEND SURGE_JUCE_FORMATS LV2) + message( STATUS "Including JUCE LV2 support. You will need a different JUCE than the submodule" ) + message( STATUS "Turning off deprecation warning to error since JUCE LV2 uses deprecated APIs" ) + add_compile_options(-Wno-error=deprecated-declarations) +endif() + +if(BUILD_USING_MY_ASIO_LICENSE) + message(STATUS "** BUILD WITH YOUR ASIO LICENSE **" ) + message(STATUS " Downloading ASIO SDK from Steinberg" ) + message(STATUS " The resulting Surge Standalones are not licensed for distribution" ) + +if(DEFINED ENV{ASIOSDK_DIR}) + file(TO_CMAKE_PATH "$ENV{ASIOSDK_DIR}" ASIOSDK_DIR) + message(STATUS "ASIO SDK found at ${ASIOSDK_DIR}") +else() + message(STATUS "Fetching ASIO SDK") + set(ASIOSDK_DIR ${CMAKE_BINARY_DIR}/asio/asiosdk) + add_custom_target(surge-get-local-asio) + add_custom_command( + TARGET surge-get-local-asio + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/asio + COMMAND ${CMAKE_COMMAND} -D ASIO_SDK_DESTINATION=${CMAKE_BINARY_DIR}/asio -P cmake/get-asio.cmake + ) + add_dependencies(surge-juce surge-get-local-asio) +endif() + target_compile_definitions(surge-juce INTERFACE JUCE_ASIO=1) + target_include_directories(surge-juce INTERFACE ${ASIOSDK_DIR}/common) + set(JUCE_ASIO_SUPPORT TRUE) +endif() + +message(STATUS "Building Surge JUCE as ${SURGE_JUCE_FORMATS}") + +add_subdirectory(common) + +if(SURGE_BUILD_HEADLESS) + add_subdirectory(headless) +endif() + +if(SURGE_BUILD_FX) + add_subdirectory(surge_effects_bank) +endif() + +if(SURGE_BUILD_XT) + add_subdirectory(gui) + add_subdirectory(surge_synth_juce) +endif() + +if(SURGE_BUILD_PYTHON_BINDINGS) + add_subdirectory(python_bindings) +endif() + +if(SURGE_BUILD_FX AND SURGE_BUILD_XT AND NOT CMAKE_CROSSCOMPILING) + surge_make_installers() +endif() + +# FIXME: Plugin validation {{{ +if (APPLE) + message( STATUS "Validate me! Please!" ) + add_custom_target(stage-pluginval) + add_custom_command(TARGET stage-pluginval + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND cmake -E make_directory pluginval + COMMAND curl -L "https://github.com/Tracktion/pluginval/releases/download/latest_release/pluginval_macOS.zip" -o pluginval/pluginval.zip + COMMAND cd pluginval && unzip -o pluginval.zip + ) + add_custom_target(surge-xt-pluginval-vst3) + add_dependencies(surge-xt-pluginval-vst3 surge-xt_VST3) + add_dependencies(surge-xt-pluginval-vst3 stage-pluginval) + add_custom_command(TARGET surge-xt-pluginval-vst3 + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_FX_OUTPUT_DIR}/VST3/Surge XT.vst3" || exit 1 + ) + + add_custom_target(surge-xt-pluginval-au) + add_dependencies(surge-xt-pluginval-au surge-xt_AU) + add_dependencies(surge-xt-pluginval-au stage-pluginval) + add_custom_command(TARGET surge-xt-pluginval-au + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_XT_OUTPUT_DIR}/AU/Surge XT.component" || exit 1 + ) + + add_custom_target(surge-fx-pluginval-vst3) + add_dependencies(surge-fx-pluginval-vst3 surge-fx_VST3) + add_dependencies(surge-fx-pluginval-vst3 stage-pluginval) + add_custom_command(TARGET surge-fx-pluginval-vst3 + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_FX_OUTPUT_DIR}/VST3/${SURGE_FX_PRODUCT_NAME}.vst3" || exit 1 + ) + + add_custom_target(surge-fx-pluginval-au) + add_dependencies(surge-fx-pluginval-au surge-fx_AU) + add_dependencies(surge-fx-pluginval-au stage-pluginval) + add_custom_command(TARGET surge-fx-pluginval-au + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND pluginval/pluginval.app/Contents/MacOS/pluginval --validate-in-process --output-dir "." --validate "${SURGE_FX_OUTPUT_DIR}/AU/${SURGE_FX_PRODUCT_NAME}.component" || exit 1 + ) +endif() +# }}} + diff --git a/cmake/get-asio.cmake b/src/cmake/get-asio.cmake similarity index 100% rename from cmake/get-asio.cmake rename to src/cmake/get-asio.cmake diff --git a/src/cmake/lib.cmake b/src/cmake/lib.cmake new file mode 100644 index 00000000000..6b29b82ff78 --- /dev/null +++ b/src/cmake/lib.cmake @@ -0,0 +1,89 @@ +# vi:set sw=2 et: +set(SURGE_PRODUCT_DIR ${CMAKE_BINARY_DIR}/surge_xt_products) +file(MAKE_DIRECTORY ${SURGE_PRODUCT_DIR}) + +add_custom_target(surge-xt-distribution) +add_custom_command(TARGET surge-xt-distribution + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/resources/surge-xt/README.txt ${SURGE_PRODUCT_DIR} +) + +function(surge_juce_package target product_name) + get_target_property(output_dir ${target} RUNTIME_OUTPUT_DIRECTORY) + set(pkg_target ${target}_Packaged) + add_custom_target(${pkg_target} ALL) + foreach(format ${SURGE_JUCE_FORMATS}) + add_dependencies(${pkg_target} ${target}_${format}) + endforeach() + foreach(format AU Standalone VST3) + if(TARGET ${target}_${format}) + add_custom_command( + TARGET ${pkg_target} + POST_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND echo "${target}: Re-locating ${format} components" + COMMAND ${CMAKE_COMMAND} -E copy_directory ${output_dir}/${format} ${SURGE_PRODUCT_DIR}/ + ) + endif() + endforeach() + add_dependencies(surge-xt-distribution ${pkg_target}) + + # Add CMake install rules for UNIX only right now (macOS and Windows use installers) + if(UNIX AND NOT APPLE) + if(TARGET ${target}_LV2) + install(DIRECTORY "${output_dir}/LV2/${product_name}.lv2" DESTINATION lib/lv2) + endif() + if(TARGET ${target}_Standalone) + install(TARGETS ${target}_Standalone DESTINATION bin) + endif() + if(TARGET ${target}_VST3) + install(DIRECTORY "${output_dir}/VST3/${product_name}.vst3" DESTINATION lib/vst3) + endif() + endif() +endfunction() + +function(surge_add_lib_subdirectory libname) + add_subdirectory(${CMAKE_SOURCE_DIR}/libs/${libname} ${CMAKE_BINARY_DIR}/libs/${libname} EXCLUDE_FROM_ALL) +endfunction() + +function(surge_make_installers) + set(SURGE_XT_DIST_OUTPUT_DIR ${CMAKE_BINARY_DIR}/surge-xt-dist) + file(MAKE_DIRECTORY ${SURGE_XT_DIST_OUTPUT_DIR}) + + set(SXTVER $ENV{SURGE_VERSION}) + if("${SXTVER}" STREQUAL "") + set(SXTVER "LOCAL") + endif() + + function(run_installer_script PATH) + add_custom_command(TARGET surge-xt-distribution + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_SOURCE_DIR}/scripts/${PATH} "${SURGE_PRODUCT_DIR}" "${CMAKE_SOURCE_DIR}" "${SURGE_XT_DIST_OUTPUT_DIR}" "${SXTVER}" + ) + endfunction() + + if(APPLE) + run_installer_script(installer_mac/make_installer.sh) + elseif(UNIX) + run_installer_script(installer_linux/make_deb.sh) + run_installer_script(installer_linux/make_rpm.sh) + elseif(WIN32) + add_custom_command(TARGET surge-xt-distribution + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E tar cvf ${SURGE_XT_DIST_OUTPUT_DIR}/surge-xt-win${SURGE_BITNESS}-${SXTVER}-pluginsonly.zip --format=zip ${SURGE_PRODUCT_DIR} + ) + find_program(SURGE_NUGET_EXE nuget.exe PATHS ENV "PATH") + if(SURGE_NUGET_EXE) + message(STATUS "Using NUGET from ${SURGE_NUGET_EXE}" ) + add_custom_command(TARGET surge-xt-distribution + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND ${SURGE_NUGET_EXE} install Tools.InnoSetup -version 6.1.2 + COMMAND Tools.InnoSetup.6.1.2/tools/iscc.exe /O"${SURGE_XT_DIST_OUTPUT_DIR}" /DSURGE_SRC="${CMAKE_SOURCE_DIR}" /DSURGE_BIN="${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/scripts/installer_win/surge${SURGE_BITNESS}.iss" + ) + else() + message(STATUS "NuGet not found, not creating InnoSetup installer") + endif() + endif() +endfunction() diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt new file mode 100644 index 00000000000..aabd4f74e99 --- /dev/null +++ b/src/common/CMakeLists.txt @@ -0,0 +1,325 @@ +# vi:set sw=2 et: +project(surge-common) + +surge_add_lib_subdirectory(airwindows) +surge_add_lib_subdirectory(eurorack) +surge_add_lib_subdirectory(filesystem) +surge_add_lib_subdirectory(fmt) +surge_add_lib_subdirectory(strnatcmp) +surge_add_lib_subdirectory(tinyxml) +surge_add_lib_subdirectory(oddsound-mts) +if(MINGW) + set(HAVE_VISIBILITY 0 CACHE INTERNAL "Force-disable libsamplerate's visibility check on MinGW") +endif() +surge_add_lib_subdirectory(libsamplerate) +surge_add_lib_subdirectory(tuning-library) +surge_add_lib_subdirectory(sqlite-3.23.3) +surge_add_lib_subdirectory(LuaJitLib) + +juce_add_binary_data(surge-common-binary + NAMESPACE SurgeSharedBinary + HEADER_NAME SurgeSharedBinary.h + SOURCES + ${CMAKE_SOURCE_DIR}/resources/surge-shared/configuration.xml + ${CMAKE_SOURCE_DIR}/resources/surge-shared/README_UserArea.txt + ${CMAKE_SOURCE_DIR}/resources/surge-shared/memoryWavetable.wt + ${CMAKE_SOURCE_DIR}/resources/surge-shared/windows.wt + ${CMAKE_SOURCE_DIR}/resources/surge-shared/paramdocumentation.xml + ${CMAKE_SOURCE_DIR}/src/lua/surge_prelude.lua + ${CMAKE_SOURCE_DIR}/src/lua/surge_prelude_test.lua +) + +add_library(${PROJECT_NAME} + CPUFeatures.cpp + CPUFeatures.h + DebugHelpers.cpp + DebugHelpers.h + FilterConfiguration.h + FxPresetAndClipboardManager.cpp + FxPresetAndClipboardManager.h + LuaSupport.cpp + LuaSupport.h + ModulationSource.h + ModulatorPresetManager.cpp + ModulatorPresetManager.h + Parameter.cpp + Parameter.h + PatchDB.cpp + PatchDB.h + SkinColors.cpp + SkinColors.h + SkinFonts.cpp + SkinFonts.h + SkinModel.cpp + SkinModel.h + SkinModelImpl.cpp + StringOps.h + SurgeParamConfig.h + SurgePatch.cpp + SurgeStorage.cpp + SurgeStorage.h + SurgeSynthesizer.cpp + SurgeSynthesizer.h + SurgeSynthesizerIO.cpp + UnitConversions.h + UserDefaults.cpp + UserDefaults.h + WAVFileSupport.cpp + dsp/Effect.cpp + dsp/Effect.h + dsp/Oscillator.cpp + dsp/Oscillator.h + dsp/QuadFilterChain.cpp + dsp/QuadFilterChain.h + dsp/QuadFilterUnit.cpp + dsp/QuadFilterUnit.h + dsp/QuadFilterWaveshapers.cpp + dsp/SurgeVoice.cpp + dsp/SurgeVoice.h + dsp/SurgeVoiceState.h + dsp/Wavetable.cpp + dsp/Wavetable.h + dsp/WavetableScriptEvaluator.cpp + dsp/WavetableScriptEvaluator.h + dsp/effects/BBDEnsembleEffect.cpp + dsp/effects/BBDEnsembleEffect.h + dsp/effects/ChorusEffect.h + dsp/effects/ChorusEffectImpl.h + dsp/effects/CombulatorEffect.cpp + dsp/effects/CombulatorEffect.h + dsp/effects/ConditionerEffect.cpp + dsp/effects/ConditionerEffect.h + dsp/effects/DelayEffect.cpp + dsp/effects/DelayEffect.h + dsp/effects/DistortionEffect.cpp + dsp/effects/DistortionEffect.h + dsp/effects/FlangerEffect.cpp + dsp/effects/FlangerEffect.h + dsp/effects/FrequencyShifterEffect.cpp + dsp/effects/FrequencyShifterEffect.h + dsp/effects/GraphicEQ11BandEffect.cpp + dsp/effects/GraphicEQ11BandEffect.h + dsp/effects/ModControl.h + dsp/effects/NimbusEffect.cpp + dsp/effects/NimbusEffect.h + dsp/effects/ParametricEQ3BandEffect.cpp + dsp/effects/ParametricEQ3BandEffect.h + dsp/effects/PhaserEffect.cpp + dsp/effects/PhaserEffect.h + dsp/effects/ResonatorEffect.cpp + dsp/effects/ResonatorEffect.h + dsp/effects/Reverb1Effect.cpp + dsp/effects/Reverb1Effect.h + dsp/effects/Reverb2Effect.cpp + dsp/effects/Reverb2Effect.h + dsp/effects/RingModulatorEffect.cpp + dsp/effects/RingModulatorEffect.h + dsp/effects/RotarySpeakerEffect.cpp + dsp/effects/RotarySpeakerEffect.h + dsp/effects/TreemonsterEffect.cpp + dsp/effects/TreemonsterEffect.h + dsp/effects/VocoderEffect.cpp + dsp/effects/VocoderEffect.h + dsp/effects/WaveShaperEffect.cpp + dsp/effects/WaveShaperEffect.h + dsp/effects/airwindows/AirWindowsEffect.cpp + dsp/effects/airwindows/AirWindowsEffect.h + dsp/effects/chowdsp/CHOWEffect.cpp + dsp/effects/chowdsp/CHOWEffect.h + dsp/effects/chowdsp/ExciterEffect.cpp + dsp/effects/chowdsp/ExciterEffect.h + dsp/effects/chowdsp/NeuronEffect.cpp + dsp/effects/chowdsp/NeuronEffect.h + dsp/effects/chowdsp/TapeEffect.cpp + dsp/effects/chowdsp/TapeEffect.h + dsp/effects/chowdsp/bbd_utils/BBDCompander.h + dsp/effects/chowdsp/bbd_utils/BBDDelayLine.cpp + dsp/effects/chowdsp/bbd_utils/BBDDelayLine.h + dsp/effects/chowdsp/bbd_utils/BBDFilterBank.h + dsp/effects/chowdsp/bbd_utils/BBDNonlin.h + dsp/effects/chowdsp/exciter/LevelDetector.cpp + dsp/effects/chowdsp/exciter/LevelDetector.h + dsp/effects/chowdsp/shared/BilinearUtils.h + dsp/effects/chowdsp/shared/DelayInterpolation.h + dsp/effects/chowdsp/shared/DelayLine.cpp + dsp/effects/chowdsp/shared/DelayLine.h + dsp/effects/chowdsp/shared/FIRFIlter.h + dsp/effects/chowdsp/shared/Oversampling.h + dsp/effects/chowdsp/shared/Shelf.h + dsp/effects/chowdsp/shared/SmoothedValue.h + dsp/effects/chowdsp/shared/chowdsp_IIR.h + dsp/effects/chowdsp/shared/omega.h + dsp/effects/chowdsp/shared/wdf.h + dsp/effects/chowdsp/shared/wdf_sse.h + dsp/effects/chowdsp/tape/ChewDropout.h + dsp/effects/chowdsp/tape/ChewProcessor.cpp + dsp/effects/chowdsp/tape/ChewProcessor.h + dsp/effects/chowdsp/tape/DegradeFilter.h + dsp/effects/chowdsp/tape/DegradeNoise.h + dsp/effects/chowdsp/tape/DegradeProcessor.cpp + dsp/effects/chowdsp/tape/DegradeProcessor.h + dsp/effects/chowdsp/tape/HysteresisProcessing.cpp + dsp/effects/chowdsp/tape/HysteresisProcessing.h + dsp/effects/chowdsp/tape/HysteresisProcessor.cpp + dsp/effects/chowdsp/tape/HysteresisProcessor.h + dsp/effects/chowdsp/tape/LossFilter.cpp + dsp/effects/chowdsp/tape/LossFilter.h + dsp/effects/chowdsp/tape/ToneControl.cpp + dsp/effects/chowdsp/tape/ToneControl.h + dsp/filters/AllpassFilter.h + dsp/filters/BiquadFilter.cpp + dsp/filters/BiquadFilter.h + dsp/filters/BiquadFilterSSE2.cpp + dsp/filters/DiodeLadder.cpp + dsp/filters/DiodeLadder.h + dsp/filters/FilterCoefficientMaker.cpp + dsp/filters/FilterCoefficientMaker.h + dsp/filters/K35Filter.cpp + dsp/filters/K35Filter.h + dsp/filters/NonlinearFeedback.cpp + dsp/filters/NonlinearFeedback.h + dsp/filters/NonlinearStates.cpp + dsp/filters/NonlinearStates.h + dsp/filters/OBXDFilter.cpp + dsp/filters/OBXDFilter.h + dsp/filters/ThreelerFilter.cpp + dsp/filters/ThreelerFilter.h + dsp/filters/VectorizedSVFilter.cpp + dsp/filters/VectorizedSVFilter.h + dsp/filters/VintageLadders.cpp + dsp/filters/VintageLadders.h + dsp/modulators/ADSRModulationSource.cpp + dsp/modulators/ADSRModulationSource.h + dsp/modulators/FormulaModulationHelper.cpp + dsp/modulators/FormulaModulationHelper.h + dsp/modulators/LFOModulationSource.cpp + dsp/modulators/LFOModulationSource.h + dsp/modulators/MSEGModulationHelper.cpp + dsp/modulators/MSEGModulationHelper.h + dsp/oscillators/AliasOscillator.cpp + dsp/oscillators/AliasOscillator.h + dsp/oscillators/AudioInputOscillator.cpp + dsp/oscillators/AudioInputOscillator.h + dsp/oscillators/ClassicOscillator.cpp + dsp/oscillators/ClassicOscillator.h + dsp/oscillators/FM2Oscillator.cpp + dsp/oscillators/FM2Oscillator.h + dsp/oscillators/FM3Oscillator.cpp + dsp/oscillators/FM3Oscillator.h + dsp/oscillators/ModernOscillator.cpp + dsp/oscillators/ModernOscillator.h + dsp/oscillators/OscillatorBase.h + dsp/oscillators/OscillatorCommonFunctions.h + dsp/oscillators/SampleAndHoldOscillator.cpp + dsp/oscillators/SampleAndHoldOscillator.h + dsp/oscillators/SineOscillator.cpp + dsp/oscillators/SineOscillator.h + dsp/oscillators/StringOscillator.cpp + dsp/oscillators/StringOscillator.h + dsp/oscillators/TwistOscillator.cpp + dsp/oscillators/TwistOscillator.h + dsp/oscillators/WavetableOscillator.cpp + dsp/oscillators/WavetableOscillator.h + dsp/oscillators/WindowOscillator.cpp + dsp/oscillators/WindowOscillator.h + dsp/utilities/DSPUtils.cpp + dsp/utilities/DSPUtils.h + dsp/utilities/FastMath.h + dsp/utilities/LanczosResampler.cpp + dsp/utilities/LanczosResampler.h + dsp/utilities/SSEComplex.h + dsp/utilities/SSESincDelayLine.h + dsp/vembertech/basic_dsp.cpp + dsp/vembertech/basic_dsp.h + dsp/vembertech/halfratefilter.cpp + dsp/vembertech/halfratefilter.h + dsp/vembertech/lipol.cpp + dsp/vembertech/lipol.h + dsp/vembertech/portable_intrinsics.h + dsp/vembertech/shared.h + dsp/vembertech/vt_dsp.h + dsp/vembertech/vt_dsp_endian.h + globals.h + resource.h + version.cpp.in + version.h +) + +if(APPLE) + target_compile_definitions(${PROJECT_NAME} PUBLIC MAC=1) + target_link_libraries(${PROJECT_NAME} + PUBLIC surge::simde + PRIVATE + "-framework CoreServices" + "-framework CoreFoundation" + "-framework Foundation" + ) +elseif(UNIX) + target_compile_definitions(${PROJECT_NAME} PUBLIC LINUX=1) + target_link_libraries(${PROJECT_NAME} PUBLIC + pthread + dl + -Wl,--no-undefined + ) + if(CMAKE_SYSTEM_NAME MATCHES "BSD") + target_link_libraries(${PROJECT_NAME} PUBLIC execinfo) + endif() + if(LINUX_ON_ARM) + target_compile_definitions(${PROJECT_NAME} PUBLIC ARM_NEON=1) + target_link_libraries(${PROJECT_NAME} PUBLIC surge::simde) + endif() +elseif(WIN32) + target_compile_definitions(${PROJECT_NAME} PUBLIC + WINDOWS=1 + NOMINMAX=1 + WIN32 + _USE_MATH_DEFINES + _WIN32_WINNT=0x0601 + _USRDLL + VA_SUBTRACTIVE_EXPORTS + USE_LIBPNG + _CRT_SECURE_NO_WARNINGS=1 + UNICODE + _UNICODE + ) +endif() + +add_custom_target(git-info BYPRODUCTS ${CMAKE_BINARY_DIR}/geninclude/version.cpp + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -D PROJECT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR} + -D PROJECT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR} + -D SURGESRC=${CMAKE_SOURCE_DIR} -D SURGEBLD=${CMAKE_BINARY_DIR} + -D AZURE_PIPELINE=${AZURE_PIPELINE} + -D WIN32=${WIN32} + -D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -D SURGE_COMPILER_INFO="${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" + -P ${CMAKE_SOURCE_DIR}/cmake/versiontools.cmake +) +target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/geninclude/version.cpp) +add_dependencies(${PROJECT_NAME} git-info) + +add_library(surge::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) +target_link_libraries(${PROJECT_NAME} PUBLIC + fmt + luajit-5.1 + samplerate + surge::airwindows + surge::eurorack + surge::filesystem + surge::oddsound-mts + surge::sqlite + surge::strnatcmp + surge::tinyxml + surge-common-binary + tuning-library +) +target_include_directories(${PROJECT_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + dsp + dsp/effects + dsp/filters + dsp/modulators + dsp/oscillators + dsp/utilities + dsp/vembertech +) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt new file mode 100644 index 00000000000..9ffc76fa23d --- /dev/null +++ b/src/gui/CMakeLists.txt @@ -0,0 +1,134 @@ +# vi:set sw=2 et: +project(surge-gui) + +add_library(${PROJECT_NAME} + AccessibleHelpers.h + CMakeLists.txt + ModulationGridConfiguration.h + RefreshableOverlay.h + RuntimeFont.cpp + RuntimeFont.h + SkinFontLoader.cpp + SkinImageMaps.h + SkinSupport.cpp + SkinSupport.h + SurgeGUICallbackInterfaces.h + SurgeGUIEditor.cpp + SurgeGUIEditor.h + SurgeGUIEditorHtmlGenerators.cpp + SurgeGUIEditorInfowindow.cpp + SurgeGUIEditorOverlays.cpp + SurgeGUIEditorTags.h + SurgeGUIEditorValueCallbacks.cpp + SurgeGUIUtils.cpp + SurgeGUIUtils.h + SurgeImage.cpp + SurgeImage.h + SurgeImageStore.cpp + SurgeImageStore.h + SurgeJUCEHelpers.h + SurgeJUCELookAndFeel.cpp + SurgeJUCELookAndFeel.h + UIInstrumentation.cpp + UIInstrumentation.h + overlays/AboutScreen.cpp + overlays/AboutScreen.h + overlays/CoveringMessageOverlay.cpp + overlays/CoveringMessageOverlay.h + overlays/LuaEditors.cpp + overlays/LuaEditors.h + overlays/MSEGEditor.cpp + overlays/MSEGEditor.h + overlays/MiniEdit.cpp + overlays/MiniEdit.h + overlays/ModulationEditor.cpp + overlays/ModulationEditor.h + overlays/OverlayWrapper.cpp + overlays/OverlayWrapper.h + overlays/PatchDBViewer.cpp + overlays/PatchDBViewer.h + overlays/PatchStoreDialog.cpp + overlays/PatchStoreDialog.h + overlays/TuningOverlays.cpp + overlays/TuningOverlays.h + overlays/TypeinParamEditor.cpp + overlays/TypeinParamEditor.h + overlays/WaveShaperAnalysis.cpp + overlays/WaveShaperAnalysis.h + widgets/EffectChooser.cpp + widgets/EffectChooser.h + widgets/EffectLabel.h + widgets/LFOAndStepDisplay.cpp + widgets/LFOAndStepDisplay.h + widgets/MainFrame.cpp + widgets/MainFrame.h + widgets/MenuCustomComponents.cpp + widgets/MenuCustomComponents.h + widgets/MenuForDiscreteParams.cpp + widgets/MenuForDiscreteParams.h + widgets/ModulatableControlInterface.h + widgets/ModulatableSlider.cpp + widgets/ModulatableSlider.h + widgets/ModulationSourceButton.cpp + widgets/ModulationSourceButton.h + widgets/MultiSwitch.cpp + widgets/MultiSwitch.h + widgets/NumberField.cpp + widgets/NumberField.h + widgets/OscillatorWaveformDisplay.cpp + widgets/OscillatorWaveformDisplay.h + widgets/ParameterInfowindow.cpp + widgets/ParameterInfowindow.h + widgets/PatchSelector.cpp + widgets/PatchSelector.h + widgets/Switch.cpp + widgets/Switch.h + widgets/VerticalLabel.cpp + widgets/VerticalLabel.h + widgets/VuMeter.cpp + widgets/VuMeter.h + widgets/WaveShaperSelector.cpp + widgets/WaveShaperSelector.h + widgets/WidgetBaseMixin.h + widgets/XMLConfiguredMenus.cpp + widgets/XMLConfiguredMenus.h +) + +if(EXISTS ${SURGE_JUCE_PATH}/modules/juce_gui_basics/accessibility/juce_AccessibilityHandler.h) + set(SURGE_JUCE_ACCESSIBLE TRUE) + message(STATUS "Including JUCE Accessibility Support") +else() + message(STATUS "No JUCE Accessibility Support in this version") +endif() + +if(EXISTS ${SURGE_JUCE_PATH}/modules/juce_audio_processors/processors/juce_AudioProcessorEditorHostContext.h) + set(SURGE_JUCE_HOST_CONTEXT TRUE) + message(STATUS "Including JUCE Host Context Support") +else() + message(STATUS "No JUCE Host Context Support in this version") +endif() + +if(EXISTS ${SURGE_JUCE_PATH}/modules/juce_audio_processors/utilities/juce_VST3ClientExtensions.h) + set(SURGE_JUCE_VST3_EXTENSIONS TRUE) + message(STATUS "Including JUCE VST3 Client Extensions") +else() + message(STATUS "No JUCE VST3 Client Extensions") +endif() + +target_compile_definitions(${PROJECT_NAME} PUBLIC + SURGE_JUCE_ACCESSIBLE=$ + SURGE_JUCE_HOST_CONTEXT=$ + SURGE_JUCE_VST3_EXTENSIONS=$ + + $,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1 +) + +target_link_libraries(${PROJECT_NAME} PUBLIC + juce::juce_graphics + surge-juce + surge::surge-common + surge::surge-xt # FIXME +) + +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +add_library(surge::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) diff --git a/src/headless/CMakeLists.txt b/src/headless/CMakeLists.txt new file mode 100644 index 00000000000..9a743d793cb --- /dev/null +++ b/src/headless/CMakeLists.txt @@ -0,0 +1,40 @@ +# vi:set sw=2 et: +project(surge-headless) + +surge_add_lib_subdirectory(catch2) + +add_executable(${PROJECT_NAME} + HeadlessNonTestFunctions.cpp + HeadlessNonTestFunctions.h + HeadlessPluginLayerProxy.h + HeadlessUtils.cpp + HeadlessUtils.h + Player.cpp + Player.h + UnitTestUtilities.cpp + UnitTestUtilities.h + UnitTests.cpp + UnitTestsDSP.cpp + UnitTestsFLT.cpp + UnitTestsFX.cpp + UnitTestsINFRA.cpp + UnitTestsIO.cpp + UnitTestsLUA.cpp + UnitTestsMIDI.cpp + UnitTestsMOD.cpp + UnitTestsMSEG.cpp + UnitTestsPARAM.cpp + UnitTestsTUN.cpp + main.cpp +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + samplerate + surge::catch2 + surge::surge-common +) + +# FIXME: Python bindings depend on a header from here +add_library(surge-headless-lib INTERFACE) +target_include_directories(surge-headless-lib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +add_library(surge::surge-headless-lib ALIAS surge-headless-lib) diff --git a/src/headless/HeadlessNonTestFunctions.cpp b/src/headless/HeadlessNonTestFunctions.cpp index 33af4bc9d92..9e3cc102b6b 100644 --- a/src/headless/HeadlessNonTestFunctions.cpp +++ b/src/headless/HeadlessNonTestFunctions.cpp @@ -63,7 +63,6 @@ void statsFromPlayingEveryPatch() auto callBack = [](const Patch &p, const PatchCategory &pc, const float *data, int nSamples, int nChannels) -> void { - bool writeWav = false; // toggle this to true to write each sample to a wav file std::cout << "cat/patch = " << pc.name << " / " << std::left << std::setw(30) << p.name; if (nSamples * nChannels > 0) @@ -85,12 +84,6 @@ void statsFromPlayingEveryPatch() << std::setw(10) << std::fixed << *maxd << "]" << " L1=" << L1 << " rms=" << rms << " samp=" << nSamples << " chan=" << nChannels; - if (writeWav) - { - std::ostringstream oss; - oss << "headless " << pc.name << " " << p.name << ".wav"; - Surge::Headless::writeToWav(data, nSamples, nChannels, 44100, oss.str()); - } } std::cout << std::endl; }; diff --git a/src/headless/HeadlessUtils.cpp b/src/headless/HeadlessUtils.cpp index d771ef31cef..f77ad9d3c93 100644 --- a/src/headless/HeadlessUtils.cpp +++ b/src/headless/HeadlessUtils.cpp @@ -4,10 +4,6 @@ #include #include -#if LIBSNDFILE -#include -#endif - namespace Surge { namespace Headless @@ -43,24 +39,5 @@ void writeToStream(const float *data, int nSamples, int nChannels, std::ostream } } -void writeToWav(const float *data, int nSamples, int nChannels, float sampleRate, - std::string wavFileName) -{ -#if LIBSNDFILE - SF_INFO sfinfo; - sfinfo.channels = nChannels; - sfinfo.samplerate = sampleRate; - sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; - - SNDFILE *of = sf_open(wavFileName.c_str(), SFM_WRITE, &sfinfo); - sf_count_t count = sf_write_float(of, &data[0], nSamples * nChannels); - sf_write_sync(of); - sf_close(of); -#else - std::cout << "writeToWav requires libsndfile which is not available on your platform." - << std::endl; -#endif -} - } // namespace Headless } // namespace Surge diff --git a/src/headless/HeadlessUtils.h b/src/headless/HeadlessUtils.h index 9b722da38de..7300260fbaf 100644 --- a/src/headless/HeadlessUtils.h +++ b/src/headless/HeadlessUtils.h @@ -14,8 +14,6 @@ namespace Headless std::shared_ptr createSurge(int sr); void writeToStream(const float *data, int nSamples, int nChannels, std::ostream &str); -void writeToWav(const float *data, int nSamples, int nChannels, float sampleRate, - std::string wavFileName); /* ** One imagines expansions along these lines: diff --git a/src/python_bindings/CMakeLists.txt b/src/python_bindings/CMakeLists.txt new file mode 100644 index 00000000000..0634d0dfae7 --- /dev/null +++ b/src/python_bindings/CMakeLists.txt @@ -0,0 +1,25 @@ +# vi:set sw=2 et: +project(surgepy) + +add_subdirectory(${CMAKE_SOURCE_DIR}/libs/pybind11 pybind11) +pybind11_add_module(${PROJECT_NAME}) + +target_sources(${PROJECT_NAME} PRIVATE surgepy.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE + surge::surge-common + surge::surge-headless-lib +) + +if(UNIX AND NOT APPLE) + find_package(Threads REQUIRED) + target_link_libraries(${PROJECT_NAME} + PRIVATE + Threads::Threads + ${PYTHON_LIBRARIES} + ) + + if(CMAKE_SYSTEM_NAME MATCHES "BSD") + target_link_libraries(${PROJECT_NAME} PRIVATE execinfo) + endif() +endif() diff --git a/src/surge_effects_bank/CMakeLists.txt b/src/surge_effects_bank/CMakeLists.txt new file mode 100644 index 00000000000..85624e9fa4c --- /dev/null +++ b/src/surge_effects_bank/CMakeLists.txt @@ -0,0 +1,62 @@ +# vi:set sw=2 et: +project(surge-fx VERSION ${CMAKE_PROJECT_VERSION}) + +if(WIN32 AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(SURGE_FX_PRODUCT_NAME "Surge XT Effects (32-bit)") +else() + set(SURGE_FX_PRODUCT_NAME "Surge XT Effects") +endif() + +file(GLOB SURGE_FX_BANK_RESOURCES_GLOB + ${CMAKE_SOURCE_DIR}/resources/surge_effects_bank/*.svg + ${CMAKE_SOURCE_DIR}/resources/surge_effects_bank/icons/*.svg +) + +juce_add_binary_data(surge-fx-binary + SOURCES ${SURGE_FX_BANK_RESOURCES_GLOB} +) + +juce_add_plugin(${PROJECT_NAME} + PRODUCT_NAME ${SURGE_FX_PRODUCT_NAME} + COMPANY_NAME "Surge Synth Team" + COMPANY_WEBSITE "https://surge-synth-team.org/" + BUNDLE_ID "org.surge-synth-team.surge-xt-fx" + PLUGIN_MANUFACTURER_CODE VmbA + PLUGIN_CODE SFXT + + ICON_BIG "${CMAKE_SOURCE_DIR}/resources/surge_effects_bank/SurgeFXLogo.png" + + IS_SYNTH FALSE + NEEDS_MIDI_INPUT FALSE + NEEDS_MIDI_OUTPUT FALSE + IS_MIDI_EFFECT FALSE + + COPY_PLUGIN_AFTER_BUILD ${SURGE_COPY_AFTER_BUILD} + + VST3_CATEGORIES Fx + VST2_CATEGORY kPlugCategEffect + AU_MAIN_TYPE kAudioUnitType_Effect + + LV2_URI https://surge-synthesizer.github.io/lv2/surge-xt-fx + LV2_SHARED_LIBRARY_NAME SurgeXT_FX + + FORMATS ${SURGE_JUCE_FORMATS} +) + +target_sources(${PROJECT_NAME} PRIVATE + SurgeFXEditor.cpp + SurgeFXEditor.h + SurgeFXProcessor.cpp + SurgeFXProcessor.h + SurgeLookAndFeel.h +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + surge::surge-common + surge-fx-binary + surge-juce + juce::juce_audio_utils + juce::juce_audio_processors +) + +surge_juce_package(${PROJECT_NAME} "Surge XT Effects") diff --git a/src/surge_synth_juce/CMakeLists.txt b/src/surge_synth_juce/CMakeLists.txt new file mode 100644 index 00000000000..684935762e5 --- /dev/null +++ b/src/surge_synth_juce/CMakeLists.txt @@ -0,0 +1,80 @@ +# vi:set sw=2 et: +project(surge-xt VERSION ${CMAKE_PROJECT_VERSION}) + +file(GLOB SURGE_XT_JUCE_RESOURCES_GLOB + ${CMAKE_SOURCE_DIR}/resources/classic-skin-svgs/*.svg + ${CMAKE_SOURCE_DIR}/resources/fonts/Lato*ttf + ${CMAKE_SOURCE_DIR}/resources/fonts/IndieFlower.ttf + ${CMAKE_SOURCE_DIR}/resources/fonts/FiraMono-Regular.ttf + ${CMAKE_SOURCE_DIR}/resources/surge-xt/memory-skin.xml +) + +juce_add_binary_data(surge-xt-binary + NAMESPACE SurgeXTBinary + HEADER_NAME SurgeXTBinary.h + SOURCES ${SURGE_XT_JUCE_RESOURCES_GLOB} +) + +if(WIN32 AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(SURGE_XT_PRODUCT_NAME "Surge XT (32-bit)") +else() + set(SURGE_XT_PRODUCT_NAME "Surge XT") +endif() + +juce_add_plugin(${PROJECT_NAME} + PRODUCT_NAME ${SURGE_XT_PRODUCT_NAME} + COMPANY_NAME "Surge Synth Team" + COMPANY_WEBSITE "https://surge-synth-team.org/" + BUNDLE_ID "org.surge-synth-team.surge-xt" + PLUGIN_MANUFACTURER_CODE VmbA + PLUGIN_CODE SgXT + + ICON_BIG "${CMAKE_SOURCE_DIR}/resources/surge-xt/SurgeLogo.png" + + IS_SYNTH TRUE + NEEDS_MIDI_INPUT TRUE + NEEDS_MIDI_OUTPUT FALSE + IS_MIDI_EFFECT FALSE + + COPY_PLUGIN_AFTER_BUILD ${SURGE_COPY_AFTER_BUILD} + + VST3_CATEGORIES Instrument Synth + VST2_CATEGORY kPlugCategSynth + AU_MAIN_TYPE kAudioUnitType_MusicDevice + + LV2_URI https://surge-synthesizer.github.io/lv2/surge-xt + LV2_SHARED_LIBRARY_NAME SurgeXT + + FORMATS ${SURGE_JUCE_FORMATS} +) + +if(JUCE_ASIO_SUPPORT) + target_compile_definitions(${PROJECT_NAME} PUBLIC JUCE_ASIO=1) +endif() + +target_sources(${PROJECT_NAME} PRIVATE + LockFreeStack.h + SurgeSynthEditor.cpp + SurgeSynthEditor.h + SurgeSynthProcessor.cpp + SurgeSynthProcessor.h +) + +foreach(format ${SURGE_JUCE_FORMATS}) + target_sources(${PROJECT_NAME}_${format} PRIVATE SurgeSynth${format}Extensions.cpp) +endforeach() + +target_link_libraries(${PROJECT_NAME} PRIVATE + surge::surge-common + surge::surge-gui + juce::juce_audio_utils + juce::juce_audio_processors + juce::juce_audio_plugin_client + PUBLIC surge-xt-binary # FIXME +) + +# FIXME: surge-gui and surge-xt depend on each other :( +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +add_library(surge::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +surge_juce_package(${PROJECT_NAME} "Surge XT") diff --git a/src/surge_synth_juce/SurgeSynthVST2Extensions.cpp b/src/surge_synth_juce/SurgeSynthVSTExtensions.cpp similarity index 100% rename from src/surge_synth_juce/SurgeSynthVST2Extensions.cpp rename to src/surge_synth_juce/SurgeSynthVSTExtensions.cpp