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)
1111list (APPEND CMAKE_MODULE_PATH
1212 "${CMAKE_CURRENT_SOURCE_DIR} /cmake/modules" )
1313
14+ # Load utility modules.
15+ include (SwiftBenchmarkUtils)
16+
1417set (SWIFT_BENCHMARK_BUILT_STANDALONE FALSE )
1518if ("${CMAKE_SOURCE_DIR} " STREQUAL "${CMAKE_CURRENT_SOURCE_DIR} " )
1619 set (SWIFT_BENCHMARK_BUILT_STANDALONE TRUE )
1720endif ()
1821
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+
1927include (AddSwiftBenchmarkSuite)
2028
2129set (SWIFT_BENCH_MODULES
Original file line number Diff line number Diff line change @@ -488,15 +488,15 @@ function(swift_benchmark_compile)
488488 list (APPEND platform_executables ${new_output_exec} )
489489 endforeach ()
490490
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)
500500 set (executable_target "swift-benchmark-${SWIFT_BENCHMARK_COMPILE_PLATFORM} -${arch}${external} " )
501501
502502 add_custom_target ("${executable_target} "
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ function (add_external_benchmark_suite)
8484 -DSWIFT_LIBRARY_PATH=${SWIFT_BINARY_DIR} /lib/swift
8585 -DCMAKE_C_COMPILER=${PATH_TO_CLANG_BUILD} /bin/clang
8686 -DCMAKE_CXX_COMPILER=${PATH_TO_CLANG_BUILD} /bin/clang++
87+ -DSWIFT_BENCHMARK_SUBCMAKE_BUILD=TRUE
8788 PASSTHROUGH_PREFIXES SWIFT_BENCHMARK
8889 )
8990endfunction ()
You can’t perform that action at this time.
0 commit comments