Skip to content

Commit

Permalink
Merge pull request #416 from mmd-osm/lib/sjparser
Browse files Browse the repository at this point in the history
Adding sjparser lib
  • Loading branch information
mmd-osm authored Jul 6, 2024
2 parents 9e3dee4 + 8ae875a commit 38b6de1
Show file tree
Hide file tree
Showing 59 changed files with 8,280 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ disable_build_lint()

add_subdirectory(catch2)
add_subdirectory(libxml++)
add_subdirectory(sjparser)

target_link_libraries(catch2 INTERFACE cgimap_common_compiler_options)
target_link_libraries(libxml++ PUBLIC cgimap_common_compiler_options)
6 changes: 6 additions & 0 deletions contrib/sjparser/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BasedOnStyle: Google
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
Standard: Cpp11
BreakBeforeBinaryOperators: NonAssignment
AlwaysBreakTemplateDeclarations: false
3 changes: 3 additions & 0 deletions contrib/sjparser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
.*.swp
.*.swo
104 changes: 104 additions & 0 deletions contrib/sjparser/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
image: registry.gitlab.com/dhurum/docker_build_images/sjparser-build:master

stages:
- configure
- build
- test
- deploy

configuration:
stage: configure
script:
- mkdir build && cd build
- cmake ../ -DCMAKE_BUILD_TYPE=Release -DSJPARSER_WITH_TESTS=On
artifacts:
expire_in: 15 min
paths:
- build

configuration-coverage:
stage: configure
script:
- mkdir build && cd build
- cmake ../ -DCMAKE_BUILD_TYPE=Debug -DSJPARSER_WITH_COVERAGE=On
artifacts:
expire_in: 15 min
paths:
- build

build:
stage: build
script:
- cd build
- make -j `nproc`
dependencies:
- configuration
artifacts:
expire_in: 15 min
paths:
- build

build-coverage:
stage: build
script:
- cd build
- make -j `nproc`
dependencies:
- configuration-coverage
artifacts:
expire_in: 15 min
paths:
- build

checks:
stage: build
script:
- cd build
- make check
- make format
- git status -s
- '[[ -z $( git status -s ) ]]'
dependencies:
- configuration

documentation:
stage: build
script:
- cd build
- make documentation
- mv documentation ../
dependencies:
- configuration
artifacts:
expire_in: 15 min
paths:
- documentation

test:
stage: test
script:
- cd build
- make test
dependencies:
- build

coverage:
stage: test
script:
- cd build
- make coverage
coverage: '/^TOTAL.*\s+(\d+\%)$/'
dependencies:
- build-coverage

pages:
stage: deploy
only:
- master
script:
- mv documentation/html public
dependencies:
- documentation
artifacts:
paths:
- public
58 changes: 58 additions & 0 deletions contrib/sjparser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 3.8)

project(sjparser)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

option(SJPARSER_WITH_TESTS
"Build tests if the config is not Debug" OFF)
option(SJPARSER_WITH_COVERAGE
"Add coverage target (only in Debug config)" OFF)
option(SJPARSER_BUILD_SHARED_LIBRARY
"Build shared library even in case of submodule build" OFF)

if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(STATUS
"Sjparser is a part of some project, only library targets are enabled.")
set(STANDALONE_BUILD FALSE)
else()
set(STANDALONE_BUILD TRUE)
set(SJPARSER_BUILD_SHARED_LIBRARY TRUE)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(SJPARSER_WITH_TESTS TRUE)
endif()
endif()

function(setup_compilation_options TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)

target_compile_options(${TARGET} PRIVATE
-Werror
-Wall
-Wextra
-Wpedantic
$<$<CONFIG:Debug>:-O0 -g3>
)

if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND SJPARSER_WITH_COVERAGE)
target_compile_options(${TARGET} PRIVATE -O0 --coverage)
target_link_libraries(${TARGET} PRIVATE --coverage)
endif()
endfunction()

add_subdirectory(library)

if(SJPARSER_WITH_TESTS)
enable_testing()
add_subdirectory(tests)
endif()

if(STANDALONE_BUILD)
add_subdirectory(check)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND SJPARSER_WITH_COVERAGE)
add_subdirectory(coverage)
endif()
19 changes: 19 additions & 0 deletions contrib/sjparser/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2016 Denis Tikhomirov <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

22 changes: 22 additions & 0 deletions contrib/sjparser/README.contrib
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@


Source: https://gitlab.com/dhurum/sjparser
Commit: a53246dac850fd5fadd288277776b43cc2c9b819

git subtree add --prefix contrib/sjparser https://gitlab.com/dhurum/sjparser.git improvements --squash

Update via `git subtree pull --prefix=contrib/sjparser/ --squash https://gitlab.com/dhurum/sjparser.git <remote-ref>`

List of changes to sjparser:

* MemberParser: replace recursive template metaprogramming by folds
* NthTypes: get rid of recursive template metaprogramming
* Value<double> should also support yajl integers
* if key appears multiple times, last one wins
* Include error location in error message
* Typo fixes
* Removed union.h and s_union.h, as well as standalone/embedded (s_)union test cases (not relevant)
* Removed doxygen & documentation directory (see original repo for documentation)



Loading

0 comments on commit 38b6de1

Please sign in to comment.