Skip to content

Commit

Permalink
Revert "A Unity Build for surge (#7771)" (#7773)
Browse files Browse the repository at this point in the history
This reverts commit 980c98a.
This reversion is, I hope, temporary while we hunt and sort out
the crash in #7772
  • Loading branch information
baconpaul authored Aug 24, 2024
1 parent 7fc0c4b commit 200851c
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 274 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,6 @@ jobs:
cmakeOpt: RELEASE
runTests: true

- name: "windows unity clang"
os: windows-latest
target: surge-xt surge-fx
cmakeConfig: -GNinja -DCMAKE_UNITY_BUILD=TRUE -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
cmakeOpt: DEBUG
runTests: false

- name: "ubuntu unity"
os: ubuntu-latest
target: surge-xt surge-fx
cmakeConfig: -GNinja -DCMAKE_UNITY_BUILD=TRUE
cmakeOpt: DEBUG
runTests: false

- name: "macos unity"
os: macos-latest
target: surge-xt surge-fx
cmakeConfig: -GNinja -DCMAKE_UNITY_BUILD=TRUE -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
cmakeOpt: DEBUG
runTests: false

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
90 changes: 89 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,95 @@ add_library(simde INTERFACE)
target_include_directories(simde INTERFACE ${SURGE_SIMDE_PATH})
add_library(surge::simde ALIAS simde)

include (cmake/setup-juce.cmake)
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=$<IF:$<BOOL:${SURGE_USE_ALSA}>,1,0>
JUCE_JACK=$<IF:$<NOT:$<BOOL:${SURGE_SKIP_STANDALONE}>>,1,0>

JUCE_WASAPI=$<IF:$<NOT:$<BOOL:${SURGE_SKIP_STANDALONE}>>,1,0>
JUCE_DIRECTSOUND=$<IF:$<NOT:$<BOOL:${SURGE_SKIP_STANDALONE}>>,1,0>

JUCE_CATCH_UNHANDLED_EXCEPTIONS=0
)

if (NOT SURGE_SKIP_JUCE_FOR_RACK)
target_link_libraries(surge-juce INTERFACE melatonin_inspector)
endif()

if(NOT SURGE_SKIP_VST3)
list(APPEND SURGE_JUCE_FORMATS VST3)
endif()

if(NOT SURGE_SKIP_STANDALONE)
list(APPEND SURGE_JUCE_FORMATS Standalone)
endif()

if(APPLE AND NOT CMAKE_CROSSCOMPILING)
# AU requires the Rez resource compiler, which seems to be unavailable on osxcross
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 "VST2 SDK path is $ENV{VST2SDK_DIR}")
# VST2 headers are invalid UTF-8
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/wd4828>)
endif()

if(SURGE_BUILD_LV2)
list(APPEND SURGE_JUCE_FORMATS LV2)
message(STATUS "Including JUCE7 LV2 support.")
endif()


if(DEFINED ENV{ASIOSDK_DIR} OR BUILD_USING_MY_ASIO_LICENSE)
if(BUILD_USING_MY_ASIO_LICENSE)
message(STATUS "** BUILD USING OWN ASIO LICENSE **")
message(STATUS "The resulting Surge standalone executable is not licensed for distribution!")
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)
else()
file(TO_CMAKE_PATH "$ENV{ASIOSDK_DIR}" ASIOSDK_DIR)
message(STATUS "ASIO SDK found at ${ASIOSDK_DIR}")
message(STATUS "The resulting Surge standalone executable is not licensed for distribution!")
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 XT using the following JUCE wrappers: ${SURGE_JUCE_FORMATS}")

add_subdirectory(common)
add_subdirectory(lua)
Expand Down
163 changes: 0 additions & 163 deletions src/cmake/setup-juce.cmake

This file was deleted.

16 changes: 4 additions & 12 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ surge_add_lib_subdirectory(fmt)
# Make MTS optional
if(NOT SURGE_SKIP_ODDSOUND_MTS)
surge_add_lib_subdirectory(oddsound-mts)
set_target_properties(oddsound-mts PROPERTIES UNITY_BUILD FALSE)
else()
add_library(oddsound-mts INTERFACE)
target_compile_definitions(oddsound-mts INTERFACE SURGE_SKIP_ODDSOUND_MTS)
Expand All @@ -31,8 +30,6 @@ endif()
surge_add_lib_subdirectory(sst/sst-basic-blocks)
surge_add_lib_subdirectory(sst/sst-cpputils)
surge_add_lib_subdirectory(sst/sst-plugininfra)
set_target_properties(sst-plugininfra PROPERTIES UNITY_BUILD FALSE)

surge_add_lib_subdirectory(sst/sst-filters)
surge_add_lib_subdirectory(sst/sst-waveshapers)
surge_add_lib_subdirectory(sst/sst-effects)
Expand All @@ -53,11 +50,8 @@ if(NOT SURGE_SKIP_JUCE_FOR_RACK)
${SURGE_SOURCE_DIR}/resources/surge-shared/README_UserArea.txt
${SURGE_SOURCE_DIR}/resources/surge-shared/windows.wt
)
set_target_properties(surge-common-binary PROPERTIES UNITY_BUILD FALSE)
target_compile_definitions(surge-common-binary PUBLIC HAS_JUCE=1 SKIP_JUCE=0)

add_library(local_common_juce_libs INTERFACE)
target_link_libraries(local_common_juce_libs INTERFACE surge-juce-for-surge-common)
else()
# So what the heck is this? Well a few effects use juce_dsp so this
# is code which skips the entire juce build infrastructure but buids the
Expand Down Expand Up @@ -99,7 +93,7 @@ else()
)
target_include_directories(juce_dsp_rack_sub PUBLIC ${SURGE_JUCE_PATH}/modules)

add_library(local_common_juce_libs ALIAS juce_dsp_rack_sub)
add_library(juce::juce_dsp ALIAS juce_dsp_rack_sub)
endif()

add_library(${PROJECT_NAME}
Expand Down Expand Up @@ -356,8 +350,6 @@ if(SURGE_RELIABLE_VERSION_INFO)
-D CMAKE_CXX_COMPILER_VERSION=${CMAKE_CXX_COMPILER_VERSION}
-P ${SURGE_SOURCE_DIR}/cmake/versiontools.cmake
)
set_source_files_properties(${CMAKE_BINARY_DIR}/geninclude/version.cpp
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
add_dependencies(${PROJECT_NAME} version-info)
else()
set(SURGESRC ${SURGE_SOURCE_DIR})
Expand Down Expand Up @@ -390,13 +382,13 @@ target_link_libraries(${PROJECT_NAME}
surge::sqlite
surge-common-binary
tuning-library
surge-lua-src

PRIVATE
surge-lua-src
surge-platform
surge-juce
taocpp::pegtl
PRIVATE
local_common_juce_libs
juce::juce_dsp
)

target_compile_definitions(${PROJECT_NAME} PRIVATE
Expand Down
4 changes: 0 additions & 4 deletions src/common/dsp/oscillators/ModernOscillator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
* https://github.com/surge-synthesizer/surge
*/

#ifndef SURGE_SRC_MODERN_OSC_H
#define SURGE_SRC_MODERN_OSC_H

#include "OscillatorBase.h"
#include "DSPUtils.h"
#include "OscillatorCommonFunctions.h"
Expand Down Expand Up @@ -101,4 +98,3 @@ class ModernOscillator : public Oscillator
};

const char mo_multitype_names[3][16] = {"Triangle", "Square", "Sine"};
#endif
4 changes: 2 additions & 2 deletions src/common/dsp/oscillators/WavetableOscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace mech = sst::basic_blocks::mechanics;

using namespace std;

const float wavetable_hpf_cycle_loss = 0.99f;
const float hpf_cycle_loss = 0.99f;

WavetableOscillator::WavetableOscillator(SurgeStorage *storage, OscillatorStorage *oscdata,
pdata *localcopy)
Expand Down Expand Up @@ -376,7 +376,7 @@ template <bool is_init> void WavetableOscillator::update_lagvals()
float invt = min(1.0, (8.175798915 * storage->note_to_pitch_tuningctr(pitch_t)) *
storage->dsamplerate_os_inv);
// TODO: Make a lookup table
float hpf2 = min(integrator_hpf, powf(wavetable_hpf_cycle_loss, 4 * invt));
float hpf2 = min(integrator_hpf, powf(hpf_cycle_loss, 4 * invt));

hpf_coeff.newValue(hpf2);
integrator_mult.newValue(invt);
Expand Down
Loading

0 comments on commit 200851c

Please sign in to comment.