Skip to content

Commit 2d7b2d6

Browse files
committed
Squashed 'Source/RapidJSON/Source/' changes from 2661a17c7..8261c1ddf
8261c1ddf Merge pull request #1969 from MalcolmTyrrell/MalcolmTyrrell/sanitizeSchemaCode 0d78b1ce9 Merge pull request #1989 from adamcalhoon/really-fix-placement-new-alignment 1dff2abff Fix the alignment of placement new buffer for GenericValue. e4bde9774 Merge pull request #1988 from Tencent/revert-1987-fix-placement-new-alignment 88bbd87dd Revert "Fix the alignment of placement new buffer for GenericValue." bf8ca5da8 Merge pull request #1987 from adamcalhoon/fix-placement-new-alignment 5b242b6b2 Fix the alignment of placement new buffer for GenericValue. fd3dc29a5 Merge pull request #1944 from ilelann/patch-1 53602ec6b Sanitize the code in schema.h 0d4517f15 Merge pull request #1961 from jedwardsol/issue1960_arm64ec_intrinsic 060c348ea use softintrin on arm64ec 4d6cb0818 Merge pull request #1949 from ardb-uk/master 033bef3c6 Merge pull request #1 from ardb-uk/ardb-uk-patch-1 befba39af Merge pull request #2 from ardb-uk/ardb-uk-patch-1-1 4bbaf28ff Add files via upload 14f1e37f8 Resolve issue 1948 e6736d1ba Support CMake none targets 2e8f5d897 Merge pull request #1940 from smhdfdl/issue-1924 9ea3f45db fix the warning b9ae2499e Merge pull request #1941 from DiamondI/patch-1 553a3ea31 typo on documentation dom.zh-cn.md: "己于" -> "已于" 864e44aef Merge branch 'master' of https://github.com/Tencent/rapidjson 00dbcf2c6 Merge pull request #1926 from Kyrega/master 22ee8b07c Correct WIStreamWrapper a3d52c75b No default template parameter for older compilers 19b55c904 No default template parameter for older compilers 128b1031b Use rapidjson internal::SelectIf 8710d7e98 Do not depend on c++11 conditional e0512e094 Using unsigned for WIStreamWrapper 7fac34f7b Added typename b952a592a Fix RawNumber for longer char types 28c59ab4c Merge pull request #1922 from jack-perisich/grisu2_precision bb0621108 Fix small errors in dtoa output for certain doubles 7ee918fc8 Merge branch 'master' of https://github.com/Tencent/rapidjson 48fbd8cd2 Merge pull request #1848 from smhdfdl/id-and-ref 8d16abd98 Uri Parse improvements b557259f8 Merge pull request #1904 from Tencent/issue1899_pointerappend a21cf9f7b equiv fix for issue 1899 8c29a7b49 Fix Pointer::Append() crash for custom allocator on Windows 12b88efa6 fix coverage again f6ebcb200 fix Uri.Match optional arg 3df804c12 fix coverage, unit test allocators and equality 18ab3b16b remove temp debug statements 6d253c160 remove compiler warning 28bcbd3f3 make std::string optional 494447b73 remove copyright & debug statements 6e58a53f4 fix coverage 3987d82f4 Merge branch 'master' of https://github.com/Tencent/rapidjson into id-and-ref 9c1002f94 rge branch 'master' of https://github.com/Tencent/rapidjson 17aa824c9 Merge pull request #1885 from saurabhchardereal/master cd737fb54 Improve documentation 25fa7a119 Merge pull request #1883 from nkolotov/fix/issues/1882 3aa8d04b7 Fixed -Wshadow warning. e0f68a435 Merge pull request #1877 from hendrikmuhs/windows-GetObject-conflict-#1418 3cdfde14d replace auto with concrete type d179facf9 don't let the GetObject macro rewrite the GetObject method, add a GetObj alias 3168d7c34 add a test that provokes a compile time error on windows 47b837e14 Merge pull request #1485 from ylavic/MemberMap be4a5a908 Turn some Tests to RAPIDJSON_USE_MEMBERSMAP in CI. fc08f4f61 Tests for Members in std::multimap. 71f0fa7eb Set RAPIDJSON_USE_MEMBERSMAP to use a (std::multi)map for object members. 7d801bbe4 Merge pull request #1503 from ylavic/sub_value_assignment 03676c9bf Merge pull request #1870 from ylavic/allocators_rvalues aa0675ffd Try some tests with -D_GLIBCXX_DEBUG and coverage with -O0. 5c764d9a8 Tests for Allocators copy by rvalue reference. 683010b02 Add rvalue copy and assignment to MemoryPoolAllocator and StdAllocator. 117276c41 Fix would-crash tests if the default allocator used were kNeedFree. 49aa0fc15 Merge pull request #1868 from ylavic/cpp17_in_ci a8bd93176 Tests for C++17 with VS 2019. 6bed9b266 Don't define StdAllocator<void> from C++17. e336667b4 Handle C++17 (and C++11 with MSVC) in CI. b996a2371 Merge pull request #1866 from ylavic/std_allocator_traits 08cf9a56c Make StdAllocator C++17-20 compatible. 02f42604b Make StdAllocator C++17-20 compatible. cd5ee4dfe Merge pull request #1858 from ylavic/std_allocator 3d77d11e2 add traverse as pointer example 2e6f76145 Tests for StdAllocator. 49e4dd619 Provide StdAllocator, STL compatible, for use with STL types. 50cb424c3 Test assignment from inner Value. c033292ae Safer GenericValue& operator=(GenericValue& rhs). d51dd2d0e RAPIDJSON_NOEXCEPT_ASSERT should assert regardless of RAPIDJSON_HAS_CXX11_NOEXCEPT. cdb2d4757 Provide RAPIDJSON_HAS_CXX11 and use it for RAPIDJSON_HAS_CXX11_RVALUE_REFS and RAPIDJSON_HAS_CXX11_NOEXCEPT. bc026e3fb satisfy all compilers 3 24b9b7e27 satisfy all compilers 2 32722fa31 satisfy all compilers 8768b5b1d correct #defines in uri.h 6c9da69ab remove comma 6b57738e4 handle internal refs properly 1c2c8e085 doc: fix incorrect template parameters in EncodedOutputStream example fe1a29ca6 fix platform-dependent compiler error with >> ad73c032e fix compile errors 892f6e3fd fix bracket cabc3d5aa merge 7698b3cd4 code and tests dad85cab9 Merge pull request #2 from smhdfdl/multiple-validation-failures-and-validation-messages b1a4d91a5 Merge pull request #1779 from pavel-pimenov/fix-1778-part-1 8be64594f Merge pull request #1847 from stac47/fix_1846 24ebd5128 Fix recursive operator== call in C++20 (#1846) 8bce684cd Merge pull request #1844 from smhdfdl/multiple-validation-failures-and-validation-messages 9bb81e20f fix crash where simple type with sub-schema has a bad value 13dfc96c9 Merge pull request #1837 from smhdfdl/multiple-validation-failures-and-validation-messages 167efb4fa work around issue 1089 28dc42d8d restore coverage a3757456f correct workaround for issue 1805 7fee368be Revert "revert perftest" 221e8d536 revert perftest f89e75af7 remove C++ 11 std::string to_string() syntax c491dd521 remove C++ 11 enum syntax 6f3cccd6e remove debug std::cout, handle empty error object in example 05e7b3397 code and tests 5d17b24e5 Merge pull request #1 from Tencent/master 585042c02 Merge pull request #1821 from slsyy/master cbf62de55 Add implicit conversion from Object and Array to Value (#1404) 3cdd3c837 Merge pull request #1817 from lukedan/lukedan_cpp20 5e50f27ed also initialize class member 1e4f59d3a add return statement & comment d742a030a add body to private copy constructor & copy assignment 300692623 suppress enum bitwise operation warnings on msvc 13f5ab4f4 fix schema test compile error 56f215e5c Merge pull request #1568 from ericrannaud/ericrannaud/memberiterator-public 0ccdbf364 Merge pull request #1786 from ssb22/master b7734d97c Remove unnecessary wording from BSD license not needed for MIT license (fixes #528) 3a65e2dd7 fix Tencent/rapidjson#1778 (part 1) ce81bc9ed Merge pull request #1760 from escherstair/fix_ce6_support 5fbf8bf89 fix unit test 7f559ec80 fix naive implementation for clzll() 58e296485 add unit test for clzll() aa5dd6086 fix naive version implementation 91940e84b fallback to the naive version for CE6 6364c8e5a fix _BitScanReverse() usage for CE6 f56928de8 Merge pull request #1744 from lklein53/improve-surrogate-handling 6694c996b Add test case for low surrogate handling ed73d7bdb Improve surrogate handling 88bd956d6 Merge pull request #1453 from eidosmontreal/custom_malloc 004e8e61a Merge branch 'master' into custom_malloc 1a803826f Merge pull request #1720 from madeso/master ac0fc79c7 Fixes issue #1718 8f4c021fa Merge pull request #1689 from g199209/master 1ce28f454 Add CMake minimum version required. f37669082 Add a target to RapidJSONConfig.cmake.in (#1350) 234ff044f ci: upgrade distro to xenial and add arm64 test cases (#1662) 36481c30b Update Visual Studio Visualizer (#1665) d4f03d0d0 Doc: Fix some typos. (#1675) ebcbd0448 Three-way comparison for CLang 10 fix (#1679) ebc003e20 Make GenericMemberIterator::Iterator public again (RAPIDJSON_NOMEMBERITERATORCLASS) cef07fb1b Added parameters to RAPIDJSON_MALLOC, RAPIDJSON_REALLOC and RAPIDJSON_FREE ad2e5369b Adding a single customization point that ensures all allocations within rapidjson can be performed with a custom memory allocator; Introduces the macros RAPIDJSON_MALLOC, RAPIDJSON_REALLOC, and RAPIDJSON_FREE. git-subtree-dir: Source/RapidJSON/Source git-subtree-split: 8261c1ddf43f10de00fd8c9a67811d1486b2c784
1 parent 98d74f9 commit 2d7b2d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+5638
-690
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
!/bin/encodings
44
!/bin/jsonchecker
55
!/bin/types
6+
!/bin/unittestschema
67
/build
78
/doc/html
89
/doc/doxygen_*.db

.travis.yml

Lines changed: 93 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
sudo: required
2-
dist: trusty
3-
group: edge
2+
dist: xenial
43

54
language: cpp
65
cache:
76
- ccache
87

8+
addons:
9+
apt:
10+
sources:
11+
- ubuntu-toolchain-r-test
12+
packages:
13+
- cmake
14+
- valgrind
15+
- clang-8
916
env:
1017
global:
1118
- USE_CCACHE=1
@@ -14,49 +21,96 @@ env:
1421
- CCACHE_MAXSIZE=100M
1522
- ARCH_FLAGS_x86='-m32' # #266: don't use SSE on 32-bit
1623
- ARCH_FLAGS_x86_64='-msse4.2' # use SSE4.2 on 64-bit
24+
- ARCH_FLAGS_aarch64='-march=armv8-a'
1725
- GITHUB_REPO='Tencent/rapidjson'
1826
- secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk="
1927

20-
before_install:
21-
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
22-
- sudo apt-get update -qq
23-
- sudo apt-get install -y cmake valgrind g++-multilib libc6-dbg:i386 --allow-unauthenticated
24-
2528
matrix:
2629
include:
2730
# gcc
28-
- env: CONF=release ARCH=x86 CXX11=ON
31+
- env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF MEMBERSMAP=OFF
32+
compiler: gcc
33+
arch: amd64
34+
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF
35+
compiler: gcc
36+
arch: amd64
37+
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=ON
38+
compiler: gcc
39+
arch: amd64
40+
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF
41+
compiler: gcc
42+
arch: amd64
43+
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF
2944
compiler: gcc
30-
- env: CONF=release ARCH=x86_64 CXX11=ON
45+
arch: amd64
46+
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG'
3147
compiler: gcc
32-
- env: CONF=debug ARCH=x86 CXX11=OFF
48+
arch: amd64
49+
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON MEMBERSMAP=ON CXX_FLAGS='-D_GLIBCXX_DEBUG'
3350
compiler: gcc
34-
- env: CONF=debug ARCH=x86_64 CXX11=OFF
51+
arch: amd64
52+
- env: CONF=release ARCH=aarch64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF
3553
compiler: gcc
54+
arch: arm64
55+
- env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=OFF MEMBERSMAP=OFF
56+
compiler: gcc
57+
arch: arm64
58+
- env: CONF=release ARCH=aarch64 CXX11=OFF CXX17=ON MEMBERSMAP=ON
59+
compiler: gcc
60+
arch: arm64
3661
# clang
37-
- env: CONF=debug ARCH=x86 CXX11=ON CCACHE_CPP2=yes
62+
- env: CONF=release ARCH=x86 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
63+
compiler: clang
64+
arch: amd64
65+
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
66+
compiler: clang
67+
arch: amd64
68+
- env: CONF=release ARCH=x86_64 CXX11=ON CXX17=OFF MEMBERSMAP=OFF CCACHE_CPP2=yes
69+
compiler: clang
70+
arch: amd64
71+
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
3872
compiler: clang
39-
- env: CONF=debug ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
73+
arch: amd64
74+
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
4075
compiler: clang
41-
- env: CONF=debug ARCH=x86 CXX11=OFF CCACHE_CPP2=yes
76+
arch: amd64
77+
- env: CONF=debug ARCH=x86 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes
4278
compiler: clang
43-
- env: CONF=debug ARCH=x86_64 CXX11=OFF CCACHE_CPP2=yes
79+
arch: amd64
80+
- env: CONF=debug ARCH=x86_64 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes
4481
compiler: clang
45-
- env: CONF=release ARCH=x86 CXX11=ON CCACHE_CPP2=yes
82+
arch: amd64
83+
- env: CONF=debug ARCH=aarch64 CXX11=ON CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
4684
compiler: clang
47-
- env: CONF=release ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
85+
arch: arm64
86+
- env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=OFF MEMBERSMAP=ON CCACHE_CPP2=yes
4887
compiler: clang
88+
arch: arm64
89+
- env: CONF=debug ARCH=aarch64 CXX11=OFF CXX17=ON MEMBERSMAP=OFF CCACHE_CPP2=yes
90+
compiler: clang
91+
arch: arm64
4992
# coverage report
50-
- env: CONF=debug ARCH=x86 CXX11=ON GCOV_FLAGS='--coverage'
93+
- env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=OFF
94+
compiler: gcc
95+
arch: amd64
96+
cache:
97+
- ccache
98+
- pip
99+
after_success:
100+
- pip install --user cpp-coveralls
101+
- coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
102+
- env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=ON CXX17=OFF MEMBERSMAP=ON
51103
compiler: gcc
104+
arch: amd64
52105
cache:
53106
- ccache
54107
- pip
55108
after_success:
56109
- pip install --user cpp-coveralls
57110
- coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
58-
- env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage'
111+
- env: CONF=debug ARCH=aarch64 GCOV_FLAGS='--coverage' CXX_FLAGS='-O0' CXX11=OFF CXX17=ON
59112
compiler: gcc
113+
arch: arm64
60114
cache:
61115
- ccache
62116
- pip
@@ -73,24 +127,37 @@ matrix:
73127
packages:
74128
- doxygen
75129

130+
before_install:
131+
- if [ "x86_64" = "$(arch)" ]; then sudo apt-get install -y g++-multilib libc6-dbg:i386 --allow-unauthenticated; fi
132+
76133
before_script:
77-
- ccache -s
78-
# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
79-
# exposed by merging PR#163 (using -march=native)
80-
# TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded.
81-
- sed -i "s/-march=native//" CMakeLists.txt
82-
- mkdir build
134+
# travis provides clang-7 for amd64 and clang-3.8 for arm64
135+
# here use clang-8 to all architectures as clang-7 is not available for arm64
136+
- if [ -f /usr/bin/clang++-8 ]; then
137+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 1000;
138+
sudo update-alternatives --config clang++;
139+
export PATH=/usr/bin:$PATH;
140+
fi
141+
- if [ "$CXX" = "clang++" ]; then export CCACHE_CPP2=yes; fi
142+
- ccache -s
143+
# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
144+
# exposed by merging PR#163 (using -march=native)
145+
# TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded.
146+
- sed -i "s/-march=native//" CMakeLists.txt
147+
- mkdir build
83148

84149
script:
85150
- if [ "$CXX" = "clang++" ]; then export CXXFLAGS="-stdlib=libc++ ${CXXFLAGS}"; fi
86151
- >
87152
eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ;
88153
(cd build && cmake
89154
-DRAPIDJSON_HAS_STDSTRING=ON
155+
-DRAPIDJSON_USE_MEMBERSMAP=$MEMBERSMAP
90156
-DRAPIDJSON_BUILD_CXX11=$CXX11
157+
-DRAPIDJSON_BUILD_CXX17=$CXX17
91158
-DCMAKE_VERBOSE_MAKEFILE=ON
92159
-DCMAKE_BUILD_TYPE=$CONF
93-
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS"
160+
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS $CXX_FLAGS"
94161
-DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS
95162
..)
96163
- cd build

CMakeLists.txt

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON)
3535
option(RAPIDJSON_BUILD_THIRDPARTY_GTEST
3636
"Use gtest installation in `thirdparty/gtest` by default if available" OFF)
3737

38-
option(RAPIDJSON_BUILD_CXX11 "Build rapidjson with C++11 (gcc/clang)" ON)
38+
option(RAPIDJSON_BUILD_CXX11 "Build rapidjson with C++11" ON)
39+
option(RAPIDJSON_BUILD_CXX17 "Build rapidjson with C++17" OFF)
3940
if(RAPIDJSON_BUILD_CXX11)
4041
set(CMAKE_CXX_STANDARD 11)
4142
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
@@ -51,6 +52,11 @@ if(RAPIDJSON_HAS_STDSTRING)
5152
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
5253
endif()
5354

55+
option(RAPIDJSON_USE_MEMBERSMAP "" OFF)
56+
if(RAPIDJSON_USE_MEMBERSMAP)
57+
add_definitions(-DRAPIDJSON_USE_MEMBERSMAP=1)
58+
endif()
59+
5460
find_program(CCACHE_FOUND ccache)
5561
if(CCACHE_FOUND)
5662
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
@@ -77,6 +83,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
7783
else()
7884
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
7985
endif()
86+
elseif (RAPIDJSON_BUILD_CXX17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")
87+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
8088
endif()
8189
if (RAPIDJSON_BUILD_ASAN)
8290
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0")
@@ -105,6 +113,8 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
105113
set(EXTRA_CXX_FLAGS -Weffc++ -Wswitch-default -Wfloat-equal -Wconversion -Wimplicit-fallthrough)
106114
if (RAPIDJSON_BUILD_CXX11 AND CMAKE_VERSION VERSION_LESS 3.1)
107115
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
116+
elseif (RAPIDJSON_BUILD_CXX17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0")
117+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
108118
endif()
109119
if (RAPIDJSON_BUILD_ASAN)
110120
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
@@ -119,6 +129,18 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
119129
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
120130
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
121131
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
132+
# CMake >= 3.10 should handle the above CMAKE_CXX_STANDARD fine, otherwise use /std:c++XX with MSVC >= 19.10
133+
if (RAPIDJSON_BUILD_CXX11 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.10")
134+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
135+
elseif (RAPIDJSON_BUILD_CXX17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.14")
136+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
137+
endif()
138+
# Always compile with /WX
139+
if(CMAKE_CXX_FLAGS MATCHES "/WX-")
140+
string(REGEX REPLACE "/WX-" "/WX" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
141+
else()
142+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
143+
endif()
122144
elseif (CMAKE_CXX_COMPILER_ID MATCHES "XL")
123145
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qarch=auto")
124146
endif()
@@ -219,8 +241,10 @@ INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAM
219241
DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
220242

221243
# Install files
222-
INSTALL(FILES
223-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
224-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
225-
DESTINATION "${CMAKE_INSTALL_DIR}"
226-
COMPONENT dev)
244+
IF(CMAKE_INSTALL_DIR)
245+
INSTALL(FILES
246+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
247+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
248+
DESTINATION "${CMAKE_INSTALL_DIR}"
249+
COMPONENT dev)
250+
ENDIF()

RapidJSONConfig.cmake.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
################################################################################
2+
# CMake minimum version required
3+
cmake_minimum_required(VERSION 3.0)
4+
15
################################################################################
26
# RapidJSON source dir
37
set( RapidJSON_SOURCE_DIR "@CONFIG_SOURCE_DIR@")
@@ -13,3 +17,9 @@ get_filename_component(RapidJSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
1317
set( RapidJSON_INCLUDE_DIR "@RapidJSON_INCLUDE_DIR@" )
1418
set( RapidJSON_INCLUDE_DIRS "@RapidJSON_INCLUDE_DIR@" )
1519
message(STATUS "RapidJSON found. Headers: ${RapidJSON_INCLUDE_DIRS}")
20+
21+
if(NOT TARGET rapidjson)
22+
add_library(rapidjson INTERFACE IMPORTED)
23+
set_property(TARGET rapidjson PROPERTY
24+
INTERFACE_INCLUDE_DIRECTORIES ${RapidJSON_INCLUDE_DIRS})
25+
endif()

appveyor.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,85 @@ environment:
1313
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
1414
VS_VERSION: 10 2010
1515
VS_PLATFORM: win32
16+
CXX11: OFF
17+
CXX17: OFF
18+
MEMBERSMAP: OFF
1619
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
1720
VS_VERSION: 10 2010
1821
VS_PLATFORM: x64
22+
CXX11: OFF
23+
CXX17: OFF
24+
MEMBERSMAP: ON
1925
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
2026
VS_VERSION: 11 2012
2127
VS_PLATFORM: win32
28+
CXX11: OFF
29+
CXX17: OFF
30+
MEMBERSMAP: ON
2231
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
2332
VS_VERSION: 11 2012
2433
VS_PLATFORM: x64
34+
CXX11: OFF
35+
CXX17: OFF
36+
MEMBERSMAP: OFF
2537
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
2638
VS_VERSION: 12 2013
2739
VS_PLATFORM: win32
40+
CXX11: OFF
41+
CXX17: OFF
42+
MEMBERSMAP: OFF
2843
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
2944
VS_VERSION: 12 2013
3045
VS_PLATFORM: x64
46+
CXX11: OFF
47+
CXX17: OFF
48+
MEMBERSMAP: ON
3149
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
3250
VS_VERSION: 14 2015
3351
VS_PLATFORM: win32
52+
CXX11: OFF
53+
CXX17: OFF
54+
MEMBERSMAP: ON
3455
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
3556
VS_VERSION: 14 2015
3657
VS_PLATFORM: x64
58+
CXX11: OFF
59+
CXX17: OFF
60+
MEMBERSMAP: OFF
3761
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
3862
VS_VERSION: 15 2017
3963
VS_PLATFORM: win32
64+
CXX11: OFF
65+
CXX17: OFF
66+
MEMBERSMAP: OFF
4067
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
4168
VS_VERSION: 15 2017
4269
VS_PLATFORM: x64
70+
CXX11: OFF
71+
CXX17: OFF
72+
MEMBERSMAP: ON
73+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
74+
VS_VERSION: 15 2017
75+
VS_PLATFORM: x64
76+
CXX11: ON
77+
CXX17: OFF
78+
MEMBERSMAP: OFF
79+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
80+
VS_VERSION: 15 2017
81+
VS_PLATFORM: x64
82+
CXX11: OFF
83+
CXX17: ON
84+
MEMBERSMAP: OFF
85+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
86+
VS_VERSION: 16 2019
87+
VS_PLATFORM: x64
88+
CXX11: OFF
89+
CXX17: ON
90+
MEMBERSMAP: ON
4391

4492
before_build:
4593
- git submodule update --init --recursive
46-
- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=true -Wno-dev
94+
- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=true -DRAPIDJSON_BUILD_CXX11=%CXX11% -DRAPIDJSON_BUILD_CXX17=%CXX17% -DRAPIDJSON_USE_MEMBERSMAP=%MEMBERSMAP% -Wno-dev
4795

4896
build:
4997
project: Build\VS\RapidJSON.sln

0 commit comments

Comments
 (0)