diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000000..9bfaa193991 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,118 @@ +cmake_minimum_required(VERSION 3.5) +project(Surge VERSION 1.0.0 LANGUAGES CXX) + +set(SURGE_COMMON_SOURCES + src/common/dsp/effect/ConditionerEffect.cpp + src/common/dsp/effect/DistortionEffect.cpp + src/common/dsp/effect/DualDelayEffect.cpp + src/common/dsp/effect/Effect.cpp + src/common/dsp/effect/FreqshiftEffect.cpp + src/common/dsp/effect/PhaserEffect.cpp + src/common/dsp/effect/Reverb1Effect.cpp + src/common/dsp/effect/Reverb2Effect.cpp + src/common/dsp/effect/RotarySpeakerEffect.cpp + src/common/dsp/effect/VocoderEffect.cpp + src/common/dsp/AdsrEnvelope.cpp + src/common/dsp/BiquadFilter.cpp + src/common/dsp/BiquadFilterSSE2.cpp + src/common/dsp/DspUtilities.cpp + src/common/dsp/FilterCoefficientMaker.cpp + src/common/dsp/FMOscillator.cpp + src/common/dsp/LfoModulationSource.cpp + src/common/dsp/Oscillator.cpp + src/common/dsp/QuadFilterChain.cpp + src/common/dsp/QuadFilterUnit.cpp + src/common/dsp/SampleAndHoldOscillator.cpp + src/common/dsp/SurgeSuperOscillator.cpp + src/common/dsp/SurgeVoice.cpp + src/common/dsp/VectorizedSvfFilter.cpp + src/common/dsp/Wavetable.cpp + src/common/dsp/WavetableOscillator.cpp + src/common/dsp/WindowOscillator.cpp + src/common/thread/CriticalSection.cpp + src/common/util/FpuState.cpp + src/common/vt_dsp/basic_dsp.cpp + src/common/vt_dsp/halfratefilter.cpp + src/common/vt_dsp/lipol.cpp + src/common/vt_dsp/macspecific.cpp + src/common/Parameter.cpp + src/common/precompiled.cpp + src/common/Sample.cpp + src/common/SampleLoadRiffWave.cpp + src/common/SurgeError.cpp + src/common/SurgePatch.cpp + src/common/SurgeStorage.cpp + src/common/SurgeStorageLoadWavetable.cpp + src/common/SurgeSynthesizer.cpp + src/common/SurgeSynthesizerIO.cpp + src/common/UserDefaults.cpp + libs/xml/tinyxml.cpp + libs/xml/tinyxmlerror.cpp + libs/xml/tinyxmlparser.cpp + libs/filesystem/filesystem.cpp +) + +set(SURGE_COMMON_INCLUDES + libs/ + libs/filesystem + libs/xml + src/common + src/common/dsp + src/common/gui + src/common/thread + src/common/vt_dsp + vst3sdk + vstgui.surge +) + +add_executable(surge-headless + ${SURGE_COMMON_SOURCES} + src/headless/main.cpp + src/headless/DisplayInfoHeadless.cpp + src/headless/UserInteractionsHeadless.cpp + src/headless/LinkFixesHeadless.cpp +) + +target_compile_features(surge-headless + PRIVATE + cxx_std_17 +) + +target_compile_definitions(surge-headless + PRIVATE + TARGET_HEADLESS=1 +) + +target_include_directories(surge-headless + PRIVATE + ${SURGE_COMMON_INCLUDES} + src/headless +) + +if (APPLE) + target_compile_definitions(surge-headless + PRIVATE + MAC=1 + MAC_COCOA=1 + COCOA=1 + OBJC_OLD_DISPATCH_PROTOTYPES=1 + ) + + target_compile_options(surge-headless + PRIVATE + -msse2 + "-D_aligned_malloc(x,a)=malloc(x)" + "-D_aligned_free(x)=free(x)" + ) + + target_include_directories(surge-headless + PRIVATE + ${SURGE_COMMON_INCLUDES} + src/mac + ) + + target_link_libraries(surge-headless + "-framework ApplicationServices" + "-framework CoreFoundation" + ) +endif() diff --git a/build-osx.sh b/build-osx.sh index dbdf74f1600..b4193da7e3c 100755 --- a/build-osx.sh +++ b/build-osx.sh @@ -126,6 +126,13 @@ run_clean() xcodebuild clean -configuration Release -project surge-${flavor}.xcodeproj } +run_clean_headless() +{ + echo + echo "Cleaning build - headless" + xcodebuild clean -configuration Release -project build/Surge.xcodeproj +} + run_build() { flavor=$1 @@ -158,6 +165,44 @@ run_build() fi } +run_build_headless() +{ + mkdir -p build_logs + + echo + echo Building surge-headless with output in build_logs/build_headless.log + + mkdir build + cmake -GXcode -Bbuild + + # Don't let TEE eat my return status + set -o pipefail + if [[ -z "$OPTION_verbose" ]]; then + xcodebuild build -configuration Release \ + -project build/Surge.xcodeproj > \ + build_logs/build_headless.log + else + xcodebuild build -configuration Release \ + -project build/Surge.xcodeproj | \ + tee build_logs/build_headless.log + fi + + build_suc=$? + set +o pipefail + + if [[ $build_suc = 0 ]]; then + echo ${GREEN}Build of surge-headless succeeded${NC} + else + echo + echo ${RED}** Build of headless failed**${NC} + grep -i ": error" build_logs/build_headless.log + echo + echo Complete information is in build_logs/build_headless.log + + exit 2 + fi +} + default_action() { run_premake @@ -182,7 +227,7 @@ run_all_builds() run_build "vst3" run_build "au" - run_build "headless" + run_build_headless } run_install_local() @@ -241,7 +286,7 @@ run_clean_builds() run_clean "vst3" run_clean "au" - run_clean "headless" + run_clean_headless } run_clean_all() @@ -325,7 +370,7 @@ case $command in ;; --build-headless) run_premake_if - run_build "headless" + run_build_headless ;; --clean) run_clean_builds diff --git a/src/common/dsp/VectorizedSvfFilter.cpp b/src/common/dsp/VectorizedSvfFilter.cpp index a6f7572ed55..1e0671164d5 100644 --- a/src/common/dsp/VectorizedSvfFilter.cpp +++ b/src/common/dsp/VectorizedSvfFilter.cpp @@ -1,8 +1,8 @@ #include +#include "globals.h" #include "VectorizedSvfFilter.h" - //================================================================================================ //------------------------------------------------------------------------------------------------ diff --git a/src/common/vt_dsp/shared.h b/src/common/vt_dsp/shared.h index fc2c49ce235..33f41860cfe 100644 --- a/src/common/vt_dsp/shared.h +++ b/src/common/vt_dsp/shared.h @@ -1,8 +1,6 @@ #pragma once -#if LINUX -#include -#endif +#include "globals.h" inline float i2f_binary_cast(int i) { diff --git a/src/headless/LinkFixesHeadless.cpp b/src/headless/LinkFixesHeadless.cpp index 4da785dcb17..dd3397bc6f3 100644 --- a/src/headless/LinkFixesHeadless.cpp +++ b/src/headless/LinkFixesHeadless.cpp @@ -6,7 +6,7 @@ ** but for the meantime lets add this file to patch the link ** errors */ -#if LINUX +#if LINUX || MAC namespace VSTGUI { void doAssert(const char*, const char*, const char*)