diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 09c6722..a95db73 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -20,6 +20,10 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 + - name: Install dependencies + run: | + pip install -r docs/requirements.txt + - name: Debugging information run: | echo "github.ref:" ${{github.ref}} @@ -42,10 +46,6 @@ jobs: ( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages rm -rf _gh-pages/.git/ - - name: Install dependencies - run: | - pip install -r docs/requirements.txt - - name: Build documentation run: | cd docs diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml new file mode 100644 index 0000000..9e9bc0e --- /dev/null +++ b/.github/workflows/mac.yml @@ -0,0 +1,86 @@ +name: Mac + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + xcode_macos_12: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: macos-12 + strategy: + matrix: + # all available versions of xcode: https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#xcode + xcode: ['13.1', '14.1'] + build_type: [Debug, Release] + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer + + steps: + - uses: actions/checkout@v3 + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build + run: cmake --build build --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10 + + xcode_macos_13: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: macos-13 + strategy: + matrix: + # all available versions of xcode: https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode + xcode: ['14.1', '15.0'] + build_type: [Debug, Release] + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer + + steps: + - uses: actions/checkout@v3 + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build + run: cmake --build build --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10 + + macos_lateset: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: macos-latest + strategy: + matrix: + compiler: + - { cpp: g++-11, c: gcc-11} + - { cpp: g++-12, c: gcc-12} + - { cpp: clang++, c: clang} + build_type: [Debug, Release] + env: + CC: ${{ matrix.compiler.c }} + CXX: ${{ matrix.compiler.cpp }} + + steps: + - uses: actions/checkout@v3 + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build + run: cmake --build build --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10 \ No newline at end of file diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 0000000..64b8179 --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,56 @@ +name: Ubuntu + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + gcc: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + strategy: + matrix: + build_type: [Debug, Release] + env: + CC: gcc + CXX: g++ + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build + run: cmake --build build --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10 + + clang: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + strategy: + matrix: + build_type: [Debug, Release] + env: + CC: clang + CXX: clang++ + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build + run: cmake --build build --verbose + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10 \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..f5564e1 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,31 @@ +name: Windows + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + msvc2022: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: windows-latest + strategy: + matrix: + build_type: [Release] + architecture: [Win32, x64] + + steps: + - uses: actions/checkout@v3 + - name: Run CMake + run: cmake -S . -B build -A ${{ matrix.architecture }} + if: matrix.build_type == 'Release' + - name: Run CMake + run: cmake -S . -B build -A ${{ matrix.architecture }} + if: matrix.build_type == 'Debug' + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4f8931c..3badfec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store docs/build +build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7bf196d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,51 @@ +################################################################################ +# Preamble +cmake_minimum_required(VERSION 3.21) + +project( + mechanism_configuration + VERSION 1.0.0 + LANGUAGES CXX +) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif() + +message(STATUS "CMake build configuration for ${PROJECT_NAME} (${CMAKE_BUILD_TYPE}) ${PROJECT_VERSION}") + +################################################################################ +# Projet wide setup options + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake") + +option(ENABLE_TESTS "Build the tests" ON) + +################################################################################ +# Dependencies + +include(cmake/dependencies.cmake) + +################################################################################ +# micm targets and documentation + +add_subdirectory(src) + +################################################################################ +# Tests + +if(PROJECT_IS_TOP_LEVEL AND ENABLE_TESTS) + enable_testing() + add_subdirectory(test) +endif() + +################################################################################ +# Packaging + +# only include packaging if we are the top level project being built +if(PROJECT_IS_TOP_LEVEL) + add_subdirectory(packaging) +endif() diff --git a/README.md b/README.md index bb13199..27b88c8 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,12 @@ An attempt at defining a model-independent configuration schema for atmospheric [![GitHub Releases](https://img.shields.io/github/release/open-atmos/MechanismConfiguration.svg)](https://github.com/open-atmos/MechanismConfiguration/releases) [![License](https://img.shields.io/github/license/open-atmos/MechanismConfiguration.svg)](https://github.com/open-atmos/MechanismConfiguration/blob/master/LICENSE) -[![Builds](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/gh-pages.yml) +[![Docs build](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/gh-pages.yml) +[![Windows](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/windows.yml/badge.svg)](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/windows.yml) +[![Mac](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/mac.yml/badge.svg)](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/mac.yml) +[![Ubuntu](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/open-atmos/MechanismConfiguration/actions/workflows/ubuntu.yml) -Copyright (C) 2017–2023 Barcelona Supercomputing Center, University of Illinois at Urbana–Champaign, and National Center for Atmospheric Research +Copyright (C) 2017–2024 Barcelona Supercomputing Center, University of Illinois at Urbana–Champaign, and National Center for Atmospheric Research The configuration documentation can be found [here](https://open-atmos.github.io/MechanismConfiguration/). diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 0000000..1fd04b5 --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,37 @@ +# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake + +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif() + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif() + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach() + +set(uninstall_dirs "@INSTALL_PREFIX@;@cmake_config_install_location@") + +foreach(dir IN LISTS uninstall_dirs) + message(STATUS "Uninstalling ${dir}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove_directory ${dir}" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing ${dir}") + endif() +endforeach() diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake new file mode 100644 index 0000000..16a7188 --- /dev/null +++ b/cmake/dependencies.cmake @@ -0,0 +1,25 @@ +include(FetchContent) + +################################################################################ +# google test + +if(PROJECT_IS_TOP_LEVEL AND ENABLE_TESTS) + FetchContent_Declare(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.14.0 + ) + + set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) + set(BUILD_GMOCK OFF CACHE BOOL "" FORCE) + + FetchContent_MakeAvailable(googletest) +endif() + +################################################################################ +# nlohmann::json + +FetchContent_Declare(json + GIT_REPOSITORY https://github.com/nlohmann/json.git + GIT_TAG v3.11.2 +) +FetchContent_MakeAvailable(json) \ No newline at end of file diff --git a/cmake/mechanism_configurationConfig.cmake.in b/cmake/mechanism_configurationConfig.cmake.in new file mode 100644 index 0000000..3cc6a43 --- /dev/null +++ b/cmake/mechanism_configurationConfig.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Exports.cmake") + +check_required_components("@PROJECT_NAME@") \ No newline at end of file diff --git a/cmake/test_util.cmake b/cmake/test_util.cmake new file mode 100644 index 0000000..359a655 --- /dev/null +++ b/cmake/test_util.cmake @@ -0,0 +1,38 @@ +################################################################################ +# build and add a standard test + +function(create_standard_test) + set(prefix TEST) + set(optionalValues SKIP_MEMCHECK) + set(singleValues NAME WORKING_DIRECTORY) + set(multiValues SOURCES LIBRARIES) + + include(CMakeParseArguments) + cmake_parse_arguments(${prefix} "${optionalValues}" "${singleValues}" "${multiValues}" ${ARGN}) + + add_executable(test_${TEST_NAME} ${TEST_SOURCES}) + + target_link_libraries(test_${TEST_NAME} PUBLIC open_atmos::mechanism_configuration GTest::gtest_main) + + # link additional libraries + foreach(library ${TEST_LIBRARIES}) + target_link_libraries(test_${TEST_NAME} PUBLIC ${library}) + endforeach() + + if(NOT DEFINED TEST_WORKING_DIRECTORY) + set(TEST_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") + endif() + + add_open_atmos_test(${TEST_NAME} test_${TEST_NAME} "" ${TEST_WORKING_DIRECTORY}) +endfunction(create_standard_test) + +################################################################################ +# Add a test + +function(add_open_atmos_test test_name test_binary test_args working_dir) + add_test(NAME ${test_name} + COMMAND ${test_binary} ${test_args} + WORKING_DIRECTORY ${working_dir}) +endfunction(add_open_atmos_test) + +################################################################################ diff --git a/docs/requirements.txt b/docs/requirements.txt index 2e6b319..9da9b83 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,5 @@ pydata-sphinx-theme +setuptools sphinx sphinx-design sphinx-tabs diff --git a/include/open_atmos/mechanism_configuration/parser.hpp b/include/open_atmos/mechanism_configuration/parser.hpp new file mode 100644 index 0000000..d3f0645 --- /dev/null +++ b/include/open_atmos/mechanism_configuration/parser.hpp @@ -0,0 +1,99 @@ +// Copyright (C) 2023-2024 National Center for Atmospheric Research, University of Illinois at Urbana-Champaign +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include +#include +#include + +namespace open_atmos +{ + namespace mechanism_configuration + { + enum class ConfigParseStatus + { + Success, + None, + InvalidKey, + UnknownKey, + InvalidCAMPFilePath, + NoConfigFilesFound, + CAMPFilesSectionNotFound, + CAMPDataSectionNotFound, + InvalidSpecies, + InvalidMechanism, + ObjectTypeNotFound, + RequiredKeyNotFound, + ContainsNonStandardKey, + MutuallyExclusiveOption + }; + + constexpr double MolesM3ToMoleculesCm3 = 1.0e-6 * 6.02214076e23; + + inline std::string configParseStatusToString(const ConfigParseStatus &status) + { + switch (status) + { + case ConfigParseStatus::Success: + return "Success"; + case ConfigParseStatus::None: + return "None"; + case ConfigParseStatus::InvalidKey: + return "InvalidKey"; + case ConfigParseStatus::UnknownKey: + return "UnknownKey"; + case ConfigParseStatus::InvalidCAMPFilePath: + return "InvalidCAMPFilePath"; + case ConfigParseStatus::NoConfigFilesFound: + return "NoConfigFilesFound"; + case ConfigParseStatus::CAMPFilesSectionNotFound: + return "CAMPFilesSectionNotFound"; + case ConfigParseStatus::CAMPDataSectionNotFound: + return "CAMPDataSectionNotFound"; + case ConfigParseStatus::InvalidSpecies: + return "InvalidSpecies"; + case ConfigParseStatus::InvalidMechanism: + return "InvalidMechanism"; + case ConfigParseStatus::ObjectTypeNotFound: + return "ObjectTypeNotFound"; + case ConfigParseStatus::RequiredKeyNotFound: + return "RequiredKeyNotFound"; + case ConfigParseStatus::ContainsNonStandardKey: + return "ContainsNonStandardKey"; + case ConfigParseStatus::MutuallyExclusiveOption: + return "MutuallyExclusiveOption"; + default: + return "Unknown"; + } + } + + class JsonReaderPolicy + { + public: + + /// @brief Parse configures + /// @param config_path Path to a the CAMP configuration directory or file + /// @return True for successful parsing + ConfigParseStatus Parse(const std::filesystem::path &config_path); + + private: + }; + + /// @brief Public interface to read and parse config + template + class ConfigurationReader : public ConfigTypePolicy + { + public: + /// @brief Reads and parses configures + /// @param config_dir Path to a the configuration directory + /// @return an enum indicating the success or failure of the parse + [[nodiscard]] ConfigParseStatus ReadAndParse(const std::filesystem::path &config_dir) + { + return this->Parse(config_dir); + } + }; + } +} diff --git a/include/open_atmos/mechanism_configuration/version.hpp b/include/open_atmos/mechanism_configuration/version.hpp new file mode 100644 index 0000000..af59680 --- /dev/null +++ b/include/open_atmos/mechanism_configuration/version.hpp @@ -0,0 +1,37 @@ +// clang-format off +#pragma once + +#ifdef __cplusplus +namespace open_atmos +{ + namespace mechanism_configuration + { +extern "C" { +#endif + + const char* getmechanism_configurationVersion() + { + return "1.0.0"; + } + unsigned getVersionMajor() + { + return 1; + } + unsigned getVersionMinor() + { + return 0+0; + } + unsigned getVersionPatch() + { + return 0+0; + } + unsigned getVersionTweak() + { + return +0; + } + +#ifdef __cplusplus +} +} +} +#endif diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt new file mode 100644 index 0000000..a091cd0 --- /dev/null +++ b/packaging/CMakeLists.txt @@ -0,0 +1,71 @@ +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) +set(INSTALL_PREFIX "mechanism_configuration-${PROJECT_VERSION}" ) + +install( + TARGETS + mechanism_configuration + EXPORT + mechanism_configuration_Exports + LIBRARY DESTINATION ${INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} +) + +install( + DIRECTORY + ${PROJECT_SOURCE_DIR}/include/open_atmos + DESTINATION + ${INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} +) + + +install(TARGETS nlohmann_json EXPORT mechanism_configuration_Exports) + +# install the cmake config files +set(cmake_config_install_location ${INSTALL_PREFIX}/cmake) + +install( + EXPORT + mechanism_configuration_Exports + DESTINATION + ${cmake_config_install_location} + NAMESPACE open_atmos:: +) + +configure_package_config_file( + "${PROJECT_SOURCE_DIR}/cmake/mechanism_configurationConfig.cmake.in" + "${PROJECT_BINARY_DIR}/mechanism_configurationConfig.cmake" + INSTALL_DESTINATION + ${cmake_config_install_location} +) + +write_basic_package_version_file( + "${PROJECT_BINARY_DIR}/mechanism_configurationConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion +) + +install( + FILES + ${PROJECT_BINARY_DIR}/mechanism_configurationConfig.cmake + ${PROJECT_BINARY_DIR}/mechanism_configurationConfigVersion.cmake + DESTINATION + ${cmake_config_install_location} +) + +###################################################################### +# uninstall target + +# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake +if(NOT TARGET uninstall) + configure_file( + "${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..186904e --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,21 @@ +################################################################################ +# version +configure_file(version.hpp.in ${PROJECT_SOURCE_DIR}/include/open_atmos/mechanism_configuration/version.hpp @ONLY) + +add_library(mechanism_configuration) +add_library(open_atmos::mechanism_configuration ALIAS mechanism_configuration) + +target_compile_features(mechanism_configuration PUBLIC cxx_std_20) + +target_sources(mechanism_configuration + PRIVATE + parser.cpp +) + +target_include_directories(mechanism_configuration + PUBLIC + $ + $ +) + +target_link_libraries(mechanism_configuration PRIVATE nlohmann_json::nlohmann_json) \ No newline at end of file diff --git a/src/parser.cpp b/src/parser.cpp new file mode 100644 index 0000000..652d998 --- /dev/null +++ b/src/parser.cpp @@ -0,0 +1,19 @@ +// Copyright (C) 2023-2024 National Center for Atmospheric Research, University of Illinois at Urbana-Champaign +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +namespace open_atmos +{ + namespace mechanism_configuration + { + // explicit template instanatiation + template class ConfigurationReader; + + ConfigParseStatus JsonReaderPolicy::Parse(const std::filesystem::path &config_path) { + return ConfigParseStatus::Success; + } + } +} \ No newline at end of file diff --git a/src/version.hpp.in b/src/version.hpp.in new file mode 100644 index 0000000..2948896 --- /dev/null +++ b/src/version.hpp.in @@ -0,0 +1,37 @@ +// clang-format off +#pragma once + +#ifdef __cplusplus +namespace open_atmos +{ + namespace mechanism_configuration + { +extern "C" { +#endif + + const char* getmechanism_configurationVersion() + { + return "@mechanism_configuration_VERSION@"; + } + unsigned getVersionMajor() + { + return @mechanism_configuration_VERSION_MAJOR@; + } + unsigned getVersionMinor() + { + return @mechanism_configuration_VERSION_MINOR@+0; + } + unsigned getVersionPatch() + { + return @mechanism_configuration_VERSION_PATCH@+0; + } + unsigned getVersionTweak() + { + return @mechanism_configuration_VERSION_TWEAK@+0; + } + +#ifdef __cplusplus +} +} +} +#endif \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..059f2a2 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(unit) \ No newline at end of file diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 0000000..3fc656b --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,15 @@ +################################################################################ +# Test utilities + +include(test_util) + +################################################################################ +# Tests + +create_standard_test(NAME parser SOURCES test_parser.cpp) + +################################################################################ +# Copy test data + +add_custom_target(copy_unit_test_configs ALL ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/unit_configs ${CMAKE_BINARY_DIR}/unit_configs) \ No newline at end of file diff --git a/test/unit/test_parser.cpp b/test/unit/test_parser.cpp new file mode 100644 index 0000000..b5b9873 --- /dev/null +++ b/test/unit/test_parser.cpp @@ -0,0 +1,10 @@ +#include + +#include + +using namespace open_atmos::mechanism_configuration; + +TEST(Parser, Returns) +{ + ConfigurationReader reader; +} \ No newline at end of file diff --git a/test/unit/unit_configs/.gitkeep b/test/unit/unit_configs/.gitkeep new file mode 100644 index 0000000..e69de29