summaryrefslogtreecommitdiff
path: root/tomlplusplus/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'tomlplusplus/src/modules')
-rw-r--r--tomlplusplus/src/modules/CMakeLists.txt44
-rw-r--r--tomlplusplus/src/modules/tomlplusplus.cppm88
2 files changed, 132 insertions, 0 deletions
diff --git a/tomlplusplus/src/modules/CMakeLists.txt b/tomlplusplus/src/modules/CMakeLists.txt
new file mode 100644
index 0000000000..5315390175
--- /dev/null
+++ b/tomlplusplus/src/modules/CMakeLists.txt
@@ -0,0 +1,44 @@
+file(GLOB_RECURSE TOMLPLUSPLUS_MODULES *.cppm)
+
+add_library(tomlplusplus_modules)
+target_sources(tomlplusplus_modules
+ PUBLIC
+ FILE_SET CXX_MODULES FILES
+ ${TOMLPLUSPLUS_MODULES}
+)
+
+cmake_minimum_required(VERSION 3.28)
+
+if(NOT COMMAND configure_cpp_module_target)
+ function(configure_cpp_module_target target)
+ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
+ target_sources(${target} PUBLIC FILE_SET CXX_MODULES FILES ${TOMLPLUSPLUS_MODULES})
+ else()
+ message(WARNING "C++ modules require CMake 3.28+. Using standard compilation.")
+ target_sources(${target} PRIVATE ${TOMLPLUSPLUS_MODULES})
+ endif()
+ endfunction()
+endif()
+
+configure_cpp_module_target(tomlplusplus_modules)
+
+target_link_libraries(tomlplusplus_modules
+ PUBLIC
+ tomlplusplus::tomlplusplus
+)
+
+target_include_directories(tomlplusplus_modules
+ PRIVATE
+ ${tomlplusplus_SOURCE_DIR}/include
+)
+
+target_compile_features(tomlplusplus_modules PUBLIC cxx_std_20)
+
+if(TOMLPLUSPLUS_ENABLE_INSTALL)
+ install(TARGETS tomlplusplus_modules
+ EXPORT tomlplusplus-targets
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tomlplusplus/modules
+ )
+endif()
diff --git a/tomlplusplus/src/modules/tomlplusplus.cppm b/tomlplusplus/src/modules/tomlplusplus.cppm
new file mode 100644
index 0000000000..e1860c4878
--- /dev/null
+++ b/tomlplusplus/src/modules/tomlplusplus.cppm
@@ -0,0 +1,88 @@
+/**
+ * @file tomlpp.cppm
+ * @brief File containing the module declaration for toml++.
+ */
+
+module;
+
+#define TOML_UNDEF_MACROS 0
+#include <toml++/toml.hpp>
+
+export module tomlplusplus;
+
+/**
+ * @namespace toml
+ * @brief The toml++ namespace toml::
+ */
+export namespace toml {
+ /**
+ * @namespace literals
+ * @brief The toml++ namespace toml::literals::
+ */
+ inline namespace literals {
+ using TOML_NAMESPACE::literals::operator""_toml;
+ using TOML_NAMESPACE::literals::operator""_tpath;
+ }
+
+ using TOML_NAMESPACE::array;
+ using TOML_NAMESPACE::date;
+ using TOML_NAMESPACE::date_time;
+ using TOML_NAMESPACE::inserter;
+ using TOML_NAMESPACE::json_formatter;
+ using TOML_NAMESPACE::key;
+ using TOML_NAMESPACE::node;
+ using TOML_NAMESPACE::node_view;
+ using TOML_NAMESPACE::parse_error;
+ using TOML_NAMESPACE::parse_result;
+ using TOML_NAMESPACE::path;
+ using TOML_NAMESPACE::path_component;
+ using TOML_NAMESPACE::source_position;
+ using TOML_NAMESPACE::source_region;
+ using TOML_NAMESPACE::table;
+ using TOML_NAMESPACE::time;
+ using TOML_NAMESPACE::time_offset;
+ using TOML_NAMESPACE::toml_formatter;
+ using TOML_NAMESPACE::value;
+ using TOML_NAMESPACE::yaml_formatter;
+ using TOML_NAMESPACE::format_flags;
+ using TOML_NAMESPACE::node_type;
+ using TOML_NAMESPACE::path_component_type;
+ using TOML_NAMESPACE::value_flags;
+ using TOML_NAMESPACE::array_iterator;
+ using TOML_NAMESPACE::const_array_iterator;
+ using TOML_NAMESPACE::const_table_iterator;
+ using TOML_NAMESPACE::default_formatter;
+ using TOML_NAMESPACE::inserted_type_of;
+ using TOML_NAMESPACE::optional;
+ using TOML_NAMESPACE::source_index;
+ using TOML_NAMESPACE::source_path_ptr;
+ using TOML_NAMESPACE::table_iterator;
+
+ using TOML_NAMESPACE::at_path;
+ using TOML_NAMESPACE::get_line;
+ using TOML_NAMESPACE::operator""_toml;
+ using TOML_NAMESPACE::operator""_tpath;
+ using TOML_NAMESPACE::operator<<;
+ using TOML_NAMESPACE::parse;
+ using TOML_NAMESPACE::parse_file;
+
+ using TOML_NAMESPACE::is_array;
+ using TOML_NAMESPACE::is_boolean;
+ using TOML_NAMESPACE::is_chronological;
+ using TOML_NAMESPACE::is_container;
+ using TOML_NAMESPACE::is_date;
+ using TOML_NAMESPACE::is_date_time;
+ using TOML_NAMESPACE::is_floating_point;
+ using TOML_NAMESPACE::is_integer;
+ using TOML_NAMESPACE::is_key;
+ using TOML_NAMESPACE::is_key_or_convertible;
+ using TOML_NAMESPACE::is_node;
+ using TOML_NAMESPACE::is_node_view;
+ using TOML_NAMESPACE::is_number;
+ using TOML_NAMESPACE::is_string;
+ using TOML_NAMESPACE::is_table;
+ using TOML_NAMESPACE::is_time;
+ using TOML_NAMESPACE::is_value;
+
+ using TOML_NAMESPACE::preserve_source_value_flags;
+}