Skip to content

Commit

Permalink
Consume GoogleTest from Noa
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Jan 20, 2025
1 parent 8b8cc12 commit 93faa1d
Show file tree
Hide file tree
Showing 62 changed files with 919 additions and 91 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ project(jsontoolkit VERSION 2.0.0 LANGUAGES C CXX
DESCRIPTION "The swiss-army knife for JSON programming in C++"
HOMEPAGE_URL "https://jsontoolkit.sourcemeta.com")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(vendor/noa/cmake/noa.cmake)

# Options
option(JSONTOOLKIT_URI "Build the JSON Toolkit URI library" ON)
Expand All @@ -20,6 +19,9 @@ option(JSONTOOLKIT_INSTALL "Install the JSON Toolkit library" ON)
option(JSONTOOLKIT_ADDRESS_SANITIZER "Build JSON Toolkit with an address sanitizer" OFF)
option(JSONTOOLKIT_UNDEFINED_SANITIZER "Build JSON Toolkit with an undefined behavior sanitizer" OFF)

set(NOA_GOOGLETEST ${JSONTOOLKIT_TESTS} CACHE BOOL "GoogleTest")
add_subdirectory(vendor/noa)

if(JSONTOOLKIT_INSTALL)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
Expand Down Expand Up @@ -92,7 +94,6 @@ endif()

# Testing
if(JSONTOOLKIT_TESTS)
find_package(GoogleTest REQUIRED)
enable_testing()

if(JSONTOOLKIT_URI)
Expand Down
3 changes: 1 addition & 2 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
vendorpull https://github.com/sourcemeta/vendorpull 70342aaf458e6cb80baeb5b718901075fc42ede6
noa https://github.com/sourcemeta/noa 99f8b42d5f1a8b0f9b3c024f5957dc399bc0262f
noa https://github.com/sourcemeta/noa 934b65a54cc31af0ce60da822d73824de81f1b77
jsontestsuite https://github.com/nst/JSONTestSuite d64aefb55228d9584d3e5b2433f720ea8fd00c82
googletest https://github.com/google/googletest a7f443b80b105f940225332ed3c31f2790092f47
jsonschema-2020-12 https://github.com/json-schema-org/json-schema-spec 769daad75a9553562333a8937a187741cb708c72
jsonschema-2019-09 https://github.com/json-schema-org/json-schema-spec 41014ea723120ce70b314d72f863c6929d9f3cfd
jsonschema-draft7 https://github.com/json-schema-org/json-schema-spec 567f768506aaa33a38e552c85bf0586029ef1b32
Expand Down
60 changes: 27 additions & 33 deletions test/json/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
add_executable(sourcemeta_jsontoolkit_json_unit
json_array_test.cc
json_boolean_test.cc
json_error_test.cc
json_flat_map_test.cc
json_hash_test.cc
json_integer_test.cc
json_null_test.cc
json_number_test.cc
json_object_test.cc
json_parse_callback_test.cc
json_parse_error_test.cc
json_parse_test.cc
json_prettify_test.cc
json_real_test.cc
json_string_test.cc
json_stringify_test.cc
json_value_test.cc
json_type_test.cc)
noa_add_default_options(PRIVATE sourcemeta_jsontoolkit_json_unit)
target_link_libraries(sourcemeta_jsontoolkit_json_unit
PRIVATE GTest::gtest GTest::gtest_main)
noa_googletest(NAMESPACE sourcemeta PROJECT jsontoolkit NAME json
FOLDER "JSON Toolkit/JSON"
SOURCES
json_array_test.cc
json_boolean_test.cc
json_error_test.cc
json_flat_map_test.cc
json_hash_test.cc
json_integer_test.cc
json_null_test.cc
json_number_test.cc
json_object_test.cc
json_parse_callback_test.cc
json_parse_error_test.cc
json_parse_test.cc
json_prettify_test.cc
json_real_test.cc
json_string_test.cc
json_stringify_test.cc
json_value_test.cc
json_type_test.cc)

target_link_libraries(sourcemeta_jsontoolkit_json_unit
PRIVATE sourcemeta::jsontoolkit::json)
target_compile_definitions(sourcemeta_jsontoolkit_json_unit
PRIVATE TEST_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}")
set_target_properties(sourcemeta_jsontoolkit_json_unit
PROPERTIES FOLDER "JSON Toolkit/JSON")
add_test(NAME JSON COMMAND sourcemeta_jsontoolkit_json_unit --gtest_brief=1)

# JSON Test Suite
# See https://github.com/nst/JSONTestSuite
add_executable(sourcemeta_jsontoolkit_jsontestsuite jsontestsuite.cc)
noa_add_default_options(PRIVATE sourcemeta_jsontoolkit_jsontestsuite)
target_compile_definitions(sourcemeta_jsontoolkit_jsontestsuite
noa_googletest(NAMESPACE sourcemeta PROJECT jsontoolkit NAME jsontestsuite
FOLDER "JSON Toolkit/JSON"
SOURCES jsontestsuite.cc)
target_compile_definitions(sourcemeta_jsontoolkit_jsontestsuite_unit
PRIVATE JSONTESTSUITE_PATH="${PROJECT_SOURCE_DIR}/vendor/jsontestsuite")
target_link_libraries(sourcemeta_jsontoolkit_jsontestsuite PRIVATE GTest::gtest)
target_link_libraries(sourcemeta_jsontoolkit_jsontestsuite PRIVATE sourcemeta::jsontoolkit::json)
set_target_properties(sourcemeta_jsontoolkit_jsontestsuite
PROPERTIES FOLDER "JSON Toolkit/JSON")
add_test(NAME JSONTestSuite COMMAND sourcemeta_jsontoolkit_jsontestsuite --gtest_brief=1)
target_link_libraries(sourcemeta_jsontoolkit_jsontestsuite_unit PRIVATE sourcemeta::jsontoolkit::json)
17 changes: 0 additions & 17 deletions vendor/googletest.mask

This file was deleted.

13 changes: 13 additions & 0 deletions vendor/noa/CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
4 changes: 3 additions & 1 deletion vendor/noa/cmake/noa.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 24 additions & 24 deletions vendor/noa/cmake/noa/defaults.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/noa/cmake/noa/shim.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions vendor/noa/cmake/noa/targets/clang-format.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions vendor/noa/cmake/noa/targets/clang-tidy.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions vendor/noa/cmake/noa/targets/executable.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions vendor/noa/cmake/noa/targets/googletest.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
2 changes: 0 additions & 2 deletions vendor/noa/cmake/noa/targets/shellcheck.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/noa/cmake/noa/variables.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 93faa1d

Please sign in to comment.