-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
487 lines (405 loc) · 17.7 KB
/
CMakeLists.txt
File metadata and controls
487 lines (405 loc) · 17.7 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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
cmake_minimum_required(VERSION 3.30)
project(PlugPatch LANGUAGES CXX)
option(ENABLE_ASAN "Enable Address Sanitizer" ON)
option(RUN_TESTS "Build and run tests" OFF)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
if (ENABLE_ASAN AND MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL" CACHE STRING "" FORCE)
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "" FORCE)
endif()
# Define the Git command to get the full commit hash
set(BUILDINFO_CPP ${CMAKE_BINARY_DIR}/GitInfo.cpp)
# Read .git/HEAD to determine the current ref file.
file(READ "${CMAKE_SOURCE_DIR}/.git/HEAD" HEAD_CONTENTS)
string(REGEX MATCH "ref: (.*)" _ ${HEAD_CONTENTS})
if(CMAKE_MATCH_1)
# Construct the full path to the ref file.
set(GIT_REF_FILE "${CMAKE_SOURCE_DIR}/.git/${CMAKE_MATCH_1}")
message(STATUS "Git ref file: ${GIT_REF_FILE}")
else()
# If HEAD doesn't contain a ref (detached head), fallback to HEAD.
set(GIT_REF_FILE "${CMAKE_SOURCE_DIR}/.git/HEAD")
endif()
set(GIT_VERSION_FILE "${CMAKE_BINARY_DIR}/GitVersion.txt")
add_custom_command(
OUTPUT ${BUILDINFO_CPP}
COMMAND ${CMAKE_COMMAND}
-DOUTPUT_FILE=${BUILDINFO_CPP}
-DGIT_VERSION_FILE=${GIT_VERSION_FILE}
-P ${CMAKE_SOURCE_DIR}/GenerateGitInfo.cmake
DEPENDS ${CMAKE_SOURCE_DIR}/.git/HEAD ${GIT_REF_FILE}
COMMENT "Generating buildinfo.cpp with updated Git info"
VERBATIM
)
add_custom_command(
OUTPUT ${BUILDINFO_CPP}
COMMAND ${CMAKE_COMMAND}
-DOUTPUT_FILE=${BUILDINFO_CPP}
-DGIT_VERSION_FILE=${GIT_VERSION_FILE}
-P ${CMAKE_SOURCE_DIR}/GenerateGitInfo.cmake
DEPENDS ${CMAKE_SOURCE_DIR}/.git/HEAD ${GIT_REF_FILE}
COMMENT "Generating buildinfo.cpp with updated Git info"
VERBATIM
)
add_custom_target(update_git_version ALL DEPENDS ${BUILDINFO_CPP})
# Check GitVersion.txt if it exists
if (EXISTS "${CMAKE_BINARY_DIR}/GitVersion.txt")
file(READ "${CMAKE_BINARY_DIR}/GitVersion.txt" PATCHFORM_VERSION_STRING)
string(STRIP "${PATCHFORM_VERSION_STRING}" PATCHFORM_VERSION_STRING)
else()
set(PATCHFORM_VERSION_STRING "dev")
endif()
message(STATUS "Detected Patchform version: ${PATCHFORM_VERSION_STRING}")
# Strip leading 'v' and extra stuff (e.g., "-alpha-17")
string(REGEX REPLACE "^v([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1,\\2,\\3,0" PATCHFORM_VERSION_COMMA "${PATCHFORM_VERSION_STRING}")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/patchformicon.ico"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/installer/windows/patchformicon.ico"
"${CMAKE_BINARY_DIR}/patchformicon.ico"
DEPENDS "${CMAKE_SOURCE_DIR}/installer/windows/patchformicon.ico"
COMMENT "Copying patchformicon.ico"
)
add_custom_target(copy_icon ALL DEPENDS "${CMAKE_BINARY_DIR}/patchformicon.ico")
set(PATCHFORM_ICON_PATH "${CMAKE_BINARY_DIR}/patchformicon.ico")
configure_file(
${CMAKE_SOURCE_DIR}/installer/windows/resources.rc.in
${CMAKE_BINARY_DIR}/version.rc
@ONLY
)
# Toggle AVX2 for Glaze based on build type
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(glaze_ENABLE_AVX2 OFF CACHE BOOL "Disable AVX2 for Glaze in Debug mode" FORCE)
else()
set(glaze_ENABLE_AVX2 ON CACHE BOOL "Enable AVX2 for Glaze in non-Debug modes" FORCE)
endif()
# External dependencies
set(PA_USE_ASIO ON CACHE BOOL "Enable ASIO support" FORCE)
add_subdirectory(external/portaudio)
add_subdirectory(external/json)
add_subdirectory(external/linenoise-ng)
add_subdirectory(external/unordered_dense)
add_subdirectory(external/glaze)
set(SDL_SHARED OFF CACHE BOOL "Disable SDL shared library" FORCE)
set(SDL_STATIC ON CACHE BOOL "Enable SDL static library" FORCE)
set(SDL_AUDIO OFF CACHE BOOL "Disable SDL audio support" FORCE)
set(SDL_JOYSTICK OFF CACHE BOOL "Disable SDL joystick support" FORCE)
set(SDL_HAPTIC OFF CACHE BOOL "Disable SDL haptic support" FORCE)
set(SDL_SENSOR OFF CACHE BOOL "Disable SDL sensor support" FORCE)
set(SDL_POWER OFF CACHE BOOL "Disable SDL power support" FORCE)
set(SDL_RENDER OFF CACHE BOOL "Disable SDL renderer support" FORCE)
set(SDL_RENDER_GPU OFF CACHE BOOL "Disable GPU rendering support" FORCE)
add_subdirectory(external/SDL2)
add_subdirectory(external/rtmidi)
add_subdirectory(external/libsamplerate)
add_subdirectory(Nodes/nodes/Metronome)
add_dependencies(Metronome PatchformSDK)
#==== nanovg static wrapper =====
# We use a wrapper to easily include nanovg without having to worry about ifdef/undef framebuffer stuff
add_library(NanoVGWrapper OBJECT
${CMAKE_SOURCE_DIR}/Glad/NanoVGWrapper.cpp
${CMAKE_SOURCE_DIR}/external/nanovg/src/nanovg.cpp
)
set_target_properties(NanoVGWrapper PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin/Debug"
)
target_include_directories(NanoVGWrapper PUBLIC
${CMAKE_SOURCE_DIR}/external/nanovg/src
${CMAKE_SOURCE_DIR}/Glad/
)
target_link_libraries(NanoVGWrapper PRIVATE glad)
add_dependencies(NanoVGWrapper glad)
target_compile_definitions(NanoVGWrapper PRIVATE NANOVG_GL3_IMPLEMENTATION)
#==== nanovg static wrapper end =====
if (ENABLE_ASAN AND MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(nanovg PRIVATE /fsanitize=address)
target_compile_options(rtmidi PRIVATE /fsanitize=address)
endif()
# Add moodycamel concurrentqueue
add_library(moodycamel_concurrentqueue INTERFACE)
target_include_directories(moodycamel_concurrentqueue INTERFACE "${CMAKE_SOURCE_DIR}/external/concurrentqueue")
# Add moodycamel readerwriterqueue
add_library(moodycamel_readerwriterqueue INTERFACE)
target_include_directories(moodycamel_readerwriterqueue INTERFACE "${CMAKE_SOURCE_DIR}/external/readerwriterqueue")
add_library(pffft OBJECT external/pffft/pffft.c)
target_include_directories(pffft PUBLIC external/pffft)
target_compile_options(pffft PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
$<$<CONFIG:Release>:/Ox /arch:AVX2 /fp:fast /Ob3 /GL /DNDEBUG>
$<$<CONFIG:Debug>:/Od /Zi>
>
)
add_library(glad STATIC Glad/glad.cpp)
target_include_directories(glad PUBLIC "${CMAKE_SOURCE_DIR}/Glad")
# Collect common source files
file(GLOB_RECURSE GRAPH_SOURCES "${CMAKE_SOURCE_DIR}/Graph/*.cpp" "${CMAKE_SOURCE_DIR}/Utility/*.cpp")
file(GLOB NODE_SHARED_SOURCES "${CMAKE_SOURCE_DIR}/Nodes/*.cpp")
# PlugPatchCLI target
add_executable(PlugPatchCLI PlugPatchCLI.cpp ${GRAPH_SOURCES})
target_include_directories(PlugPatchCLI PRIVATE
"${CMAKE_SOURCE_DIR}/external/portaudio/include"
"${CMAKE_SOURCE_DIR}/external/concurrentqueue"
"${CMAKE_SOURCE_DIR}/external/json/single_include/nlohmann"
"${CMAKE_SOURCE_DIR}/external/linenoise-ng/include"
"${CMAKE_SOURCE_DIR}/external/unordered_dense/include/ankerl"
"${CMAKE_SOURCE_DIR}/external/glaze/include/"
)
target_link_libraries(PlugPatchCLI PRIVATE
linenoise
moodycamel_concurrentqueue
moodycamel_readerwriterqueue
unordered_dense
glaze::glaze
portaudio
)
# Fix for linenoise not being updated to C++20
target_compile_options(linenoise PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/Zc:char8_t-> # Disable char8_t for MSVC
$<$<CXX_COMPILER_ID:GNU>:-fno-char8_t> # Disable char8_t for GCC
$<$<CXX_COMPILER_ID:Clang>:-fno-char8_t> # Disable char8_t for Clang
)
# Collect common source files
file(GLOB_RECURSE UI_SOURCES "${CMAKE_SOURCE_DIR}/UI/*.cpp" "${CMAKE_SOURCE_DIR}/UI_ToolKit/*.cpp")
#======= Patchform lib ==========
add_library(PatchformSDK SHARED
${GRAPH_SOURCES}
${UI_SOURCES}
${NODE_SHARED_SOURCES}
${BUILDINFO_CPP}
)
target_compile_options(PatchformSDK PRIVATE
$<$<CONFIG:Debug>:/Od /Zi /bigobj /Zc:__cplusplus>
$<$<CONFIG:Release>:/Ox /arch:AVX2 /GL /GS- /Ob3 /fp:fast /bigobj /DNDEBUG>
$<$<CONFIG:RelWithDebInfo>:/Ox /Z7 /GL /bigobj>
)
target_compile_definitions(PatchformSDK PRIVATE
PATCHFORM_WITH_GUI
PATCHFORM_SDK_BUILD
NANOVG_GL3_IMPLEMENTATION=1
)
target_include_directories(PatchformSDK PUBLIC
"${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/external"
"${CMAKE_SOURCE_DIR}/external/concurrentqueue"
"${CMAKE_SOURCE_DIR}/external/readerwriterqueue"
"${CMAKE_SOURCE_DIR}/external/json/single_include/nlohmann"
"${CMAKE_SOURCE_DIR}/external/unordered_dense/include/ankerl"
"${CMAKE_SOURCE_DIR}/external/glaze/include/"
"${CMAKE_SOURCE_DIR}/external/portaudio/include"
"${CMAKE_SOURCE_DIR}/Glad/"
"${CMAKE_SOURCE_DIR}/external/nanovg/src/"
"${CMAKE_SOURCE_DIR}/external/SDL2/include"
"${CMAKE_SOURCE_DIR}/external/pffft"
"${CMAKE_SOURCE_DIR}/external/rtmidi"
"${CMAKE_SOURCE_DIR}/external/simde"
"${CMAKE_SOURCE_DIR}/external/libsamplerate/include"
"${CMAKE_SOURCE_DIR}/external/SignalsmithDSP/include"
)
target_link_libraries(PatchformSDK PRIVATE
SDL3::SDL3-static
portaudio
moodycamel_concurrentqueue
moodycamel_readerwriterqueue
unordered_dense
glaze::glaze
rtmidi
glad
samplerate
)
target_sources(PatchformSDK PRIVATE
$<TARGET_OBJECTS:NanoVGWrapper>
$<TARGET_OBJECTS:pffft>
${BUILDINFO_CPP}
)
set_target_properties(PatchformSDK PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/patchform.def"
)
add_custom_target(generate_gitinfo
COMMAND ${CMAKE_COMMAND}
-DOUTPUT_FILE=${BUILDINFO_CPP}
-DGIT_VERSION_FILE=${GIT_VERSION_FILE}
-P ${CMAKE_SOURCE_DIR}/GenerateGitInfo.cmake
BYPRODUCTS ${BUILDINFO_CPP}
COMMENT "Generating GitInfo.cpp"
)
add_dependencies(PatchformSDK
NanoVGWrapper
generate_gitinfo
)
# PlugPatchStandalone target - use WIN32 to hide terminal
add_executable(PatchformStandalone PatchformStandalone.cpp)
set_target_properties(PatchformStandalone PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
)
target_compile_definitions(PatchformStandalone PRIVATE
PATCHFORM_WITH_GUI
PATCHFORM_STANDALONE
)
target_include_directories(PatchformStandalone PRIVATE
"${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/external"
"${CMAKE_SOURCE_DIR}/external/concurrentqueue"
"${CMAKE_SOURCE_DIR}/external/readerwriterqueue"
"${CMAKE_SOURCE_DIR}/external/json/single_include/nlohmann"
"${CMAKE_SOURCE_DIR}/external/unordered_dense/include/ankerl"
"${CMAKE_SOURCE_DIR}/external/glaze/include/"
"${CMAKE_SOURCE_DIR}/external/portaudio/include"
"${CMAKE_SOURCE_DIR}/Glad/"
"${CMAKE_SOURCE_DIR}/external/nanovg/src/"
"${CMAKE_SOURCE_DIR}/external/SDL2/include"
"${CMAKE_SOURCE_DIR}/external/pffft"
"${CMAKE_SOURCE_DIR}/external/rtmidi"
"${CMAKE_SOURCE_DIR}/external/simde"
"${CMAKE_SOURCE_DIR}/external/libsamplerate/include"
"${CMAKE_SOURCE_DIR}/external/SignalsmithDSP/include"
)
target_link_libraries(PatchformStandalone PRIVATE PatchformSDK)
target_link_directories(PatchformStandalone PRIVATE
"${CMAKE_BINARY_DIR}/bin/Debug"
)
target_compile_definitions(PatchformStandalone PRIVATE
-DPA_USE_ASIO=ON
SAMPLERATE_STATIC
)
if (MSVC)
# Force all static libs to match runtime (important!)
set_target_properties(rtmidi PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set_target_properties(portaudio PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set_target_properties(pffft PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
if (ENABLE_ASAN AND CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Building with MSVC ASAN")
# Path to ASAN libs
set(ASAN_LIB_PATH "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/lib/x64")
target_link_directories(PatchformStandalone PRIVATE "${ASAN_LIB_PATH}")
target_compile_options(PatchformStandalone PRIVATE /fsanitize=address /Od /Zi /bigobj /Zc:__cplusplus)
target_link_options(PatchformStandalone PRIVATE /INFERASANLIBS)
else()
target_compile_options(PatchformStandalone PRIVATE
/std:c++latest
/Zc:preprocessor
$<$<CONFIG:Debug>:/Od /Zi /RTC1 /bigobj /Zc:__cplusplus>
$<$<CONFIG:Release>:/Ox /arch:AVX2 /GL /GS- /Ob3 /fp:fast /bigobj /DNDEBUG>
$<$<CONFIG:RelWithDebInfo>:/Ox /Z7 /GL /bigobj>
)
add_link_options($<$<CONFIG:Debug>:/DEBUG>)
endif()
endif()
if (ENABLE_ASAN AND MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set(ASAN_DLL_PATH "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/clang_rt.asan_dynamic-x86_64.dll")
if (EXISTS "${ASAN_DLL_PATH}")
add_custom_command(TARGET PatchformStandalone POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${ASAN_DLL_PATH}"
"$<TARGET_FILE_DIR:PatchformStandalone>")
else()
message(WARNING "ASAN DLL not found: ${ASAN_DLL_PATH}")
endif()
endif()
# ======================== TEST SETUP ========================
if(RUN_TESTS)
message(STATUS "Building tests")
add_subdirectory(external/catch2)
include(Catch)
include(CTest)
add_executable(Tests Tests/test_main.cpp)
target_include_directories(Tests PRIVATE
"${CMAKE_SOURCE_DIR}/external/catch2"
)
target_link_libraries(Tests PRIVATE Catch2::Catch2)
# Auto-discover Catch2 tests
catch_discover_tests(Tests)
endif()
# ======================== RESOURCE SETUP ========================
if (WIN32)
target_sources(PatchformStandalone PRIVATE ${CMAKE_BINARY_DIR}/version.rc)
endif ()
# files to copy
set(SOURCE_FILES
"${CMAKE_SOURCE_DIR}/Patches/graph.json"
"${CMAKE_SOURCE_DIR}/Patches/graph1.json"
"${CMAKE_SOURCE_DIR}/Patches/graph2.json"
"${CMAKE_SOURCE_DIR}/Patches/graph3.json"
"${CMAKE_SOURCE_DIR}/Patches/graph4.json5"
"${CMAKE_SOURCE_DIR}/Patches/count.json5"
"${CMAKE_SOURCE_DIR}/Patches/WavetableMovement.json"
"${CMAKE_SOURCE_DIR}/Patches/Inter-VariableFont_opsz,wght.ttf"
"${CMAKE_SOURCE_DIR}/Assets/Icons/IconFontPlugPatch.ttf"
"${CMAKE_SOURCE_DIR}/Assets/Icons/IconFontPlugPatch_google.ttf"
)
# Copy compiled object's into Patchform/Objects directory
add_custom_target(copy_objects ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_BINARY_DIR}/objects"
"$<TARGET_FILE_DIR:PatchformStandalone>/Objects"
COMMENT "Copying plugin objects to output directory"
)
# Make sure copy_objects runs AFTER metronome object is built!
add_dependencies(copy_objects Metronome)
# Define a custom target to copy the Patches directory
add_custom_target(copy_patches
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/Patches"
"$<TARGET_FILE_DIR:PatchformStandalone>/Patches"
COMMENT "Copying Patches directory to the output directory"
)
# FIXME: Do not copy the whole icon dir, but just for now to test
add_custom_target(copy_fonts
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/Assets"
"$<TARGET_FILE_DIR:PatchformStandalone>/Assets"
COMMENT "Copying Fonts directory to the output directory"
)
# Add dependencies to ensure the directory is copied whenever these targets are built
add_dependencies(PlugPatchCLI copy_patches)
add_dependencies(PatchformStandalone
copy_patches
copy_fonts
copy_icon
PatchformSDK
# Plugin system
Metronome
copy_objects
)
# Installer configuration for CLI
#TODO NOT WORKING ONLY FOR RELEASE for some reason! :-(
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(INSTALLER_DIR ${CMAKE_SOURCE_DIR}/installer)
# -------------------------- CLI --------------------------
set(NSIS_SCRIPT ${INSTALLER_DIR}/windows/installer.nsi)
# Define the location of the built application
set(APPLICATION_BINARY_CLI "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/PlugPatchCLI.exe")
add_custom_target(PackageInstaller
COMMAND ${CMAKE_COMMAND} -E echo "Creating NSIS installer..."
COMMAND makensis.exe /DOUTPUT_DIR=$<TARGET_FILE_DIR:PlugPatchCLI> /DAPPLICATION_BINARY=${APPLICATION_BINARY_CLI} ${NSIS_SCRIPT}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Packaging installer with NSIS"
VERBATIM
)
add_dependencies(PackageInstaller PlugPatchCLI)
# -------------------------- GUI --------------------------
set(NSIS_SCRIPT ${INSTALLER_DIR}/windows/installerStandalone.nsi)
# Define the location of the built application
set(APPLICATION_BINARY_STANDALONE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/PatchformStandalone.exe")
add_custom_target(PackageInstallerStandalone
COMMAND ${CMAKE_COMMAND} -E echo "Creating NSIS installer..."
COMMAND makensis.exe
/DOUTPUT_DIR=$<TARGET_FILE_DIR:PatchformStandalone>
/DAPPLICATION_BINARY=${APPLICATION_BINARY_STANDALONE}
/DAPP_VERSION=${PATCHFORM_VERSION_STRING}
${NSIS_SCRIPT}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Packaging installer with NSIS"
VERBATIM
)
add_dependencies(PackageInstallerStandalone PatchformStandalone)
else()
message(WARNING "The PackageInstallers target is only available in Release mode.")
endif()