diff --git a/.gitignore b/.gitignore index 054f1ccf..3cee37df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ bench vpack-to-json json-to-vpack +taocpp-json core AsmTest *.o diff --git a/.travis.yml b/.travis.yml index 627a0bbc..3dba3d82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,6 +61,7 @@ matrix: - build_type=Release - SANITIZER=true - CXX_STANDARD=17 + - TAO=ON - name: "coverage build" if: branch = master @@ -92,6 +93,7 @@ matrix: #build settings - build_type=Release - CXX_STANDARD=17 + - TAO=ON addons: apt: sources: @@ -105,12 +107,16 @@ matrix: compiler: clang env: - build_type=Release + - TAO=ON install: + - git clone https://github.com/taocpp/json.git taocpp-json + - ( cd taocpp-json; git checkout 631095f4bfa45c63af5ccc1cb35ea16eb9ead450; ) - export CXX=$CXX - export CC=$CC - export CXX_STANDARD=${CXX_STANDARD:-17} - export BUILD_TYPE=${build_type} + - export TAO=${TAO:-OFF} - cmake --version - $CXX --version diff --git a/CMakeLists.txt b/CMakeLists.txt index ea801917..d775f421 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,15 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Mo option(BuildVelocyPackExamples "Build examples" ON) option(Maintainer "Build maintainer tools" OFF) +option(TaoJson "Add support for taocpp::json" OFF) + +if(TaoJson) + if(NOT TARGET taocpp::json) + set(TAOCPP_JSON_BUILD_TESTS OFF CACHE BOOL "Build test programs" FORCE) + set(TAOCPP_JSON_BUILD_EXAMPLES OFF CACHE BOOL "Build example programs" FORCE) + add_subdirectory(taocpp-json EXCLUDE_FROM_ALL) + endif() +endif() set(HashType "xxhash" CACHE STRING "Hash type (fasthash, xxhash)" ) @@ -44,7 +53,7 @@ set(VELOCY_SOURCE src/Iterator.cpp src/Options.cpp src/Parser.cpp - src/TaoParser.cpp + $<$:src/TaoParser.cpp> src/Serializable.cpp src/Slice.cpp src/SliceStaticData.cpp @@ -80,6 +89,7 @@ message(STATUS "Building with hash type: ${HashType}") add_library(velocypack STATIC ${VELOCY_SOURCE}) target_include_directories(velocypack PRIVATE src) target_include_directories(velocypack PUBLIC include) +target_link_libraries(velocypack PUBLIC $<$:taocpp::json>) if(Maintainer) add_executable(buildVersion scripts/build-version.cpp) diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh index 18128f6c..3009c462 100755 --- a/scripts/travis-build.sh +++ b/scripts/travis-build.sh @@ -21,7 +21,7 @@ mkdir -p build && cd build || ferr "could not create build dir" cmake -DCMAKE_BUILD_TYPE=Release -DHashType=xxhash \ -DBuildTests=ON -DBuildLargeTests=OFF -DBuildVelocyPackExamples=ON \ - -DBuildTools=ON -DEnableSSE=OFF \ + -DBuildTools=ON -DEnableSSE=OFF -DTaoJson="$TAO" \ -DCMAKE_CXX_STANDARD=${CXX_STANDARD} \ .. || ferr "failed to configure"