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:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BUILD_DIR="${BUILD_DIR:-$SCRIPT_DIR/build_macos}"
|
||||
BUILD_TYPE="${BUILD_TYPE:-Release}"
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL="${CMAKE_BUILD_PARALLEL_LEVEL:-2}"
|
||||
|
||||
if [[ "$(uname -s)" != Darwin ]]; then
|
||||
echo "ERROR: build_macos.sh requires macOS and the Apple SDK." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for tool in cmake ninja xcrun "${CC:-clang}" "${CXX:-clang++}"; do
|
||||
if ! command -v "$tool" >/dev/null 2>&1; then
|
||||
echo "ERROR: $tool not found. See README.md prerequisites." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
xcrun --sdk macosx --show-sdk-path
|
||||
|
||||
OSX_OPTIONS=("-DCMAKE_BUILD_TYPE=$BUILD_TYPE")
|
||||
if [[ -n "${CMAKE_OSX_ARCHITECTURES:-}" ]]; then
|
||||
OSX_OPTIONS+=("-DCMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES")
|
||||
fi
|
||||
if [[ -n "${CMAKE_OSX_DEPLOYMENT_TARGET:-}" ]]; then
|
||||
OSX_OPTIONS+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET")
|
||||
fi
|
||||
|
||||
echo "Configuring macOS production targets in $BUILD_DIR ($BUILD_TYPE)..."
|
||||
cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" -G Ninja \
|
||||
"${OSX_OPTIONS[@]}" \
|
||||
-DSERUMALT_BUILD_PLUGIN=ON \
|
||||
-DSERUMALT_BUILD_TESTS=OFF
|
||||
|
||||
echo "Building macOS VST3, AU, and standalone..."
|
||||
cmake --build "$BUILD_DIR" --config "$BUILD_TYPE" --target SerumAlt_VST3 SerumAlt_AU SerumAlt_Standalone
|
||||
|
||||
echo "Done. macOS artifacts: $BUILD_DIR/SerumAlt_artefacts/$BUILD_TYPE"
|
||||
Reference in New Issue
Block a user