Skip to content

Commit

Permalink
Move FetchContent for benchmark to extern
Browse files Browse the repository at this point in the history
  • Loading branch information
elsid committed Jan 29, 2022
1 parent e469054 commit 70623d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ option(RECASTNAVIGATION_STATIC "Build recastnavigation static libraries" ${_reca

option(OPENMW_USE_SYSTEM_SQLITE3 "Use system provided SQLite3 library" ON)

option(OPENMW_USE_SYSTEM_BENCHMARK "Use system Google Benchmark library." OFF)

option(OPENMW_UNITY_BUILD "Use fewer compilation units to speed up compile time" FALSE)
option(OPENMW_LTO_BUILD "Build OpenMW with Link-Time Optimization (Needs ~2GB of RAM)" OFF)

Expand Down
22 changes: 0 additions & 22 deletions apps/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
option(OPENMW_USE_SYSTEM_BENCHMARK "Use system Google Benchmark library." OFF)

if(OPENMW_USE_SYSTEM_BENCHMARK)
find_package(benchmark REQUIRED)
else()
cmake_minimum_required(VERSION 3.11)

set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)

set(SAVED_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

string(REPLACE "-Wsuggest-override" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "-Wundef" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
include(FetchContent)
FetchContent_Declare(benchmark
URL https://github.com/google/benchmark/archive/refs/tags/v1.5.2.zip
URL_HASH MD5=49395b757a7c4656d70f1328d93efd00
SOURCE_DIR fetched/benchmark
)
FetchContent_MakeAvailableExcludeFromAll(benchmark)

set(CMAKE_CXX_FLAGS "${SAVED_CMAKE_CXX_FLAGS}")
endif()

openmw_add_executable(openmw_detournavigator_navmeshtilescache_benchmark detournavigator/navmeshtilescache.cpp)
Expand Down
16 changes: 16 additions & 0 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,19 @@ if (NOT OPENMW_USE_SYSTEM_SQLITE3)
endif()

add_subdirectory(smhasher)

if (NOT OPENMW_USE_SYSTEM_BENCHMARK)
cmake_minimum_required(VERSION 3.11)

set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)

include(FetchContent)
FetchContent_Declare(benchmark
URL https://github.com/google/benchmark/archive/refs/tags/v1.5.2.zip
URL_HASH MD5=49395b757a7c4656d70f1328d93efd00
SOURCE_DIR fetched/benchmark
)
FetchContent_MakeAvailableExcludeFromAll(benchmark)
endif()

0 comments on commit 70623d0

Please sign in to comment.