diff --git a/cmake/utils.cmake b/cmake/utils.cmake index b85beb3b043..bcb7f46f4f1 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -24,7 +24,7 @@ function(target_sources_grouped) source_group(${PARSED_ARGS_NAME} FILES ${PARSED_ARGS_FILES}) endfunction() -function(set_git_info) +macro(set_git_info) execute_process(COMMAND git rev-parse --verify HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_SHA1 @@ -40,7 +40,7 @@ function(set_git_info) OUTPUT_STRIP_TRAILING_WHITESPACE ) message(STATUS "git branch: ${GIT_BRANCH}") -endfunction() +endmacro() function(calculate_xray_build_id output) set(XRAY_START_DAY 31) diff --git a/src/xrCore/CMakeLists.txt b/src/xrCore/CMakeLists.txt index 83085473c2a..7c2874d306d 100644 --- a/src/xrCore/CMakeLists.txt +++ b/src/xrCore/CMakeLists.txt @@ -464,15 +464,15 @@ endif() target_compile_definitions(xrCore PRIVATE XRCORE_EXPORTS - CMAKE_INSTALL_FULL_LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR} - CMAKE_INSTALL_FULL_DATAROOTDIR=${CMAKE_INSTALL_FULL_DATAROOTDIR} + CMAKE_INSTALL_FULL_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\" + CMAKE_INSTALL_FULL_DATAROOTDIR=\"${CMAKE_INSTALL_FULL_DATAROOTDIR}\" CI=$ENV{CI} GITHUB_ACTIONS=$ENV{GITHUB_ACTIONS} - GITHUB_RUN_ID=$ENV{GITHUB_RUN_ID} - GITHUB_RUN_NUMBER=$ENV{GITHUB_RUN_NUMBER} - GITHUB_REPOSITORY=$ENV{GITHUB_REPOSITORY} - GIT_INFO_CURRENT_COMMIT=${GIT_SHA1} - GIT_INFO_CURRENT_BRANCH=${GIT_BRANCH} + GITHUB_RUN_ID=\"$ENV{GITHUB_RUN_ID}\" + GITHUB_RUN_NUMBER=\"$ENV{GITHUB_RUN_NUMBER}\" + GITHUB_REPOSITORY=\"$ENV{GITHUB_REPOSITORY}\" + GIT_INFO_CURRENT_COMMIT=\"${GIT_SHA1}\" + GIT_INFO_CURRENT_BRANCH=\"${GIT_BRANCH}\" ) if (MEMORY_ALLOCATOR STREQUAL "mimalloc") diff --git a/src/xrCore/LocatorAPI.cpp b/src/xrCore/LocatorAPI.cpp index b14f56bb490..ef8f9ce7db5 100644 --- a/src/xrCore/LocatorAPI.cpp +++ b/src/xrCore/LocatorAPI.cpp @@ -845,7 +845,7 @@ void CLocatorAPI::setup_fs_path(pcstr fs_name) * I propose adding shaders from /openxray/gamedata/shaders so that we remove unnecessary questions from users who want to start * the game using resources not from the proposed ~/.local/share/GSC Game World/Game in this case, this section of code can be safely removed */ chdir(pref_path); - static constexpr pcstr install_dir = MACRO_TO_STRING(CMAKE_INSTALL_FULL_DATAROOTDIR); + static constexpr pcstr install_dir = CMAKE_INSTALL_FULL_DATAROOTDIR; string_path tmp, tmp_link; xr_sprintf(tmp, "%sfsgame.ltx", pref_path); struct stat statbuf; diff --git a/src/xrCore/Threading/Lock.hpp b/src/xrCore/Threading/Lock.hpp index c9474fb8213..ddc0234cd78 100644 --- a/src/xrCore/Threading/Lock.hpp +++ b/src/xrCore/Threading/Lock.hpp @@ -4,6 +4,7 @@ #include "Common/Noncopyable.hpp" #ifdef CONFIG_PROFILE_LOCKS +#include "xrCore.h" typedef void (*add_profile_portion_callback)(LPCSTR id, const u64& time); void XRCORE_API set_add_profile_portion(add_profile_portion_callback callback); diff --git a/src/xrCore/xrCore.cpp b/src/xrCore/xrCore.cpp index 42bdb0bf71f..af7b383840a 100644 --- a/src/xrCore/xrCore.cpp +++ b/src/xrCore/xrCore.cpp @@ -62,8 +62,8 @@ static u32 init_counter = 0; void SDLLogOutput(void* userdata, int category, SDL_LogPriority priority, const char* message); const pcstr xrCore::buildDate = __DATE__; -const pcstr xrCore::buildCommit = MACRO_TO_STRING(GIT_INFO_CURRENT_COMMIT); -const pcstr xrCore::buildBranch = MACRO_TO_STRING(GIT_INFO_CURRENT_BRANCH); +const pcstr xrCore::buildCommit = GIT_INFO_CURRENT_COMMIT; +const pcstr xrCore::buildBranch = GIT_INFO_CURRENT_BRANCH; xrCore::xrCore() : ApplicationName{}, ApplicationPath{}, @@ -117,14 +117,14 @@ void xrCore::PrintBuildInfo() #if defined(CI) # if defined(APPVEYOR) name = "AppVeyor"; - buildUniqueId = MACRO_TO_STRING(APPVEYOR_BUILD_ID); - buildId = MACRO_TO_STRING(APPVEYOR_BUILD_VERSION); - builder = MACRO_TO_STRING(APPVEYOR_ACCOUNT_NAME); + buildUniqueId = APPVEYOR_BUILD_ID; + buildId = APPVEYOR_BUILD_VERSION; + builder = APPVEYOR_ACCOUNT_NAME; # elif defined(GITHUB_ACTIONS) name = "GitHub Actions"; - buildUniqueId = MACRO_TO_STRING(GITHUB_RUN_ID); - buildId = MACRO_TO_STRING(GITHUB_RUN_NUMBER); - builder = MACRO_TO_STRING(GITHUB_REPOSITORY); + buildUniqueId = GITHUB_RUN_ID; + buildId = GITHUB_RUN_NUMBER; + builder = GITHUB_REPOSITORY; #else # pragma TODO("PrintBuildInfo for other CIs") name = "CI"; @@ -271,7 +271,7 @@ void xrCore::Initialize(pcstr _ApplicationName, pcstr commandLine, LogCallback c flags &= ~CLocatorAPI::flCacheFiles; #endif // _EDITOR - if (xr_stricmp(ApplicationPath, MACRO_TO_STRING(CMAKE_INSTALL_FULL_DATAROOTDIR)) != 0) + if (xr_stricmp(ApplicationPath, CMAKE_INSTALL_FULL_DATAROOTDIR) != 0) flags |= CLocatorAPI::flScanAppRoot; #ifndef _EDITOR