From 50e4739c8c19f09475bead185cd0e2ae99c571b5 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Wed, 30 Apr 2025 11:41:10 -0400 Subject: [PATCH 1/4] feat(python-composition): added composition module interface --- build-config/yaml-cpp/meson.build | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build-config/yaml-cpp/meson.build b/build-config/yaml-cpp/meson.build index 27c9332..8a81a82 100644 --- a/build-config/yaml-cpp/meson.build +++ b/build-config/yaml-cpp/meson.build @@ -1,10 +1,11 @@ yaml_cpp_cmake_options = cmake.subproject_options() yaml_cpp_cmake_options.add_cmake_defines({ - 'CMAKE_POLICY_VERSION_MINIMUM': '3.5' + 'CMAKE_POLICY_VERSION_MINIMUM': '3.5', + 'BUILD_SHARED_LIBS': 'ON', + 'CMAKE_SKIP_INSTALL_RULES': 'ON' }) yaml_cpp_sp = cmake.subproject( 'yaml-cpp', options: yaml_cpp_cmake_options, ) -yaml_cpp_dep = yaml_cpp_sp.dependency('yaml-cpp') -add_project_arguments('-I' + meson.current_build_dir() + '/subprojects/yaml-cpp/__CMake_build', language: 'cpp') \ No newline at end of file +yaml_cpp_dep = yaml_cpp_sp.dependency('yaml-cpp') \ No newline at end of file From 4fcbcb1d176deb612e220aeead8530e5144b9205 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Wed, 30 Apr 2025 11:44:53 -0400 Subject: [PATCH 2/4] build(meson): switched almost all intermediate targets to shared libraries --- src/config/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/meson.build b/src/config/meson.build index 289b086..f51e06c 100644 --- a/src/config/meson.build +++ b/src/config/meson.build @@ -8,7 +8,7 @@ config_headers = files( ) # Define the libconfig library so it can be linked against by other parts of the build system -libconfig = static_library('config', +libconfig = library('config', config_sources, include_directories: include_directories('public'), cpp_args: ['-fvisibility=default'], From 453d7a8044353af1473df0c1ef2652c5da620765 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Wed, 30 Apr 2025 11:48:38 -0400 Subject: [PATCH 3/4] build(config): added compile time option to disable config file load error In general we may want to enforce that a config file is explicitly loaded before any access is requested. However, there are times when this is non ideal behavior. We introduce a compile time flag (CONFIG_HARSH, and CONFIG_WARN). If config hars is defined then a runtime error will be thrown if a config value is requested before the config file has been loaded. If Config warn is defined (and config harsh is not) then a warning will be printed, otherwise nothing will happen. If either warn or nothing is defined this means that the default values defined in the get methods will be used. Note that the meson build system has had an option added -Dconfig_error_handling=["none", "warn", "harsh"] (default="none") which can be used to manage these compile time options. In general release builds should have this disabled while debug builts should have it set to harsh. --- src/config/public/config.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/public/config.h b/src/config/public/config.h index be33163..33a901c 100644 --- a/src/config/public/config.h +++ b/src/config/public/config.h @@ -156,7 +156,12 @@ public: template T get(const std::string &key, T defaultValue) { if (!m_loaded) { - throw std::runtime_error("Error! Config file not loaded"); +// ONLY THROW ERROR IF HARSH OR WARN CONFIGURATION +#if defined(CONFIG_HARSH) + throw std::runtime_error("Error! Config file not loaded. To disable this error, recompile with CONFIG_HARSH=0"); +#elif defined(CONFIG_WARN) + std::cerr << "Warning! Config file not loaded. This instance of 4DSSE was compiled with CONFIG_WARN so the code will continue using only default values" << std::endl; +#endif } // --- Check if the key has already been checked for existence if (std::find(unknownKeys.begin(), unknownKeys.end(), key) != unknownKeys.end()) { From b95f2e13ae93b4a441ec3e62a5d5a578bd67fc90 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 5 May 2025 14:36:16 -0400 Subject: [PATCH 4/4] refactor(config): header guard -> pragma once --- src/config/public/config.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/config/public/config.h b/src/config/public/config.h index 33a901c..3f0c8fe 100644 --- a/src/config/public/config.h +++ b/src/config/public/config.h @@ -18,8 +18,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // *********************************************************************** */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include #include @@ -134,12 +133,6 @@ public: */ bool loadConfig(const std::string& configFilePath); - /** - * @brief Get the input table from the configuration. - * @return Input table as a string. - */ - std::string getInputTable() const; - /** * @brief Get a configuration value by key. * @tparam T Type of the value to retrieve. @@ -234,8 +227,6 @@ public: // Setup gTest class as a friend friend class configTestPrivateAccessor; - // -- Resource Manager is a friend of config so it can create a seperate instance + // --- Resource Manager is a friend of config so it can create a separate instance friend class ResourceManager; }; - -#endif \ No newline at end of file