-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1859 lines (1606 loc) · 70.3 KB
/
CMakeLists.txt
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
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ======================
# ARA Examples CMake Integration
#
# Copyright (c) 2020-2024, Celemony Software GmbH, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ======================
# See accompanying README.md for details about the CMake integration of the ARA examples.
# ======================
# cmake compatibility
# You may be able to use older versions by commenting out this line, but we do not support it.
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
if(APPLE)
if(NOT CMAKE_GENERATOR MATCHES "Xcode")
message(FATAL_ERROR "CMake support for Apple platforms is currently limited to Xcode, add '-G Xcode'.")
endif()
elseif(NOT WIN32)
message(STATUS "Careful: ARA CMake support for this system is currently experimental.")
endif()
# ======================
# supported build configurations
get_property(ARA_IS_MULTI_CONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(ARA_IS_MULTI_CONFIG_GENERATOR)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Build Configurations" FORCE)
else()
if(CMAKE_BUILD_TYPE)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
message(FATAL_ERROR "CMAKE_BUILD_TYPE must be either 'Debug' or 'Release', value '${CMAKE_BUILD_TYPE}' is invalid.")
endif()
else()
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type (either 'Debug' or 'Release')" FORCE)
message(STATUS "No build type specified, defaulting to '${CMAKE_BUILD_TYPE}'.")
endif()
endif()
# these paths match Steinberg's default paths used in the VST SDK
set(optional_build_type_subfolder "")
if(NOT ARA_IS_MULTI_CONFIG_GENERATOR AND NOT WIN32)
set(optional_build_type_subfolder "/${CMAKE_BUILD_TYPE}")
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib${optional_build_type_subfolder}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib${optional_build_type_subfolder}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin${optional_build_type_subfolder}")
unset(optional_build_type_subfolder)
# ======================
# enable universal binaries on Apple platforms
if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" CACHE STRING "macOS architecture(s) - defaults to Xcode standard archs instead of CMake build platform" FORCE)
endif()
# ======================
# ARA SDK paths
if(ARA_API_DIR)
# normalize path if provided (and if relative path, assume it's relative to the top-level project)
get_filename_component(ARA_API_DIR "${ARA_API_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
else()
# if no path provided, assume ARA_API is right next to our ARA_Examples directory
get_filename_component(ARA_API_DIR ../ARA_API ABSOLUTE "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
set(ARA_API_DIR "${ARA_API_DIR}" CACHE PATH "directory of the ARA_API project")
if(ARA_LIBRARY_DIR)
# normalize path if provided (and if relative path, assume it's relative to the top-level project)
get_filename_component(ARA_LIBRARY_DIR "${ARA_LIBRARY_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
else()
# if no path provided, assume ARA_Library is right next to our ARA_Examples directory
get_filename_component(ARA_LIBRARY_DIR ../ARA_Library ABSOLUTE "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
set(ARA_LIBRARY_DIR "${ARA_LIBRARY_DIR}" CACHE PATH "directory of the ARA_Library project")
# ======================
# Companion APIs paths
if(ARA_VST3_SDK_DIR)
# normalize path if provided (and if relative path, assume it's relative to the top-level project)
get_filename_component(ARA_VST3_SDK_DIR "${ARA_VST3_SDK_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
else()
# if no path provided, assume vst3sdk is right next to our ARA_Examples directory
get_filename_component(ARA_VST3_SDK_DIR ../vst3sdk ABSOLUTE "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
set(ARA_VST3_SDK_DIR "${ARA_VST3_SDK_DIR}" CACHE PATH "directory of the VST3 SDK")
if(EXISTS "${ARA_VST3_SDK_DIR}")
set(ARA_ENABLE_VST3 TRUE)
else()
message(STATUS "No VST3 SDK installed, will not generate VST3 related examples.")
set(ARA_ENABLE_VST3 FALSE)
endif()
if(APPLE)
if(ARA_AUDIO_UNIT_SDK_DIR)
# normalize path if provided (and if relative path, assume it's relative to the top-level project)
get_filename_component(ARA_AUDIO_UNIT_SDK_DIR "${ARA_AUDIO_UNIT_SDK_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
else()
# if no path provided, assume AudioUnitSDK is right next to our ARA_Examples directory
get_filename_component(ARA_AUDIO_UNIT_SDK_DIR ../AudioUnitSDK ABSOLUTE "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
set(ARA_AUDIO_UNIT_SDK_DIR "${ARA_AUDIO_UNIT_SDK_DIR}" CACHE PATH "directory of the Audio Unit SDK")
if(EXISTS "${ARA_AUDIO_UNIT_SDK_DIR}")
set(ARA_ENABLE_AUDIO_UNIT TRUE)
else()
message(STATUS "No Audio Unit SDK installed, will not generate Audio Unit related examples.")
set(ARA_ENABLE_AUDIO_UNIT FALSE)
endif()
else()
set(ARA_ENABLE_AUDIO_UNIT FALSE)
endif()
if(ARA_CLAP_SDK_DIR)
# normalize path if provided (and if relative path, assume it's relative to the top-level project)
get_filename_component(ARA_CLAP_SDK_DIR "${ARA_CLAP_SDK_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
else()
# if no path provided, assume clap is right next to our ARA_Examples directory
get_filename_component(ARA_CLAP_SDK_DIR ../clap ABSOLUTE "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
set(ARA_CLAP_SDK_DIR "${ARA_CLAP_SDK_DIR}" CACHE PATH "directory of the CLAP SDK")
if(EXISTS "${ARA_CLAP_SDK_DIR}")
set(ARA_ENABLE_CLAP TRUE)
else()
message(STATUS "No CLAP SDK installed, will not generate CLAP related examples.")
set(ARA_ENABLE_CLAP FALSE)
endif()
if(NOT (ARA_ENABLE_VST3 OR ARA_ENABLE_AUDIO_UNIT OR ARA_ENABLE_CLAP))
message(FATAL_ERROR "No Companion API SDK installed - at least one of VST3, Audio Unit or CLAP SDK is required.")
endif()
# ======================
# project globals
include("${ARA_API_DIR}/ARA_Version.cmake")
include("${ARA_API_DIR}/ARA_API_Helpers.cmake")
# set this to OFF when running on build servers, ON for developer machines where you intend to debug.
# this may require building as admin, depending on the access rights needed to write to the audio plug-in folder(s)
option(ARA_SETUP_DEBUGGING "Prepare for debugging (configure debugger, install audio plug-ins into system, etc.)" ON)
# regenerating the project while building causes various of issues, esp. in Xcode, plus these examples are typically not modified
set(CMAKE_SUPPRESS_REGENERATION ON)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY ON)
set(CMAKE_XCODE_GENERATE_SCHEME ${ARA_SETUP_DEBUGGING})
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# https://stackoverflow.com/questions/41695993/ignore-warnings-in-external-modules-when-using-cmake
if(POLICY CMP0077)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
cmake_policy(SET CMP0077 NEW)
endif()
if(POLICY CMP0091)
set(CMAKE_POLICY_DEFAULT_CMP0091 NEW)
cmake_policy(SET CMP0091 NEW)
endif()
# helpful for debugging the build if necessary
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE STRING "Generate compile commands" FORCE)
project(ARA_Examples
DESCRIPTION "ARA Audio Random Access: Examples"
#only added in CMake 3.12, we still support 3.10 on some platforms:
#HOMEPAGE_URL https://www.celemony.com/ara
VERSION ${ARA_MAJOR_VERSION}.${ARA_MINOR_VERSION}.${ARA_PATCH_VERSION}.${ARA_BUILD_VERSION}
LANGUAGES C CXX
)
# ======================
# C and C++ language standard
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD_REQUIRED ON)
# sync C++ standard between Xcode and CMake (unfortunately the CMake Xcode generator uses OTHER_CPLUSPLUSFLAGS)
# \todo similar logic should be done above for CMAKE_C_... based on GCC_C_LANGUAGE_STANDARD
if(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD)
if(CMAKE_CXX_STANDARD)
if(NOT CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD MATCHES ${CMAKE_CXX_STANDARD})
message(FATAL_ERROR "Conflicting C++ standards set in general versus Xcode-specific configuration.")
endif()
else()
string(REGEX MATCH "[0123456789][0123456789]" CMAKE_CXX_STANDARD CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD)
endif()
string(REGEX MATCH "[Cc]\\+\\+" temp CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD)
if (CMAKE_CXX_EXTENSIONS)
if((temp AND NOT CMAKE_CXX_EXTENSIONS) OR
(NOT temp AND CMAKE_CXX_EXTENSIONS))
message(FATAL_ERROR "Conflicting C++ standards set in general versus Xcode-specific configuration.")
endif()
else()
if(temp)
set(CMAKE_CXX_EXTENSIONS OFF)
else()
set(CMAKE_CXX_EXTENSIONS ON)
endif()
endif()
unset(temp)
endif()
if(CMAKE_CXX_STANDARD)
if(NOT(CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 11 AND
CMAKE_CXX_STANDARD VERSION_LESS 98))
message(FATAL_ERROR "This project require C++11 or newer.")
endif()
else()
if(MSVC)
set(CMAKE_CXX_STANDARD 14)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
endif()
if(NOT CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
set(CXX_STANDARD_REQUIRED ON)
# ======================
# support for OBJECT libraries:
# test if we can use object targets or must fall back to or static targets
# older CMake can't link to object targets, must build static lib instead
# \todo when building universal binaries for macOS, the paths to the object files are broken...
# to work around, we need to stick with static libs for now.
# CMake 3.20 promises a fix for the issue...
#if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
# set(ARA_SHARED_TARGET_TYPE OBJECT)
#else()
set(ARA_SHARED_TARGET_TYPE STATIC)
#endif()
# ======================
# target platform
if(WIN32)
# no special setup for Windows needed at this point.
elseif(APPLE)
if (CMAKE_OSX_DEPLOYMENT_TARGET AND
CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.9")
message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET must be '10.9' or higher.")
endif()
if(NOT CMAKE_OSX_SYSROOT MATCHES ".+[Mm][Aa][Cc][Oo][Ss][X?x?]?[0123456789]+\.[0123456789]+\.sdk")
message(FATAL_ERROR "CMake support for Apple platforms is currently limited to macOS.")
endif()
elseif(UNIX)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
else()
message(FATAL_ERROR "Unsupported target system.")
endif()
# ======================
# Compiler-specific default settings
# check GNU-style compilers (GCC, Clang, AppleClang)
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(GCC_STYLE_COMPILER TRUE)
else()
set(GCC_STYLE_COMPILER FALSE)
endif()
if(MSVC)
# explicitly remove debug format set by some Windows CMake generators to enable edit&continue
# (see also similar workaround when configuring warings)
string(REGEX REPLACE "/Z[7iI]" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REGEX REPLACE "/Z[7iI]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
add_compile_options(
/MP
$<IF:$<CONFIG:Debug>,/ZI,/Zi>
/diagnostics:column
)
elseif(GCC_STYLE_COMPILER)
add_compile_options(
$<IF:$<CONFIG:Debug>,-O0,-Os>
)
# Architectures \todo CMake bug? This does not properly propagate to all targets, must be set again per-target...
set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<IF:$<CONFIG:Debug>,YES,NO>)
# Build Options
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_TESTABILITY $<IF:$<CONFIG:Debug>,YES,NO>)
# Search Paths
set(CMAKE_XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO)
# Preprocessing
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_NS_ASSERTIONS $<IF:$<CONFIG:Debug>,YES,NO>)
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_STRICT_OBJC_MSGSEND YES)
endif()
# ======================
# Apple signing (defaults to signing locally for debug and not signing for release)
# Set CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY and CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM
# in your CMakeCache.txt if building actual products based on these examples,
# or inject them when generating from the command line.
if(APPLE AND NOT CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "$<$<CONFIG:Debug>:->")
message(WARNING "CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY not set via command line or CMakeCache.txt, binaries will not be signed correctly")
endif()
if(APPLE AND NOT CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
message(WARNING "CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM not set via command line or CMakeCache.txt, binaries will not be signed correctly")
endif()
# \todo this should be set per-target, but for some reason CMake ignores it when set only there...
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/ExamplesCommon/macOS/ARAExamples.entitlements")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
# ======================
# external dependency: VST3 SDK
if(ARA_ENABLE_VST3)
message(STATUS "Importing VST3 SDK")
if(POLICY CMP0077)
set(SMTG_RENAME_ASSERT OFF)
set(SMTG_ADD_VSTGUI OFF)
else()
set(SMTG_RENAME_ASSERT OFF CACHE BOOL "Disable SMTG_RENAME_ASSERT per default")
set(SMTG_ADD_VSTGUI OFF CACHE BOOL "Disable SMTG_ADD_VSTGUI per default")
endif()
# when adding these paths, the VST3 SDK CMake file implicitly adds the corresponding wrapper targets,
# which we currently do not want because we build these plug-ins natively
#set(SMTG_COREAUDIO_SDK_PATH "${ARA_AUDIO_UNIT_SDK_DIR}/CoreAudio")
#set(SMTG_AAX_SDK_PATH "${ARA_AAX_SDK_DIR}")
add_subdirectory("${ARA_VST3_SDK_DIR}" "${PROJECT_BINARY_DIR}/vst3sdk" EXCLUDE_FROM_ALL)
set_target_properties(base cmake_modules cmake_VST_modules pluginterfaces sdk_hosting sdk_common sdk validator PROPERTIES
FOLDER "3rdParty/vst3sdk"
XCODE_GENERATE_SCHEME OFF
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<IF:$<CONFIG:Debug>,YES,NO>
)
set_target_properties(validator PROPERTIES
CXX_STANDARD 14
# \todo workaround for having to globally set the entitlements, see CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME above
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME NO
)
# disable some warnings that do not go along with the VST3 coding style
if(MSVC)
target_compile_options(base PUBLIC
"/wd4127"
)
else()
target_compile_options(base PUBLIC
"-Wno-undef"
"$<$<COMPILE_LANGUAGE:CXX>:-Wno-non-virtual-dtor>"
)
endif()
# hotfix to silence Steinberg's "DEPRECATED No Linux implementation" warnings
if(UNIX AND NOT APPLE)
target_compile_options(base PRIVATE
"-Wno-cpp"
)
endif()
function(ara_add_vst3_main target)
get_target_property(source_dir ${target} SOURCE_DIR)
get_target_property(sources_old ${target} SOURCES)
set(public_sdk_SOURCE_DIR "${ARA_VST3_SDK_DIR}/public.sdk")
smtg_target_add_library_main(${target})
get_target_property(sources_new ${target} SOURCES)
list(REMOVE_ITEM sources_new ${sources_old})
source_group("VST3 SDK/main" FILES ${sources_new})
foreach(source ${sources_new})
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS
"$<$<COMPILE_LANGUAGE:CXX>:-Wno-old-style-cast> -Wno-zero-as-null-pointer-constant -Wno-reserved-id-macro"
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS
# \todo CMake 3.10 on Linux struggles with this, but since the SDK only adds .cpp files we can skip the generator expression for now
#$<$<COMPILE_LANGUAGE:CXX>:-Wno-old-style-cast>
-Wno-old-style-cast
)
endif()
endforeach()
endfunction()
endif(ARA_ENABLE_VST3)
# ======================
# external dependency: Audio Unit SDK
if(ARA_ENABLE_AUDIO_UNIT)
message(STATUS "Importing AudioUnitSDK")
add_library(AudioUnitSDK ${ARA_SHARED_TARGET_TYPE} EXCLUDE_FROM_ALL
"${ARA_AUDIO_UNIT_SDK_DIR}/readme.md"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUBase.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUBase.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUBuffer.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUBuffer.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUBufferAllocator.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUEffectBase.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUEffectBase.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUInputElement.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUInputElement.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUOutputElement.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUOutputElement.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUPlugInDispatch.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUPlugInDispatch.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUScopeElement.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUScopeElement.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUSilentTimeout.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/AUUtility.h"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/ComponentBase.cpp"
"${ARA_AUDIO_UNIT_SDK_DIR}/Source/ComponentBase.h"
)
target_include_directories(AudioUnitSDK PUBLIC
"${ARA_AUDIO_UNIT_SDK_DIR}/Source"
)
target_compile_definitions(AudioUnitSDK PUBLIC
-DCA_USE_AUDIO_PLUGIN_ONLY=1
)
target_compile_options(AudioUnitSDK
PUBLIC
-Wno-undef
-Wno-shadow
-Wno-switch-enum
-Wno-sign-conversion
-Wno-nullable-to-nonnull-conversion
-Wno-deprecated
-Wno-extra-semi
PRIVATE
-Wall
-Wextra
-Wno-unused-parameter
-Wno-conversion
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-newline-eof>
)
target_link_libraries(AudioUnitSDK PUBLIC
"-framework CoreFoundation"
"-framework CoreAudio"
"-framework AudioToolbox"
"-framework AudioUnit"
)
set_target_properties(AudioUnitSDK PROPERTIES
CXX_STANDARD 17
FOLDER "3rdParty"
XCODE_GENERATE_SCHEME OFF
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<IF:$<CONFIG:Debug>,YES,NO>
)
endif(ARA_ENABLE_AUDIO_UNIT)
# ======================
# optional external dependency: CLAP
if(ARA_ENABLE_CLAP)
message(STATUS "Importing CLAP SDK")
add_subdirectory("${ARA_CLAP_SDK_DIR}" "${PROJECT_BINARY_DIR}/clap" EXCLUDE_FROM_ALL)
set_target_properties(clap clap-tests PROPERTIES
FOLDER "3rdParty/clap"
XCODE_GENERATE_SCHEME OFF
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<IF:$<CONFIG:Debug>,YES,NO>
)
endif(ARA_ENABLE_CLAP)
# ======================
# external dependency: some general purpose 3rdParty libraries used in the ARA examples
message(STATUS "Importing more 3rd party libraries")
function(configure_3rdParty_target target)
if(MSVC)
target_compile_options(${target}
PRIVATE
/wd4244
/wd4267
/wd4996
/wd6001
/wd6054
/wd6326
/wd6385
/wd6386
)
endif()
if(GCC_STYLE_COMPILER)
target_compile_options(${target}
PRIVATE
-Wno-conversion
-Wno-unused-result
)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(${target}
PUBLIC
-Wno-reserved-id-macro
-Wno-deprecated-dynamic-exception-spec
PRIVATE
-Wno-shorten-64-to-32
)
endif()
set_target_properties(${target} PROPERTIES
FOLDER "3rdParty"
XCODE_GENERATE_SCHEME OFF
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<IF:$<CONFIG:Debug>,YES,NO>
)
endfunction()
# fetch Git submodules if needed
if((NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/cpp-base64/base64.h") OR
(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/ICST_AudioFile/AudioFile.h") OR
(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/pugixml/src/pugixml.hpp"))
message(STATUS "Updating Git submodules")
execute_process(COMMAND git -C "${CMAKE_CURRENT_SOURCE_DIR}" submodule update --init --recursive RESULT_VARIABLE result)
if(result)
message(FATAL_ERROR "Couldn't fetch/update Git submodules: ${result}.")
endif()
unset(result)
endif()
add_library(cpp-base64 ${ARA_SHARED_TARGET_TYPE} EXCLUDE_FROM_ALL
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/cpp-base64/base64.h"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/cpp-base64/base64.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/cpp-base64/README.md"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/cpp-base64/LICENSE"
)
configure_3rdParty_target(cpp-base64)
add_library(ICST_AudioFile ${ARA_SHARED_TARGET_TYPE} EXCLUDE_FROM_ALL
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/ICST_AudioFile/Common.h"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/ICST_AudioFile/MathDefs.h"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/ICST_AudioFile/AudioFile.h"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/ICST_AudioFile/AudioFile.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/ICST_AudioFile/README.md"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/ICST_AudioFile/LICENSE.txt"
)
configure_3rdParty_target(ICST_AudioFile)
add_library(pugixml ${ARA_SHARED_TARGET_TYPE} EXCLUDE_FROM_ALL
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/pugixml/src/pugiconfig.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/pugixml/src/pugixml.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/pugixml/src/pugixml.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/pugixml/README.md"
"${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/pugixml/LICENSE.md"
)
configure_3rdParty_target(pugixml)
# ======================
# enable all warnings appropriate for the ARA SDK code
if(MSVC)
# explicitly remove default warning level set by some Windows CMake generators so we can configure it without conflict later on
# see https://github.com/Microsoft/llvm/commit/daa55a66a09167498fc8b35b6cdece3636d88b7e
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(
/Wall
# warnings that are triggered by Windows or Visual Studio system headers
# \todo see https://devblogs.microsoft.com/cppblog/broken-warnings-theory/
# we should be able to disable them only for the system headers
# this could also be used for warnings from 3rd party and companion includes
# CMake also offers SYSTEM includes for libraries, this would achieve the same.
/wd4255 # missing prototype
/wd4365 # signed/unsigned conversion
/wd4548 # expression before comma has no effect
/wd4668 # undefined macro
/wd5039 # potentially throwing function passed to 'extern "C"'
/wd5204 # trivial destructor is not virtual
# warnings that only provide additional information for valid code:
/wd4514 # removed unreferenced inline function
/wd4710 # function not inlined
/wd4711 # automatic inline expansion
/wd4820 # struct padding
/wd4623 # default constructor implicitly deleted
/wd4625 # copy constructor implicitly deleted
/wd4626 # assignment operator implicitly deleted
/wd5027 # move assignment operator implicitly deleted
/wd5026 # move constructor was implicitly defined as deleted
/wd5220 # volatile member no longer implies trivial copy/move constructors/assignment operators
/wd5045 # Spectre mitigation
# warnings that are too broad
/wd4355 # 'this' used in base member initializer list
# this is only a problem if the pointer is used, but not if the pointer is merely stored for later use
)
if(MSVC_VERSION VERSION_LESS 1920)
add_compile_options(
# warnings that are triggered by Visual Studio older than 2019 system headers
/wd4571 # catch(...) semantics changed
/wd4774 # format string mismatch
)
endif()
elseif(GCC_STYLE_COMPILER)
add_compile_options(
-Wall
-Wextra
# this cannot be used for gcc because the necessary -Wno-variadic-macros below does not work, moved to clang-only
#-Wpedantic
-Wconversion
-Wuninitialized
-Wcast-align
-Wpointer-arith
-Wundef
-Wpacked
-Wswitch-enum
-Wunreachable-code
-Wdeprecated-declarations
-Wno-missing-declarations
-Wformat=2
$<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>
$<$<COMPILE_LANGUAGE:C>:-Wimplicit>
$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>
$<$<COMPILE_LANGUAGE:CXX>:-Wpessimizing-move>
$<$<COMPILE_LANGUAGE:CXX>:-Wredundant-move>
$<$<COMPILE_LANGUAGE:CXX>:-Wextra-semi>
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(
-Wpedantic
-Wgcc-compat
-Wgnu
-Wnon-gcc
-Wno-gnu-zero-variadic-macro-arguments
-Wno-vla-extension
-Wno-four-char-constants
-Wmicrosoft
-Wpragmas
-Wshadow-all
-Wsigned-enum-bitfield
-Wnullable-to-nonnull-conversion
-Wvector-conversion
-Wshift-sign-overflow
-Wloop-analysis
-Wconditional-uninitialized
-Wunreachable-code-aggressive
-Wpedantic-core-features
-Watomic-properties
-Wimplicit-fallthrough
-Wimplicit-function-declaration
-Wimplicit-retain-self
-Wmethod-signatures
-Wmissing-noreturn
-Wassign-enum
-Wover-aligned
-Wlong-long
-Wredundant-parens
-Wcomma
-Wnewline-eof
-Wformat-pedantic
-Wformat-non-iso
-Wdeprecated
-Wdeprecated-implementations
-Wdeprecated-objc-isa-usage
-Wdeprecated-objc-pointer-introspection
-Wdeprecated-objc-pointer-introspection-performSelector
-Wblock-capture-autoreleasing
-Wrange-loop-analysis
-Wstatic-in-inline
-Wthread-safety
-Wthread-safety-beta
-Wthread-safety-negative
-Wthread-safety-verbose
-Wobjc-missing-property-synthesis
-Wobjc-interface-ivars
-Wobjc-messaging-id
-Wobjc-missing-property-synthesis
-Wobjc-property-assign-on-object-type
-Wreceiver-forward-class
-Wselector
-Wundeclared-selector
-Wstrict-selector-match
-Wsuper-class-method-mismatch
-Wduplicate-decl-specifier
-Wmain
-Wused-but-marked-unused
-Wavailability
-Wunguarded-availability
-Wheader-hygiene
-Wnonportable-system-include-path
-Wquoted-include-in-framework-header
-Winvalid-or-nonexistent-directory
-Wvariadic-macros
-Wreserved-id-macro
-Wreserved-user-defined-literal
-Widiomatic-parentheses
-Wincomplete-module
-Wimplicit-retain-self
-Wquoted-include-in-framework-header
-Watomic-implicit-seq-cst
-Wabstract-vbase-init
-Winconsistent-missing-destructor-override
-Woverriding-method-mismatch
-Wundefined-func-template
-Wundefined-reinterpret-cast
-Wunsupported-dll-base-class-template
-Wunused-exception-parameter
-Wunused-member-function
-Wunused-template
-Wweak-template-vtables
-Wzero-as-null-pointer-constant
-Wprofile-instr-missing
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(
-Wno-variadic-macros
-Wno-vla
-Wshadow
)
endif()
endif()
# ======================
# enable code analysis for the given target
function(ara_enable_target_analyzer target)
if(MSVC)
# file(TO_NATIVE_PATH "${CMAKE_CURRENT_LIST_DIR}" ARA_RULESET_DIR)
# set(ARA_RULESET_FILE "${ARA_RULESET_DIR}\\ARA_Library.ruleset")
target_compile_options(${target}
PRIVATE
/analyze
# \todo for some reason the compiler neither accepts this:
# /analyze:rulesetdirectory "${ARA_RULESET_DIR}"
# /analyze:ruleset ARA_Library.ruleset
# nor that:
# /analyze:ruleset "${ARA_RULESET_FILE}"
)
elseif(XCODE)
set_target_properties(${target} PROPERTIES
# Static Analyzer (Analysis Policy, Apple APIs, Security)
XCODE_ATTRIBUTE_RUN_CLANG_STATIC_ANALYZER YES
XCODE_ATTRIBUTE_CLANG_STATIC_ANALYZER_MODE $<IF:$<CONFIG:Debug>,shallow,deep>
XCODE_ATTRIBUTE_CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER YES
XCODE_ATTRIBUTE_CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND YES
XCODE_ATTRIBUTE_CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY YES
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# \todo instead of "cloning" the target, it may be more reliable to just run a post-build
# script that directly calls underlying xcodebuild/clang directly to build the
# target w/ analysis enabled (and obj file creation/link disabled)?
# But unfortunately OBJECT targets cannot have post-builds for some obscure reason...
get_target_property(sources ${target} SOURCES)
get_target_property(options ${target} COMPILE_OPTIONS)
get_target_property(definitions ${target} COMPILE_DEFINITIONS)
get_target_property(features ${target} COMPILE_FEATURES)
get_target_property(includes ${target} INCLUDE_DIRECTORIES)
get_target_property(libraries ${target} LINK_LIBRARIES)
# analysis only deals with object files, so we can always build an object libraray
# regardless of the original target's type
set(analysis_target ${target}_analysis)
add_library(${analysis_target} OBJECT
${sources}
)
set_target_properties(${analysis_target} PROPERTIES
FOLDER "Static Analysis"
EXCLUDE_FROM_ALL ON
LINKER_LANGUAGE NONE
)
# \todo we need to suppress linking or else the analysis build fails -
# unfortunately clearing the linker language above is not sufficent for this.
# until this is solved, we bypass automatic analysis when building and run it manually...
#add_dependencies(${target} ${analysis_target})
target_compile_options(${analysis_target} PRIVATE
PRIVATE
${options}
--analyze
# \todo do we need to pass -D__clang_analyzer__? Xcode does...
-D__clang_analyzer__
"SHELL:-Xclang -analyzer-config -Xclang mode=$<IF:$<CONFIG:Debug>,shallow,deep>"
"SHELL:-Xclang -analyzer-output=text"
"SHELL:-Xclang -analyzer-checker -Xclang core"
"SHELL:-Xclang -analyzer-checker -Xclang deadcode"
"SHELL:-Xclang -analyzer-checker -Xclang nullability"
"SHELL:-Xclang -analyzer-checker -Xclang optin"
"SHELL:-Xclang -analyzer-checker -Xclang security"
$<$<COMPILE_LANGUAGE:CXX>: "SHELL:-Xclang -analyzer-checker -Xclang cplusplus" >
$<$<PLATFORM_ID:Linux>: "SHELL:-Xclang -analyzer-checker -Xclang unix" >
$<$<PLATFORM_ID:Darwin>: "SHELL:-Xclang -analyzer-checker -Xclang osx" >
)
if(definitions)
target_compile_definitions(${analysis_target} PRIVATE ${definitions})
endif()
if(features)
target_compile_features(${analysis_target} PRIVATE ${features})
endif()
if(includes)
target_include_directories(${analysis_target} PRIVATE ${includes})
endif()
if(libraries)
target_link_libraries(${analysis_target} PRIVATE ${libraries})
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
target_compile_options(${target}
PRIVATE
# \todo with default settings in debug, the gcc analyzer eventually just dies because of memory usage.
# we need to test which analysis is causing this and disable it to make this usable
#-fanalyzer
$<$<NOT:$<CONFIG:Debug>>:-fanalyzer>
# \todo there's too many of those right now, need to figure out why...
#-Wanalyzer-too-complex
)
else()
message(WARNING "Static code analysis requires gcc 10 an up.")
endif()
else()
message(WARNING "Code analysis is not implemented for this compiler.")
endif()
endfunction()
# ======================
# set up common settings used for all the ARA examples
function(configure_ARA_Examples_target target)
# language standards
target_compile_features(${target} PRIVATE
cxx_std_11
c_std_11
)
# hide symbols per default
if(XCODE)
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES
)
else()
set_target_properties(${target} PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
endif()
# defines
target_compile_definitions(${target} PRIVATE
-DARA_TARGET_NAME=\"${target}\"
-DARA_TARGET_TYPE_$<TARGET_PROPERTY:${target},TYPE>
-DARA_MAJOR_VERSION=${ARA_MAJOR_VERSION}
-DARA_MINOR_VERSION=${ARA_MINOR_VERSION}
-DARA_PATCH_VERSION=${ARA_PATCH_VERSION}
-DARA_BUILD_VERSION=${ARA_BUILD_VERSION}
$<$<NOT:$<CONFIG:Debug>>: -DNDEBUG>
# for these examples, we want to always enable validation, assertions and logging (also for release)
# actual products would not do this, and let the ARA SDK enable these for debug builds only per default
-DARA_VALIDATE_API_CALLS=1
-DARA_ENABLE_INTERNAL_ASSERTS=1
-DARA_ENABLE_DEBUG_OUTPUT=1
)
# platform-specific settings
if(WIN32)
target_compile_definitions(${target} PRIVATE
-DNOMINMAX=1
)
elseif(APPLE)
set(bundle_identifier org.ara-audio.examples.${target})
set_target_properties(${target} PROPERTIES
ARA_PRODUCT_BUNDLE_IDENTIFIER ${bundle_identifier}
)
target_compile_definitions(${target} PRIVATE
-DARA_PRODUCT_BUNDLE_IDENTIFIER="$<TARGET_PROPERTY:${target},ARA_PRODUCT_BUNDLE_IDENTIFIER>"
)
unset(bundle_identifier)
endif()
ara_disable_unwanted_warnings(${target})
ara_enable_target_analyzer(${target})
ara_group_target_files(${target})
# stripping (may not be desired this way for actual products since these typically
# require more complex symbol handling for later crash log symbolication etc.)
if(MSVC)
# no debug symbol stripping needed here since MSVC creates separate .pdb files
# \todo any strip flags needed for dead stripping etc?
elseif(XCODE)
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING YES
XCODE_ATTRIBUTE_DEPLOYMENT_POSTPROCESSING $<IF:$<CONFIG:Debug>,NO,YES>
XCODE_ATTRIBUTE_COPY_PHASE_STRIP $<IF:$<CONFIG:Debug>,NO,YES>
)
else()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(${target} PROPERTIES
LINK_OPTIONS "-dead_strip"
)
endif()
# \todo for some reason, the Ninja and make generators do not fully expand the generator expression.
if(ARA_IS_MULTI_CONFIG_GENERATOR)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_STRIP}" $<$<NOT:$<CONFIG:Debug>>:-x -S> "$<TARGET_FILE:${target}>"
)
else()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_STRIP}" -x -S "$<TARGET_FILE:${target}>"
)
endif()
endif()
endif()
# Xcode build&scheme defaults for debugging
if(ARA_SETUP_DEBUGGING)
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<IF:$<CONFIG:Debug>,YES,NO>
# unfortunately due to how CMake and Xcode interact we cannot set these per configuration,
# so we switch the sanitizers off by default for now (\todo would be great to enable them for debug).
XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER OFF
XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP ON
XCODE_SCHEME_ADDRESS_SANITIZER OFF
XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN ON
XCODE_SCHEME_MALLOC_SCRIBBLE ON
XCODE_SCHEME_THREAD_SANITIZER OFF
XCODE_SCHEME_THREAD_SANITIZER_STOP ON
XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER OFF
XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP ON
)
endif()
endfunction()
# ======================
# set up common settings used for all targets that produce "shipping" binaries
function(ara_configure_binary_package target extension apple_plist_file)
# resources, bundle and signing
set(target_resources "")
if(WIN32)
list(APPEND target_resources
"${CMAKE_CURRENT_SOURCE_DIR}/ExamplesCommon/Windows/ARAExamples.rc"
)
elseif(APPLE)
list(APPEND target_resources
${apple_plist_file}
)
if (NOT ${extension} MATCHES "framework")
list(APPEND target_resources
"${CMAKE_CURRENT_SOURCE_DIR}/ExamplesCommon/macOS/ARAExamples.icns"
)
endif()
if(NOT ${extension} MATCHES "appex")
list(APPEND target_resources
"${CMAKE_CURRENT_SOURCE_DIR}/ExamplesCommon/macOS/ARAExamples.entitlements"
)
endif()
endif()
target_sources(${target} PRIVATE
${target_resources}
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${target_resources})
if(APPLE)
if(${extension} MATCHES "framework")
set_target_properties(${target} PROPERTIES
FRAMEWORK ON
FRAMEWORK_EXTENSION ${extension}