Reference simdjson by name, don't specify include files individually
This commit is contained in:
parent
1e30b6e334
commit
54b7291c34
|
@ -59,7 +59,7 @@ commands:
|
|||
- run: make all
|
||||
- run: make test
|
||||
|
||||
cmake_test: # this version builds, install, test and then verifyi from the installation
|
||||
cmake_test: # this version builds, install, test and then verify from the installation
|
||||
steps:
|
||||
- run: apt-get update -qq
|
||||
- run: apt-get install -y cmake
|
||||
|
|
|
@ -24,7 +24,6 @@ set(CMAKE_MACOSX_RPATH OFF)
|
|||
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
|
||||
set(SIMDJSON_LIB_NAME simdjson)
|
||||
set(PROJECT_VERSION_MAJOR 0)
|
||||
set(PROJECT_VERSION_MINOR 3)
|
||||
set(PROJECT_VERSION_PATCH 1)
|
||||
|
@ -50,22 +49,27 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake")
|
|||
find_package(CTargets)
|
||||
find_package(Options)
|
||||
|
||||
# We used to have install(DIRECTORY include/${SIMDJSON_LIB_NAME} DESTINATION include)
|
||||
# alone.
|
||||
# However, this fails because we also need the root level simdjson.h file.
|
||||
install(DIRECTORY include/${SIMDJSON_LIB_NAME} DESTINATION include)
|
||||
install(FILES include/${SIMDJSON_LIB_NAME}.h DESTINATION include)
|
||||
#
|
||||
# Create the top level simdjson library (must be done at this level to use both src/ and include/
|
||||
# directories)
|
||||
#
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(src)
|
||||
|
||||
#
|
||||
# Compile tools / tests / benchmarks
|
||||
#
|
||||
set (TEST_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/jsonchecker/")
|
||||
set (BENCHMARK_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/jsonexamples/")
|
||||
add_definitions(-DSIMDJSON_TEST_DATA_DIR="${TEST_DATA_DIR}")
|
||||
add_definitions(-DSIMDJSON_BENCHMARK_DATA_DIR="${TEST_DATA_DIR}")
|
||||
enable_testing()
|
||||
include(include/CMakeLists.txt)
|
||||
add_subdirectory(src)
|
||||
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(benchmark)
|
||||
|
||||
|
||||
if (SIMDJSON_GOOGLE_BENCHMARKS)
|
||||
if(NOT EXISTS dependencies/benchmark/CMakeLists.txt)
|
||||
# message(STATUS "Unable to find dependencies/benchmark/CMakeLists.txt")
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
target_include_directories(${SIMDJSON_LIB_NAME}
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/benchmark>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/benchmark/linux>
|
||||
)
|
||||
|
||||
include_directories( . linux )
|
||||
add_cpp_benchmark(parse)
|
||||
add_cpp_benchmark(statisticalmodel)
|
||||
add_cpp_benchmark(parse_stream)
|
||||
|
|
|
@ -44,7 +44,7 @@ macro(implement_fuzzer sourcefile)
|
|||
if (SIMDJSON_FUZZ_LINKMAIN)
|
||||
target_sources(${name} PRIVATE main.cpp)
|
||||
endif ()
|
||||
target_link_libraries(${name} PRIVATE ${SIMDJSON_LIB_NAME})
|
||||
target_link_libraries(${name} PRIVATE simdjson)
|
||||
if (SIMDJSON_FUZZ_LDFLAGS)
|
||||
target_link_libraries(${name} PRIVATE ${SIMDJSON_FUZZ_LDFLAGS})
|
||||
endif ()
|
||||
|
|
|
@ -1,25 +1,2 @@
|
|||
set(SIMDJSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
|
||||
set(SIMDJSON_INCLUDE
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/common_defs.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/compiler_check.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/document_stream.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/document.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/error.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/implementation.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/document_stream.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/document.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/error.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/padded_string.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/parsedjson_iterator.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/internal/jsonformatutils.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/jsonioutil.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/jsonparser.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/nonstd/string_view.hpp
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/padded_string.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/parsedjson.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/parsedjson_iterator.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/portability.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/simdjson_version.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/simdjson.h
|
||||
)
|
||||
install(DIRECTORY simdjson DESTINATION include FILES_MATCHING PATTERN *.h)
|
||||
install(FILES simdjson.h DESTINATION include)
|
||||
|
|
|
@ -1,114 +1,47 @@
|
|||
if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc
|
||||
# prevent shared libraries from depending on Intel provided libraries
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel")
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# we default on a shared library.
|
||||
if(SIMDJSON_BUILD_STATIC)
|
||||
set(SIMDJSON_LIB_TYPE STATIC)
|
||||
MESSAGE( STATUS "Building a static library." )
|
||||
add_library(simdjson STATIC "")
|
||||
else()
|
||||
MESSAGE( STATUS "Building a dynamic library (default)." )
|
||||
set(SIMDJSON_LIB_TYPE SHARED)
|
||||
MESSAGE( STATUS "Building a dynamic library." )
|
||||
add_library(simdjson SHARED "")
|
||||
endif()
|
||||
|
||||
MESSAGE( STATUS "SIMDJSON_LIB_TYPE: " ${SIMDJSON_LIB_TYPE})
|
||||
target_sources(simdjson PRIVATE simdjson.cpp)
|
||||
target_include_directories(simdjson PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
|
||||
target_include_directories(simdjson PRIVATE .)
|
||||
|
||||
# Bring in include files
|
||||
include(../include/CMakeLists.txt)
|
||||
if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc
|
||||
# prevent shared libraries from depending on Intel provided libraries
|
||||
target_link_options(simdjson PUBLIC "-static-intel")
|
||||
endif()
|
||||
|
||||
set(SIMDJSON_SRC_DIR $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
||||
if(SIMDJSON_ENABLE_THREADS)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(simdjson PRIVATE Threads::Threads)
|
||||
endif()
|
||||
|
||||
set(SIMDJSON_SRC
|
||||
simdjson.cpp
|
||||
)
|
||||
# Installation
|
||||
|
||||
# Load headers and sources
|
||||
set(SIMDJSON_SRC_HEADERS
|
||||
error.cpp
|
||||
implementation.cpp
|
||||
isadetection.h
|
||||
simdprune_tables.h
|
||||
stage1_find_marks.cpp
|
||||
stage2_build_tape.cpp
|
||||
arm64/bitmanipulation.h
|
||||
arm64/bitmask.h
|
||||
arm64/implementation.h
|
||||
arm64/intrinsics.h
|
||||
arm64/numberparsing.h
|
||||
arm64/simd.h
|
||||
arm64/stage1_find_marks.h
|
||||
arm64/stage2_build_tape.h
|
||||
arm64/stringparsing.h
|
||||
fallback/implementation.h
|
||||
fallback/stage1_find_marks.h
|
||||
fallback/stage2_build_tape.h
|
||||
generic/atomparsing.h
|
||||
generic/json_scanner.h
|
||||
generic/json_string_scanner.h
|
||||
generic/json_structural_indexer.h
|
||||
generic/numberparsing.h
|
||||
generic/stage2_build_tape.h
|
||||
generic/stage2_streaming_build_tape.h
|
||||
generic/stringparsing.h
|
||||
generic/utf8_fastvalidate_algorithm.h
|
||||
generic/utf8_lookup_algorithm.h
|
||||
generic/utf8_lookup2_algorithm.h
|
||||
generic/utf8_range_algorithm.h
|
||||
generic/utf8_zwegner_algorithm.h
|
||||
haswell/bitmanipulation.h
|
||||
haswell/bitmask.h
|
||||
haswell/implementation.h
|
||||
haswell/intrinsics.h
|
||||
haswell/numberparsing.h
|
||||
haswell/simd.h
|
||||
haswell/stage1_find_marks.h
|
||||
haswell/stage2_build_tape.h
|
||||
haswell/stringparsing.h
|
||||
document_parser_callbacks.h
|
||||
westmere/bitmanipulation.h
|
||||
westmere/bitmask.h
|
||||
westmere/implementation.h
|
||||
westmere/intrinsics.h
|
||||
westmere/numberparsing.h
|
||||
westmere/simd.h
|
||||
westmere/stage1_find_marks.h
|
||||
westmere/stage2_build_tape.h
|
||||
westmere/stringparsing.h
|
||||
)
|
||||
set_source_files_properties(${SIMDJSON_SRC_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
add_library(${SIMDJSON_LIB_NAME} ${SIMDJSON_LIB_TYPE} ${SIMDJSON_SRC} ${SIMDJSON_INCLUDE} ${SIMDJSON_SRC_HEADERS})
|
||||
|
||||
target_include_directories(${SIMDJSON_LIB_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${SIMDJSON_SRC_DIR}>
|
||||
$<BUILD_INTERFACE:${SIMDJSON_INCLUDE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
install(TARGETS ${SIMDJSON_LIB_NAME}
|
||||
EXPORT ${SIMDJSON_LIB_NAME}-config
|
||||
install(TARGETS simdjson
|
||||
EXPORT simdjson-config
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
install(EXPORT ${SIMDJSON_LIB_NAME}-config
|
||||
FILE ${SIMDJSON_LIB_NAME}-config.cmake
|
||||
NAMESPACE ${SIMDJSON_LIB_NAME}::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${SIMDJSON_LIB_NAME}
|
||||
install(EXPORT simdjson-config
|
||||
FILE simdjson-config.cmake
|
||||
NAMESPACE simdjson::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/simdjson
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
## We output the library at the root of the current directory where cmake is invoked
|
||||
## This is handy but Visual Studio will happily ignore us
|
||||
set_target_properties(${SIMDJSON_LIB_NAME} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
VERSION ${SIMDJSON_LIB_VERSION}
|
||||
SOVERSION ${SIMDJSON_LIB_SOVERSION})
|
||||
set_target_properties(simdjson PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
MESSAGE( STATUS "Library output directory (does not apply to Visual Studio): " ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
|
@ -121,12 +54,7 @@ if(MSVC AND (SIMDJSON_LIB_TYPE STREQUAL "SHARED"))
|
|||
MESSAGE( STATUS "To build a Windows DLL using Visual Studio, you may need cmake 3.4 or better." )
|
||||
endif()
|
||||
MESSAGE( STATUS "Building a Windows DLL using Visual Studio, exporting all symbols automatically." )
|
||||
set_target_properties(${SIMDJSON_LIB_NAME}
|
||||
set_target_properties(simdjson
|
||||
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
|
||||
endif()
|
||||
|
||||
if(SIMDJSON_ENABLE_THREADS)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries( ${SIMDJSON_LIB_NAME} Threads::Threads)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
if(MSVC)
|
||||
target_include_directories(${SIMDJSON_LIB_NAME}
|
||||
target_include_directories(simdjson
|
||||
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/windows>
|
||||
)
|
||||
endif()
|
||||
|
@ -24,7 +24,7 @@ target_compile_definitions(errortests PRIVATE JSON_TEST_PATH="${PROJECT_SOURCE_D
|
|||
|
||||
## This causes problems
|
||||
# add_executable(singleheader ./singleheadertest.cpp ${PROJECT_SOURCE_DIR}/singleheader/simdjson.cpp)
|
||||
# target_link_libraries(singleheader ${SIMDJSON_LIB_NAME})
|
||||
# target_link_libraries(singleheader simdjson)
|
||||
# add_test(singleheader singleheader)
|
||||
|
||||
if(MSVC)
|
||||
|
|
Loading…
Reference in New Issue