diff --git a/cmake/xo_expression2Config.cmake.in b/cmake/xo_expression2Config.cmake.in index d48c29a4..c8cfbcad 100644 --- a/cmake/xo_expression2Config.cmake.in +++ b/cmake/xo_expression2Config.cmake.in @@ -11,6 +11,7 @@ find_dependency(reflect) find_dependency(xo_object2) find_dependency(xo_printable2) find_dependency(xo_flatstring) +find_dependency(cmake) find_dependency(indentlog) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/include/xo/expression2/init_expression2.hpp b/include/xo/expression2/init_expression2.hpp new file mode 100644 index 00000000..c5e290a8 --- /dev/null +++ b/include/xo/expression2/init_expression2.hpp @@ -0,0 +1,21 @@ +/** @file init_expression2.hpp +* + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include + +namespace xo { + /* tag to represent the xo-expression2/ subsystem within ordered initialization */ + enum S_expression2_tag {}; + + template <> + struct InitSubsys { + static void init(); + static InitEvidence require(); + }; +} /*namespace xo*/ + +/* end init_expression2.hpp */ diff --git a/src/expression2/CMakeLists.txt b/src/expression2/CMakeLists.txt index 41700e9c..8ddedb9c 100644 --- a/src/expression2/CMakeLists.txt +++ b/src/expression2/CMakeLists.txt @@ -2,13 +2,16 @@ set(SELF_LIB xo_expression2) set(SELF_SRCS + init_expression2.cpp DConstant.cpp TypeRef.cpp IExpression_Any.cpp IExpression_DConstant.cpp StringTable.cpp DUniqueString.cpp + IGCObject_DUniqueString.cpp expression2_register_facets.cpp + expression2_register_types.cpp ) xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) @@ -18,4 +21,5 @@ xo_dependency(${SELF_LIB} reflect) xo_dependency(${SELF_LIB} xo_object2) xo_dependency(${SELF_LIB} xo_printable2) xo_dependency(${SELF_LIB} xo_flatstring) +xo_dependency(${SELF_LIB} subsys) xo_dependency(${SELF_LIB} indentlog) diff --git a/src/expression2/init_expression2.cpp b/src/expression2/init_expression2.cpp new file mode 100644 index 00000000..e975ef99 --- /dev/null +++ b/src/expression2/init_expression2.cpp @@ -0,0 +1,41 @@ +/** @file init_expression2.cpp +* + * @author Roland Conybeare, Jan 2026 + **/ + +#include "init_expression2.hpp" +#include "expression2_register_facets.hpp" +#include "expression2_register_types.hpp" + +#include +#include + +namespace xo { + using xo::scm::expression2_register_facets; + using xo::scm::expression2_register_types; + using xo::mm::CollectorTypeRegistry; + + void + InitSubsys::init() + { + expression2_register_facets(); + + CollectorTypeRegistry::instance().register_types(&expression2_register_types); + } + + InitEvidence + InitSubsys::require() + { + InitEvidence retval; + + /* direct subsystem deps for xo-object2/ */ + retval ^= InitSubsys::require(); + + /* xo-expression2/'s own initialization code */ + retval ^= Subsystem::provide("expression2", &init); + + return retval; + } +} /*namespace xo*/ + +/* end init_expression2.cpp */ diff --git a/utest/expression2_utest_main.cpp b/utest/expression2_utest_main.cpp index e13405df..004d2598 100644 --- a/utest/expression2_utest_main.cpp +++ b/utest/expression2_utest_main.cpp @@ -1,6 +1,24 @@ /* file expression2_utest_main.cpp */ -#define CATCH_CONFIG_MAIN +#include + +#define CATCH_CONFIG_RUNNER #include "catch2/catch.hpp" +int +main(int argc, char* argv[]) +{ + using xo::Subsystem; + + // Your custom initialization code here + Subsystem::initialize_all(); + + // Run Catch2's test session + int result = Catch::Session().run(argc, argv); + + // cleanup here, if any + + return result; +} + /* end expression2_utest_main.cpp */