Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
142 lines (134 loc) · 6.72 KB
/
Copy pathCMakeLists.txt
File metadata and controls
142 lines (134 loc) · 6.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#
# clap-wrapper project
#
# Copyright (c) 2022-2026 Timo Kaluza (defiantnerd)
# Paul Walker (baconpaul)
#
# There are a variety of advanced options to configure and build this wrapper, but
# for the simple case of a single plugin in a single clap, here are the relevant
# cmake-time options which this wrapper will use. See the wiki
# (https://github.com/free-audio/clap-wrapper/wiki) for a more complete description.
#
# SDK locations
# -------------
# Each SDK is resolved in this order:
# 1. an explicitly set <FOO>_SDK_ROOT cache variable
# 2. if CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES is ON, a CPM download from github
# 3. a search for the SDK directory in ./libs/<name>, ./<name> and ../<name>
#
# CLAP_SDK_ROOT The location of the CLAP SDK (directory name 'clap')
# VST3_SDK_ROOT The location of the VST3 SDK (directory name 'vst3sdk')
# AUDIOUNIT_SDK_ROOT The location of Apple's AudioUnitSDK (directory name
# 'AudioUnitSDK'); only needed for AUv2 builds. AUv3 uses
# system frameworks only and needs no extra SDK.
# AAX_SDK_ROOT The location of the AAX SDK (directory name 'aax');
# only needed for AAX builds
# RTAUDIO_SDK_ROOT The location of RtAudio (directory name 'rtaudio');
# only needed for standalone builds
# RTMIDI_SDK_ROOT The location of RtMidi (directory name 'rtmidi');
# only needed for standalone builds
# WIL_SDK_ROOT The location of the Windows Implementation Library
# (directory name 'wil'); only needed for standalone
# builds on Windows
#
# Which formats are built
# -----------------------
# When this project is the top level, a VST3 wrapper is always built, and AAX
# is built whenever the toolchain supports it (macOS, or Windows with MSVC on
# x64). The other formats are opt-in:
#
# CLAP_WRAPPER_BUILD_AUV2 Build the AUv2 wrapper (.component); requires the AudioUnitSDK
# CLAP_WRAPPER_BUILD_AUV3 Build the AUv3 app extension (.appex) plus its standalone
# host app; requires the Xcode generator (-G Xcode)
# CLAP_WRAPPER_BUILD_AAX Build the AAX wrapper; only effective where AAX is supported
# (macOS and non-ARM MSVC Windows, never Linux) and requires
# the AAX SDK
# CLAP_WRAPPER_BUILD_STANDALONE Build a simple standalone executable hosting the CLAP
# CLAP_WRAPPER_BUILD_TESTS Build the test CLAP wrappers
#
# Naming and packaging
# --------------------
# CLAP_WRAPPER_OUTPUT_NAME The name of the resulting .vst3/.component/.appex/executable;
# also the name of the .clap the wrapper loads. Defaults to
# 'clapasvst3' (with a warning)
# CLAP_WRAPPER_BUNDLE_IDENTIFIER The macOS/iOS bundle identifier. Defaults to
# 'org.cleveraudio.wrapper.(name)(.suffix)'; AUv3 appends
# '.auv3' (appex) and '.auv3standalone' (host app)
# CLAP_WRAPPER_BUNDLE_VERSION The macOS/iOS bundle version. Defaults to 1.0
# CLAP_WRAPPER_WINDOWS_SINGLE_FILE If TRUE (default) the windows .vst3 is a single file;
# if FALSE, a VST3 3.7-spec folder bundle
#
# Behavior and build environment
# ------------------------------
# CLAP_SUPPORTS_ALL_NOTE_EXPRESSIONS Forward all VST3 note expressions to your CLAP
# without asking it via the wrapper extension
# CLAP_VST3_TUID_STRING The VST3 component ::iid as a string; absent this, the
# wrapper hashes the clap id
# CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES Download the needed SDKs at configure time using
# CPM from github
# CLAP_WRAPPER_COPY_AFTER_BUILD After building, copy the plugin into the user's
# plugin directory (~/Library/Audio/Plug-Ins/... on
# macOS, ~/.vst3 on Linux)
# CLAP_WRAPPER_CXX_STANDARD The C++ standard to compile with. Defaults to 17
cmake_minimum_required(VERSION 3.21)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0149 NEW)
if (NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
message(STATUS "[clap-wrapper]: OSX_DEPLOYMENT_TARGET is undefined. Setting to 10.13")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS version")
endif()
if (NOT DEFINED CMAKE_OSX_ARCHITECTURES)
message(STATUS "[clap-wrapper]: CMAKE_OSX_ARCHITECTURES is not set. Using native build for clap wrapper")
endif()
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
if (WIN32)
message(STATUS "CMAKE_MSVC_RUNTIME_LIBRARY not defined. Setting to static link")
endif()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") # Statically link the MSVC Runtime
endif()
set(CMAKE_COLOR_DIAGNOSTICS ON)
# If your clap supports note expressions you *can* implement the wrapper extension here or you
# can just build with this turned on and it will forward all note expressions to your CLAP
option(CLAP_SUPPORTS_ALL_NOTE_EXPRESSIONS "Does the underlying CLAP support note expressions" OFF)
option(CLAP_WRAPPER_WINDOWS_SINGLE_FILE "Build a single fine (rather than folder) on windows" ON)
option(CLAP_WRAPPER_BUILD_TESTS "Build test CLAP wrappers" OFF)
project(clap-wrapper
LANGUAGES C CXX
VERSION 0.16.0
DESCRIPTION "CLAP-as-X wrappers"
)
set(CLAP_WRAPPER_VERSION "${PROJECT_VERSION}" CACHE STRING "Version of the wrapper project")
message(STATUS "clap-wrapper: CLAP_WRAPPER_VERSION is ${CLAP_WRAPPER_VERSION}")
if (APPLE)
enable_language(OBJC)
enable_language(OBJCXX)
endif()
if (PROJECT_IS_TOP_LEVEL)
if (DEFINED CLAP_WRAPPER_CXX_STANDARD)
set(CMAKE_CXX_STANDARD ${CLAP_WRAPPER_CXX_STANDARD})
else()
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
add_compile_options(/std:c++17 /Zc:__cplusplus)
endif()
elseif ( ${CMAKE_CXX_STANDARD} VERSION_LESS 17)
message(WARNING "CMAKE_CXX_STANDARD of ${CMAKE_CXX_STANDARD} < 17 not well tested")
endif()
endif()
endif()
message(STATUS "clap-wrapper: Building with C++ standard ${CMAKE_CXX_STANDARD}")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_OBJC_VISIBILITY_PRESET hidden)
set(CMAKE_OBJCXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
# discover the plugin paths and enable them. The library
# defines functions relative to this, so needs a cache
# variable with the source dir
set(CLAP_WRAPPER_CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Clap Wrapper Source Location")
include(cmake/wrapper_functions.cmake)
include(cmake/top_level_default.cmake)
if (${CLAP_WRAPPER_BUILD_TESTS})
add_subdirectory(tests)
endif()