-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4c1c19
commit 893d496
Showing
4 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# https://github.com/google/benchmark#installation | ||
|
||
set(DEPENDENCY_BENCHMARK_BRANCH main) | ||
if (NOT EXISTS ${SCRIPTX_TEST_GOOGLE_BENCHMARK}) | ||
# Download and unpack benchmark at configure time | ||
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in benchmark-download/CMakeLists.txt) | ||
execute_process(COMMAND | ||
${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/benchmark-download | ||
) | ||
if (result) | ||
message(FATAL_ERROR "CMake step for benchmark failed: ${result}") | ||
endif () | ||
|
||
execute_process(COMMAND | ||
${CMAKE_COMMAND} --build . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/benchmark-download | ||
) | ||
if (result) | ||
message(FATAL_ERROR "Build step for benchmark failed: ${result}") | ||
endif () | ||
elseif (("${SCRIPTX_TEST_FORCE_UPDATE_DEPS}" STREQUAL ON) OR ("$ENV{SCRIPTX_TEST_FORCE_UPDATE_DEPS}" STREQUAL ON)) | ||
message(STATUS "update SCRIPTX_TEST_GOOGLE_BENCHMARK ${SCRIPTX_TEST_GOOGLE_BENCHMARK}") | ||
execute_process(COMMAND | ||
git fetch | ||
WORKING_DIRECTORY ${SCRIPTX_TEST_GOOGLE_BENCHMARK} | ||
) | ||
execute_process(COMMAND | ||
git checkout --force origin/${DEPENDENCY_BENCHNARK_BRANCH} | ||
WORKING_DIRECTORY ${SCRIPTX_TEST_GOOGLE_TEST} | ||
) | ||
endif () | ||
|
||
# Add benchmark directly to our build. This defines | ||
# the gtest and gtest_main targets. | ||
add_subdirectory(${SCRIPTX_TEST_GOOGLE_BENCHMARK} | ||
${CMAKE_CURRENT_BINARY_DIR}/benchmark-build | ||
EXCLUDE_FROM_ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 2.8.2) | ||
|
||
project(benchmark-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add(benchmark | ||
GIT_REPOSITORY https://github.com/google/benchmark.git | ||
GIT_TAG ${DEPENDENCY_BENCHMARK_BRANCH} | ||
GIT_SHALLOW 1 | ||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/benchmark-src" | ||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/benchmark-build" | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) |