Allow build without download (#1334)
* Add option for downloading dependencies * Format the boost json import code Co-authored-by: friendlyanon <friendlyanon@users.noreply.github.com>
This commit is contained in:
parent
6b02b06581
commit
91b07ba075
|
@ -1,7 +1,14 @@
|
||||||
|
include(CMakeDependentOption)
|
||||||
include(import.cmake)
|
include(import.cmake)
|
||||||
|
|
||||||
option(SIMDJSON_COMPETITION "Compile competitive benchmarks" ON)
|
option(SIMDJSON_ALLOW_DOWNLOADS
|
||||||
option(SIMDJSON_GOOGLE_BENCHMARKS "compile the Google Benchmark benchmarks" ON)
|
"Allow dependencies to be downloaded during configure time"
|
||||||
|
ON)
|
||||||
|
|
||||||
|
cmake_dependent_option(SIMDJSON_COMPETITION "Compile competitive benchmarks" ON
|
||||||
|
SIMDJSON_ALLOW_DOWNLOADS OFF)
|
||||||
|
cmake_dependent_option(SIMDJSON_GOOGLE_BENCHMARKS "compile the Google Benchmark benchmarks" ON
|
||||||
|
SIMDJSON_ALLOW_DOWNLOADS OFF)
|
||||||
|
|
||||||
if(SIMDJSON_GOOGLE_BENCHMARKS)
|
if(SIMDJSON_GOOGLE_BENCHMARKS)
|
||||||
set_off(BENCHMARK_ENABLE_TESTING)
|
set_off(BENCHMARK_ENABLE_TESTING)
|
||||||
|
@ -16,13 +23,21 @@ endif()
|
||||||
function(competition_scope_)
|
function(competition_scope_)
|
||||||
# boost json in standalone mode requires C++17 string_view
|
# boost json in standalone mode requires C++17 string_view
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
check_cxx_source_compiles("#include <string_view>\n#if __cpp_lib_string_view < 201606\n#error no string view support\n#endif\nint main(){}" USE_BOOST_JSON)
|
check_cxx_source_compiles([[
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
#if __cpp_lib_string_view < 201606
|
||||||
|
# error no string view support
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main() {}
|
||||||
|
]] USE_BOOST_JSON)
|
||||||
if(USE_BOOST_JSON)
|
if(USE_BOOST_JSON)
|
||||||
import_dependency(boostjson boostorg/json ee8d72d8502b409b5561200299cad30ccdb91415)
|
import_dependency(boostjson boostorg/json ee8d72d)
|
||||||
add_library(boostjson STATIC "${boostjson_SOURCE_DIR}/src/src.cpp")
|
add_library(boostjson STATIC "${boostjson_SOURCE_DIR}/src/src.cpp")
|
||||||
target_compile_definitions(boostjson PUBLIC BOOST_JSON_STANDALONE)
|
target_compile_definitions(boostjson PUBLIC BOOST_JSON_STANDALONE)
|
||||||
target_include_directories(boostjson SYSTEM PUBLIC
|
target_include_directories(boostjson SYSTEM PUBLIC
|
||||||
"${boostjson_SOURCE_DIR}/include")
|
"${boostjson_SOURCE_DIR}/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
import_dependency(cjson DaveGamble/cJSON c69134d)
|
import_dependency(cjson DaveGamble/cJSON c69134d)
|
||||||
|
@ -102,9 +117,14 @@ if(SIMDJSON_COMPETITION)
|
||||||
competition_scope_()
|
competition_scope_()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_off(CXXOPTS_BUILD_EXAMPLES)
|
cmake_dependent_option(SIMDJSON_CXXOPTS "Download cxxopts (necessary for tools)" ON
|
||||||
set_off(CXXOPTS_BUILD_TESTS)
|
SIMDJSON_ALLOW_DOWNLOADS OFF)
|
||||||
set_off(CXXOPTS_ENABLE_INSTALL)
|
|
||||||
|
|
||||||
import_dependency(cxxopts jarro2783/cxxopts 794c975)
|
if(SIMDJSON_CXXOPTS)
|
||||||
add_dependency(cxxopts)
|
set_off(CXXOPTS_BUILD_EXAMPLES)
|
||||||
|
set_off(CXXOPTS_BUILD_TESTS)
|
||||||
|
set_off(CXXOPTS_ENABLE_INSTALL)
|
||||||
|
|
||||||
|
import_dependency(cxxopts jarro2783/cxxopts 794c975)
|
||||||
|
add_dependency(cxxopts)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue