1
- if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
2
- # Performance test harness only builds on Darwin.
3
- set (PERF_TESTSUITE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /PerfTestSuite" CACHE STRING "Path to swift performance testsuite repo." )
4
- if (EXISTS ${PERF_TESTSUITE_DIR} /CMakeLists.txt )
5
- add_subdirectory (${PERF_TESTSUITE_DIR} )
6
- else ()
7
- message (FATAL_ERROR "Can't find the Swift performance suite at ${PERF_TESTSUITE_DIR} /." )
1
+ # -*- mode: cmake -*-
2
+ ################################################################################
3
+ # WARNING: This file is automatically generated from templates and should not
4
+ # be directly modified. Instead, make changes to
5
+ # scripts/generate_harness/CMakeLists.txt_template and run
6
+ # scripts/generate_harness/generate_harness.py to regenerate this file.
7
+ ################################################################################
8
+
9
+ cmake_minimum_required (VERSION 2.8.12 )
10
+
11
+ # Add path for custom CMake modules.
12
+ list (APPEND CMAKE_MODULE_PATH
13
+ "${CMAKE_CURRENT_SOURCE_DIR} /cmake/modules" )
14
+
15
+ include (add-swift-benchmark-suite )
16
+
17
+ set (SWIFT_BENCH_MODULES
18
+ Ackermann
19
+ AngryPhonebook
20
+ Array2D
21
+ ArrayAppend
22
+ ArrayInClass
23
+ ArrayLiteral
24
+ ArrayOfGenericPOD
25
+ ArrayOfGenericRef
26
+ ArrayOfPOD
27
+ ArrayOfRef
28
+ ArraySubscript
29
+ BitCount
30
+ ByteSwap
31
+ Calculator
32
+ CaptureProp
33
+ Chars
34
+ ClassArrayGetter
35
+ DeadArray
36
+ DictionaryBridge
37
+ DictionaryLiteral
38
+ DictionaryRemove
39
+ DictionarySwap
40
+ DictTest
41
+ DictTest2
42
+ DictTest3
43
+ ErrorHandling
44
+ Fibonacci
45
+ GlobalClass
46
+ Hanoi
47
+ Hash
48
+ Histogram
49
+ Join
50
+ LinkedList
51
+ MapReduce
52
+ Memset
53
+ MonteCarloE
54
+ MonteCarloPi
55
+ NopDeinit
56
+ NSDictionaryCastToSwift
57
+ NSError
58
+ NSStringConversion
59
+ ObjectAllocation
60
+ OpenClose
61
+ Phonebook
62
+ PolymorphicCalls
63
+ PopFront
64
+ PopFrontGeneric
65
+ Prims
66
+ ProtocolDispatch
67
+ RangeAssignment
68
+ RC4
69
+ RecursiveOwnedParameter
70
+ RGBHistogram
71
+ SetTests
72
+ SevenBoom
73
+ Sim2DArray
74
+ SortLettersInPlace
75
+ SortStrings
76
+ StrComplexWalk
77
+ StringBuilder
78
+ StringInterpolation
79
+ StringTests
80
+ StringWalk
81
+ StrToInt
82
+ SuperChars
83
+ TwoSum
84
+ Walsh
85
+ XorLoop
86
+ )
87
+
88
+ set (SWIFT_MULTISOURCE_BENCHES
89
+ )
90
+
91
+
92
+ set (BENCH_DRIVER_LIBRARY_MODULES
93
+ DriverUtils
94
+ TestsUtils
95
+ )
96
+
97
+ set (BENCH_DRIVER_LIBRARY_FLAGS )
98
+ if (SWIFT_RUNTIME_ENABLE_LEAK_CHECKER )
99
+ set (BENCH_DRIVER_LIBRARY_FLAGS -DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER )
100
+ endif ()
101
+
102
+ set (BENCH_LIBRARY_MODULES
103
+ )
104
+
105
+ add_definitions (-DSWIFT_EXEC -DSWIFT_LIBRARY_PATH -DONLY_PLATFORMS
106
+ -DSWIFT_OPTIMIZATION_LEVELS -DSWIFT_BENCHMARK_EMIT_SIB )
107
+
108
+ if (NOT ONLY_PLATFORMS )
109
+ set (ONLY_PLATFORMS "macosx" "iphoneos" "appletvos" "watchos" )
110
+ endif ()
111
+
112
+ if (NOT SWIFT_EXEC )
113
+ runcmd (COMMAND "xcrun" "-f" "swiftc"
114
+ VARIABLE SWIFT_EXEC
115
+ ERROR "Unable to find Swift driver" )
116
+ endif ()
117
+
118
+ if (NOT SWIFT_LIBRARY_PATH )
119
+ get_filename_component (tmp_dir "${SWIFT_EXEC} " DIRECTORY )
120
+ get_filename_component (tmp_dir "${tmp_dir} " DIRECTORY )
121
+ set (SWIFT_LIBRARY_PATH "${tmp_dir} /lib/swift" )
122
+ endif ()
123
+
124
+ runcmd (COMMAND "xcrun" "-f" "clang"
125
+ VARIABLE CLANG_EXEC
126
+ ERROR "Unable to find Clang driver" )
127
+
128
+ # You have to delete CMakeCache.txt in the swift build to force a
129
+ # reconfiguration.
130
+ set (SWIFT_EXTRA_BENCH_CONFIGS CACHE STRING
131
+ "A semicolon separated list of benchmark configurations. \
132
+ Available configurations: <Optlevel>_SINGLEFILE, <Optlevel>_MULTITHREADED" )
133
+
134
+ # Syntax for an optset: <optimization-level>_<configuration>
135
+ # where "_<configuration>" is optional.
136
+ if (NOT SWIFT_OPTIMIZATION_LEVELS )
137
+ set (SWIFT_OPTIMIZATION_LEVELS "Onone" "O" "Ounchecked"
138
+ ${SWIFT_EXTRA_BENCH_CONFIGS} )
139
+ endif ()
140
+
141
+ # Options for the default (= empty) configuration
142
+ set (BENCHOPTS "-whole-module-optimization" )
143
+
144
+ # Options for other configurations
145
+ set (BENCHOPTS_MULTITHREADED
146
+ "-whole-module-optimization" "-num-threads" "4" )
147
+ set (BENCHOPTS_SINGLEFILE "" )
148
+
149
+ set (macosx_arch "x86_64" )
150
+ set (iphoneos_arch "arm64" "armv7" )
151
+ set (appletvos_arch "arm64" )
152
+ set (watchos_arch "armv7k" )
153
+
154
+ set (macosx_ver "10.9" )
155
+ set (iphoneos_ver "8.0" )
156
+ set (appletvos_ver "9.1" )
157
+ set (watchos_ver "2.0" )
158
+
159
+ set (macosx_triple_platform "macosx" )
160
+ set (iphoneos_triple_platform "ios" )
161
+ set (appletvos_triple_platform "tvos" )
162
+ set (watchos_triple_platform "watchos" )
163
+
164
+ set (sdks )
165
+ set (platforms )
166
+ foreach (platform ${ONLY_PLATFORMS} )
167
+ execute_process (
168
+ COMMAND "xcrun" "--sdk" "${platform} " "--show-sdk-path"
169
+ OUTPUT_VARIABLE ${platform} _sdk
170
+ RESULT_VARIABLE result
171
+ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE )
172
+ if ("${result} " MATCHES "0" )
173
+ list (APPEND sdks "${${platform} _sdk}" )
174
+ list (APPEND platforms ${platform} )
8
175
endif ()
176
+ endforeach ()
177
+
178
+ message ("--" )
179
+ message ("-- Swift Benchmark Suite:" )
180
+ message ("-- SWIFT_EXEC = ${SWIFT_EXEC} " )
181
+ message ("-- SWIFT_LIBRARY_PATH = ${SWIFT_LIBRARY_PATH} " )
182
+ message ("-- CLANG_EXEC = ${CLANG_EXEC} " )
183
+ message ("-- SWIFT_OPTIMIZATION_LEVELS = ${SWIFT_OPTIMIZATION_LEVELS} " )
184
+ message ("-- ONLY_PLATFORMS = ${ONLY_PLATFORMS} " )
185
+
186
+ message ("-- found platforms: ${platforms} " )
187
+ message ("-- found sdks:" )
188
+ foreach (sdk ${sdks} )
189
+ message ("-- ${sdk} " )
190
+ endforeach ()
191
+
192
+ set (executable_targets )
193
+
194
+ set (srcdir "${CMAKE_CURRENT_SOURCE_DIR} " )
195
+ set (bindir "${CMAKE_CURRENT_BINARY_DIR} /bin" )
196
+ set (libdir "${CMAKE_CURRENT_BINARY_DIR} /lib" )
197
+ set (libswiftdir "${CMAKE_CURRENT_BINARY_DIR} /lib/swift" )
198
+ file (MAKE_DIRECTORY "${bindir} " )
199
+ file (MAKE_DIRECTORY "${libdir} " )
200
+ file (MAKE_DIRECTORY "${libswiftdir} " )
201
+
202
+ if (SWIFT_SDKS )
203
+ set (IS_SWIFT_BUILD true )
9
204
endif ()
10
205
206
+ # Compile the perf test suite for each platform
207
+ foreach (platform ${platforms} )
208
+ swift_benchmark_compile (PLATFORM ${platform} )
209
+ endforeach ()
210
+
211
+ add_subdirectory (scripts )
0 commit comments