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 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'], diff --git a/src/config/public/config.h b/src/config/public/config.h index 0e73436..ed2f5b1 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 @@ -28,7 +27,6 @@ #include #include #include -#include // Required for YAML parsing #include "yaml-cpp/yaml.h" @@ -162,7 +160,12 @@ public: template T get(const std::string &key, T defaultValue) { if (!m_loaded) { - throw std::runtime_error("Configuration file not loaded! This should be done at the very start of whatever main function you are using (and only done once!)"); +// 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()) { @@ -241,5 +244,3 @@ public: } // namespace config } // namespace serif - -#endif