Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/website-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DSOURCEMETA_CORE_LANG_PREPROCESSOR:BOOL=OFF
-DSOURCEMETA_CORE_LANG_IO:BOOL=OFF
-DSOURCEMETA_CORE_LANG_PROCESS:BOOL=OFF
-DSOURCEMETA_CORE_LANG_PARALLEL:BOOL=OFF
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/website-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DSOURCEMETA_CORE_LANG_PREPROCESSOR:BOOL=OFF
-DSOURCEMETA_CORE_LANG_IO:BOOL=OFF
-DSOURCEMETA_CORE_LANG_PROCESS:BOOL=OFF
-DSOURCEMETA_CORE_LANG_PARALLEL:BOOL=OFF
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(core VERSION 0.0.0 LANGUAGES C CXX ASM_MASM DESCRIPTION "Sourcemeta Core
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

# Options
option(SOURCEMETA_CORE_LANG_PREPROCESSOR "Build the Sourcemeta Core language preprocessor library" ON)
option(SOURCEMETA_CORE_LANG_IO "Build the Sourcemeta Core language I/O library" ON)
option(SOURCEMETA_CORE_LANG_PROCESS "Build the Sourcemeta Core language Process library" ON)
option(SOURCEMETA_CORE_LANG_PARALLEL "Build the Sourcemeta Core language parallel library" ON)
Expand Down Expand Up @@ -58,6 +59,10 @@ if(SOURCEMETA_CORE_INSTALL)
COMPONENT sourcemeta_${PROJECT_NAME}_dev)
endif()

if(SOURCEMETA_CORE_LANG_PREPROCESSOR)
Comment thread
jviotti marked this conversation as resolved.
add_subdirectory(src/lang/preprocessor)
endif()

if(SOURCEMETA_CORE_LANG_IO)
add_subdirectory(src/lang/io)
endif()
Expand Down
7 changes: 6 additions & 1 deletion config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
list(APPEND SOURCEMETA_CORE_COMPONENTS ${Core_FIND_COMPONENTS})
list(APPEND SOURCEMETA_CORE_COMPONENTS ${core_FIND_COMPONENTS})
if(NOT SOURCEMETA_CORE_COMPONENTS)
list(APPEND SOURCEMETA_CORE_COMPONENTS preprocessor)
list(APPEND SOURCEMETA_CORE_COMPONENTS io)
list(APPEND SOURCEMETA_CORE_COMPONENTS process)
list(APPEND SOURCEMETA_CORE_COMPONENTS parallel)
Expand All @@ -29,14 +30,17 @@ endif()
include(CMakeFindDependencyMacro)

foreach(component ${SOURCEMETA_CORE_COMPONENTS})
if(component STREQUAL "io")
if(component STREQUAL "preprocessor")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_preprocessor.cmake")
elseif(component STREQUAL "io")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_io.cmake")
elseif(component STREQUAL "process")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_process.cmake")
elseif(component STREQUAL "parallel")
find_dependency(Threads)
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_parallel.cmake")
elseif(component STREQUAL "numeric")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_preprocessor.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_numeric.cmake")
elseif(component STREQUAL "unicode")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_unicode.cmake")
Expand All @@ -59,6 +63,7 @@ foreach(component ${SOURCEMETA_CORE_COMPONENTS})
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_io.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_uritemplate.cmake")
elseif(component STREQUAL "json")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_preprocessor.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_numeric.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_io.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sourcemeta_core_unicode.cmake")
Expand Down
1 change: 1 addition & 0 deletions src/core/json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ endif()
target_link_libraries(sourcemeta_core_json PRIVATE sourcemeta::core::io)
target_link_libraries(sourcemeta_core_json PRIVATE sourcemeta::core::unicode)
target_link_libraries(sourcemeta_core_json PUBLIC sourcemeta::core::numeric)
target_link_libraries(sourcemeta_core_json PUBLIC sourcemeta::core::preprocessor)
12 changes: 10 additions & 2 deletions src/core/json/include/sourcemeta/core/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <sourcemeta/core/json_value.h>
// NOLINTEND(misc-include-cleaner)

#include <sourcemeta/core/preprocessor.h>

#include <cstdint> // std::uint64_t
#include <filesystem> // std::filesystem
#include <fstream> // std::basic_ifstream
Expand Down Expand Up @@ -228,8 +230,14 @@ auto operator<<(std::basic_ostream<JSON::Char, JSON::CharTraits> &stream,
/// {sourcemeta::core::JSON::Type::Object,
/// sourcemeta::core::JSON::Type::Array});
/// ```
SOURCEMETA_CORE_JSON_EXPORT
auto make_set(std::initializer_list<JSON::Type> types) -> JSON::TypeSet;
SOURCEMETA_FORCEINLINE inline auto
make_set(std::initializer_list<JSON::Type> types) -> JSON::TypeSet {
JSON::TypeSet result;
for (const auto type : types) {
result.set(static_cast<std::size_t>(type));
}
return result;
}

} // namespace sourcemeta::core

Expand Down
Loading