Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
281 lines (248 loc) · 10.5 KB
/
Copy pathCMakeLists.txt
File metadata and controls
281 lines (248 loc) · 10.5 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
cmake_minimum_required(VERSION 3.22)
# These two MUST be set before project(). CMake's platform module creates both cache
# entries while project() runs, and a later `set(... CACHE ...)` without FORCE is then
# silently ignored — which is how a "universal" macOS build quietly ships as arm64 only.
# Guarded so an explicit -DCMAKE_OSX_ARCHITECTURES on the command line still wins.
if(NOT DEFINED CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "macOS build architectures")
endif()
if(NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum macOS deployment target")
endif()
project(SimpleCue VERSION 0.4.1 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# --------------------------------------------------------------------------------------
# Optional Steinberg ASIO SDK (Windows only).
#
# The ASIO SDK licence forbids redistribution, so it is never vendored here. Download it
# from https://www.steinberg.net/developers/ and point CMake at the unpacked folder:
#
# cmake -B build -DSIMPLECUE_ASIO_SDK_PATH=C:/SDKs/asiosdk_2.3.3
#
# Without it, Windows builds still get WASAPI (shared + exclusive) and DirectSound.
# --------------------------------------------------------------------------------------
set(SIMPLECUE_ASIO_SDK_PATH "" CACHE PATH "Path to the unpacked Steinberg ASIO SDK (Windows only)")
# --------------------------------------------------------------------------------------
# Build identity for crash reports.
#
# A compiled binary cannot read its own git revision at runtime, and a crash report that
# only carries a version number is useless during a show: the version has not changed
# since the last release, but the binary on the machine may be three commits past it.
# `-dirty` means the tree had uncommitted changes, so the sha alone does not identify
# the source that was built.
# --------------------------------------------------------------------------------------
find_package(Git QUIET)
set(SIMPLECUE_GIT_REV "unknown")
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short=12 HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE SIMPLECUE_GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND ${GIT_EXECUTABLE} status --porcelain --untracked-files=no
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE SIMPLECUE_GIT_DIRTY
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(NOT SIMPLECUE_GIT_REV)
set(SIMPLECUE_GIT_REV "unknown")
elseif(SIMPLECUE_GIT_DIRTY)
set(SIMPLECUE_GIT_REV "${SIMPLECUE_GIT_REV}-dirty")
endif()
endif()
message(STATUS "SimpleCue build revision: ${SIMPLECUE_GIT_REV}")
include(FetchContent)
FetchContent_Declare(
JUCE
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG 8.0.6
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(JUCE)
juce_add_gui_app(SimpleCue
COMPANY_NAME "Allan Sargeant"
BUNDLE_ID "com.allansargeant.simplecue"
PRODUCT_NAME "SimpleCue"
VERSION ${PROJECT_VERSION}
NEEDS_CURL FALSE
NEEDS_WEB_BROWSER FALSE
)
juce_generate_juce_header(SimpleCue)
target_sources(SimpleCue
PRIVATE
Source/Main.cpp
Source/App/MainComponent.cpp
Source/App/ScreenshotMode.cpp
Source/Diag/Diag.cpp
Source/Model/Cue.cpp
Source/Model/CueList.cpp
Source/Model/Show.cpp
Source/Model/FadeCurve.cpp
Source/Model/CueStep.cpp
Source/Model/ControlMessage.cpp
Source/Model/StreamingSettings.cpp
Source/Control/ControlHub.cpp
Source/Control/ControlSettings.cpp
Source/Control/DmxControl.cpp
Source/Control/DmxProtocol.cpp
Source/Control/MidiControl.cpp
Source/Control/OscControl.cpp
Source/Audio/AudioEngine.cpp
Source/Audio/CueVoice.cpp
Source/Audio/SampleSource.cpp
Source/Audio/SampleCache.cpp
Source/GUI/LookAndFeel.cpp
Source/GUI/TransportBar.cpp
Source/GUI/CueListComponent.cpp
Source/GUI/CueInspector.cpp
Source/GUI/WaveformComponent.cpp
Source/GUI/RoutingMatrixComponent.cpp
Source/GUI/AudioSetupWindow.cpp
Source/GUI/ActiveCuesComponent.cpp
Source/GUI/ControlSetupWindow.cpp
Source/GUI/SettingsWindow.cpp
)
target_include_directories(SimpleCue PRIVATE Source)
target_compile_definitions(SimpleCue
PRIVATE
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:SimpleCue,JUCE_PRODUCT_NAME>"
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:SimpleCue,JUCE_VERSION>"
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_MODAL_LOOPS_PERMITTED=0
DIAG_GIT_REV="${SIMPLECUE_GIT_REV}"
)
# ---- Audio backends -----------------------------------------------------------------
# Each backend is enabled only where its headers actually exist, so a build never fails
# looking for, say, jack/jack.h on a Mac.
if(WIN32)
# WASAPI shared and exclusive (exclusive is the low-latency path), plus DirectSound
# as the fallback for older or unusual drivers. ASIO is handled separately below.
target_compile_definitions(SimpleCue PRIVATE
JUCE_WASAPI=1
JUCE_WASAPI_EXCLUSIVE=1
JUCE_DIRECTSOUND=1)
elseif(APPLE)
# CoreAudio is always compiled in by JUCE on macOS; nothing to switch on.
# JACK is available on macOS too, but only if the user has installed its headers.
find_path(SIMPLECUE_JACK_INCLUDE_DIR jack/jack.h
PATHS /usr/local/include /opt/homebrew/include /usr/include)
if(SIMPLECUE_JACK_INCLUDE_DIR)
message(STATUS "SimpleCue: JACK support enabled (${SIMPLECUE_JACK_INCLUDE_DIR})")
target_compile_definitions(SimpleCue PRIVATE JUCE_JACK=1)
target_include_directories(SimpleCue PRIVATE ${SIMPLECUE_JACK_INCLUDE_DIR})
endif()
else()
# Linux. ALSA is the baseline; JACK covers pro audio setups. PipeWire needs neither
# of its own — it is reached through its ALSA and JACK compatibility layers, and
# appears there as an ordinary device.
target_compile_definitions(SimpleCue PRIVATE JUCE_ALSA=1)
find_path(SIMPLECUE_JACK_INCLUDE_DIR jack/jack.h PATHS /usr/include /usr/local/include)
if(SIMPLECUE_JACK_INCLUDE_DIR)
message(STATUS "SimpleCue: JACK support enabled")
target_compile_definitions(SimpleCue PRIVATE JUCE_JACK=1)
target_include_directories(SimpleCue PRIVATE ${SIMPLECUE_JACK_INCLUDE_DIR})
else()
message(STATUS "SimpleCue: JACK headers not found (install libjack-jackd2-dev "
"or pipewire-jack headers to enable it). ALSA remains available.")
endif()
endif()
# ---- ASIO ---------------------------------------------------------------------------
if(WIN32 AND SIMPLECUE_ASIO_SDK_PATH)
if(EXISTS "${SIMPLECUE_ASIO_SDK_PATH}/common/iasiodrv.h")
message(STATUS "SimpleCue: ASIO enabled (SDK at ${SIMPLECUE_ASIO_SDK_PATH})")
target_compile_definitions(SimpleCue PRIVATE JUCE_ASIO=1)
target_include_directories(SimpleCue PRIVATE "${SIMPLECUE_ASIO_SDK_PATH}/common")
else()
message(FATAL_ERROR
"SIMPLECUE_ASIO_SDK_PATH is set to '${SIMPLECUE_ASIO_SDK_PATH}' but "
"common/iasiodrv.h was not found there. Point it at the unpacked ASIO SDK root.")
endif()
elseif(WIN32)
message(STATUS "SimpleCue: ASIO disabled (set SIMPLECUE_ASIO_SDK_PATH to enable). "
"WASAPI and DirectSound remain available.")
endif()
# ---- Diagnostics crash example ------------------------------------------------------
# Deliberately crashes, so the crash handler is something that has been observed working
# rather than assumed. See docs/diagnostics.md.
juce_add_console_app(SimpleCueDiagCrash PRODUCT_NAME "SimpleCueDiagCrash")
target_sources(SimpleCueDiagCrash PRIVATE Tests/DiagCrashExample.cpp Source/Diag/Diag.cpp)
target_include_directories(SimpleCueDiagCrash PRIVATE Source)
target_compile_definitions(SimpleCueDiagCrash
PRIVATE
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_STANDALONE_APPLICATION=1
DIAG_GIT_REV="${SIMPLECUE_GIT_REV}")
target_link_libraries(SimpleCueDiagCrash
PRIVATE
juce::juce_core
juce::juce_events
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_warning_flags)
# ---- Engine tests -------------------------------------------------------------------
# Console harness that drives the real CueVoice with a ramp signal and checks positions,
# fades, loops and vamps numerically. Run with: ./build/SimpleCueTests
juce_add_console_app(SimpleCueTests PRODUCT_NAME "SimpleCueTests")
target_sources(SimpleCueTests
PRIVATE
Tests/EngineTests.cpp
Tests/ControlTests.cpp
Source/Model/Cue.cpp
Source/Model/CueList.cpp
Source/Model/Show.cpp
Source/Model/FadeCurve.cpp
Source/Model/CueStep.cpp
Source/Model/ControlMessage.cpp
Source/Model/StreamingSettings.cpp
Source/Control/ControlSettings.cpp
Source/Control/DmxProtocol.cpp
Source/Control/DmxControl.cpp
Source/Control/MidiControl.cpp
Source/Control/OscControl.cpp
Source/Audio/CueVoice.cpp
Source/Audio/SampleSource.cpp
Source/GUI/LookAndFeel.cpp)
target_include_directories(SimpleCueTests PRIVATE Source Tests)
target_compile_definitions(SimpleCueTests
PRIVATE
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_STANDALONE_APPLICATION=1
# So the suite can assert on the save path's source. The atomicity of a
# replace is a property of which API is called, not of any state a test
# can observe afterwards — see testShowSaveIsAtomic.
SIMPLECUE_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/Source")
target_link_libraries(SimpleCueTests
PRIVATE
juce::juce_audio_formats
juce::juce_audio_basics
juce::juce_audio_devices
juce::juce_events
juce::juce_gui_basics
juce::juce_osc
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_warning_flags)
enable_testing()
add_test(NAME engine COMMAND SimpleCueTests)
target_link_libraries(SimpleCue
PRIVATE
juce::juce_audio_utils
juce::juce_audio_devices
juce::juce_audio_formats
juce::juce_dsp
juce::juce_gui_extra
juce::juce_osc
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
)