build: extract CMake plugin/harness modules and add platform build scripts

Split CMakeLists.txt into cmake/Plugin.cmake (production formats and
MinGW link flags) and cmake/Harness.cmake (console test harness with
CTest registration). Add SERUMALT_BUILD_PLUGIN and SERUMALT_BUILD_TESTS
options so production and harness builds are mutually exclusive and
each omits the other's targets.

Add build_linux.sh, build_macos.sh, and build_harness.sh with host
validation, env-overridable build dirs, and explicit option flags.
Rewrite build_windows.sh to use the checked-in mingw64-toolchain.cmake
instead of regenerating it, validate all required tools, and stage
with cmake -E copy_directory.

Broaden .gitignore to cover all build_*/ directories.
This commit is contained in:
2026-09-09 13:24:09 +02:00
parent a1feeb76f0
commit f10409ad1e
8 changed files with 260 additions and 118 deletions
+27 -63
View File
@@ -9,43 +9,20 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(SERUMALT_BUILD_PLUGIN "Build production plugin and standalone formats" ON)
option(SERUMALT_BUILD_TESTS "Build the headless QA harness" OFF)
if(NOT SERUMALT_BUILD_PLUGIN AND NOT SERUMALT_BUILD_TESTS)
message(FATAL_ERROR "Enable SERUMALT_BUILD_PLUGIN or SERUMALT_BUILD_TESTS")
endif()
# ---------------------------------------------------------------------------
# JUCE
# ---------------------------------------------------------------------------
if(NOT DEFINED JUCE_ROOT)
set(JUCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/JUCE")
endif()
add_subdirectory("${JUCE_ROOT}")
# ---------------------------------------------------------------------------
# Plugin target
# ---------------------------------------------------------------------------
# JUCE 7.0.12 builds its VST3 manifest helper (juce_vst3_helper) with the same
# toolchain as the plugin itself. When cross-compiling, that produces a Windows
# .exe which cannot run on the Linux build host, so we disable the automatic
# manifest step and inject a platform-independent moduleinfo.json afterwards
# (see build_windows.sh). Native builds keep the automatic step.
set(SERUMALT_VST3_AUTO_MANIFEST TRUE)
if(CMAKE_CROSSCOMPILING)
set(SERUMALT_VST3_AUTO_MANIFEST FALSE)
endif()
juce_add_plugin(SerumAlt
VERSION 1.0.0
COMPANY_NAME "SerumAlt Audio"
IS_SYNTH TRUE
NEEDS_MIDI_INPUT TRUE
NEEDS_MIDI_OUTPUT FALSE
IS_MIDI_EFFECT FALSE
EDITOR_WANTS_KEYBOARD_FOCUS FALSE
PLUGIN_MANUFACTURER_CODE Salt
PLUGIN_CODE Sera
BUNDLE_ID com.serumalt.SerumAlt
FORMATS VST3 AU Standalone
PRODUCT_NAME "SerumAlt"
VST3_AUTO_MANIFEST ${SERUMALT_VST3_AUTO_MANIFEST})
juce_generate_juce_header(SerumAlt)
add_subdirectory("${JUCE_ROOT}" "${CMAKE_CURRENT_BINARY_DIR}/third_party/JUCE")
set(SERUMALT_SOURCES
Source/PluginProcessor.cpp
@@ -86,46 +63,33 @@ set(SERUMALT_SOURCES
Source/GUI/Panel.cpp
Source/Presets/FactoryPresets.cpp)
target_sources(SerumAlt PRIVATE ${SERUMALT_SOURCES})
target_compile_definitions(SerumAlt
PUBLIC
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0)
target_link_libraries(SerumAlt
PRIVATE
juce::juce_audio_utils
juce::juce_dsp
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_warning_flags)
# ---------------------------------------------------------------------------
# Headless QA harness (console app that drives the processor and checks output)
# ---------------------------------------------------------------------------
option(SERUMALT_BUILD_TESTS "Build the headless QA harness" ON)
if(SERUMALT_BUILD_TESTS)
juce_add_console_app(SerumAltTest)
juce_generate_juce_header(SerumAltTest)
target_sources(SerumAltTest PRIVATE ${SERUMALT_SOURCES} Source/Tests/TestMain.cpp)
target_compile_definitions(SerumAltTest
function(serumalt_configure_target target)
juce_generate_juce_header(${target})
target_sources(${target} PRIVATE ${SERUMALT_SOURCES})
target_compile_definitions(${target}
PUBLIC
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0)
target_link_libraries(SerumAltTest
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0)
target_link_libraries(${target}
PRIVATE
juce::juce_audio_utils
juce::juce_dsp
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_warning_flags)
if(MSVC)
target_compile_options(${target} PRIVATE /W4)
else()
target_compile_options(${target} PRIVATE -Wall -Wextra)
endif()
endfunction()
if(SERUMALT_BUILD_PLUGIN)
include(cmake/Plugin.cmake)
endif()
if(MSVC)
target_compile_options(SerumAlt PRIVATE /W4)
else()
target_compile_options(SerumAlt PRIVATE -Wall -Wextra)
if(SERUMALT_BUILD_TESTS)
enable_testing()
include(cmake/Harness.cmake)
endif()