diff --git a/broker/jfjoch_broker.cpp b/broker/jfjoch_broker.cpp index d26812935..6badfbc2c 100644 --- a/broker/jfjoch_broker.cpp +++ b/broker/jfjoch_broker.cpp @@ -9,6 +9,7 @@ #include +#include "../common/GitInfo.h" #include "../common/Logger.h" #include "../common/print_license.h" #include "../detector_control/DectrisSimplonClient.h" @@ -61,6 +62,8 @@ int main(int argc, char **argv) { if (argc >= 3) http_port = static_cast(std::atoi(argv[2])); Logger logger("jfjoch_broker"); + logger.Info("jfjoch_broker {} (git {}), built with {}", jfjoch_version(), jfjoch_git_sha1().substr(0, 6), + jfjoch_build_info(true)); org::openapitools::server::model::Jfjoch_settings settings; std::ifstream file(argv[1]); diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index f8afb413f..bac24abd8 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -7,6 +7,13 @@ SET(GITINFO_SOURCE_DIR "${CMAKE_SOURCE_DIR}") SET(GITINFO_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/GitInfo.cpp.in") SET(GITINFO_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/GitInfo.cpp") SET(JFJOCH_BUILD_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +# The compiler, and the CUDA toolkit where the build uses one, for the line each program logs at start. +SET(JFJOCH_BUILD_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") +IF (JFJOCH_CUDA_AVAILABLE) + SET(JFJOCH_BUILD_CUDA "${CMAKE_CUDA_COMPILER_VERSION}") +ELSE() + SET(JFJOCH_BUILD_CUDA "") +ENDIF() INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/GitInfoStamp.cmake") set (THREADS_PREFER_PTHREAD_FLAG ON) @@ -26,6 +33,8 @@ ADD_CUSTOM_TARGET(JFJochGitInfo "-DGITINFO_OUTPUT=${CMAKE_CURRENT_BINARY_DIR}/GitInfo.cpp" "-DJFJOCH_VERSION=${JFJOCH_VERSION}" "-DJFJOCH_BUILD_CXX_FLAGS=${CMAKE_CXX_FLAGS}" + "-DJFJOCH_BUILD_COMPILER=${JFJOCH_BUILD_COMPILER}" + "-DJFJOCH_BUILD_CUDA=${JFJOCH_BUILD_CUDA}" -P "${CMAKE_CURRENT_SOURCE_DIR}/GitInfoStamp.cmake" BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/GitInfo.cpp" COMMENT "Stamping GitInfo.cpp from git HEAD" diff --git a/common/GitInfo.cpp.in b/common/GitInfo.cpp.in index 33868dd05..b9f1d2e53 100644 --- a/common/GitInfo.cpp.in +++ b/common/GitInfo.cpp.in @@ -18,3 +18,19 @@ std::string jfjoch_version() { std::string jfjoch_build_cxx_flags() { return "@JFJOCH_BUILD_CXX_FLAGS@"; } + +std::string jfjoch_build_compiler() { + return "@JFJOCH_BUILD_COMPILER@"; +} + +std::string jfjoch_build_cuda() { + return "@JFJOCH_BUILD_CUDA@"; +} + +std::string jfjoch_build_info(bool with_cuda) { + std::string out = jfjoch_build_compiler(); + if (with_cuda) + out += jfjoch_build_cuda().empty() ? ", no CUDA" : ", CUDA " + jfjoch_build_cuda(); + out += jfjoch_build_cxx_flags().empty() ? ", no extra compiler flags" : ", flags " + jfjoch_build_cxx_flags(); + return out; +} diff --git a/common/GitInfo.h b/common/GitInfo.h index 4951ef17a..bbeea6180 100644 --- a/common/GitInfo.h +++ b/common/GitInfo.h @@ -11,3 +11,8 @@ std::string jfjoch_version(); // CMAKE_CXX_FLAGS of the build - empty on a plain configure. Recorded because two builds of one // commit can differ by flags alone, and -march moves the CPU-bound results. std::string jfjoch_build_cxx_flags(); +// The C++ compiler (CMake's id and version), and the CUDA toolkit version - empty in a build without CUDA. +std::string jfjoch_build_compiler(); +std::string jfjoch_build_cuda(); +// One line for a program's start: compiler, CUDA (where `with_cuda`: a program that can use it) and flags. +std::string jfjoch_build_info(bool with_cuda); diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index f0dcb3214..c6a9bcd89 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -699,6 +699,7 @@ namespace { c.Line(fmt::format(" rugnux Version {}{}", jfjoch_version(), jfjoch_git_sha1().empty() ? std::string() : fmt::format(" (git {} {})", jfjoch_git_sha1().substr(0, 6), jfjoch_git_date()))); + c.Line(" Built with " + jfjoch_build_info(true)); c.Line(" Copyright (C) 2019-2026 Paul Scherrer Institute. Free software under GPLv3,"); c.Line(" with ABSOLUTELY NO WARRANTY. The methods and software rugnux builds on are"); c.Line(" credited in ACKNOWLEDGEMENT.md, LICENSE and THIRD_PARTY_NOTICES.md."); @@ -918,6 +919,7 @@ static int RunRugnux(int argc, char **argv, bool no_gpu) { jfjoch_git_sha1().empty() ? std::string() : fmt::format(" (git {} {})", jfjoch_git_sha1().substr(0, 6), jfjoch_git_date()), build); logger.Info("Build flags: {}", jfjoch_build_cxx_flags().empty() ? "none" : jfjoch_build_cxx_flags()); + logger.Info("Build: {}", jfjoch_build_info(true)); logger.Info("Command line: {}", provenance.command_line); logger.Info("GPU: {}", no_gpu ? std::string("not used (--no-gpu) - running on the CPU") : provenance.gpu_count > 0 ? fmt::format("{} ({} visible)", provenance.gpu_description, provenance.gpu_count) diff --git a/viewer/JFJochViewerMenu.cpp b/viewer/JFJochViewerMenu.cpp index 241d670b8..809c27471 100644 --- a/viewer/JFJochViewerMenu.cpp +++ b/viewer/JFJochViewerMenu.cpp @@ -201,6 +201,7 @@ void JFJochViewerMenu::aboutSelected() { QString about_text = "

Jungfraujoch Image Viewer

" // Use HTML for improved style "

Version: " + version + "

" + "

Build: " + QString::fromStdString(jfjoch_build_info(true)).toHtmlEscaped() + "

" "

Copyright: 2019-2025 Paul Scherrer Institute

" "

Author: Filip Leonarski <filip.leonarski@psi.ch>

" "

Links: Documentation, " diff --git a/writer/jfjoch_writer.cpp b/writer/jfjoch_writer.cpp index c8ee45b92..893f539e4 100644 --- a/writer/jfjoch_writer.cpp +++ b/writer/jfjoch_writer.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "../common/GitInfo.h" #include "../common/Logger.h" #include "StreamWriter.h" #include "../common/print_license.h" @@ -185,6 +186,8 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } } + logger.Info("jfjoch_writer {} (git {}), built with {}", jfjoch_version(), jfjoch_git_sha1().substr(0, 6), + jfjoch_build_info(false)); logger.Info("Current path {}", std::filesystem::current_path().string()); std::string repub_zmq_addr, file_done_zmq_addr;