@@ -21,6 +21,10 @@ endif()
2121
2222include (AddSwiftBenchmarkSuite)
2323
24+ #===-----------------------------------------------------------------------===#
25+ # Declarative Description of Benchmarks
26+ #===-----------------------------------------------------------------------===#
27+
2428set (SWIFT_BENCH_MODULES
2529 single-source /Ackermann
2630 single-source /AngryPhonebook
@@ -186,37 +190,9 @@ set(BENCH_DRIVER_LIBRARY_MODULES
186190 utils/DriverUtils
187191)
188192
189- add_definitions (-DSWIFT_EXEC -DSWIFT_LIBRARY_PATH -DONLY_PLATFORMS
190- -DSWIFT_OPTIMIZATION_LEVELS -DSWIFT_BENCHMARK_EMIT_SIB)
191-
192- if (NOT ONLY_PLATFORMS)
193- set (ONLY_PLATFORMS "macosx" "iphoneos" "appletvos" "watchos" )
194- endif ()
195-
196- if (NOT SWIFT_EXEC)
197- runcmd(COMMAND "xcrun" "-f" "swiftc"
198- VARIABLE SWIFT_EXEC
199- ERROR "Unable to find Swift driver" )
200- endif ()
201-
202- if (NOT SWIFT_LIBRARY_PATH)
203- get_filename_component (tmp_dir "${SWIFT_EXEC} " DIRECTORY )
204- get_filename_component (tmp_dir "${tmp_dir} " DIRECTORY )
205- set (SWIFT_LIBRARY_PATH "${tmp_dir} /lib/swift" )
206- endif ()
207-
208- # If the CMAKE_C_COMPILER is already clang, don't find it again,
209- # thus allowing the --host-cc build-script argument to work here.
210- get_filename_component (c_compiler ${CMAKE_C_COMPILER} NAME )
211-
212- if (${c_compiler} STREQUAL "clang" )
213- set (CLANG_EXEC ${CMAKE_C_COMPILER} )
214- else ()
215- runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN} " "-f" "clang"
216- VARIABLE CLANG_EXEC
217- ERROR "Unable to find Clang driver" )
218- endif ()
219-
193+ #===-----------------------------------------------------------------------===#
194+ # Build Configuration
195+ #===-----------------------------------------------------------------------===#
220196
221197# You have to delete CMakeCache.txt in the swift build to force a
222198# reconfiguration.
@@ -273,34 +249,17 @@ set(BENCHOPTS_MULTITHREADED
273249 "-whole-module-optimization" "-num-threads" "4" )
274250set (BENCHOPTS_SINGLEFILE "" )
275251
276- set (macosx_arch "x86_64" )
277- set (iphoneos_arch "arm64" "armv7" )
278- set (appletvos_arch "arm64" )
279- set (watchos_arch "armv7k" )
280-
281- set (macosx_ver "10.9" )
282- set (iphoneos_ver "8.0" )
283- set (appletvos_ver "9.1" )
284- set (watchos_ver "2.0" )
285-
286- set (macosx_triple_platform "macosx" )
287- set (iphoneos_triple_platform "ios" )
288- set (appletvos_triple_platform "tvos" )
289- set (watchos_triple_platform "watchos" )
290-
291- set (sdks)
292- set (platforms)
293- foreach (platform ${ONLY_PLATFORMS} )
294- execute_process (
295- COMMAND "xcrun" "--sdk" "${platform} " "--show-sdk-path"
296- OUTPUT_VARIABLE ${platform} _sdk
297- RESULT_VARIABLE result
298- ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
299- if ("${result} " MATCHES "0" )
300- list (APPEND sdks "${${platform} _sdk}" )
301- list (APPEND platforms ${platform} )
302- endif ()
303- endforeach ()
252+ configure_build()
253+
254+ #===-----------------------------------------------------------------------===#
255+ # SDK Configuration
256+ #===-----------------------------------------------------------------------===#
257+
258+ configure_sdks()
259+
260+ #===---------------------------------------------------------------------===#
261+ # Statement of Configuration for Build Users
262+ #===---------------------------------------------------------------------===#
304263
305264message ("--" )
306265message ("-- Swift Benchmark Suite:" )
@@ -318,6 +277,10 @@ foreach(sdk ${sdks})
318277 message ("-- ${sdk} " )
319278endforeach ()
320279
280+ #===---------------------------------------------------------------------===#
281+ # Build Rule Generation
282+ #===---------------------------------------------------------------------===#
283+
321284set (executable_targets)
322285
323286set (srcdir "${CMAKE_CURRENT_SOURCE_DIR} " )
0 commit comments