2019-05-10 09:17:13 +08:00
|
|
|
cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
|
2020-01-20 23:18:58 +08:00
|
|
|
|
2020-04-01 05:47:25 +08:00
|
|
|
project(simdjson
|
|
|
|
DESCRIPTION "Parsing gigabytes of JSON per second"
|
2020-04-07 08:18:37 +08:00
|
|
|
LANGUAGES CXX C
|
2020-01-20 23:18:58 +08:00
|
|
|
)
|
|
|
|
|
2019-03-05 04:40:52 +08:00
|
|
|
set(PROJECT_VERSION_MAJOR 0)
|
2020-06-24 08:55:52 +08:00
|
|
|
set(PROJECT_VERSION_MINOR 4)
|
2020-07-02 02:14:51 +08:00
|
|
|
set(PROJECT_VERSION_PATCH 6)
|
|
|
|
set(SIMDJSON_SEMANTIC_VERSION "0.4.6" CACHE STRING "simdjson semantic version")
|
|
|
|
set(SIMDJSON_LIB_VERSION "2.0.0" CACHE STRING "simdjson library version")
|
2020-06-24 08:55:52 +08:00
|
|
|
set(SIMDJSON_LIB_SOVERSION "2" CACHE STRING "simdjson library soversion")
|
2020-04-19 05:13:34 +08:00
|
|
|
set(SIMDJSON_GITHUB_REPOSITORY https://github.com/simdjson/simdjson)
|
2018-12-29 02:04:38 +08:00
|
|
|
|
2020-04-24 06:12:21 +08:00
|
|
|
include(GNUInstallDirs)
|
2020-06-24 01:12:19 +08:00
|
|
|
include(cmake/simdjson-flags.cmake)
|
|
|
|
include(cmake/simdjson-user-cmakecache.cmake)
|
2020-04-19 05:13:34 +08:00
|
|
|
|
2020-06-25 05:09:18 +08:00
|
|
|
|
2020-06-25 04:12:19 +08:00
|
|
|
|
2020-06-22 02:20:58 +08:00
|
|
|
if(SIMDJSON_JUST_LIBRARY)
|
2020-06-25 04:12:19 +08:00
|
|
|
message( STATUS "Building just the library, omitting all tests, tools and benchmarks." )
|
2020-06-22 02:20:58 +08:00
|
|
|
endif()
|
|
|
|
|
2020-04-18 06:07:18 +08:00
|
|
|
#
|
|
|
|
# Set up test data
|
|
|
|
#
|
2020-06-22 02:20:58 +08:00
|
|
|
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()
|
2020-04-18 06:07:18 +08:00
|
|
|
|
2020-04-06 07:43:37 +08:00
|
|
|
#
|
|
|
|
# Create the top level simdjson library (must be done at this level to use both src/ and include/
|
2020-04-19 07:37:11 +08:00
|
|
|
# directories) and tools
|
2020-04-06 07:43:37 +08:00
|
|
|
#
|
|
|
|
add_subdirectory(include)
|
|
|
|
add_subdirectory(src)
|
2020-04-19 07:37:11 +08:00
|
|
|
add_subdirectory(windows)
|
2020-06-22 02:20:58 +08:00
|
|
|
if(NOT(SIMDJSON_JUST_LIBRARY))
|
2020-06-25 03:44:22 +08:00
|
|
|
add_subdirectory(dependencies) ## This needs to be before tools because of cxxopts
|
|
|
|
add_subdirectory(tools) ## This needs to be before tests because of cxxopts
|
2020-07-02 02:14:51 +08:00
|
|
|
add_subdirectory(singleheader)
|
2020-06-22 02:20:58 +08:00
|
|
|
endif()
|
2020-07-02 02:14:51 +08:00
|
|
|
install(FILES singleheader/simdjson.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
2020-04-06 07:43:37 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Compile tools / tests / benchmarks
|
|
|
|
#
|
2020-06-22 02:20:58 +08:00
|
|
|
if(NOT(SIMDJSON_JUST_LIBRARY))
|
|
|
|
add_subdirectory(tests)
|
|
|
|
add_subdirectory(examples)
|
|
|
|
add_subdirectory(benchmark)
|
|
|
|
add_subdirectory(fuzz)
|
|
|
|
endif()
|
2019-10-29 02:46:57 +08:00
|
|
|
|
2020-05-22 09:59:06 +08:00
|
|
|
#
|
|
|
|
# Source files should be just ASCII
|
|
|
|
#
|
|
|
|
find_program(FIND find)
|
|
|
|
find_program(FILE file)
|
|
|
|
find_program(GREP grep)
|
|
|
|
if((FIND) AND (FILE) AND (GREP))
|
|
|
|
add_test(
|
|
|
|
NAME "just_ascii"
|
|
|
|
COMMAND sh -c "${FIND} include src windows tools singleheader tests examples benchmark -path benchmark/checkperf-reference -prune -name '*.h' -o -name '*.cpp' -type f -exec ${FILE} '{}' \; |${GREP} -v ASCII || exit 0 && exit 1"
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2020-04-10 08:31:35 +08:00
|
|
|
#
|
|
|
|
# CPack
|
|
|
|
#
|
2019-02-26 03:33:01 +08:00
|
|
|
set(CPACK_PACKAGE_VENDOR "Daniel Lemire")
|
|
|
|
set(CPACK_PACKAGE_CONTACT "lemire@gmail.com")
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Parsing gigabytes of JSON per second")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
|
|
|
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
|
|
|
|
|
|
|
set(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
|
|
|
|
|
|
|
set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
|
|
|
|
|
|
|
include(CPack)
|