Skip to content

Commit

Permalink
Merge pull request surge-synthesizer#670 from jsakkine/cmake-headless…
Browse files Browse the repository at this point in the history
…-mac

cmake: Headless version for macOS
Former-commit-id: 7fd2406f821c07c2154eb63497cb328bdddac844 [formerly 5792f61]
Former-commit-id: 0f736517eef719e11cda41ab7c72d389d5329a04
Former-commit-id: 4b1ac312bf38af40d7617fed5e223c20d0e1ffee
  • Loading branch information
jarkkojs authored Feb 27, 2019
2 parents 12c7659 + 2a53a5a commit 838cb66
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 8 deletions.
118 changes: 118 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
51 changes: 48 additions & 3 deletions build-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -182,7 +227,7 @@ run_all_builds()

run_build "vst3"
run_build "au"
run_build "headless"
run_build_headless
}

run_install_local()
Expand Down Expand Up @@ -241,7 +286,7 @@ run_clean_builds()

run_clean "vst3"
run_clean "au"
run_clean "headless"
run_clean_headless
}

run_clean_all()
Expand Down Expand Up @@ -325,7 +370,7 @@ case $command in
;;
--build-headless)
run_premake_if
run_build "headless"
run_build_headless
;;
--clean)
run_clean_builds
Expand Down
2 changes: 1 addition & 1 deletion src/common/dsp/VectorizedSvfFilter.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <math.h>

#include "globals.h"
#include "VectorizedSvfFilter.h"


//================================================================================================

//------------------------------------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions src/common/vt_dsp/shared.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#pragma once

#if LINUX
#include <immintrin.h>
#endif
#include "globals.h"

inline float i2f_binary_cast(int i)
{
Expand Down
2 changes: 1 addition & 1 deletion src/headless/LinkFixesHeadless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down

0 comments on commit 838cb66

Please sign in to comment.