-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
JUCEUtils.cmake
2248 lines (1775 loc) · 90.4 KB
/
JUCEUtils.cmake
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
# ==============================================================================
#
# This file is part of the JUCE 6 technical preview.
# Copyright (c) 2020 - Raw Material Software Limited
#
# You may use this code under the terms of the GPL v3
# (see www.gnu.org/licenses).
#
# For this technical preview, this file is not subject to commercial licensing.
#
# JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
# DISCLAIMED.
#
# ==============================================================================
# ==================================================================================================
# JUCE/CMake Compatibility Module
#
# In this file, functions intended for use by end-users have the prefix `juce_`.
# Functions beginning with an underscore should be considered private and susceptible to
# change, so don't call them directly.
#
# See the readme at `examples/CMake` for more information about CMake usage,
# including documentation of the public functions in this file.
# ==================================================================================================
include_guard(GLOBAL)
cmake_minimum_required(VERSION 3.12)
define_property(TARGET PROPERTY JUCE_COMPANY_NAME INHERITED
BRIEF_DOCS "The company name for a particular target"
FULL_DOCS "This can be found in ProjectInfo::companyName in a generated JuceHeader.h")
set_property(GLOBAL PROPERTY JUCE_COMPANY_NAME "yourcompany")
define_property(TARGET PROPERTY JUCE_COMPANY_WEBSITE INHERITED
BRIEF_DOCS "The company website for a particular target"
FULL_DOCS "This will be placed in the Info.plist for the target")
set_property(GLOBAL PROPERTY JUCE_COMPANY_WEBSITE "")
define_property(TARGET PROPERTY JUCE_COMPANY_EMAIL INHERITED
BRIEF_DOCS "The company email address for a particular target"
FULL_DOCS "This will be placed in the Info.plist for the target")
set_property(GLOBAL PROPERTY JUCE_COMPANY_EMAIL "")
define_property(TARGET PROPERTY JUCE_COMPANY_COPYRIGHT INHERITED
BRIEF_DOCS "The company copyright for a particular target"
FULL_DOCS "This will be placed in the Info.plist for the target")
set_property(GLOBAL PROPERTY JUCE_COMPANY_COPYRIGHT "")
define_property(TARGET PROPERTY JUCE_VST_COPY_DIR INHERITED
BRIEF_DOCS "Install location for VST2 plugins"
FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
define_property(TARGET PROPERTY JUCE_VST3_COPY_DIR INHERITED
BRIEF_DOCS "Install location for VST3 plugins"
FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
define_property(TARGET PROPERTY JUCE_AU_COPY_DIR INHERITED
BRIEF_DOCS "Install location for AU plugins"
FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
define_property(TARGET PROPERTY JUCE_AAX_COPY_DIR INHERITED
BRIEF_DOCS "Install location for AAX plugins"
FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
define_property(TARGET PROPERTY JUCE_UNITY_COPY_DIR INHERITED
BRIEF_DOCS "Install location for Unity plugins"
FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
define_property(TARGET PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD INHERITED
BRIEF_DOCS "Whether or not plugins should be copied after building"
FULL_DOCS "Whether or not plugins should be copied after building")
set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD FALSE)
# ==================================================================================================
function(_juce_add_interface_library target)
add_library(${target} INTERFACE)
target_sources(${target} INTERFACE ${ARGN})
endfunction()
# ==================================================================================================
function(_juce_create_pkgconfig_target name)
if(TARGET juce::pkgconfig_${name})
return()
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(${name} ${ARGN})
add_library(pkgconfig_${name} INTERFACE)
add_library(juce::pkgconfig_${name} ALIAS pkgconfig_${name})
install(TARGETS pkgconfig_${name} EXPORT JUCE)
set(pairs
"INCLUDE_DIRECTORIES\;INCLUDE_DIRS"
"LINK_LIBRARIES\;LINK_LIBRARIES"
"LINK_OPTIONS\;LDFLAGS_OTHER"
"COMPILE_OPTIONS\;CFLAGS_OTHER")
foreach(pair IN LISTS pairs)
list(GET pair 0 key)
list(GET pair 1 value)
if(${name}_${value})
set_target_properties(pkgconfig_${name} PROPERTIES INTERFACE_${key} "${${name}_${value}}")
endif()
endforeach()
endfunction()
# ==================================================================================================
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
_juce_create_pkgconfig_target(JUCE_CURL_LINUX_DEPS libcurl)
_juce_create_pkgconfig_target(JUCE_BROWSER_LINUX_DEPS webkit2gtk-4.0 gtk+-x11-3.0)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_program(JUCE_RC_COMPILER Rez NO_DEFAULT_PATHS PATHS "/Applications/Xcode.app/Contents/Developer/usr/bin")
if(NOT JUCE_RC_COMPILER)
message(WARNING "failed to find Rez; older resource-based AU plug-ins may not work correctly")
endif()
endif()
set(JUCE_CMAKE_UTILS_DIR ${CMAKE_CURRENT_LIST_DIR}
CACHE INTERNAL "The path to the folder holding this file and other resources")
# We set up default/fallback copy dirs here. If you need different copy dirs, use
# set_directory_properties or set_target_properties to adjust the values of `JUCE_*_COPY_DIR` at
# the appropriate scope.
function(_juce_set_default_properties)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST")
set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST3")
set_property(GLOBAL PROPERTY JUCE_AU_COPY_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/Components")
set_property(GLOBAL PROPERTY JUCE_AAX_COPY_DIR "/Library/Application Support/Avid/Audio/Plug-Ins")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{ProgramW6432}/Steinberg/Vstplugins")
set(prefix "$ENV{CommonProgramW6432}")
else()
set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{programfiles\(x86\)}/Steinberg/Vstplugins")
set(prefix "$ENV{CommonProgramFiles\(x86\)}")
endif()
set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "${prefix}/VST3")
set_property(GLOBAL PROPERTY JUCE_AAX_COPY_DIR "${prefix}/Avid/Audio/Plug-Ins")
endif()
endfunction()
_juce_set_default_properties()
# ==================================================================================================
function(_juce_add_standard_defs juce_target)
target_compile_definitions(${juce_target} INTERFACE
JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1
$<IF:$<CONFIG:DEBUG>,DEBUG=1 _DEBUG=1,NDEBUG=1 _NDEBUG=1>
$<$<PLATFORM_ID:Android>:JUCE_ANDROID=1>)
endfunction()
# ==================================================================================================
macro(_juce_make_absolute path)
if(NOT IS_ABSOLUTE "${${path}}")
get_filename_component("${path}" "${${path}}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
endif()
endmacro()
macro(_juce_make_absolute_and_check path)
_juce_make_absolute("${path}")
if(NOT EXISTS "${${path}}")
message(FATAL_ERROR "No file at path ${${path}}")
endif()
endmacro()
# ==================================================================================================
function(juce_add_bundle_resources_directory target folder)
_juce_make_absolute(folder)
if(NOT EXISTS "${folder}")
message(FATAL_ERROR "Could not find resource folder ${folder}")
endif()
get_filename_component(folder_parent_path "${folder}" DIRECTORY)
file(GLOB_RECURSE resources RELATIVE "${folder_parent_path}" "${folder}/*")
foreach(file IN LISTS resources)
target_sources(${target} PRIVATE "${folder_parent_path}/${file}")
get_filename_component(resource_parent_path "${file}" DIRECTORY)
set_source_files_properties("${folder_parent_path}/${file}" PROPERTIES
HEADER_FILE_ONLY TRUE
MACOSX_PACKAGE_LOCATION "Resources/${resource_parent_path}")
endforeach()
endfunction()
# ==================================================================================================
# This creates an imported interface library with a random name, and then adds
# the fields from a JUCE module header to the target as INTERFACE_ properties.
# We can extract properties later using `_juce_get_metadata`.
# This way, the interface library ends up behaving a bit like a dictionary,
# and we don't have to parse the module header from scratch every time we
# want to find a specific key.
function(_juce_extract_metadata_block delim_str file_with_block out_dict)
string(RANDOM LENGTH 16 random_string)
set(target_name "${random_string}_dict")
set(${out_dict} "${target_name}" PARENT_SCOPE)
add_library(${target_name} INTERFACE IMPORTED)
if(NOT EXISTS ${file_with_block})
message(FATAL_ERROR "Unable to find file ${file_with_block}")
endif()
file(STRINGS ${file_with_block} module_header_contents)
set(last_written_key)
set(append NO)
foreach(line IN LISTS module_header_contents)
if(NOT append)
if(line MATCHES " *BEGIN_${delim_str} *")
set(append YES)
endif()
continue()
endif()
if(append AND (line MATCHES " *END_${delim_str} *"))
break()
endif()
if(line MATCHES "^ *([a-zA-Z]+):")
set(last_written_key "${CMAKE_MATCH_1}")
endif()
string(REGEX REPLACE "^ *${last_written_key}: *" "" line "${line}")
string(REGEX REPLACE "[ ,]+" ";" line "${line}")
set_property(TARGET ${target_name} APPEND PROPERTY
"INTERFACE_JUCE_${last_written_key}" "${line}")
endforeach()
endfunction()
# Fetches properties attached to a metadata target.
function(_juce_get_metadata target key out_var)
get_target_property(content "${target}" "INTERFACE_JUCE_${key}")
if(NOT "${content}" STREQUAL "content-NOTFOUND")
set(${out_var} "${content}" PARENT_SCOPE)
endif()
endfunction()
# ==================================================================================================
function(_juce_module_sources module_path output_path out_var)
get_filename_component(module_parent_path ${module_path} DIRECTORY)
get_filename_component(module_glob ${module_path} NAME)
file(GLOB module_cpp
CONFIGURE_DEPENDS LIST_DIRECTORIES false
RELATIVE "${module_parent_path}"
"${module_path}/${module_glob}*.cpp")
if(APPLE)
file(GLOB module_mm
CONFIGURE_DEPENDS LIST_DIRECTORIES false
RELATIVE "${module_parent_path}"
"${module_path}/${module_glob}*.mm"
"${module_path}/${module_glob}*.r")
if(module_mm)
set(module_mm_replaced ${module_mm})
list(TRANSFORM module_mm_replaced REPLACE "\\.mm$" ".cpp")
list(REMOVE_ITEM module_cpp ${module_mm_replaced})
list(APPEND module_cpp ${module_mm})
endif()
endif()
list(TRANSFORM module_cpp PREPEND "${output_path}/")
set(${out_var} ${module_cpp} PARENT_SCOPE)
endfunction()
# ==================================================================================================
function(_juce_get_all_plugin_kinds out)
set(${out} AU AUv3 AAX Standalone Unity VST VST3 PARENT_SCOPE)
endfunction()
function(_juce_get_platform_plugin_kinds out)
set(result Standalone)
if(APPLE)
list(APPEND result AUv3)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND result AU)
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND result AAX Unity VST VST3)
endif()
set(${out} ${result} PARENT_SCOPE)
endfunction()
function(_juce_add_plugin_definitions target visibility)
_juce_get_all_plugin_kinds(options)
cmake_parse_arguments(JUCE_ARG "${options}" "" "" ${ARGN})
foreach(opt IN LISTS options)
set(flag_value 0)
if(JUCE_ARG_${opt})
set(flag_value 1)
endif()
target_compile_definitions(${target} ${visibility} "JucePlugin_Build_${opt}=${flag_value}")
endforeach()
endfunction()
# ==================================================================================================
function(_juce_add_au_resource_fork shared_code_target au_target)
if(NOT JUCE_RC_COMPILER)
return()
endif()
get_target_property(product_name ${shared_code_target} JUCE_PRODUCT_NAME)
get_target_property(module_sources juce::juce_audio_plugin_client_AU INTERFACE_SOURCES)
list(FILTER module_sources INCLUDE REGEX "/juce_audio_plugin_client_AU.r$")
if(NOT module_sources)
message(FATAL_ERROR "Failed to find AU resource file input")
endif()
list(GET module_sources 0 au_rez_sources)
get_target_property(juce_library_code ${shared_code_target} JUCE_GENERATED_SOURCES_DIRECTORY)
# We don't want our AU AppConfig.h to end up on peoples' include paths if we can help it
set(secret_au_resource_dir "${juce_library_code}/${au_target}/secret")
set(secret_au_plugindefines "${secret_au_resource_dir}/JucePluginDefines.h")
set(au_rez_output "${secret_au_resource_dir}/${product_name}.rsrc")
target_sources(${au_target} PRIVATE "${au_rez_output}")
set_source_files_properties("${au_rez_output}" PROPERTIES
GENERATED TRUE
MACOSX_PACKAGE_LOCATION Resources)
set(defs_file $<GENEX_EVAL:$<TARGET_PROPERTY:${shared_code_target},JUCE_DEFS_FILE>>)
# Passing all our compile definitions using generator expressions is really painful
# because some of the definitions have pipes and quotes and dollars and goodness-knows
# what else that the shell would very much like to claim for itself, thank you very much.
# CMake definitely knows how to escape all these things, because it's perfectly happy to pass
# them to compiler invocations, but I have no idea how to get it to escape them
# in a custom command.
# In the end, it's simplest to generate a special single-purpose appconfig just for the
# resource compiler.
add_custom_command(OUTPUT "${secret_au_plugindefines}"
COMMAND juce::juceaide auplugindefines "${defs_file}" "${secret_au_plugindefines}"
DEPENDS "${defs_file}"
VERBATIM)
add_custom_command(OUTPUT "${au_rez_output}"
COMMAND "${JUCE_RC_COMPILER}"
-d "ppc_$ppc" -d "i386_$i386" -d "ppc64_$ppc64" -d "x86_64_$x86_64"
-I "${secret_au_resource_dir}"
-I "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers"
-I "/Applications/Xcode/app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase"
-I "/Applications/Xcode/app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AudioUnit.framework/Headers"
-isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
"${au_rez_sources}"
-o "${au_rez_output}"
DEPENDS "${au_rez_input}" "${secret_au_plugindefines}"
VERBATIM)
endfunction()
# ==================================================================================================
function(_juce_add_plugin_wrapper_target)
set(one_value_args FORMAT PATH OUT_PATH INSTALL_EXPORT)
cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN})
_juce_module_sources("${JUCE_ARG_PATH}" "${JUCE_ARG_OUT_PATH}" out_var)
list(FILTER out_var EXCLUDE REGEX "/juce_audio_plugin_client_utils.cpp$")
set(target_name juce_audio_plugin_client_${JUCE_ARG_FORMAT})
_juce_add_interface_library("${target_name}" ${out_var})
_juce_add_plugin_definitions("${target_name}" INTERFACE ${JUCE_ARG_FORMAT})
_juce_add_standard_defs("${target_name}")
target_compile_features("${target_name}" INTERFACE cxx_std_11)
add_library("juce::${target_name}" ALIAS "${target_name}")
install(TARGETS "${target_name}" EXPORT "${JUCE_ARG_INSTALL_EXPORT}")
if(JUCE_ARG_FORMAT STREQUAL "AUv3")
find_library(AUv3_AVFoundation AVFoundation REQUIRED)
target_link_libraries("${target_name}" INTERFACE ${AUv3_AVFoundation})
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_library(AUv3_AudioUnit AudioUnit REQUIRED)
target_link_libraries("${target_name}" INTERFACE ${AUv3_AudioUnit})
endif()
endif()
endfunction()
# ==================================================================================================
function(_juce_link_libs_from_metadata module_name dict key)
_juce_get_metadata("${dict}" "${key}" libs)
if(libs)
target_link_libraries(${module_name} INTERFACE ${libs})
endif()
endfunction()
# ==================================================================================================
function(juce_add_module module_path)
set(one_value_args INSTALL_PATH INSTALL_EXPORT ALIAS_NAMESPACE)
cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN})
_juce_make_absolute(module_path)
get_filename_component(module_name ${module_path} NAME)
get_filename_component(module_parent_path ${module_path} DIRECTORY)
set(installed_module_path "${JUCE_ARG_INSTALL_PATH}")
set(module_header_name "${module_name}.h")
if(NOT EXISTS "${module_path}/${module_header_name}")
set(module_header_name "${module_header_name}pp")
endif()
if(NOT EXISTS "${module_path}/${module_header_name}")
message(FATAL_ERROR "Could not locate module header for module '${module_path}'")
endif()
set(base_path "$<BUILD_INTERFACE:${module_parent_path}>$<INSTALL_INTERFACE:${installed_module_path}>")
list(APPEND all_module_sources "${base_path}/${module_name}/${module_header_name}")
set(install_export_args)
if(JUCE_ARG_INSTALL_EXPORT)
set(install_export_args INSTALL_EXPORT "${JUCE_ARG_INSTALL_EXPORT}")
endif()
if(${module_name} STREQUAL "juce_audio_plugin_client")
_juce_get_platform_plugin_kinds(plugin_kinds)
foreach(kind IN LISTS plugin_kinds)
_juce_add_plugin_wrapper_target(FORMAT ${kind}
PATH "${module_path}"
OUT_PATH "${base_path}"
${install_export_args})
endforeach()
list(APPEND all_module_sources "${base_path}/${module_name}/juce_audio_plugin_client_utils.cpp")
else()
_juce_module_sources("${module_path}" "${base_path}" globbed_sources)
list(APPEND all_module_sources ${globbed_sources})
endif()
_juce_add_interface_library(${module_name} ${all_module_sources})
if(${module_name} STREQUAL "juce_core")
_juce_add_standard_defs(${module_name})
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
target_sources(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c")
target_include_directories(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures")
target_link_libraries(juce_core INTERFACE android log)
endif()
endif()
source_group(Modules FILES ${all_module_sources})
if(${module_name} STREQUAL "juce_audio_processors")
add_library(juce_vst3_headers INTERFACE)
target_include_directories(juce_vst3_headers INTERFACE
"${base_path}/juce_audio_processors/format_types/VST3_SDK")
target_link_libraries(juce_audio_processors INTERFACE juce_vst3_headers)
if(JUCE_ARG_INSTALL_EXPORT)
install(TARGETS juce_vst3_headers EXPORT "${JUCE_ARG_INSTALL_EXPORT}")
endif()
if(JUCE_ARG_ALIAS_NAMESPACE)
add_library(${JUCE_ARG_ALIAS_NAMESPACE}::juce_vst3_headers ALIAS juce_vst3_headers)
endif()
endif()
target_include_directories(${module_name} INTERFACE ${base_path})
target_compile_definitions(${module_name} INTERFACE JUCE_MODULE_AVAILABLE_${module_name}=1)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_compile_definitions(${module_name} INTERFACE LINUX=1)
endif()
_juce_extract_metadata_block(JUCE_MODULE_DECLARATION "${module_path}/${module_header_name}" metadata_dict)
_juce_get_metadata("${metadata_dict}" minimumCppStandard module_cpp_standard)
if(module_cpp_standard)
target_compile_features(${module_name} INTERFACE cxx_std_${module_cpp_standard})
else()
target_compile_features(${module_name} INTERFACE cxx_std_11)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
_juce_get_metadata("${metadata_dict}" OSXFrameworks module_osxframeworks)
foreach(module_framework IN LISTS module_osxframeworks)
if(module_framework STREQUAL "")
continue()
endif()
find_library("${module_name}_${module_framework}" ${module_framework} REQUIRED)
target_link_libraries(${module_name} INTERFACE "${${module_name}_${module_framework}}")
endforeach()
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" OSXLibs)
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
_juce_get_metadata("${metadata_dict}" iOSFrameworks module_iosframeworks)
foreach(module_framework IN LISTS module_iosframeworks)
if(module_framework STREQUAL "")
continue()
endif()
find_library("${module_name}_${module_framework}" ${module_framework} REQUIRED)
target_link_libraries(${module_name} INTERFACE "${${module_name}_${module_framework}}")
endforeach()
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" iOSLibs)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
_juce_get_metadata("${metadata_dict}" linuxPackages module_linuxpackages)
if(module_linuxpackages)
_juce_create_pkgconfig_target(${module_name}_LINUX_DEPS ${module_linuxpackages})
target_link_libraries(${module_name} INTERFACE juce::pkgconfig_${module_name}_LINUX_DEPS)
endif()
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" linuxLibs)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_options(${module_name} INTERFACE /bigobj)
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" windowsLibs)
endif()
_juce_get_metadata("${metadata_dict}" dependencies module_dependencies)
target_link_libraries(${module_name} INTERFACE ${module_dependencies})
if(JUCE_ARG_INSTALL_PATH OR JUCE_ARG_INSTALL_EXPORT)
install(DIRECTORY "${module_path}" DESTINATION "${installed_module_path}")
install(TARGETS ${module_name} EXPORT "${JUCE_ARG_INSTALL_EXPORT}")
endif()
if(JUCE_ARG_ALIAS_NAMESPACE)
add_library(${JUCE_ARG_ALIAS_NAMESPACE}::${module_name} ALIAS ${module_name})
endif()
endfunction()
function(juce_add_modules)
set(one_value_args INSTALL_PATH INSTALL_EXPORT ALIAS_NAMESPACE)
cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN})
foreach(path IN LISTS JUCE_ARG_UNPARSED_ARGUMENTS)
juce_add_module(${path}
INSTALL_PATH "${JUCE_ARG_INSTALL_PATH}"
INSTALL_EXPORT "${JUCE_ARG_INSTALL_EXPORT}"
ALIAS_NAMESPACE "${JUCE_ARG_ALIAS_NAMESPACE}")
endforeach()
endfunction()
# ==================================================================================================
# Ideally, we'd check the preprocessor defs on the target to see whether
# JUCE_USE_CURL, JUCE_WEB_BROWSER, or JUCE_IN_APP_PURCHASES have been explicitly turned off,
# and then link libraries as appropriate.
# Unfortunately, this doesn't work, because linking a new library (curl/webkit/StoreKit)
# updates the target's compile defs, which results in a recursion/circular-dependency.
# Instead, we ask the user to explicitly request curl/webkit/StoreKit linking if they
# know they need it. Otherwise, we won't link anything.
# See the NEEDS_CURL, NEEDS_WEB_BROWSER, and NEEDS_STORE_KIT options in the CMake/readme.md.
function(_juce_link_optional_libraries target)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
get_target_property(needs_curl ${target} JUCE_NEEDS_CURL)
if(needs_curl)
target_link_libraries(${target} PRIVATE juce::pkgconfig_JUCE_CURL_LINUX_DEPS)
endif()
get_target_property(needs_browser ${target} JUCE_NEEDS_WEB_BROWSER)
if(needs_browser)
target_link_libraries(${target} PRIVATE juce::pkgconfig_JUCE_BROWSER_LINUX_DEPS)
endif()
elseif(APPLE)
get_target_property(needs_storekit ${target} JUCE_NEEDS_STORE_KIT)
if(needs_storekit)
find_library(${target}_StoreKit StoreKit REQUIRED)
target_link_libraries(${target} PRIVATE ${${target}_StoreKit})
endif()
get_target_property(needs_camera ${target} JUCE_CAMERA_PERMISSION_ENABLED)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" AND needs_camera)
find_library(${target}_ImageIO ImageIO REQUIRED)
target_link_libraries(${target} PRIVATE ${${target}_ImageIO})
endif()
endif()
endfunction()
# ==================================================================================================
function(_juce_get_module_definitions target filter out_var)
set(compile_defs $<TARGET_GENEX_EVAL:${target},$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>>)
if(filter)
set(${out_var} $<FILTER:${compile_defs},INCLUDE,JUCE_MODULE_AVAILABLE_> PARENT_SCOPE)
else()
set(${out_var} ${compile_defs} PARENT_SCOPE)
endif()
endfunction()
function(_juce_append_record output key)
string(ASCII 30 RS)
string(ASCII 31 US)
set(${output} "${${output}}${key}${US}${ARGN}${RS}" PARENT_SCOPE)
endfunction()
function(_juce_append_target_property output key target property)
get_target_property(prop ${target} ${property})
if(prop STREQUAL "prop-NOTFOUND")
set(prop)
endif()
_juce_append_record(${output} ${key} ${prop})
set(${output} "${${output}}" PARENT_SCOPE)
endfunction()
# This is all info that should be known at configure time (i.e. no generator expressions here!)
# We use this info to generate plists and entitlements files, also at configure time.
function(_juce_write_configure_time_info target)
_juce_append_target_property(file_content EXECUTABLE_NAME ${target} JUCE_PRODUCT_NAME)
_juce_append_target_property(file_content VERSION ${target} JUCE_VERSION)
_juce_append_target_property(file_content PLIST_TO_MERGE ${target} JUCE_PLIST_TO_MERGE)
_juce_append_target_property(file_content BUNDLE_ID ${target} JUCE_BUNDLE_ID)
_juce_append_target_property(file_content XCODE_EXTRA_PLIST_ENTRIES ${target} JUCE_XCODE_EXTRA_PLIST_ENTRIES)
_juce_append_target_property(file_content MICROPHONE_PERMISSION_ENABLED ${target} JUCE_MICROPHONE_PERMISSION_ENABLED)
_juce_append_target_property(file_content MICROPHONE_PERMISSION_TEXT ${target} JUCE_MICROPHONE_PERMISSION_TEXT)
_juce_append_target_property(file_content CAMERA_PERMISSION_ENABLED ${target} JUCE_CAMERA_PERMISSION_ENABLED)
_juce_append_target_property(file_content CAMERA_PERMISSION_TEXT ${target} JUCE_CAMERA_PERMISSION_TEXT)
_juce_append_target_property(file_content BLUETOOTH_PERMISSION_ENABLED ${target} JUCE_BLUETOOTH_PERMISSION_ENABLED)
_juce_append_target_property(file_content BLUETOOTH_PERMISSION_TEXT ${target} JUCE_BLUETOOTH_PERMISSION_TEXT)
_juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_ENABLED ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_ENABLED)
_juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_TEXT ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_TEXT)
_juce_append_target_property(file_content SHOULD_ADD_STORYBOARD ${target} JUCE_SHOULD_ADD_STORYBOARD)
_juce_append_target_property(file_content LAUNCH_STORYBOARD_FILE ${target} JUCE_LAUNCH_STORYBOARD_FILE)
_juce_append_target_property(file_content ICON_FILE ${target} JUCE_ICON_FILE)
_juce_append_target_property(file_content PROJECT_NAME ${target} JUCE_PRODUCT_NAME)
_juce_append_target_property(file_content COMPANY_COPYRIGHT ${target} JUCE_COMPANY_COPYRIGHT)
_juce_append_target_property(file_content COMPANY_NAME ${target} JUCE_COMPANY_NAME)
_juce_append_target_property(file_content DOCUMENT_EXTENSIONS ${target} JUCE_DOCUMENT_EXTENSIONS)
_juce_append_target_property(file_content FILE_SHARING_ENABLED ${target} JUCE_FILE_SHARING_ENABLED)
_juce_append_target_property(file_content DOCUMENT_BROWSER_ENABLED ${target} JUCE_DOCUMENT_BROWSER_ENABLED)
_juce_append_target_property(file_content STATUS_BAR_HIDDEN ${target} JUCE_STATUS_BAR_HIDDEN)
_juce_append_target_property(file_content BACKGROUND_AUDIO_ENABLED ${target} JUCE_BACKGROUND_AUDIO_ENABLED)
_juce_append_target_property(file_content BACKGROUND_BLE_ENABLED ${target} JUCE_BACKGROUND_BLE_ENABLED)
_juce_append_target_property(file_content PUSH_NOTIFICATIONS_ENABLED ${target} JUCE_PUSH_NOTIFICATIONS_ENABLED)
_juce_append_target_property(file_content PLUGIN_MANUFACTURER_CODE ${target} JUCE_PLUGIN_MANUFACTURER_CODE)
_juce_append_target_property(file_content PLUGIN_CODE ${target} JUCE_PLUGIN_CODE)
_juce_append_target_property(file_content IPHONE_SCREEN_ORIENTATIONS ${target} JUCE_IPHONE_SCREEN_ORIENTATIONS)
_juce_append_target_property(file_content IPAD_SCREEN_ORIENTATIONS ${target} JUCE_IPAD_SCREEN_ORIENTATIONS)
_juce_append_target_property(file_content PLUGIN_NAME ${target} JUCE_PRODUCT_NAME)
_juce_append_target_property(file_content PLUGIN_MANUFACTURER ${target} JUCE_COMPANY_NAME)
_juce_append_target_property(file_content PLUGIN_DESCRIPTION ${target} JUCE_DESCRIPTION)
_juce_append_target_property(file_content PLUGIN_AU_EXPORT_PREFIX ${target} JUCE_AU_EXPORT_PREFIX)
_juce_append_target_property(file_content PLUGIN_AU_MAIN_TYPE ${target} JUCE_AU_MAIN_TYPE_CODE)
_juce_append_target_property(file_content IS_AU_SANDBOX_SAFE ${target} JUCE_AU_SANDBOX_SAFE)
_juce_append_target_property(file_content IS_PLUGIN_SYNTH ${target} JUCE_IS_SYNTH)
_juce_append_target_property(file_content HARDENED_RUNTIME_ENABLED ${target} JUCE_HARDENED_RUNTIME_ENABLED)
_juce_append_target_property(file_content APP_SANDBOX_ENABLED ${target} JUCE_APP_SANDBOX_ENABLED)
_juce_append_target_property(file_content APP_SANDBOX_INHERIT ${target} JUCE_APP_SANDBOX_INHERIT)
_juce_append_target_property(file_content HARDENED_RUNTIME_OPTIONS ${target} JUCE_HARDENED_RUNTIME_OPTIONS)
_juce_append_target_property(file_content APP_SANDBOX_OPTIONS ${target} JUCE_APP_SANDBOX_OPTIONS)
_juce_append_target_property(file_content APP_GROUPS_ENABLED ${target} JUCE_APP_GROUPS_ENABLED)
_juce_append_target_property(file_content APP_GROUP_IDS ${target} JUCE_APP_GROUP_IDS)
_juce_append_target_property(file_content IS_PLUGIN ${target} JUCE_IS_PLUGIN)
_juce_append_target_property(file_content ICLOUD_PERMISSIONS_ENABLED ${target} JUCE_ICLOUD_PERMISSIONS_ENABLED)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
_juce_append_record(file_content IS_IOS 1)
else()
_juce_append_record(file_content IS_IOS 0)
endif()
get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY)
set(info_file "${juce_library_code}/Info.txt")
file(WRITE "${info_file}" "${file_content}")
set_target_properties(${target} PROPERTIES JUCE_INFO_FILE "${info_file}")
endfunction()
# In this file, we put things that CMake is only able to divine at generate time, like preprocessor definitions.
# We use the target preprocessor definitions to work out which JUCE modules should go in the JuceHeader.h.
function(_juce_write_generate_time_info target)
_juce_get_module_definitions(${target} OFF module_defs)
_juce_append_record(defs MODULE_DEFINITIONS ${module_defs})
_juce_append_target_property(defs EXECUTABLE_NAME ${target} JUCE_PRODUCT_NAME)
_juce_append_target_property(defs PROJECT_NAME ${target} JUCE_PRODUCT_NAME)
_juce_append_target_property(defs VERSION ${target} JUCE_VERSION)
_juce_append_target_property(defs COMPANY_NAME ${target} JUCE_COMPANY_NAME)
get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY)
set(defs_file "${juce_library_code}/$<CONFIG>/Defs.txt")
file(GENERATE OUTPUT "${defs_file}" CONTENT "${defs}")
set_target_properties(${target} PROPERTIES JUCE_DEFS_FILE "${defs_file}")
endfunction()
# ==================================================================================================
function(juce_add_binary_data target)
set(one_value_args NAMESPACE HEADER_NAME)
set(multi_value_args SOURCES)
cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN})
list(LENGTH JUCE_ARG_SOURCES num_binary_files)
if(${num_binary_files} LESS 1)
message(FATAL_ERROR "juce_add_binary_data must be passed at least one file to encode")
endif()
add_library(${target} STATIC)
set(juce_binary_data_folder "${CMAKE_CURRENT_BINARY_DIR}/juce_binarydata_${target}/JuceLibraryCode")
list(APPEND binary_file_names "${juce_binary_data_folder}/BinaryData.h")
foreach(index RANGE 1 ${num_binary_files})
list(APPEND binary_file_names "${juce_binary_data_folder}/BinaryData${index}.cpp")
endforeach()
file(MAKE_DIRECTORY ${juce_binary_data_folder})
if(NOT JUCE_ARG_NAMESPACE)
set(JUCE_ARG_NAMESPACE BinaryData)
endif()
if(NOT JUCE_ARG_HEADER_NAME)
set(JUCE_ARG_HEADER_NAME BinaryData.h)
endif()
add_custom_command(OUTPUT ${binary_file_names}
COMMAND juce::juceaide binarydata "${JUCE_ARG_NAMESPACE}" "${JUCE_ARG_HEADER_NAME}"
${juce_binary_data_folder} ${JUCE_ARG_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
VERBATIM)
target_sources(${target} PRIVATE "${binary_file_names}")
target_include_directories(${target} INTERFACE ${juce_binary_data_folder})
target_compile_features(${target} PRIVATE cxx_std_11)
if(JUCE_ARG_HEADER_NAME STREQUAL "BinaryData.h")
target_compile_definitions(${target} INTERFACE JUCE_TARGET_HAS_BINARY_DATA=1)
endif()
endfunction()
# ==================================================================================================
# math(EXPR ... OUTPUT_FORMAT HEXADECIMAL) wasn't added until 3.13, but we need 3.12 for vcpkg
# compatibility
function(_juce_dec_to_hex num out_var)
while(num)
math(EXPR digit "${num} % 16")
math(EXPR num "${num} / 16")
if(digit GREATER_EQUAL 10)
math(EXPR ascii_code "${digit} + 55")
string(ASCII "${ascii_code}" digit)
endif()
set(result "${digit}${result}")
endwhile()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(_juce_version_code version_in out_var)
string(REGEX REPLACE "\\." ";" version_list ${version_in})
list(LENGTH version_list num_version_components)
set(version_major 0)
set(version_minor 0)
set(version_patch 0)
if(num_version_components GREATER 0)
list(GET version_list 0 version_major)
endif()
if(num_version_components GREATER 1)
list(GET version_list 1 version_minor)
endif()
if(num_version_components GREATER 2)
list(GET version_list 2 version_patch)
endif()
math(EXPR decimal "(${version_major} << 16) + (${version_minor} << 8) + ${version_patch}")
_juce_dec_to_hex(${decimal} hex)
set(${out_var} "${hex}" PARENT_SCOPE)
endfunction()
function(_juce_to_char_literal str out_var)
string(APPEND str " ") # Make sure there are at least 4 characters in the string.
# Round-tripping through a file is the simplest way to convert a string to hex...
string(SUBSTRING "${str}" 0 4 four_chars)
string(RANDOM LENGTH 16 random_string)
set(scratch_file "${CMAKE_CURRENT_BINARY_DIR}/${random_string}_ascii_conversion.txt")
file(WRITE "${scratch_file}" "${four_chars}")
file(READ "${scratch_file}" four_chars_hex HEX)
file(REMOVE "${scratch_file}")
set(${out_var} ${four_chars_hex} PARENT_SCOPE)
endfunction()
# ==================================================================================================
function(juce_generate_juce_header target)
get_target_property(juce_library_code ${target} JUCE_GENERATED_SOURCES_DIRECTORY)
if(NOT juce_library_code)
message(FATAL_ERROR "Target ${target} does not have a generated sources directory. Ensure it was created with a juce_add_* function")
endif()
set(juce_header ${juce_library_code}/JuceHeader.h)
target_sources(${target} PRIVATE ${juce_header})
set(defs_file $<GENEX_EVAL:$<TARGET_PROPERTY:${target},JUCE_DEFS_FILE>>)
set(extra_args)
add_custom_command(OUTPUT "${juce_header}"
COMMAND juce::juceaide header "${defs_file}" "${juce_header}" ${extra_args}
DEPENDS "${defs_file}"
VERBATIM)
endfunction()
# ==================================================================================================
function(_juce_execute_juceaide)
if(NOT TARGET juce::juceaide)
message(FATAL_ERROR "The juceaide target does not exist")
endif()
get_target_property(juceaide_location juce::juceaide IMPORTED_LOCATION)
if(NOT EXISTS "${juceaide_location}")
message(FATAL_ERROR "juceaide was imported, but it doesn't exist!")
endif()
execute_process(COMMAND "${juceaide_location}" ${ARGN} RESULT_VARIABLE result_variable)
if(result_variable)
message(FATAL_ERROR "Running juceaide failed")
endif()
endfunction()
function(_juce_set_output_name target name)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
set_target_properties(${target} PROPERTIES
OUTPUT_NAME ${name}
XCODE_ATTRIBUTE_PRODUCT_NAME ${name})
endif()
endfunction()
function(_juce_generate_icon source_target dest_target)
get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY)
get_target_property(juce_property_icon_big ${source_target} JUCE_ICON_BIG)
get_target_property(juce_property_icon_small ${source_target} JUCE_ICON_SMALL)
if(NOT (juce_property_icon_big OR juce_property_icon_small))
return()
endif()
set(icon_args)
if(juce_property_icon_big)
list(APPEND icon_args "${juce_property_icon_big}")
endif()
if(juce_property_icon_small)
list(APPEND icon_args "${juce_property_icon_small}")
endif()
set(generated_icon)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(generated_icon "${juce_library_code}/Icon.icns")
add_custom_command(OUTPUT "${generated_icon}"
COMMAND juce::juceaide macicon "${generated_icon}" ${icon_args}
VERBATIM)
set_source_files_properties(${generated_icon} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(generated_icon "${juce_library_code}/icon.ico")
add_custom_command(OUTPUT ${generated_icon}
COMMAND juce::juceaide winicon "${generated_icon}" ${icon_args}
VERBATIM)
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
get_target_property(generated_icon ${source_target} JUCE_CUSTOM_XCASSETS_FOLDER)
if(NOT generated_icon)
set(out_path "${juce_library_code}/${dest_target}")
set(generated_icon "${out_path}/Images.xcassets")
# To get compiled properly, we need iOS assets at configure time!
_juce_execute_juceaide(iosassets "${out_path}" ${icon_args})
endif()
set_target_properties(${dest_target} PROPERTIES
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
get_target_property(add_storyboard ${source_target} JUCE_SHOULD_ADD_STORYBOARD)
if(NOT add_storyboard)
set_target_properties(${dest_target} PROPERTIES
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME "LaunchImage")
endif()
endif()
if(generated_icon)
target_sources(${dest_target} PRIVATE ${generated_icon})
set_target_properties(${source_target} PROPERTIES
JUCE_ICON_FILE "${generated_icon}"
RESOURCE "${generated_icon}")
endif()
endfunction()
function(_juce_add_xcode_entitlements source_target dest_target)
get_target_property(juce_kind_string ${dest_target} JUCE_TARGET_KIND_STRING)
get_target_property(input_info_file ${source_target} JUCE_INFO_FILE)
get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY)
set(entitlements_file "${juce_library_code}/${dest_target}.entitlements")
_juce_execute_juceaide(entitlements "${juce_kind_string}" "${input_info_file}" "${entitlements_file}")
set_target_properties(${dest_target} PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${entitlements_file}")
endfunction()
function(_juce_configure_bundle source_target dest_target)
_juce_generate_icon(${source_target} ${dest_target})
_juce_write_configure_time_info(${source_target})
if(NOT APPLE)
return()
endif()
get_target_property(generated_icon ${source_target} JUCE_ICON_FILE)
set(icon_dependency)
if(generated_icon)
set(icon_dependency "${generated_icon}")
endif()
get_target_property(juce_library_code ${source_target} JUCE_GENERATED_SOURCES_DIRECTORY)
get_target_property(input_info_file ${source_target} JUCE_INFO_FILE)
set(this_output_info_dir "${juce_library_code}/${dest_target}")
set(this_output_pkginfo "${this_output_info_dir}/PkgInfo")
set(this_output_plist "${this_output_info_dir}/Info.plist")
get_target_property(juce_kind_string ${dest_target} JUCE_TARGET_KIND_STRING)
_juce_execute_juceaide(plist "${juce_kind_string}" "${input_info_file}" "${this_output_plist}")
set_target_properties(${dest_target} PROPERTIES
BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${this_output_plist}")
add_custom_command(OUTPUT "${this_output_pkginfo}"