From e1907c48d6735aed981910a358cd8fd666b168bd Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Wed, 6 Dec 2023 18:15:50 +0000 Subject: [PATCH] Add compiler information to buildInfo. --- src/basics/PointerDefinitions.h | 4 +- src/basics/buildInfo.cmake | 47 +++++++++++++++-- src/basics/buildInfo.h | 29 +++++------ src/basics/buildInfo.in.cpp | 89 ++++++++++++++++++++++++++++++--- 4 files changed, 137 insertions(+), 32 deletions(-) diff --git a/src/basics/PointerDefinitions.h b/src/basics/PointerDefinitions.h index 3ce233037..8940262fc 100644 --- a/src/basics/PointerDefinitions.h +++ b/src/basics/PointerDefinitions.h @@ -26,8 +26,6 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file PointerDefinitions.h -//! \ingroup Core //! \author Soeren Peters //======================================================================================= #ifndef SHARED_POINTER_H @@ -45,7 +43,7 @@ template <class T> using UPtr = std::unique_ptr<T>; template <class T> -using RPtr = T *; +using RPtr = T*; template <class T> using enableSharedFromThis = std::enable_shared_from_this<T>; diff --git a/src/basics/buildInfo.cmake b/src/basics/buildInfo.cmake index bbad317e9..dea11a7c4 100644 --- a/src/basics/buildInfo.cmake +++ b/src/basics/buildInfo.cmake @@ -1,3 +1,33 @@ +#======================================================================================= +# ____ ____ __ ______ __________ __ __ __ __ +# \ \ | | | | | _ \ |___ ___| | | | | / \ | | +# \ \ | | | | | |_) | | | | | | | / \ | | +# \ \ | | | | | _ / | | | | | | / /\ \ | | +# \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +# \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +# \ \ | | ________________________________________________________________ +# \ \ | | | ______________________________________________________________| +# \ \| | | | __ __ __ __ ______ _______ +# \ | | |_____ | | | | | | | | | _ \ / _____) +# \ | | _____| | | | | | | | | | | \ \ \_______ +# \ | | | | |_____ | \_/ | | | | |_/ / _____ | +# \ _____| |__| |________| \_______/ |__| |______/ (_______/ +# +# This file is part of VirtualFluids. VirtualFluids is free software: you can +# redistribute it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +# +#! \author Soeren Peters +#======================================================================================= set(buildInfoPath ${CMAKE_BINARY_DIR}/buildInfo) set(buildInfoFile buildInfo.cpp) set(buildInfoInput ${CMAKE_CURRENT_LIST_DIR}/buildInfo.in.cpp) @@ -7,10 +37,19 @@ get_git_head_revision(git_branch git_commit_hash) set(COMPILER_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} ${CMAKE_CXX_FLAGS}") +site_name(BUILD_computerName) + +if( BUILD_VF_DOUBLE_ACCURACY ) + set(BUILD_PRECISION "double") +else() + set(BUILD_PRECISION "float") +endif() + +get_target_property(BUILD_COMPILE_OPTIONS project_options INTERFACE_COMPILE_OPTIONS) +get_target_property(BUILD_COMPILE_DEFINITIONS project_options INTERFACE_COMPILE_DEFINITIONS) +get_target_property(BUILD_COMPILE_WARNINGS project_warnings INTERFACE_COMPILE_OPTIONS) + configure_file(${buildInfoInput} ${buildInfoPath}/${buildInfoFile}) -#message ("buildInfoPath: ${buildInfoPath}") -include_directories(${buildInfoPath}) -#set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile} ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) + set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile}) source_group("" FILES ${buildInfoPath}/${buildInfoFile}) -#source_group("" FILES ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader}) \ No newline at end of file diff --git a/src/basics/buildInfo.h b/src/basics/buildInfo.h index 598d5ee74..b3a86f411 100644 --- a/src/basics/buildInfo.h +++ b/src/basics/buildInfo.h @@ -26,8 +26,6 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file buildInfo.h -//! \ingroup Core //! \author Soeren Peters //======================================================================================= #ifndef buildInfo_H @@ -35,21 +33,18 @@ namespace buildInfo { -const char *gitCommitHash(); -const char *gitBranch(); -const char *buildType(); -const char *compilerFlags(); -const char *buildMachine(); -const char *projectDir(); -const char *binaryDir(); -} // namespace buildInfo -#define GIT_COMMIT_HASH buildinfo::gitCommitHash() -#define GIT_BRANCH buildinfo::gitBranch() -#define BUILD_MACHINE buildinfo::buildMachine() -#define PROJECT_DIR buildinfo::projectDir() -#define BINARY_DIR buildinfo::binaryDir() -#define COMPILER_FLAGS buildinfo::compilerFlags() -#define BUILD_TYPE buildinfo::buildType() +const char* gitCommitHash(); +const char* gitBranch(); +const char* buildType(); +const char* compilerFlags(); +const char* compilerFlagWarnings(); +const char* compilerDefinitions(); +const char* buildMachine(); +const char* projectDir(); +const char* binaryDir(); +const char* precision(); + +} // namespace buildInfo #endif diff --git a/src/basics/buildInfo.in.cpp b/src/basics/buildInfo.in.cpp index 59dbe5a3a..cc0ca03eb 100644 --- a/src/basics/buildInfo.in.cpp +++ b/src/basics/buildInfo.in.cpp @@ -1,12 +1,85 @@ - +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \author Soeren Peters +//======================================================================================= namespace buildInfo { -const char *gitCommitHash() { return "@git_commit_hash@"; } -const char *gitBranch() { return "@git_branch@"; } -const char *buildType() { return "@CMAKE_BUILD_TYPE@"; } -const char *compilerFlags() { return "@COMPILER_FLAGS@"; } -const char *buildMachine() { return "@BUILD_computerName@"; } -const char *projectDir() { return "@CMAKE_SOURCE_DIR@"; } -const char *binaryDir() { return "@CMAKE_BINARY_DIR@"; } + +const char* gitCommitHash() +{ + return "@git_commit_hash@"; +} + +const char* gitBranch() +{ + return "@git_branch@"; +} + +const char* buildType() +{ + return "@CMAKE_BUILD_TYPE@"; +} + +const char* compilerFlags() +{ + return "@BUILD_COMPILE_OPTIONS@"; +} + +const char* compilerFlagWarnings() +{ + return "@BUILD_COMPILE_WARNINGS@"; +} + +const char* compilerDefinitions() +{ + return "@BUILD_COMPILE_DEFINITIONS@"; +} + +const char* buildMachine() +{ + return "@BUILD_computerName@"; +} + +const char* projectDir() +{ + return "@CMAKE_SOURCE_DIR@"; +} + +const char* binaryDir() +{ + return "@CMAKE_BINARY_DIR@"; +} + +const char* precision() +{ + return "@BUILD_PRECISION@"; +} + } // namespace buildInfo -- GitLab