File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,19 @@ cmake_minimum_required(VERSION 2.8.12)
11
11
list (APPEND CMAKE_MODULE_PATH
12
12
"${CMAKE_CURRENT_SOURCE_DIR} /cmake/modules" )
13
13
14
+ # Load utility modules.
15
+ include (SwiftBenchmarkUtils )
16
+
14
17
set (SWIFT_BENCHMARK_BUILT_STANDALONE FALSE )
15
18
if ("${CMAKE_SOURCE_DIR} " STREQUAL "${CMAKE_CURRENT_SOURCE_DIR} " )
16
19
set (SWIFT_BENCHMARK_BUILT_STANDALONE TRUE )
17
20
endif ()
18
21
22
+ if (SWIFT_BENCHMARK_SUBCMAKE_BUILD )
23
+ precondition (SWIFT_BENCHMARK_BUILD_STANDALONE
24
+ MESSAGE "If we are a subcmake build, we must be built standalone" )
25
+ endif ()
26
+
19
27
include (AddSwiftBenchmarkSuite )
20
28
21
29
set (SWIFT_BENCH_MODULES
Original file line number Diff line number Diff line change @@ -488,15 +488,15 @@ function(swift_benchmark_compile)
488
488
list (APPEND platform_executables ${new_output_exec} )
489
489
endforeach ()
490
490
491
- # If we are building standalone, we add the -external suffix to all of our
492
- # cmake target names. This enables the main swift build to simple create
493
- # -external targets and forward them via AddExternalProject to the
494
- # standalone benchmark project. The reason why this is necessary is that we
495
- # want to be able to support in-tree and out-of-tree benchmark builds at the
496
- # same time implying that we need some sort of way to distinguish the
497
- # in-tree (which don't have the suffix) from the out of tree target (which
498
- # do).
499
- translate_flag (SWIFT_BENCHMARK_BUILT_STANDALONE "-external" external )
491
+ # If we are building standalone as part of a subcmake build, we add the
492
+ # -external suffix to all of our cmake target names. This enables the main
493
+ # swift build to simple create -external targets and forward them via
494
+ # AddExternalProject to the standalone benchmark project. The reason why
495
+ # this is necessary is that we want to be able to support in-tree and
496
+ # out-of-tree benchmark builds at the same time implying that we need some
497
+ # sort of way to distinguish the in-tree (which don't have the suffix) from
498
+ # the out of tree target (which do).
499
+ translate_flag (SWIFT_BENCHMARK_SUBCMAKE_BUILD "-external" external )
500
500
set (executable_target "swift-benchmark-${SWIFT_BENCHMARK_COMPILE_PLATFORM} -${arch}${external} " )
501
501
502
502
add_custom_target ("${executable_target} "
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ function (add_external_benchmark_suite)
84
84
-DSWIFT_LIBRARY_PATH=${SWIFT_BINARY_DIR}/lib/swift
85
85
-DCMAKE_C_COMPILER=${PATH_TO_CLANG_BUILD}/bin/clang
86
86
-DCMAKE_CXX_COMPILER=${PATH_TO_CLANG_BUILD}/bin/clang++
87
+ -DSWIFT_BENCHMARK_SUBCMAKE_BUILD=TRUE
87
88
PASSTHROUGH_PREFIXES SWIFT_BENCHMARK
88
89
)
89
90
endfunction ()
You can’t perform that action at this time.
0 commit comments