diff --git a/CMakeLists.txt b/CMakeLists.txt index ede9caa0..8735c456 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,8 @@ include(GNUInstallDirs) include(cmake/simdjson-flags.cmake) include(cmake/simdjson-user-cmakecache.cmake) - +# So we can build just tests with "make all_tests" +add_custom_target(all_tests) if(SIMDJSON_JUST_LIBRARY) message( STATUS "Building just the library, omitting all tests, tools and benchmarks." ) @@ -35,6 +36,7 @@ endif(SIMDJSON_JUST_LIBRARY) # Create the top level simdjson library (must be done at this level to use both src/ and include/ # directories) and tools # + add_subdirectory(include) add_subdirectory(src) add_subdirectory(windows) diff --git a/benchmark/checkperf.cmake b/benchmark/checkperf.cmake index b0cbbbee..8c11a046 100644 --- a/benchmark/checkperf.cmake +++ b/benchmark/checkperf.cmake @@ -92,6 +92,8 @@ if (Git_FOUND AND (GIT_VERSION_STRING VERSION_GREATER "2.1.4") AND (NOT CMAKE_G set_property(TEST checkperf APPEND PROPERTY LABELS per_implementation explicitonly) set_property(TEST checkperf APPEND PROPERTY DEPENDS parse perfdiff ${SIMDJSON_USER_CMAKECACHE}) set_property(TEST checkperf PROPERTY RUN_SERIAL TRUE) + add_dependencies(per_implementation_tests checkperf) + add_dependencies(explicitonly_tests checkperf) else() if (CMAKE_GENERATOR MATCHES Ninja) message(STATUS "We disable the checkperf targets under Ninja.") diff --git a/singleheader/CMakeLists.txt b/singleheader/CMakeLists.txt index 12ff2119..c9f4f50f 100644 --- a/singleheader/CMakeLists.txt +++ b/singleheader/CMakeLists.txt @@ -87,6 +87,9 @@ else() endif() +add_custom_target(singleheader_tests) +add_dependencies(all_tests singleheader_tests) + # # Do not depend on singleheader files directly: depend on this target instead. # Otherwise the custom command may get triggered multiple times and race with itself! @@ -126,6 +129,8 @@ if(NOT SIMDJSON_LEGACY_VISUAL_STUDIO AND NOT SIMDJSON_WINDOWS_DLL) add_executable(amalgamate_demo $) target_link_libraries(amalgamate_demo simdjson-singleheader-include-source simdjson-internal-flags) add_test(amalgamate_demo amalgamate_demo ${EXAMPLE_JSON} ${EXAMPLE_NDJSON}) + set_property(TEST amalgamate_demo APPEND PROPERTY LABELS per_implementation singleheader) + add_dependencies(singleheader_tests amalgamate_demo) MESSAGE( STATUS "Including amalgamate_demo test. ${SIMDJSON_WINDOWS_DLL}" ) else() MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, amalgamate_demo test disabled." ) @@ -137,6 +142,8 @@ if(NOT SIMDJSON_LEGACY_VISUAL_STUDIO AND NOT SIMDJSON_WINDOWS_DLL) add_library(simdjson-singleheader STATIC "") target_link_libraries(simdjson-singleheader simdjson-singleheader-source simdjson-internal-flags) add_compile_only_test(simdjson-singleheader) + set_property(TEST simdjson-singleheader APPEND PROPERTY LABELS per_implementation singleheader) + add_dependencies(singleheader_tests simdjson-singleheader) MESSAGE( STATUS "Including simdjson-singleheader test." ) else() MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, simdjson-singleheader test disabled." ) @@ -164,6 +171,8 @@ if (NOT (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})) add_executable(amalgamate_demo_direct_from_repository ${CMAKE_CURRENT_SOURCE_DIR}/amalgamate_demo.cpp) target_link_libraries(amalgamate_demo_direct_from_repository simdjson-singleheader-include-source-direct-from-repository simdjson-internal-flags) add_test(amalgamate_demo_direct_from_repository amalgamate_demo_direct_from_repository ${EXAMPLE_JSON} ${EXAMPLE_NDJSON}) + set_property(TEST amalgamate_demo_direct_from_repository APPEND PROPERTY LABELS per_implementation singleheader) + add_dependencies(singleheader_tests amalgamate_demo_direct_from_repository) MESSAGE( STATUS "Including amalgamate_demo_direct_from_repository test." ) else() MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, amalgamate_demo test disabled." ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9c10f6aa..9abbb8ce 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,9 +2,6 @@ link_libraries(simdjson-internal-flags test-data simdjson-windows-headers) include(${PROJECT_SOURCE_DIR}/cmake/add_cpp_test.cmake) -# add_cpp_tests will add dependencies to this -add_custom_target(all_tests) - add_subdirectory(ondemand) # @@ -59,6 +56,7 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts ) set_property(TEST testjson2json APPEND PROPERTY DEPENDS minify json2json) set_property(TEST testjson2json APPEND PROPERTY LABELS per_implementation) + add_dependencies(per_implementation_tests minify) # # Competition parse test @@ -71,8 +69,8 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts target_link_libraries(allparserscheckfile PRIVATE competition-all) add_test(issue150 ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/issue150.sh) - set_property(TEST issue150 APPEND PROPERTY DEPENDS allparserscheckfile) set_property(TEST issue150 APPEND PROPERTY LABELS per_implementation competition) + add_dependencies(all_tests allparserscheckfile) endif() # @@ -85,6 +83,8 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts add_test(NAME json2json COMMAND $ ${EXAMPLE_JSON}) set_property(TEST json2json APPEND PROPERTY LABELS acceptance per_implementation) + add_dependencies(acceptance_tests json2json) + add_dependencies(per_implementation_tests json2json) # # SIMDJSON_FORCE_IMPLEMENTATION tests: run json2json with SIMDJSON