Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
18a0271a
Unverified
Commit
18a0271a
authored
Apr 08, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/issue1021
parents
896a9db4
83b14338
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
22 deletions
+23
-22
.travis.yml
.travis.yml
+1
-0
CMakeLists.txt
CMakeLists.txt
+6
-4
benchmarks/CMakeLists.txt
benchmarks/CMakeLists.txt
+3
-2
doc/examples/operator__greater.cpp
doc/examples/operator__greater.cpp
+4
-4
doc/examples/operator__greater.link
doc/examples/operator__greater.link
+1
-1
doc/examples/operator__greater.output
doc/examples/operator__greater.output
+4
-4
test/CMakeLists.txt
test/CMakeLists.txt
+4
-7
No files found.
.travis.yml
View file @
18a0271a
...
@@ -277,6 +277,7 @@ script:
...
@@ -277,6 +277,7 @@ script:
if [[ (-x $(which brew)) ]]; then
if [[ (-x $(which brew)) ]]; then
brew update
brew update
brew install cmake ninja
brew install cmake ninja
brew upgrade cmake
cmake --version
cmake --version
fi
fi
...
...
CMakeLists.txt
View file @
18a0271a
cmake_minimum_required
(
VERSION 3.
0.0
)
cmake_minimum_required
(
VERSION 3.
8
)
##
##
## PROJECT
## PROJECT
...
@@ -44,6 +44,8 @@ endif()
...
@@ -44,6 +44,8 @@ endif()
##
##
add_library
(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE
)
add_library
(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE
)
target_compile_features
(
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE cxx_std_11
)
target_include_directories
(
target_include_directories
(
${
NLOHMANN_JSON_TARGET_NAME
}
${
NLOHMANN_JSON_TARGET_NAME
}
INTERFACE
INTERFACE
...
@@ -51,8 +53,8 @@ target_include_directories(
...
@@ -51,8 +53,8 @@ target_include_directories(
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include>
)
)
## add debug view defintion file for msvc (natvis)
[cmake <= 3.2.2 does not support export of source files]
## add debug view defintion file for msvc (natvis)
if
(
MSVC
AND CMAKE_VERSION VERSION_GREATER
"3.2.2"
)
if
(
MSVC
)
set
(
NLOHMANN_ADD_NATVIS TRUE
)
set
(
NLOHMANN_ADD_NATVIS TRUE
)
set
(
NLOHMANN_NATVIS_FILE
"nlohmann_json.natvis"
)
set
(
NLOHMANN_NATVIS_FILE
"nlohmann_json.natvis"
)
target_sources
(
target_sources
(
...
@@ -62,7 +64,7 @@ if (MSVC AND CMAKE_VERSION VERSION_GREATER "3.2.2")
...
@@ -62,7 +64,7 @@ if (MSVC AND CMAKE_VERSION VERSION_GREATER "3.2.2")
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
NLOHMANN_NATVIS_FILE
}
>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
NLOHMANN_NATVIS_FILE
}
>
)
)
endif
()
endif
()
##
##
## TESTS
## TESTS
## create and configure the unit test target
## create and configure the unit test target
...
...
benchmarks/CMakeLists.txt
View file @
18a0271a
cmake_minimum_required
(
VERSION 3.
0
)
cmake_minimum_required
(
VERSION 3.
8
)
project
(
JSON_Benchmarks LANGUAGES CXX
)
project
(
JSON_Benchmarks LANGUAGES CXX
)
# set compiler flags
# set compiler flags
if
((
CMAKE_CXX_COMPILER_ID MATCHES GNU
)
OR
(
CMAKE_CXX_COMPILER_ID MATCHES Clang
))
if
((
CMAKE_CXX_COMPILER_ID MATCHES GNU
)
OR
(
CMAKE_CXX_COMPILER_ID MATCHES Clang
))
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-
std=c++11 -
flto -DNDEBUG -O3"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-flto -DNDEBUG -O3"
)
endif
()
endif
()
# configure Google Benchmarks
# configure Google Benchmarks
...
@@ -23,4 +23,5 @@ file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
...
@@ -23,4 +23,5 @@ file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
# benchmark binary
# benchmark binary
add_executable
(
json_benchmarks src/benchmarks.cpp
)
add_executable
(
json_benchmarks src/benchmarks.cpp
)
target_compile_features
(
json_benchmarks PRIVATE cxx_std_11
)
target_link_libraries
(
json_benchmarks benchmark
${
CMAKE_THREAD_LIBS_INIT
}
)
target_link_libraries
(
json_benchmarks benchmark
${
CMAKE_THREAD_LIBS_INIT
}
)
doc/examples/operator__greater.cpp
View file @
18a0271a
...
@@ -17,8 +17,8 @@ int main()
...
@@ -17,8 +17,8 @@ int main()
// output values and comparisons
// output values and comparisons
std
::
cout
<<
std
::
boolalpha
;
std
::
cout
<<
std
::
boolalpha
;
std
::
cout
<<
array_1
<<
"
==
"
<<
array_2
<<
" "
<<
(
array_1
>
array_2
)
<<
'\n'
;
std
::
cout
<<
array_1
<<
"
>
"
<<
array_2
<<
" "
<<
(
array_1
>
array_2
)
<<
'\n'
;
std
::
cout
<<
object_1
<<
"
==
"
<<
object_2
<<
" "
<<
(
object_1
>
object_2
)
<<
'\n'
;
std
::
cout
<<
object_1
<<
"
>
"
<<
object_2
<<
" "
<<
(
object_1
>
object_2
)
<<
'\n'
;
std
::
cout
<<
number_1
<<
"
==
"
<<
number_2
<<
" "
<<
(
number_1
>
number_2
)
<<
'\n'
;
std
::
cout
<<
number_1
<<
"
>
"
<<
number_2
<<
" "
<<
(
number_1
>
number_2
)
<<
'\n'
;
std
::
cout
<<
string_1
<<
"
==
"
<<
string_2
<<
" "
<<
(
string_1
>
string_2
)
<<
'\n'
;
std
::
cout
<<
string_1
<<
"
>
"
<<
string_2
<<
" "
<<
(
string_1
>
string_2
)
<<
'\n'
;
}
}
doc/examples/operator__greater.link
View file @
18a0271a
<a target="_blank" href="https://wandbox.org/permlink/yiz7oCHVpFHSALB1"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/ntF7DMzC85gbQKHu"><b>online</b></a>
\ No newline at end of file
\ No newline at end of file
doc/examples/operator__greater.output
View file @
18a0271a
[1,2,3]
==
[1,2,4] false
[1,2,3]
>
[1,2,4] false
{"A":"a","B":"b"}
==
{"A":"a","B":"b"} false
{"A":"a","B":"b"}
>
{"A":"a","B":"b"} false
17
==
17.0000000000001 false
17
>
17.0000000000001 false
"foo"
==
"bar" true
"foo"
>
"bar" true
test/CMakeLists.txt
View file @
18a0271a
...
@@ -6,15 +6,14 @@ option(JSON_Coverage "Build test suite with coverage information" OFF)
...
@@ -6,15 +6,14 @@ option(JSON_Coverage "Build test suite with coverage information" OFF)
if
(
JSON_Sanitizer
)
if
(
JSON_Sanitizer
)
message
(
STATUS
"Building test suite with Clang sanitizer"
)
message
(
STATUS
"Building test suite with Clang sanitizer"
)
if
(
NOT MSVC
)
if
(
NOT MSVC
)
set
(
CMAKE_CXX_FLAGS
"-
std=c++11 -
g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
)
set
(
CMAKE_CXX_FLAGS
"-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
)
endif
()
endif
()
endif
()
endif
()
if
(
JSON_Valgrind
)
if
(
JSON_Valgrind
)
find_program
(
CMAKE_MEMORYCHECK_COMMAND valgrind
)
find_program
(
CMAKE_MEMORYCHECK_COMMAND valgrind
)
message
(
STATUS
"Executing test suite with Valgrind (
${
CMAKE_MEMORYCHECK_COMMAND
}
)"
)
message
(
STATUS
"Executing test suite with Valgrind (
${
CMAKE_MEMORYCHECK_COMMAND
}
)"
)
set
(
MEMORYCHECK_COMMAND_OPTIONS
"--error-exitcode=1 --leak-check=full"
)
set
(
memcheck_command
"
${
CMAKE_MEMORYCHECK_COMMAND
}
${
CMAKE_MEMORYCHECK_COMMAND_OPTIONS
}
--error-exitcode=1 --leak-check=full"
)
set
(
memcheck_command
"
${
CMAKE_MEMORYCHECK_COMMAND
}
${
CMAKE_MEMORYCHECK_COMMAND_OPTIONS
}
"
)
separate_arguments
(
memcheck_command
)
separate_arguments
(
memcheck_command
)
endif
()
endif
()
...
@@ -62,11 +61,10 @@ add_library(catch_main OBJECT
...
@@ -62,11 +61,10 @@ add_library(catch_main OBJECT
"src/unit.cpp"
"src/unit.cpp"
)
)
set_target_properties
(
catch_main PROPERTIES
set_target_properties
(
catch_main PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
)
)
target_compile_features
(
catch_main PUBLIC cxx_std_11
)
target_include_directories
(
catch_main PRIVATE
"thirdparty/catch"
)
target_include_directories
(
catch_main PRIVATE
"thirdparty/catch"
)
# https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
# https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
...
@@ -96,13 +94,12 @@ foreach(file ${files})
...
@@ -96,13 +94,12 @@ foreach(file ${files})
add_executable
(
${
testcase
}
$<TARGET_OBJECTS:catch_main>
${
file
}
)
add_executable
(
${
testcase
}
$<TARGET_OBJECTS:catch_main>
${
file
}
)
set_target_properties
(
${
testcase
}
PROPERTIES
set_target_properties
(
${
testcase
}
PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_DEFINITIONS
"$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
COMPILE_OPTIONS
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
)
)
target_compile_definitions
(
${
testcase
}
PRIVATE CATCH_CONFIG_FAST_COMPILE
)
target_compile_definitions
(
${
testcase
}
PRIVATE CATCH_CONFIG_FAST_COMPILE
)
target_compile_features
(
${
testcase
}
PRIVATE cxx_std_11
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/catch"
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/catch"
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/fifo_map"
)
target_include_directories
(
${
testcase
}
PRIVATE
"thirdparty/fifo_map"
)
target_include_directories
(
${
testcase
}
PRIVATE
${
NLOHMANN_JSON_INCLUDE_BUILD_DIR
}
)
target_include_directories
(
${
testcase
}
PRIVATE
${
NLOHMANN_JSON_INCLUDE_BUILD_DIR
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment