Skip to content

Commit

Permalink
Rename project to "Core"
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 28, 2025
1 parent 25c7732 commit 82d2aae
Show file tree
Hide file tree
Showing 415 changed files with 10,712 additions and 13,374 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: JSON Toolkit
name: Core

on:
schedule:
Expand Down Expand Up @@ -68,13 +68,13 @@ jobs:
cxx: clang++
type: static
shell: sh
options: -DJSONTOOLKIT_ADDRESS_SANITIZER:BOOL=ON
options: -DSOURCEMETA_CORE_ADDRESS_SANITIZER:BOOL=ON
- os: ubuntu-latest
cc: clang
cxx: clang++
type: static
shell: sh
options: -DJSONTOOLKIT_UNDEFINED_SANITIZER:BOOL=ON
options: -DSOURCEMETA_CORE_UNDEFINED_SANITIZER:BOOL=ON

defaults:
run:
Expand All @@ -96,25 +96,25 @@ jobs:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
- run: cmake --version
- name: Configure JSON Toolkit (static)
- name: Configure (static)
if: matrix.platform.type == 'static'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DJSONTOOLKIT_TESTS:BOOL=ON
-DJSONTOOLKIT_BENCHMARK:BOOL=ON
-DJSONTOOLKIT_DOCS:BOOL=OFF
-DSOURCEMETA_CORE_TESTS:BOOL=ON
-DSOURCEMETA_CORE_BENCHMARK:BOOL=ON
-DSOURCEMETA_CORE_DOCS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
${{ matrix.platform.options }}
- name: Configure JSON Toolkit (shared)
- name: Configure (shared)
if: matrix.platform.type == 'shared'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DJSONTOOLKIT_TESTS:BOOL=ON
-DJSONTOOLKIT_BENCHMARK:BOOL=ON
-DJSONTOOLKIT_DOCS:BOOL=OFF
-DSOURCEMETA_CORE_TESTS:BOOL=ON
-DSOURCEMETA_CORE_BENCHMARK:BOOL=ON
-DSOURCEMETA_CORE_DOCS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
${{ matrix.platform.options }}
Expand All @@ -128,10 +128,10 @@ jobs:
--component sourcemeta_noa_dev
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_jsontoolkit
--component sourcemeta_core
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_jsontoolkit_dev
--component sourcemeta_core_dev
# Not every CTest version supports the --test-dir option. If such option
# is not recognized, `ctest` will successfully exit finding no tests.
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/website-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
- run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DJSONTOOLKIT_CORE_REGEX:BOOL=OFF
-DJSONTOOLKIT_CORE_URI:BOOL=OFF
-DJSONTOOLKIT_CORE_JSON:BOOL=OFF
-DJSONTOOLKIT_CORE_JSONL:BOOL=OFF
-DJSONTOOLKIT_CORE_JSONSCHEMA:BOOL=OFF
-DJSONTOOLKIT_CORE_JSONPOINTER:BOOL=OFF
-DJSONTOOLKIT_CORE_YAML:BOOL=OFF
-DJSONTOOLKIT_EXTENSION_ALTERSCHEMA:BOOL=OFF
-DJSONTOOLKIT_DOCS:BOOL=ON
-DSOURCEMETA_CORE_REGEX:BOOL=OFF
-DSOURCEMETA_CORE_URI:BOOL=OFF
-DSOURCEMETA_CORE_JSON:BOOL=OFF
-DSOURCEMETA_CORE_JSONL:BOOL=OFF
-DSOURCEMETA_CORE_JSONSCHEMA:BOOL=OFF
-DSOURCEMETA_CORE_JSONPOINTER:BOOL=OFF
-DSOURCEMETA_CORE_YAML:BOOL=OFF
-DSOURCEMETA_CORE_EXTENSION_ALTERSCHEMA:BOOL=OFF
-DSOURCEMETA_CORE_DOCS:BOOL=ON
- run: cmake --build ./build --config Release --target doxygen
18 changes: 9 additions & 9 deletions .github/workflows/website-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
- run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DJSONTOOLKIT_CORE_REGEX:BOOL=OFF
-DJSONTOOLKIT_CORE_URI:BOOL=OFF
-DJSONTOOLKIT_CORE_JSON:BOOL=OFF
-DJSONTOOLKIT_CORE_JSONL:BOOL=OFF
-DJSONTOOLKIT_CORE_JSONSCHEMA:BOOL=OFF
-DJSONTOOLKIT_CORE_JSONPOINTER:BOOL=OFF
-DJSONTOOLKIT_CORE_YAML:BOOL=OFF
-DJSONTOOLKIT_EXTENSION_ALTERSCHEMA:BOOL=OFF
-DJSONTOOLKIT_DOCS:BOOL=ON
-DSOURCEMETA_CORE_REGEX:BOOL=OFF
-DSOURCEMETA_CORE_URI:BOOL=OFF
-DSOURCEMETA_CORE_JSON:BOOL=OFF
-DSOURCEMETA_CORE_JSONL:BOOL=OFF
-DSOURCEMETA_CORE_JSONSCHEMA:BOOL=OFF
-DSOURCEMETA_CORE_JSONPOINTER:BOOL=OFF
-DSOURCEMETA_CORE_YAML:BOOL=OFF
-DSOURCEMETA_CORE_EXTENSION_ALTERSCHEMA:BOOL=OFF
-DSOURCEMETA_CORE_DOCS:BOOL=ON
- run: cmake --build ./build --config Release --target doxygen
- name: Setup Pages
uses: actions/configure-pages@v5
Expand Down
80 changes: 39 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
cmake_minimum_required(VERSION 3.16)
project(jsontoolkit VERSION 0.0.0 LANGUAGES C CXX
DESCRIPTION "The swiss-army knife for JSON programming in C++"
HOMEPAGE_URL "https://jsontoolkit.sourcemeta.com")
project(core VERSION 0.0.0 LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

# Options
option(JSONTOOLKIT_CORE_REGEX "Build the JSON Toolkit Regex library" ON)
option(JSONTOOLKIT_CORE_URI "Build the JSON Toolkit URI library" ON)
option(JSONTOOLKIT_CORE_JSON "Build the JSON Toolkit JSON library" ON)
option(JSONTOOLKIT_CORE_JSONSCHEMA "Build the JSON Toolkit JSON Schema library" ON)
option(JSONTOOLKIT_CORE_JSONPOINTER "Build the JSON Toolkit JSON Pointer library" ON)
option(JSONTOOLKIT_CORE_JSONL "Build the JSON Toolkit JSONL library" ON)
option(JSONTOOLKIT_CORE_YAML "Build the JSON Toolkit YAML library" ON)
option(JSONTOOLKIT_EXTENSION_ALTERSCHEMA "Build the JSON Toolkit AlterSchema library" ON)
option(JSONTOOLKIT_TESTS "Build the JSON Toolkit tests" OFF)
option(JSONTOOLKIT_BENCHMARK "Build the JSON Toolkit benchmarks" OFF)
option(JSONTOOLKIT_DOCS "Build the JSON Toolkit docs" OFF)
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)
option(SOURCEMETA_CORE_REGEX "Build the Sourcemeta Core Regex library" ON)
option(SOURCEMETA_CORE_URI "Build the Sourcemeta Core URI library" ON)
option(SOURCEMETA_CORE_JSON "Build the Sourcemeta Core JSON library" ON)
option(SOURCEMETA_CORE_JSONSCHEMA "Build the Sourcemeta Core JSON Schema library" ON)
option(SOURCEMETA_CORE_JSONPOINTER "Build the Sourcemeta Core JSON Pointer library" ON)
option(SOURCEMETA_CORE_JSONL "Build the Sourcemeta Core JSONL library" ON)
option(SOURCEMETA_CORE_YAML "Build the Sourcemeta Core YAML library" ON)
option(SOURCEMETA_CORE_EXTENSION_ALTERSCHEMA "Build the Sourcemeta Core AlterSchema library" ON)
option(SOURCEMETA_CORE_TESTS "Build the Sourcemeta Core tests" OFF)
option(SOURCEMETA_CORE_BENCHMARK "Build the Sourcemeta Core benchmarks" OFF)
option(SOURCEMETA_CORE_DOCS "Build the Sourcemeta Core docs" OFF)
option(SOURCEMETA_CORE_INSTALL "Install the Sourcemeta Core library" ON)
option(SOURCEMETA_CORE_ADDRESS_SANITIZER "Build Sourcemeta Core with an address sanitizer" OFF)
option(SOURCEMETA_CORE_UNDEFINED_SANITIZER "Build Sourcemeta Core with an undefined behavior sanitizer" OFF)

find_package(Noa REQUIRED)

if(JSONTOOLKIT_INSTALL)
if(SOURCEMETA_CORE_INSTALL)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
configure_package_config_file(
Expand All @@ -36,51 +34,51 @@ if(JSONTOOLKIT_INSTALL)
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
COMPONENT sourcemeta_jsontoolkit_dev)
COMPONENT sourcemeta_core_dev)
endif()

if(JSONTOOLKIT_CORE_REGEX)
if(SOURCEMETA_CORE_REGEX)
find_package(BoostRegex REQUIRED)
add_subdirectory(src/core/regex)
endif()

if(JSONTOOLKIT_CORE_URI)
if(SOURCEMETA_CORE_URI)
find_package(UriParser REQUIRED)
add_subdirectory(src/core/uri)
endif()

if(JSONTOOLKIT_CORE_JSON)
if(SOURCEMETA_CORE_JSON)
add_subdirectory(src/core/json)
endif()

if(JSONTOOLKIT_CORE_JSONPOINTER)
if(SOURCEMETA_CORE_JSONPOINTER)
add_subdirectory(src/core/jsonpointer)
endif()

if(JSONTOOLKIT_CORE_JSONSCHEMA)
if(SOURCEMETA_CORE_JSONSCHEMA)
add_subdirectory(src/core/jsonschema)
endif()

if(JSONTOOLKIT_CORE_JSONL)
if(SOURCEMETA_CORE_JSONL)
add_subdirectory(src/core/jsonl)
endif()

if(JSONTOOLKIT_CORE_YAML)
if(SOURCEMETA_CORE_YAML)
find_package(yaml REQUIRED)
add_subdirectory(src/core/yaml)
endif()

if(JSONTOOLKIT_EXTENSION_ALTERSCHEMA)
if(SOURCEMETA_CORE_EXTENSION_ALTERSCHEMA)
add_subdirectory(src/extension/alterschema)
endif()

if(JSONTOOLKIT_ADDRESS_SANITIZER)
if(SOURCEMETA_CORE_ADDRESS_SANITIZER)
noa_sanitizer(TYPE address)
elseif(JSONTOOLKIT_UNDEFINED_SANITIZER)
elseif(SOURCEMETA_CORE_UNDEFINED_SANITIZER)
noa_sanitizer(TYPE undefined)
endif()

if(JSONTOOLKIT_DOCS)
if(SOURCEMETA_CORE_DOCS)
noa_target_doxygen(CONFIG "${PROJECT_SOURCE_DIR}/doxygen/Doxyfile.in"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/website")
endif()
Expand All @@ -95,50 +93,50 @@ if(PROJECT_IS_TOP_LEVEL)
endif()

# Testing
if(JSONTOOLKIT_TESTS)
if(SOURCEMETA_CORE_TESTS)
enable_testing()

if(JSONTOOLKIT_CORE_REGEX)
if(SOURCEMETA_CORE_REGEX)
add_subdirectory(test/regex)
endif()

if(JSONTOOLKIT_CORE_URI)
if(SOURCEMETA_CORE_URI)
add_subdirectory(test/uri)
endif()

if(JSONTOOLKIT_CORE_JSON)
if(SOURCEMETA_CORE_JSON)
add_subdirectory(test/json)
endif()

if(JSONTOOLKIT_CORE_JSONPOINTER)
if(SOURCEMETA_CORE_JSONPOINTER)
add_subdirectory(test/jsonpointer)
endif()

if(JSONTOOLKIT_CORE_JSONSCHEMA)
if(SOURCEMETA_CORE_JSONSCHEMA)
add_subdirectory(test/jsonschema)
endif()

if(JSONTOOLKIT_CORE_JSONL)
if(SOURCEMETA_CORE_JSONL)
add_subdirectory(test/jsonl)
endif()

if(JSONTOOLKIT_CORE_YAML)
if(SOURCEMETA_CORE_YAML)
add_subdirectory(test/yaml)
endif()

if(JSONTOOLKIT_EXTENSION_ALTERSCHEMA)
if(SOURCEMETA_CORE_EXTENSION_ALTERSCHEMA)
add_subdirectory(test/alterschema)
endif()

if(PROJECT_IS_TOP_LEVEL)
# Otherwise we need the child project to link
# against the sanitizers too.
if(NOT JSONTOOLKIT_ADDRESS_SANITIZER AND NOT JSONTOOLKIT_UNDEFINED_SANITIZER)
if(NOT SOURCEMETA_CORE_ADDRESS_SANITIZER AND NOT SOURCEMETA_CORE_UNDEFINED_SANITIZER)
add_subdirectory(test/packaging)
endif()
endif()

if(JSONTOOLKIT_BENCHMARK)
if(SOURCEMETA_CORE_BENCHMARK)
add_subdirectory(benchmark)
endif()
endif()
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ configure: .always
$(CMAKE) -S . -B ./build \
-DCMAKE_BUILD_TYPE:STRING=$(PRESET) \
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON \
-DJSONTOOLKIT_TESTS:BOOL=ON \
-DJSONTOOLKIT_BENCHMARK:BOOL=ON \
-DJSONTOOLKIT_DOCS:BOOL=ON \
-DSOURCEMETA_CORE_TESTS:BOOL=ON \
-DSOURCEMETA_CORE_BENCHMARK:BOOL=ON \
-DSOURCEMETA_CORE_DOCS:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=$(SHARED)

compile: .always
Expand All @@ -25,9 +25,9 @@ compile: .always
$(CMAKE) --install ./build --prefix ./build/dist --config $(PRESET) --verbose \
--component sourcemeta_noa_dev
$(CMAKE) --install ./build --prefix ./build/dist --config $(PRESET) --verbose \
--component sourcemeta_jsontoolkit
--component sourcemeta_core
$(CMAKE) --install ./build --prefix ./build/dist --config $(PRESET) --verbose \
--component sourcemeta_jsontoolkit_dev
--component sourcemeta_core_dev

lint: .always
$(CMAKE) --build ./build --config $(PRESET) --target clang_tidy
Expand Down
41 changes: 4 additions & 37 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
![JSON Toolkit](./assets/banner.png)
Sourcemeta Core
===============

JSON Toolkit is a swiss-army knife for [JSON](https://www.json.org) programming
in modern C++. It comes with a built-in parser and growing support for
standards such as [JSON Schema](http://json-schema.org), [JSON
Pointer](https://www.rfc-editor.org/rfc/rfc6901),
[JSONL](https://jsonlines.org), and more. For example:

```cpp
#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonpointer.h>

#include <sstream>
#include <iostream>
#include <stdlib>
#include <utility>

auto main() -> int {
// Parsing a JSON document from a string
auto document{sourcemeta::jsontoolkit::parse(R"JSON({
"name": "John Doe",
"age": 20,
"address": "14 Manchester Road, Coventry CV77 1XN"
})JSON")};

// Updating a property using JSON Pointer
const sourcemeta::jsontoolkit::Pointer pointer{"name"};
sourcemeta::jsontoolkit::JSON new_value{"Jane Doe"};
sourcemeta::jsontoolkit::set(document, pointer, std::move(new_value));

// Pretty-print result
sourcemeta::jsontoolkit::prettify(document, std::cout);
std::cout << "\n";

return EXIT_SUCCESS;
}
```
This project implements a set of foundational C++ libraries to power Sourcemeta projects.

Documentation
-------------

Refer to the project website for documentation:
[https://jsontoolkit.sourcemeta.com](https://jsontoolkit.sourcemeta.com).
[https://core.sourcemeta.com](https://core.sourcemeta.com).
Binary file removed assets/banner.png
Binary file not shown.
Loading

0 comments on commit 82d2aae

Please sign in to comment.