Don't reinitialize submodules

Add ability to turn competitive benchmarks off (no need for submodules)
This commit is contained in:
John Keiser 2020-04-07 09:25:11 -07:00
parent 7b58fea911
commit 7317fe1440
6 changed files with 100 additions and 81 deletions

View File

@ -226,35 +226,36 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF
commands:
- apt-get update -qq
- apt-get install -y clang make cmake
- apt-get install -y clang make cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
- make -j
- ctest --output-on-failure
---
kind: pipeline
name: amd64_clang_cmake_no_exceptions
platform:
os: linux
arch: amd64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: clang
CXX: clang++
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF
commands:
- apt-get update -qq
- apt-get install -y clang make cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
- make -j
- ctest --output-on-failure
---
kind: pipeline
name: amd64_clang_cmake_no_exceptions
platform:
os: linux
arch: amd64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: clang
CXX: clang++
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF
commands:
- apt-get update -qq
- apt-get install -y clang make cmake
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
- make -j
- ctest --output-on-failure
kind: pipeline
name: amd64_clang_cmake_static
@ -271,7 +272,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON
commands:
- apt-get update -qq
- apt-get install -y clang make cmake
- apt-get install -y clang make cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
@ -340,7 +341,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF
commands:
- apt-get update -qq
- apt-get install -y clang make cmake
- apt-get install -y clang make cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
@ -386,7 +387,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON
commands:
- apt-get update -qq
- apt-get install -y clang make cmake
- apt-get install -y clang make cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
@ -433,7 +434,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON
commands:
- apt-get update -qq
- apt-get install -y clang make cmake
- apt-get install -y clang make cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
@ -480,7 +481,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON
commands:
- apt-get update -y
- apt-get install -y make $CC g++ cmake
- apt-get install -y make $CC g++ cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
@ -527,7 +528,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON -DSIMDJSON_IMPLEMENTATION_HASWELL=OFF
commands:
- apt-get update -qq
- apt-get install -y clang make cmake
- apt-get install -y clang make cmake git
- $CC --version
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..

View File

@ -31,6 +31,7 @@ set(PROJECT_VERSION_PATCH 1)
set(SIMDJSON_LIB_VERSION "0.3.1" CACHE STRING "simdjson library version")
set(SIMDJSON_LIB_SOVERSION "1" CACHE STRING "simdjson library soversion")
option(SIMDJSON_COMPETITION "Compile competitive benchmarks" ON)
option(SIMDJSON_IMPLEMENTATION_HASWELL "Include the haswell implementation" ON)
option(SIMDJSON_IMPLEMENTATION_WESTMERE "Include the westmere implementation" ON)
option(SIMDJSON_IMPLEMENTATION_ARM64 "Include the arm64 implementation" ON)

View File

@ -14,7 +14,6 @@ target_compile_definitions(parse_nonumberparsing PRIVATE SIMDJSON_SKIPNUMBERPARS
add_executable(parse_nostringparsing parse.cpp)
target_compile_definitions(parse_nostringparsing PRIVATE SIMDJSON_SKIPSTRINGPARSING)
# Google Benchmarks
if (SIMDJSON_GOOGLE_BENCHMARKS)
link_libraries(benchmark::benchmark)
add_executable(bench_parse_call bench_parse_call.cpp)
@ -22,14 +21,16 @@ if (SIMDJSON_GOOGLE_BENCHMARKS)
target_link_libraries(bench_dom_api test-data)
endif()
add_executable(distinctuseridcompetition distinctuseridcompetition.cpp)
target_link_libraries(distinctuseridcompetition competition-core)
add_executable(minifiercompetition minifiercompetition.cpp)
target_link_libraries(minifiercompetition competition-core)
add_executable(parseandstatcompetition parseandstatcompetition.cpp)
target_link_libraries(parseandstatcompetition competition-core)
add_executable(parsingcompetition parsingcompetition.cpp)
target_link_libraries(parsingcompetition competition-core)
add_executable(allparsingcompetition parsingcompetition.cpp)
target_link_libraries(allparsingcompetition competition-all)
target_compile_definitions(allparsingcompetition PRIVATE ALLPARSER)
if (SIMDJSON_COMPETITION)
add_executable(distinctuseridcompetition distinctuseridcompetition.cpp)
target_link_libraries(distinctuseridcompetition competition-core)
add_executable(minifiercompetition minifiercompetition.cpp)
target_link_libraries(minifiercompetition competition-core)
add_executable(parseandstatcompetition parseandstatcompetition.cpp)
target_link_libraries(parseandstatcompetition competition-core)
add_executable(parsingcompetition parsingcompetition.cpp)
target_link_libraries(parsingcompetition competition-core)
add_executable(allparsingcompetition parsingcompetition.cpp)
target_link_libraries(allparsingcompetition competition-all)
target_compile_definitions(allparsingcompetition PRIVATE ALLPARSER)
endif()

View File

@ -1,58 +1,70 @@
# Init submodules so they can be used
find_package(Git QUIET)
if(GIT_FOUND)
option(SIMDJSON_GIT_SUBMODULE "Check submodules during build" ON)
if(SIMDJSON_GIT_SUBMODULE)
message(STATUS "Updating submodules")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
# Initializes a git submodule if it hasn't been initialized before
# Does NOT attempt to update or otherwise modify git submodules that are already initialized.
function(initialize_submodule DIRECTORY)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${DIRECTORY}/.git)
find_package(Git QUIET REQUIRED)
message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRECTORY}/.git does not exist. Initializing ${DIRECTORY} submodule ...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init ${DIRECTORY}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_EXIT_CODE)
if(NOT GIT_EXIT_CODE EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
message(FATAL_ERROR "${GIT_EXECUTABLE} submodule update --init dependencies/${DIRECTORY} failed with exit code ${GIT_EXIT_CODE}, please checkout submodules")
endif()
endif()
endif()
endfunction(initialize_submodule)
if (SIMDJSON_GOOGLE_BENCHMARKS)
option(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_TESTING OFF)
option(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
initialize_submodule(benchmark)
add_subdirectory(benchmark)
endif()
add_library(competition-cJSON INTERFACE)
target_include_directories(competition-cJSON INTERFACE cJSON)
if (SIMDJSON_COMPETITION)
initialize_submodule(cJSON)
add_library(competition-cJSON INTERFACE)
target_include_directories(competition-cJSON INTERFACE cJSON)
add_library(competition-fastjson INTERFACE)
target_include_directories(competition-fastjson INTERFACE fastjson/src fastjson/include)
initialize_submodule(fastjson)
add_library(competition-fastjson INTERFACE)
target_include_directories(competition-fastjson INTERFACE fastjson/src fastjson/include)
add_library(competition-gason INTERFACE)
target_include_directories(competition-gason INTERFACE gason/src)
initialize_submodule(gason)
add_library(competition-gason INTERFACE)
target_include_directories(competition-gason INTERFACE gason/src)
add_library(competition-jsmn INTERFACE)
target_include_directories(competition-jsmn INTERFACE jsmn)
initialize_submodule(jsmn)
add_library(competition-jsmn INTERFACE)
target_include_directories(competition-jsmn INTERFACE jsmn)
add_library(competition-json INTERFACE)
target_include_directories(competition-json INTERFACE json/single_include)
initialize_submodule(json)
add_library(competition-json INTERFACE)
target_include_directories(competition-json INTERFACE json/single_include)
add_library(competition-json11 INTERFACE)
target_include_directories(competition-json11 INTERFACE json11)
initialize_submodule(json11)
add_library(competition-json11 INTERFACE)
target_include_directories(competition-json11 INTERFACE json11)
add_library(competition-jsoncppdist INTERFACE)
target_include_directories(competition-jsoncppdist INTERFACE jsoncppdist)
add_library(competition-jsoncppdist INTERFACE)
target_include_directories(competition-jsoncppdist INTERFACE jsoncppdist)
add_library(competition-rapidjson INTERFACE)
target_include_directories(competition-rapidjson INTERFACE rapidjson/include)
initialize_submodule(rapidjson)
add_library(competition-rapidjson INTERFACE)
target_include_directories(competition-rapidjson INTERFACE rapidjson/include)
add_library(competition-sajson INTERFACE)
target_include_directories(competition-sajson INTERFACE sajson/include)
initialize_submodule(sajson)
add_library(competition-sajson INTERFACE)
target_include_directories(competition-sajson INTERFACE sajson/include)
add_library(competition-ujson4c ujson4c/src/ujdecode.c)
target_include_directories(competition-ujson4c PUBLIC ujson4c/3rdparty ujson4c/src)
initialize_submodule(ujson4c)
add_library(competition-ujson4c ujson4c/src/ujdecode.c)
target_include_directories(competition-ujson4c PUBLIC ujson4c/3rdparty ujson4c/src)
add_library(competition-core INTERFACE)
target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn)
add_library(competition-core INTERFACE)
target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn)
add_library(competition-all INTERFACE)
target_link_libraries(competition-all INTERFACE competition-core competition-jsoncppdist competition-json11 competition-fastjson competition-gason competition-ujson4c)
add_library(competition-all INTERFACE)
target_link_libraries(competition-all INTERFACE competition-core competition-jsoncppdist competition-json11 competition-fastjson competition-gason competition-ujson4c)
endif()

View File

@ -1,5 +1,7 @@
add_test(
NAME issue150
COMMAND ${PROJECT_SOURCE_DIR}/scripts/issue150.sh
WORKING_DIRECTORY $<TARGET_FILE_DIR:allparserscheckfile>
)
if (SIMDJSON_COMPETITION)
add_test(
NAME issue150
COMMAND ${PROJECT_SOURCE_DIR}/scripts/issue150.sh
WORKING_DIRECTORY $<TARGET_FILE_DIR:allparserscheckfile>
)
endif()

View File

@ -32,8 +32,10 @@ add_cpp_test(pointercheck pointercheck.cpp)
#
# Competition parse test
#
add_executable(allparserscheckfile allparserscheckfile.cpp)
target_link_libraries(allparserscheckfile competition-all)
if (SIMDJSON_COMPETITION)
add_executable(allparserscheckfile allparserscheckfile.cpp)
target_link_libraries(allparserscheckfile competition-all)
endif()
#
# Compile-only tests