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 CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -y clang make cmake - apt-get install -y clang make cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - cmake $CMAKE_FLAGS ..
- make -j - make -j
- ctest --output-on-failure - ctest --output-on-failure
--- ---
kind: pipeline kind: pipeline
name: amd64_clang_cmake_no_exceptions name: amd64_clang_cmake_no_exceptions
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
steps: steps:
- name: Build and Test - name: Build and Test
image: ubuntu:18.04 image: ubuntu:18.04
environment: environment:
CC: clang CC: clang
CXX: clang++ CXX: clang++
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -y clang make cmake - apt-get install -y clang make cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - cmake $CMAKE_FLAGS ..
- make -j - make -j
- ctest --output-on-failure - ctest --output-on-failure
---
kind: pipeline kind: pipeline
name: amd64_clang_cmake_static name: amd64_clang_cmake_static
@ -271,7 +272,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -y clang make cmake - apt-get install -y clang make cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - cmake $CMAKE_FLAGS ..
@ -340,7 +341,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=OFF
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -y clang make cmake - apt-get install -y clang make cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - cmake $CMAKE_FLAGS ..
@ -386,7 +387,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON CMAKE_FLAGS: -DSIMDJSON_BUILD_STATIC=ON
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -y clang make cmake - apt-get install -y clang make cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - cmake $CMAKE_FLAGS ..
@ -433,7 +434,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -y clang make cmake - apt-get install -y clang make cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - cmake $CMAKE_FLAGS ..
@ -480,7 +481,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON
commands: commands:
- apt-get update -y - apt-get update -y
- apt-get install -y make $CC g++ cmake - apt-get install -y make $CC g++ cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - cmake $CMAKE_FLAGS ..
@ -527,7 +528,7 @@ steps:
CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON -DSIMDJSON_IMPLEMENTATION_HASWELL=OFF CMAKE_FLAGS: -DSIMDJSON_SANITIZE=ON -DSIMDJSON_IMPLEMENTATION_HASWELL=OFF
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -y clang make cmake - apt-get install -y clang make cmake git
- $CC --version - $CC --version
- mkdir build && cd build - mkdir build && cd build
- cmake $CMAKE_FLAGS .. - 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_VERSION "0.3.1" CACHE STRING "simdjson library version")
set(SIMDJSON_LIB_SOVERSION "1" CACHE STRING "simdjson library soversion") 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_HASWELL "Include the haswell implementation" ON)
option(SIMDJSON_IMPLEMENTATION_WESTMERE "Include the westmere implementation" ON) option(SIMDJSON_IMPLEMENTATION_WESTMERE "Include the westmere implementation" ON)
option(SIMDJSON_IMPLEMENTATION_ARM64 "Include the arm64 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) add_executable(parse_nostringparsing parse.cpp)
target_compile_definitions(parse_nostringparsing PRIVATE SIMDJSON_SKIPSTRINGPARSING) target_compile_definitions(parse_nostringparsing PRIVATE SIMDJSON_SKIPSTRINGPARSING)
# Google Benchmarks
if (SIMDJSON_GOOGLE_BENCHMARKS) if (SIMDJSON_GOOGLE_BENCHMARKS)
link_libraries(benchmark::benchmark) link_libraries(benchmark::benchmark)
add_executable(bench_parse_call bench_parse_call.cpp) 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) target_link_libraries(bench_dom_api test-data)
endif() endif()
add_executable(distinctuseridcompetition distinctuseridcompetition.cpp) if (SIMDJSON_COMPETITION)
target_link_libraries(distinctuseridcompetition competition-core) add_executable(distinctuseridcompetition distinctuseridcompetition.cpp)
add_executable(minifiercompetition minifiercompetition.cpp) target_link_libraries(distinctuseridcompetition competition-core)
target_link_libraries(minifiercompetition competition-core) add_executable(minifiercompetition minifiercompetition.cpp)
add_executable(parseandstatcompetition parseandstatcompetition.cpp) target_link_libraries(minifiercompetition competition-core)
target_link_libraries(parseandstatcompetition competition-core) add_executable(parseandstatcompetition parseandstatcompetition.cpp)
add_executable(parsingcompetition parsingcompetition.cpp) target_link_libraries(parseandstatcompetition competition-core)
target_link_libraries(parsingcompetition competition-core) add_executable(parsingcompetition parsingcompetition.cpp)
add_executable(allparsingcompetition parsingcompetition.cpp) target_link_libraries(parsingcompetition competition-core)
target_link_libraries(allparsingcompetition competition-all) add_executable(allparsingcompetition parsingcompetition.cpp)
target_compile_definitions(allparsingcompetition PRIVATE ALLPARSER) 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 # Initializes a git submodule if it hasn't been initialized before
find_package(Git QUIET) # Does NOT attempt to update or otherwise modify git submodules that are already initialized.
if(GIT_FOUND) function(initialize_submodule DIRECTORY)
option(SIMDJSON_GIT_SUBMODULE "Check submodules during build" ON) if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${DIRECTORY}/.git)
if(SIMDJSON_GIT_SUBMODULE) find_package(Git QUIET REQUIRED)
message(STATUS "Updating submodules") message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRECTORY}/.git does not exist. Initializing ${DIRECTORY} submodule ...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init ${DIRECTORY}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_EXIT_CODE) RESULT_VARIABLE GIT_EXIT_CODE)
if(NOT GIT_EXIT_CODE EQUAL "0") 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() endif()
endif() endfunction(initialize_submodule)
if (SIMDJSON_GOOGLE_BENCHMARKS) if (SIMDJSON_GOOGLE_BENCHMARKS)
option(BENCHMARK_ENABLE_TESTING OFF) option(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_TESTING OFF) set(BENCHMARK_ENABLE_TESTING OFF)
option(BENCHMARK_ENABLE_INSTALL OFF) option(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_ENABLE_INSTALL OFF) set(BENCHMARK_ENABLE_INSTALL OFF)
initialize_submodule(benchmark)
add_subdirectory(benchmark) add_subdirectory(benchmark)
endif() endif()
add_library(competition-cJSON INTERFACE) if (SIMDJSON_COMPETITION)
target_include_directories(competition-cJSON INTERFACE cJSON) initialize_submodule(cJSON)
add_library(competition-cJSON INTERFACE)
target_include_directories(competition-cJSON INTERFACE cJSON)
add_library(competition-fastjson INTERFACE) initialize_submodule(fastjson)
target_include_directories(competition-fastjson INTERFACE fastjson/src fastjson/include) add_library(competition-fastjson INTERFACE)
target_include_directories(competition-fastjson INTERFACE fastjson/src fastjson/include)
add_library(competition-gason INTERFACE) initialize_submodule(gason)
target_include_directories(competition-gason INTERFACE gason/src) add_library(competition-gason INTERFACE)
target_include_directories(competition-gason INTERFACE gason/src)
add_library(competition-jsmn INTERFACE) initialize_submodule(jsmn)
target_include_directories(competition-jsmn INTERFACE jsmn) add_library(competition-jsmn INTERFACE)
target_include_directories(competition-jsmn INTERFACE jsmn)
add_library(competition-json INTERFACE) initialize_submodule(json)
target_include_directories(competition-json INTERFACE json/single_include) add_library(competition-json INTERFACE)
target_include_directories(competition-json INTERFACE json/single_include)
add_library(competition-json11 INTERFACE) initialize_submodule(json11)
target_include_directories(competition-json11 INTERFACE json11) add_library(competition-json11 INTERFACE)
target_include_directories(competition-json11 INTERFACE json11)
add_library(competition-jsoncppdist INTERFACE) add_library(competition-jsoncppdist INTERFACE)
target_include_directories(competition-jsoncppdist INTERFACE jsoncppdist) target_include_directories(competition-jsoncppdist INTERFACE jsoncppdist)
add_library(competition-rapidjson INTERFACE) initialize_submodule(rapidjson)
target_include_directories(competition-rapidjson INTERFACE rapidjson/include) add_library(competition-rapidjson INTERFACE)
target_include_directories(competition-rapidjson INTERFACE rapidjson/include)
add_library(competition-sajson INTERFACE) initialize_submodule(sajson)
target_include_directories(competition-sajson INTERFACE sajson/include) add_library(competition-sajson INTERFACE)
target_include_directories(competition-sajson INTERFACE sajson/include)
add_library(competition-ujson4c ujson4c/src/ujdecode.c) initialize_submodule(ujson4c)
target_include_directories(competition-ujson4c PUBLIC ujson4c/3rdparty ujson4c/src) add_library(competition-ujson4c ujson4c/src/ujdecode.c)
target_include_directories(competition-ujson4c PUBLIC ujson4c/3rdparty ujson4c/src)
add_library(competition-core INTERFACE) add_library(competition-core INTERFACE)
target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn) target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn)
add_library(competition-all INTERFACE) add_library(competition-all INTERFACE)
target_link_libraries(competition-all INTERFACE competition-core competition-jsoncppdist competition-json11 competition-fastjson competition-gason competition-ujson4c) 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( if (SIMDJSON_COMPETITION)
NAME issue150 add_test(
COMMAND ${PROJECT_SOURCE_DIR}/scripts/issue150.sh NAME issue150
WORKING_DIRECTORY $<TARGET_FILE_DIR:allparserscheckfile> 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 # Competition parse test
# #
add_executable(allparserscheckfile allparserscheckfile.cpp) if (SIMDJSON_COMPETITION)
target_link_libraries(allparserscheckfile competition-all) add_executable(allparserscheckfile allparserscheckfile.cpp)
target_link_libraries(allparserscheckfile competition-all)
endif()
# #
# Compile-only tests # Compile-only tests