Unverified Commit a646c9c5 authored by Niels Lohmann's avatar Niels Lohmann

🔀 merge branch 'cotire' of...

🔀 merge branch 'cotire' of https://github.com/tusharpm/json into tusharpm-cotire
parents 8cec55a2 5436407b
......@@ -7,6 +7,7 @@ fuzz-testing
*.gcno
*.gcda
build
working
doc/xml
......
......@@ -228,6 +228,14 @@ install:
# make sure CXX is correctly set
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
# get CMake (only for systems with brew - macOS)
- |
if [[ !(-x $(which cmake)) && (-x $(which brew)) ]]; then
brew update
brew install cmake
cmake --version
fi
# install LLVM/clang when LLVM_VERSION is set
- |
if [[ "${LLVM_VERSION}" != "" ]]; then
......@@ -266,7 +274,10 @@ script:
- $CXX --version
# compile and execute unit tests
- make check
- mkdir -p build && cd build
- cmake .. && cmake --build . --config Release -- -j4
- ctest -C Release -V
- cd ..
# check if homebrew works (only checks develop branch)
- if [ `which brew` ]; then
......
......@@ -16,6 +16,8 @@ set(JSON_CONFIGVERSION_FILENAME "${JSON_PACKAGE_NAME}ConfigVersion.cmake")
set(JSON_CONFIG_DESTINATION "cmake")
set(JSON_INCLUDE_DESTINATION "include/nlohmann")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# create and configure the library target
add_library(${JSON_TARGET_NAME} INTERFACE)
target_include_directories(${JSON_TARGET_NAME} INTERFACE
......
This source diff could not be displayed because it is too large. You can view the blob instead.
add_library(catch_main OBJECT
"src/unit.cpp"
)
set_target_properties(catch_main PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
target_include_directories(catch_main PRIVATE "thirdparty/catch")
# The unit test executable.
set(JSON_UNITTEST_TARGET_NAME "json_unit")
add_executable(${JSON_UNITTEST_TARGET_NAME}
"thirdparty/catch/catch.hpp"
"src/unit.cpp"
$<TARGET_OBJECTS:catch_main>
"src/unit-algorithms.cpp"
"src/unit-allocator.cpp"
"src/unit-capacity.cpp"
......@@ -43,13 +51,33 @@ add_executable(${JSON_UNITTEST_TARGET_NAME}
set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
COMPILE_DEFINITIONS "$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
)
if(MSVC)
set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS"
COMPILE_OPTIONS "/EHsc;$<$<CONFIG:Release>:/Od>"
)
endif()
target_include_directories(${JSON_UNITTEST_TARGET_NAME} PRIVATE "src" "thirdparty/catch")
target_link_libraries(${JSON_UNITTEST_TARGET_NAME} ${JSON_TARGET_NAME})
include(cotire OPTIONAL)
if(COMMAND cotire)
set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
COTIRE_ADD_UNITY_BUILD FALSE
COTIRE_CXX_PREFIX_HEADER_INIT "src/prefix.hpp"
)
# HACK - CMAKE_INCLUDE_SYSTEM_FLAG_CXX has a trailing space, which Cotire doesn't strip
# Technically, this fix should go in cotire.cmake. TODO - submit a pull request upstream.
if (CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}" CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
endif()
cotire(${JSON_UNITTEST_TARGET_NAME})
endif()
add_test(NAME "${JSON_UNITTEST_TARGET_NAME}_default"
COMMAND ${JSON_UNITTEST_TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
......
#pragma once
#include "catch.hpp"
#define private public
#include "json.hpp"
using nlohmann::json;
......@@ -26,16 +26,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <array>
#include <map>
#include <string>
#include <memory>
#include "catch.hpp"
#include "json.hpp"
using nlohmann::json;
#include <array>
#include <map>
#include <string>
#include <memory>
namespace udt
{
enum class country
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment