Skip to content

Commit 3bc99c7

Browse files
committed
bulid-script: simplify code and use more idiomatic variable names
1 parent 2bd30ed commit 3bc99c7

File tree

3 files changed

+12
-31
lines changed

3 files changed

+12
-31
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ option(SWIFT_BUILD_STATIC_STDLIB
4444
"Build static variants of the Swift standard library and SDK overlay"
4545
FALSE)
4646

47-
option(SWIFT_INCLUDE_BENCHMARKS
48-
"Create targets for running swift benchmarks"
49-
TRUE)
47+
option(SWIFT_BUILD_PERF_TESTSUITE
48+
"Create targets for swift performance benchmarks."
49+
FALSE)
5050

5151
option(SWIFT_INCLUDE_TESTS "Create targets for building/running tests." TRUE)
5252

@@ -633,7 +633,7 @@ if(SWIFT_BUILD_TOOLS)
633633
endif()
634634
add_subdirectory(utils)
635635
add_subdirectory(stdlib)
636-
if(SWIFT_INCLUDE_BENCHMARKS)
636+
if(SWIFT_BUILD_PERF_TESTSUITE)
637637
add_subdirectory(benchmark)
638638
endif()
639639
if(SWIFT_INCLUDE_TESTS)

benchmark/CMakeLists.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
option(SWIFT_INCLUDE_PERF_TESTSUITE "Create targets for swift performance benchmarks." NO)
21
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
32
# Performance test harness only builds on Darwin.
4-
if (SWIFT_INCLUDE_PERF_TESTSUITE)
5-
set(PERF_TESTSUITE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/PerfTestSuite" CACHE STRING "Path to swift performance testsuite repo.")
6-
if(EXISTS ${PERF_TESTSUITE_DIR}/CMakeLists.txt)
7-
add_subdirectory(${PERF_TESTSUITE_DIR})
8-
else()
9-
message(FATAL_ERROR "Can't find the Swift performance suite at ${PERF_TESTSUITE_DIR}/.")
10-
endif()
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}/.")
118
endif()
129
endif()
1310

utils/build-script-impl

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,10 @@ function not() {
698698

699699
function true_false() {
700700
case "$1" in
701-
false | 0)
701+
false | FALSE | 0)
702702
echo "FALSE"
703703
;;
704-
true | 1)
704+
true | TRUE | 1)
705705
echo "TRUE"
706706
;;
707707
*)
@@ -1322,15 +1322,6 @@ function cmake_config_opt() {
13221322
fi
13231323
}
13241324

1325-
function should_build_perftestsuite() {
1326-
if [ "$(uname -s)" != Darwin ]; then
1327-
echo "FALSE"
1328-
return
1329-
fi
1330-
1331-
true_false "${BUILD_SWIFT_PERF_TESTSUITE}"
1332-
}
1333-
13341325
function set_swiftpm_bootstrap_command() {
13351326
swiftpm_bootstrap_command=()
13361327

@@ -1480,13 +1471,6 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
14801471
)
14811472
fi
14821473

1483-
if [[ $(should_build_perftestsuite) == "TRUE" ]]; then
1484-
swift_cmake_options=(
1485-
"${swift_cmake_options[@]}"
1486-
-DSWIFT_INCLUDE_PERF_TESTSUITE=YES
1487-
)
1488-
fi
1489-
14901474
swift_cmake_options=(
14911475
"${swift_cmake_options[@]}"
14921476
-DSWIFT_AST_VERIFIER:BOOL=$(true_false "${SWIFT_ENABLE_AST_VERIFIER}")
@@ -1694,7 +1678,7 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
16941678
fi
16951679

16961680
build_targets=(all "${SWIFT_STDLIB_TARGETS[@]}")
1697-
if [[ $(should_build_perftestsuite) == "TRUE" ]]; then
1681+
if [[ $(true_false "${build_perf_testsuite_this_time}") == "TRUE" ]]; then
16981682
native_swift_tools_path=$(build_directory macosx-x86_64 swift)/bin
16991683
cmake_options=(
17001684
"${cmake_options[@]}"

0 commit comments

Comments
 (0)