From 7bc653304cb1a840db2aae1caef296d5ba5d5241 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Wed, 21 Aug 2019 09:13:19 +0200 Subject: [PATCH] Added InfoLib. --- InfoLib/CMakeInfo.cpp.in | 21 +++++++++++++++++++++ InfoLib/CMakeInfo.h | 25 +++++++++++++++++++++++++ InfoLib/CMakeLists.txt | 15 +++++++++++++++ InfoLib/CompilerInfo.cpp.in | 24 ++++++++++++++++++++++++ InfoLib/CompilerInfo.h | 28 ++++++++++++++++++++++++++++ InfoLib/GitInfo.cpp.in | 22 ++++++++++++++++++++++ InfoLib/GitInfo.h | 26 ++++++++++++++++++++++++++ InfoLib/TestInfo.cpp.in | 24 ++++++++++++++++++++++++ InfoLib/TestInfo.h | 28 ++++++++++++++++++++++++++++ 9 files changed, 213 insertions(+) create mode 100644 InfoLib/CMakeInfo.cpp.in create mode 100644 InfoLib/CMakeInfo.h create mode 100644 InfoLib/CMakeLists.txt create mode 100644 InfoLib/CompilerInfo.cpp.in create mode 100644 InfoLib/CompilerInfo.h create mode 100644 InfoLib/GitInfo.cpp.in create mode 100644 InfoLib/GitInfo.h create mode 100644 InfoLib/TestInfo.cpp.in create mode 100644 InfoLib/TestInfo.h diff --git a/InfoLib/CMakeInfo.cpp.in b/InfoLib/CMakeInfo.cpp.in new file mode 100644 index 00000000000..8adfce5d1a7 --- /dev/null +++ b/InfoLib/CMakeInfo.cpp.in @@ -0,0 +1,21 @@ +/** + * \brief CMake information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "InfoLib/CMakeInfo.h" + +namespace CMakeInfoLib +{ + +namespace CMakeInfo +{ + const std::string cmake_args("@CMAKE_ARGS_ESCAPED@"); +} +} diff --git a/InfoLib/CMakeInfo.h b/InfoLib/CMakeInfo.h new file mode 100644 index 00000000000..31de88a0acc --- /dev/null +++ b/InfoLib/CMakeInfo.h @@ -0,0 +1,25 @@ +/** + * \brief CMake information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#pragma once + +#include <string> + +#include "cmakeinfolib_export.h" + +namespace CMakeInfoLib +{ + +namespace CMakeInfo +{ + extern CMAKEINFOLIB_EXPORT const std::string cmake_args; +} // namespace +} // namespace diff --git a/InfoLib/CMakeLists.txt b/InfoLib/CMakeLists.txt new file mode 100644 index 00000000000..977a9f2aaea --- /dev/null +++ b/InfoLib/CMakeLists.txt @@ -0,0 +1,15 @@ +foreach(lib + Compiler + Git + CMake + Test) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${lib}Info.cpp.in + ${CMAKE_CURRENT_BINARY_DIR}/${lib}Info.cpp @ONLY) + + add_library(${lib}InfoLib ${CMAKE_CURRENT_BINARY_DIR}/${lib}Info.cpp + ${lib}Info.h) + + include(GenerateExportHeader) + generate_export_header(${lib}InfoLib) + target_include_directories(${lib}InfoLib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) +endforeach(lib) diff --git a/InfoLib/CompilerInfo.cpp.in b/InfoLib/CompilerInfo.cpp.in new file mode 100644 index 00000000000..c290f27543c --- /dev/null +++ b/InfoLib/CompilerInfo.cpp.in @@ -0,0 +1,24 @@ +/** + * \brief Build information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "InfoLib/CompilerInfo.h" + +namespace CompilerInfoLib +{ + +namespace CompilerInfo +{ + const std::string cmake_cxx_compiler("@CMAKE_CXX_COMPILER@"); + const std::string cmake_cxx_flags("@CMAKE_CXX_FLAGS@"); + const std::string cmake_cxx_flags_release("@CMAKE_CXX_FLAGS_RELEASE@"); + const std::string cmake_cxx_flags_debug("@CMAKE_CXX_FLAGS_DEBUG@"); +} +} diff --git a/InfoLib/CompilerInfo.h b/InfoLib/CompilerInfo.h new file mode 100644 index 00000000000..96acfc0b7e8 --- /dev/null +++ b/InfoLib/CompilerInfo.h @@ -0,0 +1,28 @@ +/** + * \brief Build information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#pragma once + +#include <string> + +#include "compilerinfolib_export.h" + +namespace CompilerInfoLib +{ + +namespace CompilerInfo +{ + extern COMPILERINFOLIB_EXPORT const std::string cmake_cxx_compiler; // all not used + extern COMPILERINFOLIB_EXPORT const std::string cmake_cxx_flags; + extern COMPILERINFOLIB_EXPORT const std::string cmake_cxx_flags_release; + extern COMPILERINFOLIB_EXPORT const std::string cmake_cxx_flags_debug; + } // namespace BuildInfo + } // namespace BaseLib diff --git a/InfoLib/GitInfo.cpp.in b/InfoLib/GitInfo.cpp.in new file mode 100644 index 00000000000..2d3694384ab --- /dev/null +++ b/InfoLib/GitInfo.cpp.in @@ -0,0 +1,22 @@ +/** + * \brief Git information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "InfoLib/GitInfo.h" + +namespace GitInfoLib +{ + +namespace GitInfo +{ + const std::string git_version_sha1_short("@GIT_SHA1_SHORT@"); + const std::string ogs_version("@OGS_VERSION@"); +} +} diff --git a/InfoLib/GitInfo.h b/InfoLib/GitInfo.h new file mode 100644 index 00000000000..fbee43541c5 --- /dev/null +++ b/InfoLib/GitInfo.h @@ -0,0 +1,26 @@ +/** + * \brief Git information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#pragma once + +#include <string> + +#include "gitinfolib_export.h" + +namespace GitInfoLib +{ + +namespace GitInfo +{ + extern GITINFOLIB_EXPORT const std::string git_version_sha1_short; + extern GITINFOLIB_EXPORT const std::string ogs_version; +} // namespace +} // namespace diff --git a/InfoLib/TestInfo.cpp.in b/InfoLib/TestInfo.cpp.in new file mode 100644 index 00000000000..3d16ad2371a --- /dev/null +++ b/InfoLib/TestInfo.cpp.in @@ -0,0 +1,24 @@ +/** + * \brief Test information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "InfoLib/TestInfo.h" + +namespace TestInfoLib +{ + +namespace TestInfo +{ + // const std::string source_path("@CMAKE_CURRENT_SOURCE_DIR@"); + const std::string data_path("@Data_SOURCE_DIR@"); + // const std::string data_binary_path("@Data_BINARY_DIR@"); + const std::string tests_tmp_path("@PROJECT_BINARY_DIR@/Tests/"); +} +} diff --git a/InfoLib/TestInfo.h b/InfoLib/TestInfo.h new file mode 100644 index 00000000000..3461b354d00 --- /dev/null +++ b/InfoLib/TestInfo.h @@ -0,0 +1,28 @@ +/** + * \brief Test information. + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#pragma once + +#include <string> + +#include "testinfolib_export.h" + +namespace TestInfoLib +{ + +namespace TestInfo +{ + // extern INFOLIB_EXPORT const std::string source_path; // not used + extern TESTINFOLIB_EXPORT const std::string data_path; + // extern INFOLIB_EXPORT const std::string data_binary_path; // not used + extern TESTINFOLIB_EXPORT const std::string tests_tmp_path; +} // namespace +} // namespace -- GitLab