Skip to content

Commit

Permalink
Squashed 'src/Valijson/valijson/' changes from 2dfc7499..94d3bfd3
Browse files Browse the repository at this point in the history
94d3bfd3 Fix format regex escape sequences
25dcdb1c Merge pull request microsoft#160 from jrave/time-format-fields
dee2fa64 Support for time related format fields
5f49d77b Basic structure for format constraint
a6a4fbb5 Remove redundant call to baseline
0de61e0c Tidy up readme
1ff36254 Add script to bundle library into a single header
21322b2d Move Adapter and BasicAdapter classes to internal
23724b97 Merge pull request microsoft#159 from jackorobot/fix_poco_get_integer
72afeb1f Fixed PocoJsonValue::getInteger being limited to 32-bit integers
4d603df4 Update Authors file
0e3f48c8 Remove vendored copy of urdl
9e7dbd84 Remove outdated Xcode project files
2f6760f6 Merge pull request microsoft#154 from psigen/yaml-cpp-support
f4bbf4e0 Remove non-critical yaml-cpp files from PR.
b685584e Add optimization for find implementation.
c688aa3b Add a unit test for object member access.
76c9f40c Added simple loading utility.
66424a11 Added a column limit to the file.
f03461bb Fixed issue with YAML::Node reference usage.
7f23f369 Fix unit tests to match property tree.
698936ae Added missing dep for YAML-cpp.
328db2f6 Initial pass at yaml-cpp support.
34f75118 Add note about GCC versions to readme
5ca87a61 Remove very obsolete valgrind suppressions file
27d30658 Update vendored jsoncpp to version 1.9.5
c2822576 Update CMakeLists to use add_compile_definitions
f9701392 Remove unnecessary indentation from code snippets in readme
7d4ea908 Add boost::json example and delete problematic constructors
d34f78b4 Improve error messaging when parsing schemas and documents
dd32f66d Build tests for fuzzing
8b5f253c Tweak readme formatting
a2e39586 Remove Travis CI config
3940b361 Mention web-based demo in readme
f5f979b0 Mention boost compiler warnings in README
80afdef5 Merge pull request microsoft#150 from jonpetri/jonpetri/cmake-improvements
4622b958 Set valijson_BUILD_TESTS  OFF by default in cmake
50010fd9 Make VALIJSON_USE_EXCEPTIONS interface definition
c5dac2bc Install cmake export file
c7d5f2cb Remove valijson_INSTALL_HEADERS from cmake build
bfb5860c Fix fuzzer build
7b865438 Merge pull request microsoft#147 from keith-bennett-airmap/keith/shellcheck
1f25558c make shellcheck clean
3c185cb8 Merge pull request microsoft#145 from mporsch/smart-pointer-memory-management
828fc876 use implicit conversion of unique_ptr<T, DeleterA> to unique_ptr<const T, DeleterB>
cf841e10 use unique_ptr for memory management in constraints and subschema
4a99dd79 Add missing include
75ada05c Use strong types in external_schema example, and update README
26f3a847 Less const-ness
3eaf1bb9 Add note about VALIJSON_USE_EXCEPTIONS to the README
4990e352 Update inspector to enable and handle exceptions
af071f01 Update inspector build to work with Qt6
7b6d22f1 Update CMakeLists.txt to check for boost/json.hpp before building tests
5da89730 Merge pull request microsoft#139 from YangJiao1996/master
0f0cc2bc Always apply callback function when validating schema
9a2ebbde Merge pull request microsoft#137 from veselypeta/readme-cmake
e5530feb update README add with cmake

git-subtree-dir: src/Valijson/valijson
git-subtree-split: 94d3bfd39ad4dca1be0f700b5eea8e4234d0e7e8
  • Loading branch information
jedieaston committed Jul 22, 2022
1 parent 9f4ae89 commit 69594c4
Show file tree
Hide file tree
Showing 220 changed files with 24,170 additions and 15,432 deletions.
17 changes: 17 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
BasedOnStyle: LLVM
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBraces: Custom
IndentWidth: 4
AllowShortFunctionsOnASingleLine: Empty
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ doc/html
.idea
cmake-build-*
CMakeFiles/
.vs
74 changes: 0 additions & 74 deletions .travis.yml

This file was deleted.

5 changes: 4 additions & 1 deletion Authors
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ Jordan Bayles (jophba), [email protected]
JsonCpp owner

Matt Young (matty0ung), <[email protected]>
Adapter for Boost.JSON parser library
Adapter for Boost.JSON parser library

Pras Velagapudi (psigen), <[email protected]>
Adapter for yaml-cpp parser library
89 changes: 67 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.1.2)
project(valijson)

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

option(valijson_INSTALL_HEADERS "Install valijson headers." FALSE)
option(valijson_BUILD_EXAMPLES "Build valijson examples." FALSE)
option(valijson_BUILD_TESTS "Build valijson test suite." TRUE)
option(valijson_BUILD_TESTS "Build valijson test suite." FALSE)
option(valijson_EXCLUDE_BOOST "Exclude Boost when building test suite." FALSE)
option(valijson_USE_EXCEPTIONS "Use exceptions in valijson and included libs." TRUE)

Expand Down Expand Up @@ -35,35 +34,46 @@ target_include_directories(valijson INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

if(valijson_INSTALL_HEADERS)
install(DIRECTORY include/ DESTINATION include)
if(valijson_USE_EXCEPTIONS)
target_compile_definitions(valijson INTERFACE -DVALIJSON_USE_EXCEPTIONS=1)
endif()

install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(TARGETS valijson
EXPORT valijsonConfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(EXPORT valijsonConfig
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/valijson"
)

if(NOT valijson_BUILD_TESTS AND NOT valijson_BUILD_EXAMPLES)
return()
endif()

if(valijson_USE_EXCEPTIONS)
add_definitions(-DVALIJSON_USE_EXCEPTIONS=1)
add_compile_definitions(VALIJSON_USE_EXCEPTIONS=1)
else()
add_definitions(-D_HAS_EXCEPTIONS=0)
add_definitions(-DBOOST_NO_EXCEPTIONS)
add_definitions(-DJSON_USE_EXCEPTION=0)
add_definitions(-DVALIJSON_USE_EXCEPTIONS=0)
add_compile_definitions(_HAS_EXCEPTIONS=0)
add_compile_definitions(BOOST_NO_EXCEPTIONS)
add_compile_definitions(JSON_USE_EXCEPTION=0)
add_compile_definitions(VALIJSON_USE_EXCEPTIONS=0)
endif()

find_package(Poco OPTIONAL_COMPONENTS JSON)
find_package(Qt5Core)

# jsoncpp library
add_library(jsoncpp
thirdparty/jsoncpp-1.9.4/src/lib_json/json_reader.cpp
thirdparty/jsoncpp-1.9.4/src/lib_json/json_value.cpp
thirdparty/jsoncpp-1.9.4/src/lib_json/json_writer.cpp
thirdparty/jsoncpp-1.9.5/src/lib_json/json_reader.cpp
thirdparty/jsoncpp-1.9.5/src/lib_json/json_value.cpp
thirdparty/jsoncpp-1.9.5/src/lib_json/json_writer.cpp
)

target_include_directories(jsoncpp SYSTEM PRIVATE thirdparty/jsoncpp-1.9.4/include)
set_target_properties(jsoncpp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/jsoncpp-1.9.4)
target_include_directories(jsoncpp SYSTEM PRIVATE thirdparty/jsoncpp-1.9.5/include)
set_target_properties(jsoncpp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/jsoncpp-1.9.5)

add_library(json11
thirdparty/json11-ec4e452/json11.cpp
Expand All @@ -72,15 +82,23 @@ add_library(json11
target_include_directories(json11 SYSTEM PRIVATE thirdparty/json11-ec4e452)
set_target_properties(json11 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/json11-ec4e452)

# yaml-cpp library
file(GLOB yamlcpp_SOURCES "thirdparty/yaml-cpp-0.7.0/src/*.cpp")
add_library(yamlcpp ${yamlcpp_SOURCES})

target_include_directories(yamlcpp SYSTEM PRIVATE thirdparty/yamlcpp-0.7.0/include)
set_target_properties(yamlcpp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/yamlcpp-0.7.0)

# Not all of these are required for examples build it doesn't hurt to include them
include_directories(include SYSTEM
thirdparty/gtest-1.11.0/include
thirdparty/json11-ec4e452
thirdparty/jsoncpp-1.9.4/include
thirdparty/jsoncpp-1.9.5/include
thirdparty/rapidjson-48fbd8c/include
thirdparty/picojson-1.3.0
thirdparty/nlohmann-json-3.1.2
)
thirdparty/yaml-cpp-0.7.0/include
)

if(valijson_BUILD_TESTS)
if(NOT valijson_EXCLUDE_BOOST)
Expand All @@ -95,8 +113,8 @@ if(valijson_BUILD_TESTS)

set(TEST_SOURCES
tests/test_adapter_comparison.cpp
tests/test_fetch_urn_document_callback.cpp
tests/test_fetch_absolute_uri_document_callback.cpp
tests/test_fetch_urn_document_callback.cpp
tests/test_json_pointer.cpp
tests/test_json11_adapter.cpp
tests/test_jsoncpp_adapter.cpp
Expand All @@ -106,14 +124,30 @@ if(valijson_BUILD_TESTS)
tests/test_poly_constraint.cpp
tests/test_validation_errors.cpp
tests/test_validator.cpp
tests/test_yaml_cpp_adapter.cpp
)

set(TEST_LIBS gtest gtest_main jsoncpp json11)
set(TEST_LIBS gtest gtest_main jsoncpp json11 yamlcpp)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_boost_json_adapter.cpp)

# Property Trees have been in Boost since 1.41.0, so we just assume they're present
list(APPEND TEST_SOURCES tests/test_property_tree_adapter.cpp)

# Boost.JSON was introduced in Boost 1.75.0, so we should check for its presence before
# including the unit tests for boost_json_adapter
include(CheckIncludeFileCXX)
set (CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS})
check_include_file_cxx("boost/json.hpp" BOOST_JSON_HPP_FOUND)
if(${BOOST_JSON_HPP_FOUND})
list(APPEND TEST_SOURCES tests/test_boost_json_adapter.cpp)
else()
message(WARNING
"boost/json.hpp not found; tests for boost_json_adapter will not be built. "
"If you have recently upgraded Boost to 1.75.0 or later, you may need to clear "
"your CMake cache for the header to be found.")
endif()
endif()

if(Poco_FOUND)
Expand Down Expand Up @@ -146,15 +180,22 @@ if(valijson_BUILD_TESTS)
set_target_properties(test_suite PROPERTIES COMPILE_FLAGS " -pedantic -Werror -Wshadow -Wunused")
endif()

if (MSVC)
target_compile_options(test_suite PRIVATE "/bigobj")
endif()

# Definition for using picojson
set_target_properties(test_suite PROPERTIES COMPILE_DEFINITIONS "PICOJSON_USE_INT64")

if(Boost_FOUND)
add_definitions(-DBOOST_ALL_DYN_LINK)
add_compile_definitions(BOOST_ALL_DYN_LINK)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_BOOST_ADAPTERS")
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_BOOST_PROPERTY_TREE_ADAPTER")
if(${BOOST_JSON_HPP_FOUND})
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_BOOST_JSON_ADAPTER")
endif()
endif()

if(Poco_FOUND)
Expand Down Expand Up @@ -200,6 +241,10 @@ if(valijson_BUILD_EXAMPLES)
examples/remote_resolution_local_file.cpp
)

add_executable(valijson_nlohmann_bundled_test
examples/valijson_nlohmann_bundled_test.cpp
)

if(curlpp_FOUND)
include_directories(${curlpp_INCLUDE_DIR})

Expand Down
Loading

0 comments on commit 69594c4

Please sign in to comment.