Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/split it #700

Merged
merged 23 commits into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5bffc95
add json_fwd.hpp
theodelrieu Aug 14, 2017
d686713
add detail/macro_{un}scope.hpp
theodelrieu Aug 14, 2017
f364f5a
add detail/meta.hpp
theodelrieu Aug 14, 2017
8c555db
add detail/exceptions.hpp
theodelrieu Aug 14, 2017
7056b37
add detail/value_t.hpp
theodelrieu Aug 14, 2017
e0c02c1
add detail/conversions/from_json.hpp
theodelrieu Aug 14, 2017
2188160
add detail/conversions/to_json.hpp
theodelrieu Aug 14, 2017
7ab3e8d
add detail/parsing/input_adapters.hpp
theodelrieu Aug 14, 2017
3a0743d
add detail/parsing/lexer.hpp
theodelrieu Aug 14, 2017
9ea2568
add detail/parsing/parser.hpp
theodelrieu Aug 14, 2017
51ecc31
add detail/iterators/primitive_iterator.hpp
theodelrieu Aug 14, 2017
3e65a65
add detail/iterators/internal_iterator.hpp
theodelrieu Aug 14, 2017
bf06cf6
add detail/iterators/iter_impl.hpp
theodelrieu Aug 14, 2017
5fc9ef2
add detail/iterators/iteration_proxy.hpp
theodelrieu Aug 14, 2017
ae6f660
add detail/iterators/json_reverse_iterator.hpp
theodelrieu Aug 14, 2017
4dbb433
add detail/parsing/output_adapters.hpp
theodelrieu Aug 14, 2017
d620f76
add detail/parsing/binary_reader.hpp
theodelrieu Aug 14, 2017
c117515
add detail/parsing/binary_writer.hpp
theodelrieu Aug 14, 2017
a3473fd
add detail/serializer.hpp
theodelrieu Aug 14, 2017
8e9714f
add detail/json_ref.hpp
theodelrieu Aug 14, 2017
9cab30c
add adl_serializer.hpp
theodelrieu Aug 14, 2017
57d822b
add missing includes, put back include comments
theodelrieu Aug 14, 2017
7e4ee23
add single_header CMake target
theodelrieu Aug 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ benchmarks/files/numbers/*.json
cmake-build-debug

test/test-*
amalgamate
single_include
third_party/Amalgamate
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ cmake_minimum_required(VERSION 3.0.0)
##
project(nlohmann_json VERSION 3.0.1 LANGUAGES CXX)

##
## INCLUDE
##
##
include(ExternalProject)

##
## OPTIONS
##
Expand All @@ -15,7 +21,7 @@ option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
## CONFIGURATION
##
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_INCLUDE_INSTALL_DIR "include")
set(NLOHMANN_JSON_HEADER_INSTALL_DIR "${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}/nlohmann")
Expand Down Expand Up @@ -62,6 +68,19 @@ if(BUILD_TESTING AND JSON_BuildTests)
add_subdirectory(test)
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 header files, generate and install cmake config files for find_package()
Expand Down
32 changes: 30 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
.PHONY: pretty clean ChangeLog.md

SRCDIR = ./src
SRCS = $(SRCDIR)/json.hpp \
$(SRCDIR)/json_fwd.hpp \
$(SRCDIR)/detail/macro_scope.hpp \
$(SRCDIR)/detail/macro_unscope.hpp \
$(SRCDIR)/detail/meta.hpp \
$(SRCDIR)/detail/exceptions.hpp \
$(SRCDIR)/detail/value_t.hpp \
$(SRCDIR)/detail/conversions/from_json.hpp \
$(SRCDIR)/detail/conversions/to_json.hpp \
$(SRCDIR)/detail/parsing/input_adapters.hpp \
$(SRCDIR)/detail/parsing/lexer.hpp \
$(SRCDIR)/detail/parsing/parser.hpp \
$(SRCDIR)/detail/iterators/primitive_iterator.hpp \
$(SRCDIR)/detail/iterators/internal_iterator.hpp \
$(SRCDIR)/detail/iterators/iter_impl.hpp \
$(SRCDIR)/detail/iterators/iteration_proxy.hpp \
$(SRCDIR)/detail/iterators/json_reverse_iterator.hpp \
$(SRCDIR)/detail/parsing/output_adapters.hpp \
$(SRCDIR)/detail/parsing/binary_reader.hpp \
$(SRCDIR)/detail/parsing/binary_writer.hpp \
$(SRCDIR)/detail/serializer.hpp \
$(SRCDIR)/detail/json_ref.hpp \
$(SRCDIR)/adl_serializer.hpp

UNAME = $(shell uname)
CXX=clang++

# main target
all:
@echo "ChangeLog.md - generate ChangeLog file"
@echo "check - compile and execute test suite"
Expand All @@ -16,7 +45,6 @@ all:
@echo "pedantic_gcc - run GCC with maximal warning flags"
@echo "pretty - beautify code with Artistic Style"


##########################################################################
# unit tests
##########################################################################
Expand Down Expand Up @@ -218,7 +246,7 @@ pretty:
--indent-col1-comments --pad-oper --pad-header --align-pointer=type \
--align-reference=type --add-brackets --convert-tabs --close-templates \
--lineend=linux --preserve-date --suffix=none --formatted \
src/json.hpp test/src/*.cpp \
$(SRCS) test/src/*.cpp \
benchmarks/src/benchmarks.cpp doc/examples/*.cpp


Expand Down
Loading