-
Notifications
You must be signed in to change notification settings - Fork 85
Building the SWS Extension
Software requirements:
- A CMake-supported build system or IDE (eg. GNU make, Ninja, Visual Studio–see the Generators section below)
- A C++11 compiler (MSVC on Windows)
- CMake 3.13.3 or newer
- git, Perl (optional) and PHP
Supported platforms:
- Linux (x86_64, i686, armv7l, aarch64)
- macOS (x86_64, i386, arm64)
- Windows (x64, x86)
MSVC can be installed with the Build Tools for Visual
Studio
or the Visual Studio IDE. On macOS 10.10+, the build tools can be installed using
xcode-select --install
or the Xcode IDE (version 7 or newer, up to version 9 for 32-bit support).
# Step 1: Clone the repository and submodules
git clone --recursive https://github.com/reaper-oss/sws
cd sws
# Step 2: Create and configure a build tree
cmake -B build -DCMAKE_BUILD_TYPE=Debug
# Step 3: Compile SWS
cmake --build build
# or additionally copy it into your REAPER resource path
cmake --build build --target install
# Step 4 (optional): Generate distribution packages
(cd build && cpack)
The following targets are available:
-
all
: Build SWS and the Python ReaScript API wrapper (default target) -
clean
: Delete all generated files (can be run before building another target using--clean-first
) -
install
: Build and install SWS into REAPER's resource directory (as specified inCMAKE_INSTALL_PREFIX
) -
langpack
: Generate SWS_Template.ReaperLangPack into <build dir>/BuildUtils -
whatsnew
: Generate whatsnew.html into <build dir>/BuildUtils
cmake -B build \
-DBUILD_SWS_PYTHON=YES \ # requires Perl
-DUSE_SYSTEM_TAGLIB=NO \
-DCMAKE_BUILD_TYPE=Release \ # Debug, Release, RelWithDebInfo or MinSizeRel
-DCMAKE_OSX_ARCHITECTURES=x86_64 \ # i386, x86_64 or arm64
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.5 \ # lowest supported macOS version
-DCMAKE_INSTALL_PREFIX="/path/to/reaper/resource/directory"
# Default install prefix:
# Linux: ~/.config/REAPER
# macOS: ~/Library/Application Support/REAPER
# Windows: %APPDATA%\REAPER
Multiple build configurations can be setup as subdirectories of the build
folder (it's .gitignore-ed to not clutter the main source tree).
cmake -B build/debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build/debug
cmake -B build/release -DCMAKE_BUILD_TYPE=Release
cmake --build build/release
By default CMake generates Unix Makefiles on Linux & macOS and Visual Studio project files on Windows.
cmake -B build -G Ninja # faster & recommended (use x64 or x86 Native Tools Command Prompt for VS20XX)
cmake -B build -G "Visual Studio 16 2019" -A x64
cmake -B build -G "Visual Studio 15 2017 Win64"
cmake -B build -G Xcode
CMAKE_BUILD_TYPE
has no effect when using multi-configuration generators such
as the Visual Studio or Xcode project generators. The build type is instead set
using the --config
option in the build phase.
cmake --build build --config RelWithDebInfo
Learn more about CMake Generators
(Visual Studio 2019 or newer)
Use "Open a local folder" or File > Open > CMake. Visual Studio defaults to the Ninja generator when opening a CMake-based source directory.
Put your REAPER installation's resource path into Visual Studio's
CMakeSettings.json > Show advanced settings > Install directory or the
"installRoot"
key (save to apply the new settings).
In View > Solution explorer: click on "Switch view" in the toolbar and select "CMake Targets View". Right click on "sws (shared library)":
- Set As Startup Project > reaper_sws-x64.dll (Install)
- Debug and launch settings > reaper_sws-x64.dll (Install)
- Write the path to your reaper.exe in the
"exe"
key (launch.vs.json). Backslashes must be escaped.