Skip to content

Commit

Permalink
fix cmake install directory (for real this time)
Browse files Browse the repository at this point in the history
* Rename 'develop' folder to 'nlohmann'
* Use <nlohmann/*> headers in sources
* Hack test/CMakeLists.txt to find the correct json.hpp
* Change amalgamate config file
  • Loading branch information
theodelrieu committed Jan 29, 2018
1 parent b3bd3b7 commit e77365f
Show file tree
Hide file tree
Showing 31 changed files with 173 additions and 166 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ set(NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/$
set(NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake")

if (JSON_MultipleHeaders)
set(NLOHMANN_JSON_SOURCE_DIR "develop/")
set(NLOHMANN_JSON_INCLUDE_BUILD_DIR ${PROJECT_SOURCE_DIR})
set(NLOHMANN_JSON_SOURCE_DIR "${PROJECT_SOURCE_DIR}/nlohmann/")
else()
set(NLOHMANN_JSON_SOURCE_DIR "src/")
set(NLOHMANN_JSON_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/src")
set(NLOHMANN_JSON_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/")
endif()

##
Expand All @@ -46,7 +48,7 @@ add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
target_include_directories(
${NLOHMANN_JSON_TARGET_NAME}
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${NLOHMANN_JSON_SOURCE_DIR}>
$<BUILD_INTERFACE:${NLOHMANN_JSON_INCLUDE_BUILD_DIR}>
$<INSTALL_INTERFACE:include>
)

Expand All @@ -70,7 +72,6 @@ include(CTest) #adds option BUILD_TESTING (default ON)

if(BUILD_TESTING AND JSON_BuildTests)
enable_testing()
include_directories(${NLOHMANN_JSON_SOURCE_DIR})
add_subdirectory(test)
endif()

Expand Down
62 changes: 31 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
.PHONY: pretty clean ChangeLog.md

SRCS = develop/json.hpp \
develop/json_fwd.hpp \
develop/adl_serializer.hpp \
develop/detail/conversions/from_json.hpp \
develop/detail/conversions/to_chars.hpp \
develop/detail/conversions/to_json.hpp \
develop/detail/exceptions.hpp \
develop/detail/input/binary_reader.hpp \
develop/detail/input/input_adapters.hpp \
develop/detail/input/lexer.hpp \
develop/detail/input/parser.hpp \
develop/detail/iterators/internal_iterator.hpp \
develop/detail/iterators/iter_impl.hpp \
develop/detail/iterators/iteration_proxy.hpp \
develop/detail/iterators/json_reverse_iterator.hpp \
develop/detail/iterators/primitive_iterator.hpp \
develop/detail/json_pointer.hpp \
develop/detail/json_ref.hpp \
develop/detail/macro_scope.hpp \
develop/detail/macro_unscope.hpp \
develop/detail/meta.hpp \
develop/detail/output/binary_writer.hpp \
develop/detail/output/output_adapters.hpp \
develop/detail/output/serializer.hpp \
develop/detail/value_t.hpp
SRCS = nlohmann/json.hpp \
nlohmann/json_fwd.hpp \
nlohmann/adl_serializer.hpp \
nlohmann/detail/conversions/from_json.hpp \
nlohmann/detail/conversions/to_chars.hpp \
nlohmann/detail/conversions/to_json.hpp \
nlohmann/detail/exceptions.hpp \
nlohmann/detail/input/binary_reader.hpp \
nlohmann/detail/input/input_adapters.hpp \
nlohmann/detail/input/lexer.hpp \
nlohmann/detail/input/parser.hpp \
nlohmann/detail/iterators/internal_iterator.hpp \
nlohmann/detail/iterators/iter_impl.hpp \
nlohmann/detail/iterators/iteration_proxy.hpp \
nlohmann/detail/iterators/json_reverse_iterator.hpp \
nlohmann/detail/iterators/primitive_iterator.hpp \
nlohmann/detail/json_pointer.hpp \
nlohmann/detail/json_ref.hpp \
nlohmann/detail/macro_scope.hpp \
nlohmann/detail/macro_unscope.hpp \
nlohmann/detail/meta.hpp \
nlohmann/detail/output/binary_writer.hpp \
nlohmann/detail/output/output_adapters.hpp \
nlohmann/detail/output/serializer.hpp \
nlohmann/detail/value_t.hpp

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

# main target
all:
@echo "amalgamate - amalgamate file src/json.hpp from the develop sources"
@echo "amalgamate - amalgamate file src/json.hpp from the nlohmann sources"
@echo "ChangeLog.md - generate ChangeLog file"
@echo "check - compile and execute test suite"
@echo "check-amalgamation - check whether sources have been amalgamated"
Expand Down Expand Up @@ -264,22 +264,22 @@ pretty:
amalgamate: src/json.hpp

src/json.hpp: $(SRCS)
third_party/amalgamate/amalgamate.py -c third_party/amalgamate/config.json -s develop --verbose=yes
third_party/amalgamate/amalgamate.py -c third_party/amalgamate/config.json -s . --verbose=yes
$(MAKE) pretty

# check if src/json.hpp has been amalgamated from the develop sources
# check if src/json.hpp has been amalgamated from the nlohmann sources
check-amalgamation:
@mv src/json.hpp src/json.hpp~
@$(MAKE) amalgamate
@diff src/json.hpp src/json.hpp~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv src/json.hpp~ src/json.hpp ; false)
@mv src/json.hpp~ src/json.hpp

# check if every header in develop includes sufficient headers to be compiled
# check if every header in nlohmann includes sufficient headers to be compiled
# individually
check-single-includes:
for x in $(SRCS); do \
echo "#include \"$$x\"\nint main() {}\n" | sed 's|develop/||' > single_include_test.cpp; \
$(CXX) $(CXXFLAGS) -Idevelop -std=c++11 single_include_test.cpp -o single_include_test; \
echo "#include \"$$x\"\nint main() {}\n" | sed 's|nlohmann/||' > single_include_test.cpp; \
$(CXX) $(CXXFLAGS) -I. -std=c++11 single_include_test.cpp -o single_include_test; \
rm single_include_test.cpp single_include_test; \
done

Expand Down
4 changes: 2 additions & 2 deletions develop/adl_serializer.hpp → nlohmann/adl_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <utility>

#include "detail/conversions/from_json.hpp"
#include "detail/conversions/to_json.hpp"
#include <nlohmann/detail/conversions/from_json.hpp>
#include <nlohmann/detail/conversions/to_json.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include <utility> // pair, declval
#include <valarray> // valarray

#include "detail/exceptions.hpp"
#include "detail/macro_scope.hpp"
#include "detail/meta.hpp"
#include "detail/value_t.hpp"
#include <nlohmann/detail/exceptions.hpp>
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/meta.hpp>
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <valarray> // valarray
#include <vector> // vector

#include "detail/meta.hpp"
#include "detail/value_t.hpp"
#include <nlohmann/detail/meta.hpp>
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include <string> // char_traits, string
#include <utility> // make_pair, move

#include "detail/input/input_adapters.hpp"
#include "detail/exceptions.hpp"
#include "detail/macro_scope.hpp"
#include "detail/value_t.hpp"
#include <nlohmann/detail/input/input_adapters.hpp>
#include <nlohmann/detail/exceptions.hpp>
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <type_traits> // enable_if, is_base_of, is_pointer, is_integral, remove_pointer
#include <utility> // pair, declval

#include "detail/macro_scope.hpp"
#include <nlohmann/detail/macro_scope.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <string> // char_traits, string
#include <vector> // vector

#include "detail/macro_scope.hpp"
#include "detail/input/input_adapters.hpp"
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/input/input_adapters.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include <string> // string
#include <utility> // move

#include "detail/exceptions.hpp"
#include "detail/macro_scope.hpp"
#include "detail/input/input_adapters.hpp"
#include "detail/input/lexer.hpp"
#include "detail/value_t.hpp"
#include <nlohmann/detail/exceptions.hpp>
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/input/input_adapters.hpp>
#include <nlohmann/detail/input/lexer.hpp>
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "detail/iterators/primitive_iterator.hpp"
#include <nlohmann/detail/iterators/primitive_iterator.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include <iterator> // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next
#include <type_traits> // conditional, is_const, remove_const

#include "detail/exceptions.hpp"
#include "detail/iterators/internal_iterator.hpp"
#include "detail/iterators/primitive_iterator.hpp"
#include "detail/macro_scope.hpp"
#include "detail/meta.hpp"
#include "detail/value_t.hpp"
#include <nlohmann/detail/exceptions.hpp>
#include <nlohmann/detail/iterators/internal_iterator.hpp>
#include <nlohmann/detail/iterators/primitive_iterator.hpp>
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/meta.hpp>
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cstddef> // size_t
#include <string> // string, to_string

#include "detail/value_t.hpp"
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <string> // string
#include <vector> // vector

#include "detail/macro_scope.hpp"
#include "detail/exceptions.hpp"
#include "detail/value_t.hpp"
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/exceptions.hpp>
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions develop/detail/meta.hpp → nlohmann/detail/meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
#include <utility> // declval

#include "json_fwd.hpp"
#include "detail/macro_scope.hpp"
#include <nlohmann/json_fwd.hpp>
#include <nlohmann/detail/macro_scope.hpp>

namespace nlohmann
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <cstring> // memcpy
#include <limits> // numeric_limits

#include "detail/input/binary_reader.hpp"
#include "detail/output/output_adapters.hpp"
#include <nlohmann/detail/input/binary_reader.hpp>
#include <nlohmann/detail/output/output_adapters.hpp>

namespace nlohmann
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
#include <sstream> // stringstream
#include <type_traits> // is_same

#include "detail/exceptions.hpp"
#include "detail/conversions/to_chars.hpp"
#include "detail/macro_scope.hpp"
#include "detail/meta.hpp"
#include "detail/output/output_adapters.hpp"
#include "detail/value_t.hpp"
#include <nlohmann/detail/exceptions.hpp>
#include <nlohmann/detail/conversions/to_chars.hpp>
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/meta.hpp>
#include <nlohmann/detail/output/output_adapters.hpp>
#include <nlohmann/detail/value_t.hpp>

namespace nlohmann
{
Expand Down
File renamed without changes.
46 changes: 23 additions & 23 deletions develop/json.hpp → nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ SOFTWARE.
#include <string> // string, stoi, to_string
#include <utility> // declval, forward, move, pair, swap

#include "json_fwd.hpp"
#include "detail/macro_scope.hpp"
#include "detail/meta.hpp"
#include "detail/exceptions.hpp"
#include "detail/value_t.hpp"
#include "detail/conversions/from_json.hpp"
#include "detail/conversions/to_json.hpp"
#include "detail/input/input_adapters.hpp"
#include "detail/input/lexer.hpp"
#include "detail/input/parser.hpp"
#include "detail/iterators/primitive_iterator.hpp"
#include "detail/iterators/internal_iterator.hpp"
#include "detail/iterators/iter_impl.hpp"
#include "detail/iterators/iteration_proxy.hpp"
#include "detail/iterators/json_reverse_iterator.hpp"
#include "detail/output/output_adapters.hpp"
#include "detail/input/binary_reader.hpp"
#include "detail/output/binary_writer.hpp"
#include "detail/output/serializer.hpp"
#include "detail/json_ref.hpp"
#include "detail/json_pointer.hpp"
#include "adl_serializer.hpp"
#include <nlohmann/json_fwd.hpp>
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/meta.hpp>
#include <nlohmann/detail/exceptions.hpp>
#include <nlohmann/detail/value_t.hpp>
#include <nlohmann/detail/conversions/from_json.hpp>
#include <nlohmann/detail/conversions/to_json.hpp>
#include <nlohmann/detail/input/input_adapters.hpp>
#include <nlohmann/detail/input/lexer.hpp>
#include <nlohmann/detail/input/parser.hpp>
#include <nlohmann/detail/iterators/primitive_iterator.hpp>
#include <nlohmann/detail/iterators/internal_iterator.hpp>
#include <nlohmann/detail/iterators/iter_impl.hpp>
#include <nlohmann/detail/iterators/iteration_proxy.hpp>
#include <nlohmann/detail/iterators/json_reverse_iterator.hpp>
#include <nlohmann/detail/output/output_adapters.hpp>
#include <nlohmann/detail/input/binary_reader.hpp>
#include <nlohmann/detail/output/binary_writer.hpp>
#include <nlohmann/detail/output/serializer.hpp>
#include <nlohmann/detail/json_ref.hpp>
#include <nlohmann/detail/json_pointer.hpp>
#include <nlohmann/adl_serializer.hpp>

/*!
@brief namespace for Niels Lohmann
Expand Down Expand Up @@ -7557,6 +7557,6 @@ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std
return nlohmann::json::json_pointer(std::string(s, n));
}

#include "detail/macro_unscope.hpp"
#include <nlohmann/detail/macro_unscope.hpp>

#endif
File renamed without changes.
Loading

0 comments on commit e77365f

Please sign in to comment.