From 7ebe5c4bcf57de3407aa5ed19971f08a1e50b35a Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Sun, 21 Jun 2020 14:20:58 -0400 Subject: [PATCH] This might enable folks to just build the library. --- .circleci/config.yml | 12 ++++++++---- CMakeLists.txt | 34 ++++++++++++++++++++++------------ simdjson-flags.cmake | 2 +- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b44c2364..ed5df345 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,14 +83,13 @@ commands: - run: | cd build && cmake $CMAKE_FLAGS -DCMAKE_INSTALL_PREFIX:PATH=destination .. && - make $BUILD_FLAGS all && - tools/json2json -h # Print out the implementation we're using on this hardware + make $BUILD_FLAGS all cmake_test: steps: - cmake_build - run: | - cd build && + cd build && tools/json2json -h && ctest $CTEST_FLAGS -L acceptance && ctest $CTEST_FLAGS -LE acceptance -E checkperf @@ -98,7 +97,7 @@ commands: steps: - cmake_build - run: | - cd build && + cd build && tools/json2json -h && ctest $CTEST_FLAGS -L acceptance -LE per_implementation && SIMDJSON_FORCE_IMPLEMENTATION=haswell ctest $CTEST_FLAGS -L per_implementation && SIMDJSON_FORCE_IMPLEMENTATION=westmere ctest $CTEST_FLAGS -L per_implementation &&SIMDJSON_FORCE_IMPLEMENTATION=fallback ctest $CTEST_FLAGS -L per_implementation && @@ -119,6 +118,11 @@ jobs: executor: gcc7 environment: { CMAKE_FLAGS: -DSIMDJSON_GOOGLE_BENCHMARKS=ON } steps: [ install_cmake, cmake_test, cmake_install_test ] + gcc10justlib: + description: Build just the library, install it and do a basic test + executor: gcc10 + environment: { CMAKE_FLAGS: -SIMDJSON_JUST_LIBRARY=ON } + steps: [ cmake_build, cmake_install_test ] gcc10: description: Build and run tests on GCC 10 and AVX 2 with a cmake static build executor: gcc10 diff --git a/CMakeLists.txt b/CMakeLists.txt index 755f74c3..0de496a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,14 +16,20 @@ include(GNUInstallDirs) include(simdjson-flags.cmake) include(simdjson-user-cmakecache.cmake) +if(SIMDJSON_JUST_LIBRARY) + MESSAGE( STATUS "Building just the library, omitting all tests, tools and benchmarks." ) +endif() + # # Set up test data # -enable_testing() -add_subdirectory(jsonchecker) -add_subdirectory(jsonexamples) -add_library(test-data INTERFACE) -target_link_libraries(test-data INTERFACE jsonchecker-data jsonexamples-data) +if(NOT(SIMDJSON_JUST_LIBRARY)) + enable_testing() + add_subdirectory(jsonchecker) + add_subdirectory(jsonexamples) + add_library(test-data INTERFACE) + target_link_libraries(test-data INTERFACE jsonchecker-data jsonexamples-data) +endif() # # Create the top level simdjson library (must be done at this level to use both src/ and include/ @@ -32,17 +38,21 @@ target_link_libraries(test-data INTERFACE jsonchecker-data jsonexamples-data) add_subdirectory(include) add_subdirectory(src) add_subdirectory(windows) -add_subdirectory(tools) -add_subdirectory(singleheader) +if(NOT(SIMDJSON_JUST_LIBRARY)) + add_subdirectory(tools) + add_subdirectory(singleheader) +endif() # # Compile tools / tests / benchmarks # -add_subdirectory(dependencies) -add_subdirectory(tests) -add_subdirectory(examples) -add_subdirectory(benchmark) -add_subdirectory(fuzz) +if(NOT(SIMDJSON_JUST_LIBRARY)) + add_subdirectory(dependencies) + add_subdirectory(tests) + add_subdirectory(examples) + add_subdirectory(benchmark) + add_subdirectory(fuzz) +endif() # # Source files should be just ASCII diff --git a/simdjson-flags.cmake b/simdjson-flags.cmake index c64ebe6b..ba51b988 100644 --- a/simdjson-flags.cmake +++ b/simdjson-flags.cmake @@ -1,4 +1,4 @@ - +option(SIMDJSON_JUST_LIBRARY "Buld just the library, omit tests, tools and benchmarks" OFF) # # Flags used by exes and by the simdjson library (project-wide flags) #