@@ -3,37 +3,110 @@ import ProjectDescription
33// MARK: - Constants
44
55let destinations : Destinations = [ . iPhone , . iPad , . mac , . appleVision ]
6+ let useComputeBackend = Environment . openattributegraphCompute . getBoolean ( default : false )
7+ let platformTargetName = " OpenAttributeGraphPlatform "
8+ let utilitiesTargetName = " OpenAttributeGraphUtilities "
9+ let commonConfigurations : [ Configuration ] = [
10+ . debug ( name : " Debug " , xcconfig : " Configs/Common.xcconfig " ) ,
11+ . release ( name : " Release " , xcconfig : " Configs/Common.xcconfig " ) ,
12+ ]
13+ let nativeHeaderSearchSettings : SettingsDictionary = [
14+ " HEADER_SEARCH_PATHS " : " $(inherited) $(SRCROOT)/Sources/Platform/include $(SRCROOT)/Sources/Utilities/include $(SRCROOT)/Sources/OpenAttributeGraphCxx/include " ,
15+ " USER_HEADER_SEARCH_PATHS " : " $(inherited) $(SRCROOT)/Sources/OpenAttributeGraphCxx " ,
16+ ]
17+ let cxxInteropSettings : SettingsDictionary = [
18+ " GCC_PREPROCESSOR_DEFINITIONS " : " $(inherited) SWIFT_TESTING=1 " ,
19+ " OTHER_SWIFT_FLAGS " : " $(inherited) -cxx-interoperability-mode=default -Xcc -std=c++20 " ,
20+ " SWIFT_INCLUDE_PATHS " : " $(inherited) $(SRCROOT)/Sources/Platform/include $(SRCROOT)/Sources/Utilities/include $(SRCROOT)/Sources/OpenAttributeGraphCxx/include " ,
21+ ]
22+ let openAttributeGraphShimsDependencies : [ TargetDependency ] = useComputeBackend
23+ ? [
24+ . external ( name : " Compute " ) ,
25+ . sdk ( name : " c++ " , type : . library ) ,
26+ . sdk ( name : " Demangle " , type : . swiftLibrary ) ,
27+ ]
28+ : [
29+ . target ( name : " OpenAttributeGraph " ) ,
30+ ]
31+ let openAttributeGraphShimsSettings : SettingsDictionary = useComputeBackend
32+ ? [
33+ " SWIFT_ACTIVE_COMPILATION_CONDITIONS " : " $(inherited) OPENATTRIBUTEGRAPH_COMPUTE " ,
34+ ]
35+ : [ : ]
36+
37+ func commonSettings ( base : SettingsDictionary = [ : ] ) -> Settings {
38+ . settings (
39+ base : base ,
40+ configurations : commonConfigurations ,
41+ defaultSettings : . none
42+ )
43+ }
644
745// MARK: - Project
846
947let project = Project (
1048 name : " OpenAttributeGraph " ,
1149 settings : . settings (
12- configurations : [
13- . debug ( name : " Debug " , xcconfig : " Configs/Common.xcconfig " ) ,
14- . release ( name : " Release " , xcconfig : " Configs/Common.xcconfig " ) ,
15- ] ,
50+ configurations : commonConfigurations ,
1651 defaultSettings : . none
1752 ) ,
1853 targets : [
54+ . target (
55+ name : platformTargetName ,
56+ destinations : destinations ,
57+ product : . staticLibrary ,
58+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.Platform " ,
59+ sources : [ " Sources/Platform/**/*.c " ] ,
60+ headers : . headers ( public : [ " Sources/Platform/include/platform/** " ] ) ,
61+ settings : commonSettings ( base : nativeHeaderSearchSettings )
62+ ) ,
63+ . target (
64+ name : utilitiesTargetName ,
65+ destinations : destinations ,
66+ product : . staticLibrary ,
67+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.Utilities " ,
68+ sources : [ " Sources/Utilities/**/*.cpp " ] ,
69+ headers : . headers ( public : [ " Sources/Utilities/include/Utilities/** " ] ) ,
70+ dependencies : [
71+ . target ( name : platformTargetName ) ,
72+ ] ,
73+ settings : commonSettings (
74+ base : nativeHeaderSearchSettings . merging ( [
75+ " PRODUCT_MODULE_NAME " : " Utilities " ,
76+ ] )
77+ )
78+ ) ,
79+ . target (
80+ name : " OpenAttributeGraphCxx " ,
81+ destinations : destinations ,
82+ product : . staticLibrary ,
83+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.Cxx " ,
84+ sources : [
85+ " Sources/OpenAttributeGraphCxx/**/*.c " ,
86+ " Sources/OpenAttributeGraphCxx/**/*.cpp " ,
87+ " Sources/OpenAttributeGraphCxx/**/*.mm " ,
88+ ] ,
89+ headers : . headers (
90+ public : [
91+ " Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/** " ,
92+ " Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/** " ,
93+ ]
94+ ) ,
95+ dependencies : [
96+ . target ( name : platformTargetName ) ,
97+ . target ( name : utilitiesTargetName ) ,
98+ . sdk ( name : " z " , type : . library ) ,
99+ ] ,
100+ settings : commonSettings ( base : nativeHeaderSearchSettings )
101+ ) ,
19102 . target (
20103 name : " OpenAttributeGraph " ,
21104 destinations : destinations ,
22105 product : . framework ,
23106 bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph " ,
24107 sources : [
25- " Sources/Platform/** " ,
26- " Sources/Utilities/** " ,
27- " Sources/OpenAttributeGraphCxx/** " ,
28108 " Sources/OpenAttributeGraph/** " ,
29109 ] ,
30- headers : . headers (
31- project : [
32- " Sources/OpenAttributeGraphCxx/include/** " ,
33- " Sources/Platform/include/** " ,
34- " Sources/Utilities/include/** " ,
35- ]
36- ) ,
37110 scripts : [
38111 . pre (
39112 path : " Scripts/Xcode/process_headers.sh " ,
@@ -51,11 +124,13 @@ let project = Project(
51124 ) ,
52125 ] ,
53126 dependencies : [
54- . sdk ( name : " z " , type : . library ) ,
127+ . target ( name : " OpenAttributeGraphCxx " ) ,
128+ . sdk ( name : " c++ " , type : . library ) ,
55129 ] ,
56130 settings : . settings (
57131 base : [
58132 " DEFINES_MODULE " : " NO " ,
133+ " OTHER_LDFLAGS " : " $(inherited) -force_load $(BUILT_PRODUCTS_DIR)/libOpenAttributeGraphCxx.a " ,
59134 ] ,
60135 configurations : [
61136 . debug ( name : " Debug " , xcconfig : " Configs/OpenAttributeGraph.xcconfig " ) ,
@@ -64,5 +139,60 @@ let project = Project(
64139 defaultSettings : . none
65140 )
66141 ) ,
142+ . target (
143+ name : " OpenAttributeGraphShims " ,
144+ destinations : destinations ,
145+ product : . staticFramework ,
146+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.Shims " ,
147+ sources : [ " Sources/OpenAttributeGraphShims/** " ] ,
148+ dependencies : openAttributeGraphShimsDependencies ,
149+ settings : commonSettings ( base : openAttributeGraphShimsSettings )
150+ ) ,
151+ . target (
152+ name : " UtilitiesTests " ,
153+ destinations : destinations ,
154+ product : . unitTests ,
155+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.UtilitiesTests " ,
156+ sources : [ " Tests/UtilitiesTests/**/*.swift " ] ,
157+ dependencies : [
158+ . target ( name : utilitiesTargetName ) ,
159+ ] ,
160+ settings : commonSettings ( base : cxxInteropSettings )
161+ ) ,
162+ . target (
163+ name : " OpenAttributeGraphCxxTests " ,
164+ destinations : destinations ,
165+ product : . unitTests ,
166+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.CxxTests " ,
167+ sources : [ " Tests/OpenAttributeGraphCxxTests/**/*.swift " ] ,
168+ dependencies : [
169+ . target ( name : " OpenAttributeGraphCxx " ) ,
170+ ] ,
171+ settings : commonSettings ( base : cxxInteropSettings )
172+ ) ,
173+ . target (
174+ name : " OpenAttributeGraphShimsTests " ,
175+ destinations : destinations ,
176+ product : . unitTests ,
177+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.ShimsTests " ,
178+ sources : [ " Tests/OpenAttributeGraphShimsTests/**/*.swift " ] ,
179+ dependencies : [
180+ . target ( name : " OpenAttributeGraphShims " ) ,
181+ ] ,
182+ settings : commonSettings ( )
183+ ) ,
184+ . target (
185+ name : " OpenAttributeGraphCompatibilityTests " ,
186+ destinations : destinations ,
187+ product : . unitTests ,
188+ bundleId : " org.OpenSwiftUIProject.OpenAttributeGraph.CompatibilityTests " ,
189+ sources : [ " Tests/OpenAttributeGraphCompatibilityTests/**/*.swift " ] ,
190+ dependencies : [
191+ . target ( name : " OpenAttributeGraph " ) ,
192+ . external ( name : " Numerics " ) ,
193+ . external ( name : " RealModule " ) ,
194+ ] ,
195+ settings : commonSettings ( )
196+ ) ,
67197 ]
68198)
0 commit comments