Skip to content

Commit e18b3e5

Browse files
authored
Merge pull request #12090 from gottesmm/pr-80a8b55262a765448824270b23b10cdcda3e99f7
2 parents 8aab454 + 83ae787 commit e18b3e5

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

benchmark/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ cmake_minimum_required(VERSION 2.8.12)
1111
list(APPEND CMAKE_MODULE_PATH
1212
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
1313

14+
set(SWIFT_BENCHMARK_BUILT_STANDALONE FALSE)
15+
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
16+
set(SWIFT_BENCHMARK_BUILT_STANDALONE TRUE)
17+
endif()
18+
1419
include(AddSwiftBenchmarkSuite)
1520

1621
set(SWIFT_BENCH_MODULES
@@ -240,16 +245,12 @@ endforeach()
240245

241246
set(executable_targets)
242247

243-
if(SWIFT_SDKS)
244-
set(IS_SWIFT_BUILD true)
245-
endif()
246-
247248
set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
248249

249-
if(IS_SWIFT_BUILD)
250-
get_filename_component(swift-bin-dir "${SWIFT_EXEC}" DIRECTORY)
251-
else()
250+
if(SWIFT_BENCHMARK_BUILT_STANDALONE)
252251
set(swift-bin-dir "${CMAKE_BINARY_DIR}/bin")
252+
else()
253+
get_filename_component(swift-bin-dir "${SWIFT_EXEC}" DIRECTORY)
253254
endif()
254255

255256
set(benchmark-bin-dir "${CMAKE_CURRENT_BINARY_DIR}/bin")

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ endfunction()
415415
function(swift_benchmark_compile)
416416
cmake_parse_arguments(SWIFT_BENCHMARK_COMPILE "" "PLATFORM" "" ${ARGN})
417417

418-
if(IS_SWIFT_BUILD)
418+
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
419419
set(stdlib_dependencies "swift")
420420
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
421421
string(FIND "${stdlib_dependency}" "Unittest" find_output)
@@ -441,7 +441,7 @@ function(swift_benchmark_compile)
441441
add_custom_target("${executable_target}"
442442
DEPENDS ${platform_executables})
443443

444-
if(IS_SWIFT_BUILD AND "${SWIFT_BENCHMARK_COMPILE_PLATFORM}" STREQUAL "macosx")
444+
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE AND "${SWIFT_BENCHMARK_COMPILE_PLATFORM}" STREQUAL "macosx")
445445
add_custom_command(
446446
TARGET "${executable_target}"
447447
POST_BUILD

0 commit comments

Comments
 (0)