enable boost json (#1292)
* bump boost.json and see if it works in simdjson CI * enable boost json * clean up * add boost json to deps * use boost if std::string_view is available * add build with c++20 * use docker image which has the proper libc++ installed
This commit is contained in:
parent
553befa012
commit
f62ca21dd1
21
.drone.yml
21
.drone.yml
|
@ -183,6 +183,27 @@ steps:
|
|||
- ASAN_OPTIONS="detect_leaks=0" ctest $CTEST_FLAGS -LE "acceptance|per_implementation" # Everything we haven't run yet, run now.
|
||||
---
|
||||
kind: pipeline
|
||||
name: cpp20-clang11-libcpp
|
||||
platform: { os: linux, arch: amd64 }
|
||||
steps:
|
||||
- name: Build and Test
|
||||
image: pauldreik/llvm-11
|
||||
user: root
|
||||
environment:
|
||||
CC: clang-11
|
||||
CXX: clang++-11
|
||||
CMAKE_FLAGS: -GNinja
|
||||
BUILD_FLAGS:
|
||||
CTEST_FLAGS: -j4 --output-on-failure -E checkperf
|
||||
CXXFLAGS: -std=c++20 -stdlib=libc++
|
||||
commands:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake $CMAKE_FLAGS ..
|
||||
- cmake --build . $BUILD_FLAGS
|
||||
- ctest $CTEST_FLAGS
|
||||
---
|
||||
kind: pipeline
|
||||
name: arm64-gcc8
|
||||
platform: { os: linux, arch: arm64 }
|
||||
steps:
|
||||
|
|
|
@ -27,13 +27,7 @@ SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
|
|||
#include <nlohmann/json.hpp>
|
||||
using json = nlohmann::json;
|
||||
|
||||
#if defined(__clang__)
|
||||
// Under some clang/libc++ configurations, boost json fails
|
||||
// to build.
|
||||
#define DISABLE_BOOST_JSON
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BOOST_JSON
|
||||
#ifdef HAS_BOOST_JSON
|
||||
#include <boost/json/parser.hpp>
|
||||
#include <boost/json/monotonic_resource.hpp>
|
||||
#endif
|
||||
|
@ -185,7 +179,7 @@ bool bench(const char *filename, bool verbose, bool just_data,
|
|||
std::memcpy(buffer, p.data(), p.size()) &&
|
||||
(buffer[p.size()] = '\0'),
|
||||
repeat, volume, !just_data);
|
||||
#ifndef DISABLE_BOOST_JSON
|
||||
#ifdef HAS_BOOST_JSON
|
||||
{
|
||||
const boost::json::string_view sv(p.data(), p.size());
|
||||
boost::json::parser p;
|
||||
|
|
|
@ -14,9 +14,11 @@ endif()
|
|||
# This prevents variables declared with set() from unnecessarily escaping and
|
||||
# should not be called more than once
|
||||
function(competition_scope_)
|
||||
# Boost JSON is not compatible with some clang/libc++ configurations.
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
import_dependency(boostjson CPPAlliance/json a0983f7)
|
||||
# boost json in standalone mode requires C++17 string_view
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("#include <string_view>\n#if __cpp_lib_string_view < 201606\n#error no string view support\n#endif\nint main(){}" USE_BOOST_JSON)
|
||||
if(USE_BOOST_JSON)
|
||||
import_dependency(boostjson boostorg/json ee8d72d8502b409b5561200299cad30ccdb91415)
|
||||
add_library(boostjson STATIC "${boostjson_SOURCE_DIR}/src/src.cpp")
|
||||
target_compile_definitions(boostjson PUBLIC BOOST_JSON_STANDALONE)
|
||||
target_include_directories(boostjson SYSTEM PUBLIC
|
||||
|
@ -87,7 +89,8 @@ function(competition_scope_)
|
|||
|
||||
add_library(competition-core INTERFACE)
|
||||
target_link_libraries(competition-core INTERFACE nlohmann_json rapidjson sajson cjson jsmn yyjson)
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(USE_BOOST_JSON)
|
||||
target_compile_definitions(boostjson INTERFACE HAS_BOOST_JSON)
|
||||
target_link_libraries(competition-core INTERFACE boostjson)
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue