🔥 use simdjson instead of nlohmannjson

This commit is contained in:
Vladislav Nepogodin 2021-12-31 16:52:54 +04:00
parent 09c966b0ff
commit 119d4a5767
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
7 changed files with 47 additions and 10 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ subprojects/fmt
subprojects/ftxui
subprojects/nlohmann_json-*
subprojects/spdlog
subprojects/simdjson
subprojects/packagecache
# Prerequisites

View File

@ -36,8 +36,8 @@ pkg_check_modules(
glibmm-2.4>=2.56.0)
FetchContent_Declare(ftxui
GIT_REPOSITORY "https://github.com/arthursonzogni/ftxui.git"
GIT_TAG "7e5cd23b4c47972b70b99c39617d6e38f05d1b3a"
GIT_REPOSITORY "https://github.com/vnepogodin/ftxui.git"
GIT_TAG "constexpr"
)
FetchContent_Declare(fmt
GIT_REPOSITORY "https://github.com/fmtlib/fmt.git"
@ -48,15 +48,15 @@ FetchContent_Declare(spdlog
GIT_REPOSITORY "https://github.com/gabime/spdlog.git"
GIT_TAG "cc30229abb1e22ebe1f8657de4011a53db7bd6ac"
)
FetchContent_Declare(nlohmann_json
GIT_REPOSITORY "https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent.git"
GIT_TAG "v3.10.4"
FetchContent_Declare(simdjson
GIT_REPOSITORY "https://github.com/simdjson/simdjson.git"
GIT_TAG "3a93e45dd166d8e614a33b0ba4da39c1a01660b7"
)
FetchContent_Declare(cpr
GIT_REPOSITORY "https://github.com/libcpr/cpr.git"
GIT_TAG "beb9e98806bb84bcc130a2cebfbcbbc6ce62b335"
)
FetchContent_MakeAvailable(ftxui spdlog nlohmann_json cpr)
FetchContent_MakeAvailable(ftxui spdlog simdjson cpr)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
FetchContent_Declare(range-v3
GIT_REPOSITORY "https://github.com/ericniebler/range-v3.git"
@ -123,7 +123,7 @@ enable_sanitizers(project_options)
include_directories(${CMAKE_SOURCE_DIR}/src)
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::screen ftxui::dom ftxui::component nlohmann_json::nlohmann_json cpr::cpr PkgConfig::GLIBMM)
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::screen ftxui::dom ftxui::component simdjson::simdjson cpr::cpr PkgConfig::GLIBMM)
target_link_libraries(test-exec-interactive PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::component cpr::cpr PkgConfig::GLIBMM)
target_link_libraries(test-process-tailing PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::component cpr::cpr PkgConfig::GLIBMM)

View File

@ -22,6 +22,7 @@ set(FTXUI_BUILD_EXAMPLES OFF CACHE INTERNAL "" FORCE)
set(FTXUI_ENABLE_INSTALL OFF CACHE INTERNAL "" FORCE)
set(SPDLOG_FMT_EXTERNAL ON CACHE INTERNAL "" FORCE)
set(SPDLOG_DISABLE_DEFAULT_LOGGER ON CACHE INTERNAL "" FORCE)
set(SIMDJSON_DISABLE_DEPRECATED_API ON CACHE INTERNAL "" FORCE)
# Generate compile_commands.json to make it easier to work with clang based tools
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

View File

@ -35,7 +35,7 @@ endif
spdlog = dependency('spdlog', version : ['>=1.9.2'])
fmt = dependency('fmt', version : ['>=8.0.0'], fallback : ['fmt', 'fmt_dep'])
ftxui = dependency('ftxui', modules : ['ftxui::screen', 'ftxui::dom', 'ftxui::component'], fallback : ['ftxui', 'ftxui_dep'])
nlohmann_json = dependency('nlohmann_json', version : ['>=3.10.4'], fallback : ['nlohmann_json', 'nlohmann_json_dep'])
simdjson = dependency('simdjson', version : ['>=1.0.2'], fallback : ['simdjson', 'simdjson_dep'])
cpr = dependency('cpr', version : ['>=1.7.0'], fallback : ['cpr', 'cpr_dep'])
libnm = dependency('libnm', version : ['>=1.10.6'])
glibmm = dependency('glibmm-2.4', version : ['>=2.56.0'])
@ -57,12 +57,14 @@ possible_cc_flags = [
'-Wnon-virtual-dtor',
'-Wold-style-cast',
'-Wcast-align',
'-Wunused',
'-Woverloaded-virtual',
'-Wpedantic', # non-standard C++
'-Wconversion', # type conversion that may lose data
'-Wsign-conversion',
'-Wnull-dereference',
'-Wdouble-promotion', # float to double

View File

@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/arthursonzogni/ftxui.git
revision = 7e5cd23b4c47972b70b99c39617d6e38f05d1b3a
url = https://github.com/vnepogodin/ftxui.git
revision = constexpr
patch_directory = ftxui

View File

@ -0,0 +1,25 @@
project('simdjson', 'cpp',
version : '1.0.2',
license : 'Apache-2.0',
default_options : [
'cpp_std=c++17',
'default_library=static',
]
)
simdjson_lib = library('simdjson',
sources : ['singleheader/simdjson.cpp'],
cpp_args : '-DSIMDJSON_THREADS_ENABLED=1',
include_directories: include_directories('singleheader')
)
simdjson_dep = declare_dependency(
include_directories: include_directories('singleheader'),
compile_args : '-DSIMDJSON_THREADS_ENABLED=1',
link_with : simdjson_lib
)
simdjson_multiple_headers = declare_dependency(
include_directories: include_directories('include'),
compile_args : '-DSIMDJSON_THREADS_ENABLED=1'
)

View File

@ -0,0 +1,8 @@
[wrap-git]
url = https://github.com/simdjson/simdjson.git
revision = 3a93e45dd166d8e614a33b0ba4da39c1a01660b7
patch_directory = simdjson
[provide]
simdjson = simdjson_dep