Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
7e4ee23f
Unverified
Commit
7e4ee23f
authored
Aug 14, 2017
by
Théo DELRIEU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add single_header CMake target
parent
57d822b6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
27 deletions
+52
-27
.gitignore
.gitignore
+3
-0
CMakeLists.txt
CMakeLists.txt
+20
-1
Makefile
Makefile
+28
-25
json.hpp
single_header/json.hpp
+0
-0
Makefile
test/Makefile
+1
-1
No files found.
.gitignore
View file @
7e4ee23f
...
@@ -21,3 +21,6 @@ benchmarks/files/numbers/*.json
...
@@ -21,3 +21,6 @@ benchmarks/files/numbers/*.json
cmake-build-debug
cmake-build-debug
test/test-*
test/test-*
amalgamate
single_include
third_party/Amalgamate
CMakeLists.txt
View file @
7e4ee23f
...
@@ -7,6 +7,12 @@ cmake_minimum_required(VERSION 3.0.0)
...
@@ -7,6 +7,12 @@ cmake_minimum_required(VERSION 3.0.0)
project
(
nlohmann_json VERSION 3.0.1 LANGUAGES CXX
)
project
(
nlohmann_json VERSION 3.0.1 LANGUAGES CXX
)
##
##
## INCLUDE
##
##
include
(
ExternalProject
)
##
## OPTIONS
## OPTIONS
##
##
option
(
JSON_BuildTests
"Build the unit tests when BUILD_TESTING is enabled."
ON
)
option
(
JSON_BuildTests
"Build the unit tests when BUILD_TESTING is enabled."
ON
)
...
@@ -15,7 +21,7 @@ option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
...
@@ -15,7 +21,7 @@ option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
## CONFIGURATION
## CONFIGURATION
##
##
set
(
NLOHMANN_JSON_TARGET_NAME
${
PROJECT_NAME
}
)
set
(
NLOHMANN_JSON_TARGET_NAME
${
PROJECT_NAME
}
)
set
(
NLOHMANN_JSON_SOURCE_DIR
"src
/
"
)
set
(
NLOHMANN_JSON_SOURCE_DIR
"src"
)
set
(
NLOHMANN_JSON_CONFIG_INSTALL_DIR
"lib/cmake/
${
PROJECT_NAME
}
"
)
set
(
NLOHMANN_JSON_CONFIG_INSTALL_DIR
"lib/cmake/
${
PROJECT_NAME
}
"
)
set
(
NLOHMANN_JSON_INCLUDE_INSTALL_DIR
"include"
)
set
(
NLOHMANN_JSON_INCLUDE_INSTALL_DIR
"include"
)
set
(
NLOHMANN_JSON_HEADER_INSTALL_DIR
"
${
NLOHMANN_JSON_INCLUDE_INSTALL_DIR
}
/nlohmann"
)
set
(
NLOHMANN_JSON_HEADER_INSTALL_DIR
"
${
NLOHMANN_JSON_INCLUDE_INSTALL_DIR
}
/nlohmann"
)
...
@@ -62,6 +68,19 @@ if(BUILD_TESTING AND JSON_BuildTests)
...
@@ -62,6 +68,19 @@ if(BUILD_TESTING AND JSON_BuildTests)
add_subdirectory
(
test
)
add_subdirectory
(
test
)
endif
()
endif
()
ExternalProject_Add
(
amalgamate
GIT_REPOSITORY
"https://github.com/theodelrieu/Amalgamate"
CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=
${
CMAKE_BINARY_DIR
}
"
)
# There is no way to tell amalgamate to force-write the output file even if it already exists...
add_custom_target
(
single_header ALL rm -f
"
${
CMAKE_SOURCE_DIR
}
/single_header/json.hpp"
COMMENT
"Amalgamating json.hpp..."
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/
${
NLOHMANN_JSON_SOURCE_DIR
}
DEPENDS amalgamate
COMMAND
"
${
CMAKE_BINARY_DIR
}
/bin/amalgamate"
-w '*.hpp' -i . json.hpp
"
${
CMAKE_SOURCE_DIR
}
/single_header/json.hpp"
)
##
##
## INSTALL
## INSTALL
## install header files, generate and install cmake config files for find_package()
## install header files, generate and install cmake config files for find_package()
...
...
Makefile
View file @
7e4ee23f
.PHONY
:
pretty clean ChangeLog.md
.PHONY
:
pretty clean ChangeLog.md
SRCDIR
=
src
SRCDIR
=
./src
SRCS
=
${
SRCDIR
}
/json.hpp
\
SRCS
=
$(SRCDIR)
/json.hpp
\
${
SRCDIR
}
/json_fwd.hpp
\
$(SRCDIR)
/json_fwd.hpp
\
${
SRCDIR
}
/detail/macro_scope.hpp
\
$(SRCDIR)
/detail/macro_scope.hpp
\
${
SRCDIR
}
/detail/macro_unscope.hpp
\
$(SRCDIR)
/detail/macro_unscope.hpp
\
${
SRCDIR
}
/detail/meta.hpp
\
$(SRCDIR)
/detail/meta.hpp
\
${
SRCDIR
}
/detail/exceptions.hpp
\
$(SRCDIR)
/detail/exceptions.hpp
\
${
SRCDIR
}
/detail/value_t.hpp
\
$(SRCDIR)
/detail/value_t.hpp
\
${
SRCDIR
}
/detail/conversions/from_json.hpp
\
$(SRCDIR)
/detail/conversions/from_json.hpp
\
${
SRCDIR
}
/detail/conversions/to_json.hpp
\
$(SRCDIR)
/detail/conversions/to_json.hpp
\
${
SRCDIR
}
/detail/parsing/input_adapters.hpp
\
$(SRCDIR)
/detail/parsing/input_adapters.hpp
\
${
SRCDIR
}
/detail/parsing/lexer.hpp
\
$(SRCDIR)
/detail/parsing/lexer.hpp
\
${
SRCDIR
}
/detail/parsing/parser.hpp
\
$(SRCDIR)
/detail/parsing/parser.hpp
\
${
SRCDIR
}
/detail/iterators/primitive_iterator.hpp
\
$(SRCDIR)
/detail/iterators/primitive_iterator.hpp
\
${
SRCDIR
}
/detail/iterators/internal_iterator.hpp
\
$(SRCDIR)
/detail/iterators/internal_iterator.hpp
\
${
SRCDIR
}
/detail/iterators/iter_impl.hpp
\
$(SRCDIR)
/detail/iterators/iter_impl.hpp
\
${
SRCDIR
}
/detail/iterators/iteration_proxy.hpp
\
$(SRCDIR)
/detail/iterators/iteration_proxy.hpp
\
${
SRCDIR
}
/detail/iterators/json_reverse_iterator.hpp
\
$(SRCDIR)
/detail/iterators/json_reverse_iterator.hpp
\
${
SRCDIR
}
/detail/parsing/output_adapters.hpp
\
$(SRCDIR)
/detail/parsing/output_adapters.hpp
\
${
SRCDIR
}
/detail/parsing/binary_reader.hpp
\
$(SRCDIR)
/detail/parsing/binary_reader.hpp
\
${
SRCDIR
}
/detail/parsing/binary_writer.hpp
\
$(SRCDIR)
/detail/parsing/binary_writer.hpp
\
${
SRCDIR
}
/detail/serializer.hpp
\
$(SRCDIR)
/detail/serializer.hpp
\
${
SRCDIR
}
/detail/json_ref.hpp
\
$(SRCDIR)
/detail/json_ref.hpp
\
${
SRCDIR
}
/adl_serializer.hpp
$(SRCDIR)
/adl_serializer.hpp
UNAME
=
$(
shell
uname
)
CXX
=
clang++
# main target
# main target
all
:
all
:
...
@@ -42,7 +45,6 @@ all:
...
@@ -42,7 +45,6 @@ all:
@
echo
"pedantic_gcc - run GCC with maximal warning flags"
@
echo
"pedantic_gcc - run GCC with maximal warning flags"
@
echo
"pretty - beautify code with Artistic Style"
@
echo
"pretty - beautify code with Artistic Style"
##########################################################################
##########################################################################
# unit tests
# unit tests
##########################################################################
##########################################################################
...
@@ -247,6 +249,7 @@ pretty:
...
@@ -247,6 +249,7 @@ pretty:
$(SRCS)
test
/src/
*
.cpp
\
$(SRCS)
test
/src/
*
.cpp
\
benchmarks/src/benchmarks.cpp doc/examples/
*
.cpp
benchmarks/src/benchmarks.cpp doc/examples/
*
.cpp
##########################################################################
##########################################################################
# changelog
# changelog
##########################################################################
##########################################################################
...
...
single_header/json.hpp
0 → 100644
View file @
7e4ee23f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
test/Makefile
View file @
7e4ee23f
...
@@ -77,7 +77,7 @@ test-%: src/unit-%.o src/unit.o ../src/json.hpp thirdparty/catch/catch.hpp
...
@@ -77,7 +77,7 @@ test-%: src/unit-%.o src/unit.o ../src/json.hpp thirdparty/catch/catch.hpp
TEST_PATTERN
?=
"*"
TEST_PATTERN
?=
"*"
TEST_PREFIX
=
""
TEST_PREFIX
=
""
check
:
$(TESTCASES)
check
:
$(
OBJECTS) $(
TESTCASES)
@
cd
..
;
for
testcase
in
$(TESTCASES)
;
do
echo
"Executing
$$
testcase..."
;
$(TEST_PREFIX)
test
/
$$
testcase
$(TEST_PATTERN)
||
exit
1
;
done
@
cd
..
;
for
testcase
in
$(TESTCASES)
;
do
echo
"Executing
$$
testcase..."
;
$(TEST_PREFIX)
test
/
$$
testcase
$(TEST_PATTERN)
||
exit
1
;
done
...
...
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