diff --git a/SilKit/include/silkit/capi/SilKitVersionMacros.h b/SilKit/include/silkit/capi/SilKitVersionMacros.h new file mode 100644 index 000000000..86c83aae3 --- /dev/null +++ b/SilKit/include/silkit/capi/SilKitVersionMacros.h @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: 2022 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT + +#pragma once + +#define SILKIT_GIT_HASH "f3b467c2028695e487d0337868ddae43a5674fe7" +#define SILKIT_VERSION_MAJOR 5 +#define SILKIT_VERSION_MINOR 0 +#define SILKIT_VERSION_PATCH 6 +#define SILKIT_BUILD_NUMBER 0 +#define SILKIT_VERSION_STRING "5.0.6" +#define SILKIT_VERSION_SUFFIX "" diff --git a/SilKit/source/CMakeLists.txt b/SilKit/source/CMakeLists.txt index 0eb290e34..d5dfdc069 100644 --- a/SilKit/source/CMakeLists.txt +++ b/SilKit/source/CMakeLists.txt @@ -14,44 +14,20 @@ add_subdirectory(dashboard) find_package(Threads REQUIRED) -# Encode the current GIT and version infos into version_macros.hpp -# If this file is present in the current source directory we assume -# that this source-tree is a non-git/packaged source tree and re-use -# the file unmodified. -set(GIT_DIR "${PROJECT_SOURCE_DIR}/../.git") -set(GIT_HEAD_FILE "${GIT_DIR}/HEAD") -set(VERSION_MACROS_HPP ${CMAKE_CURRENT_BINARY_DIR}/version_macros.hpp) -if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/version_macros.hpp) - message(STATUS "SIL Kit: using deployed version_macros.hpp") - set(VERSION_MACROS_HPP ${CMAKE_CURRENT_LIST_DIR}/version_macros.hpp) -elseif(EXISTS "${GIT_HEAD_FILE}") - configure_file( - "MakeVersionMacros.cmake.in" - ${CMAKE_CURRENT_BINARY_DIR}/MakeVersionMacros.cmake - @ONLY) - include(${CMAKE_CURRENT_BINARY_DIR}/MakeVersionMacros.cmake) - if(SILKIT_INSTALL_SOURCE) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/version_macros.hpp - DESTINATION - ${INSTALL_SOURCE_DIR}/SilKit/source - COMPONENT source - ) - endif() -else() - message(STATUS "SIL Kit: Cannot determine hash of current git head! GIT_HEAD_HASH will be set to UNKNOWN") - set(GIT_HEAD_HASH "UNKNOWN") - configure_file( - version_macros.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/version_macros.hpp - @ONLY) +# SilKitVersionMacros.h is committed to source and updated by running sil-kit-version-gen. +# No generation at configure time — any build tool can use the file as a regular source file. +# To update: sil-kit-version-gen --major X --minor Y --patch Z [--source-dir .] +set(VERSION_MACROS_HPP "${CMAKE_CURRENT_LIST_DIR}/../include/silkit/capi/SilKitVersionMacros.h") +if(NOT EXISTS "${VERSION_MACROS_HPP}") + message(FATAL_ERROR + "SilKitVersionMacros.h not found. Run sil-kit-version-gen to create it:\n" + " sil-kit-version-gen --major ${SILKIT_VERSION_MAJOR} --minor ${SILKIT_VERSION_MINOR}" + " --patch ${SILKIT_VERSION_PATCH} ${VERSION_MACROS_HPP}") endif() -# now install the configured version_macros.hpp as a header into the `include/silkit/capi` directory. -# NB please keep the version_macros.hpp C11 compatible! + install(FILES ${VERSION_MACROS_HPP} DESTINATION ${INSTALL_INCLUDE_DIR}/silkit/capi - RENAME SilKitVersionMacros.h COMPONENT dev ) @@ -183,7 +159,6 @@ target_link_libraries(O_SilKit_CreateSilKitRegistryImpl add_library(O_SilKit_VersionImpl OBJECT SilKitVersionImpl.cpp SilKitVersionImpl.hpp - ${VERSION_MACROS_HPP} ) target_link_libraries(O_SilKit_VersionImpl diff --git a/SilKit/source/MakeVersionMacros.cmake.in b/SilKit/source/MakeVersionMacros.cmake.in deleted file mode 100644 index c384dac40..000000000 --- a/SilKit/source/MakeVersionMacros.cmake.in +++ /dev/null @@ -1,47 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Vector Informatik GmbH -# -# SPDX-License-Identifier: MIT - -set(gitHashFile "${CMAKE_CURRENT_BINARY_DIR}/git_hash_file") -set(gitHeadFile "${CMAKE_CURRENT_BINARY_DIR}/git_head_file") - -configure_file("@GIT_HEAD_FILE@" ${gitHeadFile} COPYONLY) - -file(READ ${gitHeadFile} GIT_HEAD LIMIT 512) -string(REGEX MATCH "^ref: (.*)\n" GIT_HEAD_REF ${GIT_HEAD}) - -set(linkedHeadFile "${GIT_DIR}/${CMAKE_MATCH_1}") -set(linkedRef "${CMAKE_MATCH_1}") -if(GIT_HEAD_REF) - if(NOT EXISTS "${linkedHeadFile}") - # the workspace might have a .git/packed-refs file instead of - # .git/refs/heads/master - message("-- SIL Kit GIT Version: using ${GIT_DIR}/packed-refs") - file(READ ${GIT_DIR}/packed-refs packedRefs LIMIT 4096) - string(REGEX MATCH "([abcdef0-9]+) ${linkedRef}" headHash ${packedRefs}) - if(NOT headHash) - message(FATAL_ERROR "MakeVersionMacros: cannot find linked git ref \"${linkedRef}\"") - endif() - file(WRITE ${gitHashFile} "${CMAKE_MATCH_1}\n") - else() - message("-- SIL Kit GIT Version: using ${linkedHeadFile}") - configure_file( - "${linkedHeadFile}" - ${gitHashFile} - COPYONLY) - endif() -else() - configure_file( - ${gitHeadFile} - ${gitHashFile} - COPYONLY) -endif() - - -file(READ ${gitHashFile} GIT_HEAD_HASH LIMIT 512) -string(STRIP "${GIT_HEAD_HASH}" GIT_HEAD_HASH) -message(STATUS "SIL Kit GIT Version: ${GIT_HEAD_HASH}") -configure_file( - version_macros.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/version_macros.hpp - @ONLY) diff --git a/SilKit/source/SilKit.rc b/SilKit/source/SilKit.rc index 6dadcc8df..0b57ab705 100644 --- a/SilKit/source/SilKit.rc +++ b/SilKit/source/SilKit.rc @@ -1,5 +1,5 @@ #include -#include "version_macros.hpp" +#include "silkit/capi/SilKitVersionMacros.h" #pragma code_page(65001) // UTF-8 for © symbol #define STRING_HELPER(x) #x diff --git a/SilKit/source/SilKitVersionImpl.cpp b/SilKit/source/SilKitVersionImpl.cpp index 36be9aaf1..22c24a784 100644 --- a/SilKit/source/SilKitVersionImpl.cpp +++ b/SilKit/source/SilKitVersionImpl.cpp @@ -4,7 +4,7 @@ #include "SilKitVersionImpl.hpp" -#include "version_macros.hpp" +#include "silkit/capi/SilKitVersionMacros.h" namespace SilKit { namespace Version { diff --git a/SilKit/source/util/CMakeLists.txt b/SilKit/source/util/CMakeLists.txt index d9fba7454..d851f4afd 100644 --- a/SilKit/source/util/CMakeLists.txt +++ b/SilKit/source/util/CMakeLists.txt @@ -85,4 +85,12 @@ add_silkit_test_to_executable(SilKitUnitTests ) +add_executable(SilKit_version_gen sil-kit-version-gen.cpp) +set_target_properties(SilKit_version_gen PROPERTIES + CXX_STANDARD 17 + OUTPUT_NAME "sil-kit-version-gen" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$" +) + + add_subdirectory(tests) diff --git a/SilKit/source/util/sil-kit-version-gen.cpp b/SilKit/source/util/sil-kit-version-gen.cpp new file mode 100644 index 000000000..c49553a98 --- /dev/null +++ b/SilKit/source/util/sil-kit-version-gen.cpp @@ -0,0 +1,401 @@ +// SPDX-FileCopyrightText: 2026 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT + +// Standalone tool: generates version_macros.hpp from CLI arguments and the +// current git HEAD hash. Optionally rotates the changelog when the version +// number changes. Requires C++17 (std::filesystem). No external dependencies. +// +// Usage: sil-kit-version-gen [options] +// --major N Version major (required) +// --minor N Version minor (required) +// --patch N Version patch (required) +// --build N Build number (default: 0) +// --suffix S Version suffix (default: "") +// --git-dir PATH Path to .git directory (default: search upward from CWD) +// --git-hash HASH Override git hash; skips .git reading +// --source-dir PATH Source tree root for changelog files (default: CWD) +// --no-changelog Skip changelog rotation even if version changed +// --dry-run Print actions without writing any files +// Pass '-' as output-header to write to stdout. + +#include +#include +#include +#include +#include +#include + + +namespace fs = std::filesystem; + +// --------------------------------------------------------------------------- +// File helpers +// --------------------------------------------------------------------------- + +static std::string readFileFull(const fs::path& path) +{ + std::ifstream f(path); + if (!f.is_open()) + return ""; + std::ostringstream ss; + ss << f.rdbuf(); + return ss.str(); +} + +static bool writeFileFull(const fs::path& path, const std::string& content) +{ + std::ofstream f(path); + if (!f.is_open()) + { + std::cerr << "error: cannot write " << path << "\n"; + return false; + } + f << content; + return f.good(); +} + +static std::string trimStr(const std::string& s) +{ + size_t start = s.find_first_not_of(" \t\r\n"); + if (start == std::string::npos) + return ""; + size_t end = s.find_last_not_of(" \t\r\n"); + return s.substr(start, end - start + 1); +} + +// --------------------------------------------------------------------------- +// Git hash resolution (mirrors the old MakeVersionMacros.cmake.in logic) +// --------------------------------------------------------------------------- + +static fs::path findGitDir() +{ + fs::path dir = fs::current_path(); + while (true) + { + fs::path candidate = dir / ".git"; + if (fs::exists(candidate / "HEAD")) + return candidate; + fs::path parent = dir.parent_path(); + if (parent == dir) + break; + dir = parent; + } + return {}; +} + +static std::string resolveGitHash(const fs::path& gitDir) +{ + std::string headContent = trimStr(readFileFull(gitDir / "HEAD")); + if (headContent.empty()) + return "UNKNOWN"; + + const std::string refPrefix = "ref: "; + if (headContent.compare(0, refPrefix.size(), refPrefix) == 0) + { + std::string ref = headContent.substr(refPrefix.size()); + fs::path refFile = gitDir / ref; + + if (fs::exists(refFile)) + return trimStr(readFileFull(refFile)); + + // Fall back to packed-refs + std::string packedRefs = readFileFull(gitDir / "packed-refs"); + if (!packedRefs.empty()) + { + std::istringstream stream(packedRefs); + std::string line; + while (std::getline(stream, line)) + { + if (line.empty() || line[0] == '#' || line[0] == '^') + continue; + size_t space = line.find(' '); + if (space != std::string::npos && trimStr(line.substr(space + 1)) == ref) + return line.substr(0, space); + } + } + return "UNKNOWN"; + } + + // Detached HEAD — content is the hash directly + if (headContent.size() >= 40) + return headContent.substr(0, 40); + return headContent; +} + +// --------------------------------------------------------------------------- +// Parse current version from an existing version_macros.hpp +// --------------------------------------------------------------------------- + +struct Version +{ + int major{-1}, minor{-1}, patch{-1}; + bool valid() const { return major >= 0 && minor >= 0 && patch >= 0; } +}; + +static int extractDefineInt(const std::string& content, const std::string& macroName) +{ + std::string search = "#define " + macroName + " "; + size_t pos = content.find(search); + if (pos == std::string::npos) + return -1; + pos += search.size(); + size_t end = content.find_first_of("\r\n", pos); + return std::atoi(trimStr(content.substr(pos, end - pos)).c_str()); +} + +static Version parseVersionFromHeader(const fs::path& path) +{ + Version v; + std::string content = readFileFull(path); + if (content.empty()) + return v; + v.major = extractDefineInt(content, "SILKIT_VERSION_MAJOR"); + v.minor = extractDefineInt(content, "SILKIT_VERSION_MINOR"); + v.patch = extractDefineInt(content, "SILKIT_VERSION_PATCH"); + return v; +} + +// --------------------------------------------------------------------------- +// Changelog rotation +// --------------------------------------------------------------------------- + +static bool rotateChangelog(const fs::path& sourceDir, const Version& oldVer, bool dryRun) +{ + fs::path versionsDir = sourceDir / "docs" / "changelog" / "versions"; + fs::path latestMd = versionsDir / "latest.md"; + fs::path templateMd = versionsDir / "template.md"; + + fs::path archiveMd = versionsDir / (std::to_string(oldVer.major) + "." + std::to_string(oldVer.minor) + "." + + std::to_string(oldVer.patch) + ".md"); + + if (!fs::exists(latestMd)) + { + std::cerr << "warning: changelog rotation skipped — " << latestMd << " not found\n"; + return true; + } + if (!fs::exists(templateMd)) + { + std::cerr << "warning: changelog rotation skipped — " << templateMd << " not found\n"; + return true; + } + if (fs::exists(archiveMd)) + { + std::cerr << "warning: changelog rotation skipped — " << archiveMd << " already exists\n"; + return true; + } + + if (dryRun) + { + std::cout << "[dry-run] copy " << latestMd << "\n" + << " -> " << archiveMd << "\n"; + std::cout << "[dry-run] copy " << templateMd << "\n" + << " -> " << latestMd << "\n"; + return true; + } + + std::error_code ec; + std::cout << "changelog: " << latestMd << " -> " << archiveMd << "\n"; + fs::copy_file(latestMd, archiveMd, ec); + if (ec) + { + std::cerr << "error: " << ec.message() << "\n"; + return false; + } + std::cout << "changelog: " << latestMd << " <- " << templateMd << "\n"; + fs::copy_file(templateMd, latestMd, fs::copy_options::overwrite_existing, ec); + if (ec) + { + std::cerr << "error: " << ec.message() << "\n"; + return false; + } + return true; +} + +// --------------------------------------------------------------------------- +// Header generation +// --------------------------------------------------------------------------- + +static void replaceAll(std::string& s, const std::string& from, const std::string& to) +{ + for (size_t pos = 0; (pos = s.find(from, pos)) != std::string::npos; pos += to.size()) + s.replace(pos, from.size(), to); +} + +static void substituteVar(std::string& s, const std::string& name, const std::string& value) +{ + replaceAll(s, "@" + name + "@", value); +} + +// clang-format off +static constexpr auto kHeaderTemplate = R"(// SPDX-FileCopyrightText: 2022 Vector Informatik GmbH +// +// SPDX-License-Identifier: MIT + +#pragma once + +#define SILKIT_GIT_HASH "@GIT_HASH@" +#define SILKIT_VERSION_MAJOR @MAJOR@ +#define SILKIT_VERSION_MINOR @MINOR@ +#define SILKIT_VERSION_PATCH @PATCH@ +#define SILKIT_BUILD_NUMBER @BUILD@ +#define SILKIT_VERSION_STRING "@VERSION_STRING@" +#define SILKIT_VERSION_SUFFIX "@SUFFIX@" +)"; +// clang-format on + +static std::string buildHeader(const std::string& gitHash, int major, int minor, int patch, int build, + const std::string& suffix) +{ + const std::string versionStr = std::to_string(major) + "." + std::to_string(minor) + "." + + std::to_string(patch) + (suffix.empty() ? "" : "-" + suffix); + + std::string result{kHeaderTemplate}; + substituteVar(result, "GIT_HASH", gitHash); + substituteVar(result, "MAJOR", std::to_string(major)); + substituteVar(result, "MINOR", std::to_string(minor)); + substituteVar(result, "PATCH", std::to_string(patch)); + substituteVar(result, "BUILD", std::to_string(build)); + substituteVar(result, "VERSION_STRING", versionStr); + substituteVar(result, "SUFFIX", suffix); + return result; +} + +// --------------------------------------------------------------------------- +// main +// --------------------------------------------------------------------------- + +static void usage(const char* prog) +{ + std::cerr << "Usage: " << prog << " [options] \n" + << "\n" + << " --major N Version major (required)\n" + << " --minor N Version minor (required)\n" + << " --patch N Version patch (required)\n" + << " --build N Build number (default: 0)\n" + << " --suffix S Version suffix (default: \"\")\n" + << " --git-dir PATH Path to .git directory\n" + << " --git-hash HASH Override git hash (skips .git reading)\n" + << " --source-dir PATH Source tree root for changelog files\n" + << " --no-changelog Skip changelog rotation\n" + << " --dry-run Print actions without writing any files\n"; +} + +int main(int argc, char* argv[]) +{ + int major = -1, minor = -1, patch = -1, build = 0; + std::string suffix; + fs::path gitDir; + std::string gitHashOverride; + fs::path sourceDir; + std::string outputPath; + bool noChangelog = false; + bool dryRun = false; + + for (int i = 1; i < argc; ++i) + { + std::string arg = argv[i]; + + auto requireNext = [&]() -> std::string { + if (i + 1 >= argc) + { + std::cerr << "error: " << arg << " requires an argument\n"; + std::exit(1); + } + return argv[++i]; + }; + + if (arg == "--major") + major = std::atoi(requireNext().c_str()); + else if (arg == "--minor") + minor = std::atoi(requireNext().c_str()); + else if (arg == "--patch") + patch = std::atoi(requireNext().c_str()); + else if (arg == "--build") + build = std::atoi(requireNext().c_str()); + else if (arg == "--suffix") + suffix = requireNext(); + else if (arg == "--git-dir") + gitDir = requireNext(); + else if (arg == "--git-hash") + gitHashOverride = requireNext(); + else if (arg == "--source-dir") + sourceDir = requireNext(); + else if (arg == "--no-changelog") + noChangelog = true; + else if (arg == "--dry-run" || arg == "-n") + dryRun = true; + else if (!arg.empty() && arg[0] != '-') + outputPath = arg; + else + { + std::cerr << "error: unknown option '" << arg << "'\n"; + usage(argv[0]); + return 1; + } + } + + if (major < 0 || minor < 0 || patch < 0) + { + std::cerr << "error: --major, --minor, --patch are required\n"; + usage(argv[0]); + return 1; + } + if (outputPath.empty()) + { + std::cerr << "error: output path is required\n"; + usage(argv[0]); + return 1; + } + + // Resolve git hash + std::string gitHash; + if (!gitHashOverride.empty()) + { + gitHash = gitHashOverride; + } + else + { + if (gitDir.empty()) + gitDir = findGitDir(); + gitHash = gitDir.empty() ? "UNKNOWN" : resolveGitHash(gitDir); + } + + // Changelog rotation — read existing header before overwriting + if (!noChangelog && outputPath != "-") + { + Version oldVer = parseVersionFromHeader(outputPath); + bool versionChanged = + oldVer.valid() && (oldVer.major != major || oldVer.minor != minor || oldVer.patch != patch); + if (versionChanged) + { + fs::path srcDir = sourceDir.empty() ? fs::current_path() : sourceDir; + if (!rotateChangelog(srcDir, oldVer, dryRun)) + return 1; + } + } + + // Generate and write the header + std::string content = buildHeader(gitHash, major, minor, patch, build, suffix); + + if (dryRun) + { + std::cout << "[dry-run] write " << outputPath << "\n" + << "---\n" + << content; + return 0; + } + + if (outputPath == "-") + { + std::cout << content; + } + else + { + if (!writeFileFull(outputPath, content)) + return 1; + std::cout << "wrote " << outputPath << " (git hash: " << gitHash << ")\n"; + } + + return 0; +} diff --git a/SilKit/source/version_macros.hpp.in b/SilKit/source/version_macros.hpp.in deleted file mode 100644 index 6529e06be..000000000 --- a/SilKit/source/version_macros.hpp.in +++ /dev/null @@ -1,14 +0,0 @@ - -// SPDX-FileCopyrightText: 2022 Vector Informatik GmbH -// -// SPDX-License-Identifier: MIT - -#pragma once - -#define SILKIT_GIT_HASH "@GIT_HEAD_HASH@" -#define SILKIT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ -#define SILKIT_VERSION_MINOR @PROJECT_VERSION_MINOR@ -#define SILKIT_VERSION_PATCH @PROJECT_VERSION_PATCH@ -#define SILKIT_BUILD_NUMBER @SILKIT_BUILD_NUMBER@ -#define SILKIT_VERSION_STRING "@PROJECT_VERSION@" -#define SILKIT_VERSION_SUFFIX "@SILKIT_VERSION_SUFFIX@" diff --git a/Utilities/SilKitMonitor/CMakeLists.txt b/Utilities/SilKitMonitor/CMakeLists.txt index 3639bfa9e..c4ea08297 100644 --- a/Utilities/SilKitMonitor/CMakeLists.txt +++ b/Utilities/SilKitMonitor/CMakeLists.txt @@ -29,12 +29,10 @@ target_link_libraries(sil-kit-monitor # Set versioning infos on exe if(MSVC) - get_target_property(SILKIT_BINARY_DIR SilKit BINARY_DIR) get_target_property(SILKIT_SOURCE_DIR SilKit SOURCE_DIR) - # Include the generated version_macros.hpp in SilKit/source + # Include SilKit/include so the RC compiler finds silkit/capi/SilKitVersionMacros.h target_include_directories(sil-kit-monitor - PRIVATE ${SILKIT_BINARY_DIR} - PRIVATE ${SILKIT_SOURCE_DIR} + PRIVATE ${SILKIT_SOURCE_DIR}/../include ) target_sources(sil-kit-monitor PRIVATE sil-kit-monitor.rc) endif() diff --git a/Utilities/SilKitMonitor/sil-kit-monitor.rc b/Utilities/SilKitMonitor/sil-kit-monitor.rc index 0c9d3e583..26dafb501 100644 --- a/Utilities/SilKitMonitor/sil-kit-monitor.rc +++ b/Utilities/SilKitMonitor/sil-kit-monitor.rc @@ -1,5 +1,5 @@ #include -#include "version_macros.hpp" +#include "silkit/capi/SilKitVersionMacros.h" #pragma code_page(65001) // UTF-8 for © symbol #define STRING_HELPER(x) #x diff --git a/Utilities/SilKitRegistry/CMakeLists.txt b/Utilities/SilKitRegistry/CMakeLists.txt index bb0f8f56b..9194b001b 100644 --- a/Utilities/SilKitRegistry/CMakeLists.txt +++ b/Utilities/SilKitRegistry/CMakeLists.txt @@ -46,12 +46,10 @@ target_link_libraries(sil-kit-registry # Set versioning infos on exe if(MSVC) - get_target_property(SILKIT_BINARY_DIR SilKit BINARY_DIR) get_target_property(SILKIT_SOURCE_DIR SilKit SOURCE_DIR) - # Include the generated version_macros.hpp in SilKit/source + # Include SilKit/include so the RC compiler finds silkit/capi/SilKitVersionMacros.h target_include_directories(sil-kit-registry - PRIVATE ${SILKIT_BINARY_DIR} - PRIVATE ${SILKIT_SOURCE_DIR} + PRIVATE ${SILKIT_SOURCE_DIR}/../include ) target_sources(sil-kit-registry PRIVATE SilKitRegistry.rc) endif() diff --git a/Utilities/SilKitRegistry/SilKitRegistry.rc b/Utilities/SilKitRegistry/SilKitRegistry.rc index d4e1c0226..b4e810376 100644 --- a/Utilities/SilKitRegistry/SilKitRegistry.rc +++ b/Utilities/SilKitRegistry/SilKitRegistry.rc @@ -1,5 +1,5 @@ #include -#include "version_macros.hpp" +#include "silkit/capi/SilKitVersionMacros.h" #pragma code_page(65001) // UTF-8 for © symbol #define STRING_HELPER(x) #x diff --git a/Utilities/SilKitSystemController/CMakeLists.txt b/Utilities/SilKitSystemController/CMakeLists.txt index 46d5968f3..d08a061b4 100644 --- a/Utilities/SilKitSystemController/CMakeLists.txt +++ b/Utilities/SilKitSystemController/CMakeLists.txt @@ -29,12 +29,10 @@ target_link_libraries(sil-kit-system-controller # Set versioning infos on exe if(MSVC) - get_target_property(SILKIT_BINARY_DIR SilKit BINARY_DIR) get_target_property(SILKIT_SOURCE_DIR SilKit SOURCE_DIR) - # Include the generated version_macros.hpp in SilKit/source + # Include SilKit/include so the RC compiler finds silkit/capi/SilKitVersionMacros.h target_include_directories(sil-kit-system-controller - PRIVATE ${SILKIT_BINARY_DIR} - PRIVATE ${SILKIT_SOURCE_DIR} + PRIVATE ${SILKIT_SOURCE_DIR}/../include ) target_sources(sil-kit-system-controller PRIVATE SilKitSystemController.rc) endif() diff --git a/Utilities/SilKitSystemController/SilKitSystemController.rc b/Utilities/SilKitSystemController/SilKitSystemController.rc index b34c5f3b1..dc29ac43e 100644 --- a/Utilities/SilKitSystemController/SilKitSystemController.rc +++ b/Utilities/SilKitSystemController/SilKitSystemController.rc @@ -1,5 +1,5 @@ #include -#include "version_macros.hpp" +#include "silkit/capi/SilKitVersionMacros.h" #pragma code_page(65001) // UTF-8 for © symbol #define STRING_HELPER(x) #x