Add competition libraries
This commit is contained in:
parent
0714f5fc67
commit
6dabfa176a
|
@ -119,6 +119,7 @@ objs
|
|||
/simdjson.h
|
||||
/singleheader/amalgamation_demo
|
||||
/singleheader/demo
|
||||
/tests/allparserscheckfile
|
||||
/tests/basictests
|
||||
/tests/errortests
|
||||
/tests/integer_tests
|
||||
|
|
|
@ -8,7 +8,7 @@ endif()
|
|||
|
||||
project(simdjson
|
||||
DESCRIPTION "Parsing gigabytes of JSON per second"
|
||||
LANGUAGES CXX
|
||||
LANGUAGES CXX C
|
||||
)
|
||||
|
||||
# LTO seems to create all sorts of fun problems. Let us
|
||||
|
@ -60,8 +60,9 @@ add_subdirectory(src)
|
|||
#
|
||||
# Compile tools / tests / benchmarks
|
||||
#
|
||||
add_definitions(-DSIMDJSON_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/jsonchecker/")
|
||||
add_definitions(-DSIMDJSON_BENCHMARK_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/jsonexamples/")
|
||||
add_library(test-data INTERFACE)
|
||||
target_compile_definitions(test-data INTERFACE SIMDJSON_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/jsonchecker/")
|
||||
target_compile_definitions(test-data INTERFACE SIMDJSON_BENCHMARK_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/jsonexamples/")
|
||||
|
||||
enable_testing()
|
||||
|
||||
|
|
|
@ -11,4 +11,5 @@ if (SIMDJSON_GOOGLE_BENCHMARKS)
|
|||
link_libraries(benchmark::benchmark)
|
||||
add_executable(bench_parse_call bench_parse_call.cpp)
|
||||
add_executable(bench_dom_api bench_dom_api.cpp)
|
||||
target_link_libraries(bench_dom_api test-data)
|
||||
endif()
|
|
@ -20,3 +20,39 @@ if (SIMDJSON_GOOGLE_BENCHMARKS)
|
|||
set(BENCHMARK_ENABLE_INSTALL OFF)
|
||||
add_subdirectory(benchmark)
|
||||
endif()
|
||||
|
||||
add_library(competition-cJSON INTERFACE)
|
||||
target_include_directories(competition-cJSON INTERFACE cJSON)
|
||||
|
||||
add_library(competition-fastjson INTERFACE)
|
||||
target_include_directories(competition-fastjson INTERFACE fastjson/src fastjson/include)
|
||||
|
||||
add_library(competition-gason INTERFACE)
|
||||
target_include_directories(competition-gason INTERFACE gason/src)
|
||||
|
||||
add_library(competition-jsmn INTERFACE)
|
||||
target_include_directories(competition-jsmn INTERFACE jsmn)
|
||||
|
||||
add_library(competition-json INTERFACE)
|
||||
target_include_directories(competition-json INTERFACE json/single_include)
|
||||
|
||||
add_library(competition-json11 INTERFACE)
|
||||
target_include_directories(competition-json11 INTERFACE json11)
|
||||
|
||||
add_library(competition-jsoncppdist INTERFACE)
|
||||
target_include_directories(competition-jsoncppdist INTERFACE jsoncppdist)
|
||||
|
||||
add_library(competition-rapidjson INTERFACE)
|
||||
target_include_directories(competition-rapidjson INTERFACE rapidjson/include)
|
||||
|
||||
add_library(competition-sajson INTERFACE)
|
||||
target_include_directories(competition-sajson INTERFACE sajson/include)
|
||||
|
||||
add_library(competition-ujson4c ujson4c/src/ujdecode.c)
|
||||
target_include_directories(competition-ujson4c PUBLIC ujson4c/3rdparty ujson4c/src)
|
||||
|
||||
add_library(competition-core INTERFACE)
|
||||
target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn)
|
||||
|
||||
add_library(competition-all INTERFACE)
|
||||
target_link_libraries(competition-all INTERFACE competition-core competition-jsoncppdist competition-json11 competition-fastjson competition-gason competition-ujson4c)
|
||||
|
|
|
@ -2,9 +2,42 @@
|
|||
function(add_cpp_test TEST_NAME TEST_FILE)
|
||||
add_executable(${TEST_NAME} ${TEST_FILE})
|
||||
add_test(${TEST_NAME} ${TEST_NAME})
|
||||
target_link_libraries(${TEST_NAME} test-data)
|
||||
endfunction(add_cpp_test)
|
||||
|
||||
# Sets a target to only build when you run the test, and expect failure
|
||||
#
|
||||
# These test explicitly do #include "simdjson.cpp"
|
||||
#
|
||||
if (NOT MSVC) # Can't get simdjson-source to compile on Windows for some reason.
|
||||
add_cpp_test(numberparsingcheck numberparsingcheck.cpp)
|
||||
target_link_libraries(numberparsingcheck simdjson-source test-data simdjson-windows-headers)
|
||||
add_cpp_test(stringparsingcheck stringparsingcheck.cpp)
|
||||
target_link_libraries(stringparsingcheck simdjson-source test-data simdjson-windows-headers)
|
||||
endif()
|
||||
|
||||
#
|
||||
# All remaining tests link with simdjson proper
|
||||
#
|
||||
link_libraries(simdjson)
|
||||
|
||||
add_cpp_test(basictests basictests.cpp)
|
||||
add_cpp_test(errortests errortests.cpp)
|
||||
add_cpp_test(integer_tests integer_tests.cpp)
|
||||
add_cpp_test(jsoncheck jsoncheck.cpp)
|
||||
target_link_libraries(jsoncheck simdjson-windows-headers)
|
||||
add_cpp_test(parse_many_test parse_many_test.cpp)
|
||||
target_link_libraries(parse_many_test simdjson-windows-headers)
|
||||
add_cpp_test(pointercheck pointercheck.cpp)
|
||||
|
||||
#
|
||||
# Competition parse test
|
||||
#
|
||||
add_executable(allparserscheckfile allparserscheckfile.cpp)
|
||||
target_link_libraries(allparserscheckfile competition-all)
|
||||
|
||||
#
|
||||
# Compile-only tests
|
||||
#
|
||||
function(add_compile_test TEST_NAME TEST_FILE EXPECT_SUCCESS)
|
||||
add_executable(${TEST_NAME} ${TEST_FILE})
|
||||
set_target_properties(${TEST_NAME} PROPERTIES
|
||||
|
@ -18,32 +51,6 @@ function(add_compile_test TEST_NAME TEST_FILE EXPECT_SUCCESS)
|
|||
endif()
|
||||
endfunction(add_compile_test)
|
||||
|
||||
#
|
||||
# These test explicitly do #include "simdjson.cpp"
|
||||
#
|
||||
if (NOT MSVC) # Can't get simdjson-source to compile on Windows for some reason.
|
||||
add_cpp_test(numberparsingcheck numberparsingcheck.cpp)
|
||||
target_link_libraries(numberparsingcheck simdjson-source simdjson-windows-headers)
|
||||
add_cpp_test(stringparsingcheck stringparsingcheck.cpp)
|
||||
target_link_libraries(stringparsingcheck simdjson-source simdjson-windows-headers)
|
||||
endif()
|
||||
|
||||
#
|
||||
# All remaining tests link with simdjson proper
|
||||
#
|
||||
link_libraries(simdjson)
|
||||
|
||||
# add_executable(allparserscheckfile allparserscheckfile.cpp)
|
||||
add_cpp_test(basictests basictests.cpp)
|
||||
add_cpp_test(errortests errortests.cpp)
|
||||
add_cpp_test(integer_tests integer_tests.cpp)
|
||||
add_cpp_test(jsoncheck jsoncheck.cpp)
|
||||
target_link_libraries(jsoncheck simdjson-windows-headers)
|
||||
add_cpp_test(parse_many_test parse_many_test.cpp)
|
||||
target_link_libraries(parse_many_test simdjson-windows-headers)
|
||||
add_cpp_test(pointercheck pointercheck.cpp)
|
||||
|
||||
# Compile-only tests
|
||||
# Don't add the tests if we're on VS2017 or older; they don't succeed.
|
||||
if(NOT (MSVC AND MSVC_VERSION LESS 1920))
|
||||
add_compile_test(readme_examples readme_examples.cpp TRUE)
|
||||
|
|
Loading…
Reference in New Issue