From 727846cbcecb509955a91a3e89b96d716945d56d Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Sun, 15 Jul 2018 14:40:33 +0500 Subject: [PATCH] AppVeyor builds now will be marked as such in the log Manually builded engine will be marked as custom build --- src/xrCore/xrCore.cpp | 33 +++++++++++++++++++++++++++++++++ src/xrCore/xrCore.vcxproj | 12 ++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/xrCore/xrCore.cpp b/src/xrCore/xrCore.cpp index 6a84379dd26..33c05fc6000 100644 --- a/src/xrCore/xrCore.cpp +++ b/src/xrCore/xrCore.cpp @@ -20,6 +20,38 @@ XRCORE_API xrCore Core; static u32 init_counter = 0; +#define DO_EXPAND(VAL) VAL##1 +#define EXPAND(VAL) DO_EXPAND(VAL) + +#if EXPAND(CI) == 1 +#undef CI +#endif + +#define HELPER(s) #s +#define TO_STRING(s) HELPER(s) + +void PrintCI() +{ +#if defined(CI) + pcstr name = nullptr; + pcstr buildId = nullptr; + pcstr builder = nullptr; + pcstr commit = nullptr; +#if defined(APPVEYOR) + name = "AppVeyor"; + buildId = TO_STRING(APPVEYOR_BUILD_VERSION); + builder = TO_STRING(APPVEYOR_ACCOUNT_NAME); + commit = TO_STRING(APPVEYOR_REPO_COMMIT); +#else +#pragma TODO("PrintCI for other CIs") + return; +#endif + Msg("%s build %s from commit %s (built by %s)", name, buildId, commit, builder); +#else + Log("This is a custom build"); +#endif +} + void xrCore::Initialize(pcstr _ApplicationName, LogCallback cb, bool init_fs, pcstr fs_fname, bool plugin) { xr_strcpy(ApplicationName, _ApplicationName); @@ -75,6 +107,7 @@ void xrCore::Initialize(pcstr _ApplicationName, LogCallback cb, bool init_fs, pc Memory._initialize(); Msg("%s %s build %d, %s\n", "OpenXRay", GetBuildConfiguration(), buildId, buildDate); + PrintCI(); Msg("command line %s\n", Params); _initialize_cpu(); R_ASSERT(CPU::ID.hasFeature(CpuFeature::Sse)); diff --git a/src/xrCore/xrCore.vcxproj b/src/xrCore/xrCore.vcxproj index 403f638152c..d2069755fc9 100644 --- a/src/xrCore/xrCore.vcxproj +++ b/src/xrCore/xrCore.vcxproj @@ -103,7 +103,7 @@ $(xrExternals);$(xrExternals)lzo\include;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) - _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;%(PreprocessorDefinitions) + _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;CI=$(CI);APPVEYOR=$(APPVEYOR);APPVEYOR_BUILD_VERSION=$(APPVEYOR_BUILD_VERSION);APPVEYOR_ACCOUNT_NAME=$(APPVEYOR_ACCOUNT_NAME);APPVEYOR_REPO_COMMIT=$(APPVEYOR_REPO_COMMIT);%(PreprocessorDefinitions) PowrProf.lib;DbgHelp.lib;%(AdditionalDependencies) @@ -118,7 +118,7 @@ $(xrExternals);$(xrExternals)lzo\include;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) - _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;%(PreprocessorDefinitions) + _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;CI=$(CI);APPVEYOR=$(APPVEYOR);APPVEYOR_BUILD_VERSION=$(APPVEYOR_BUILD_VERSION);APPVEYOR_ACCOUNT_NAME=$(APPVEYOR_ACCOUNT_NAME);APPVEYOR_REPO_COMMIT=$(APPVEYOR_REPO_COMMIT);%(PreprocessorDefinitions) PowrProf.lib;DbgHelp.lib;%(AdditionalDependencies) @@ -131,7 +131,7 @@ $(xrExternals);$(xrExternals)lzo\include;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) - _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;%(PreprocessorDefinitions) + _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;CI=$(CI);APPVEYOR=$(APPVEYOR);APPVEYOR_BUILD_VERSION=$(APPVEYOR_BUILD_VERSION);APPVEYOR_ACCOUNT_NAME=$(APPVEYOR_ACCOUNT_NAME);APPVEYOR_REPO_COMMIT=$(APPVEYOR_REPO_COMMIT);%(PreprocessorDefinitions) PowrProf.lib;DbgHelp.lib;%(AdditionalDependencies) @@ -146,7 +146,7 @@ $(xrExternals);$(xrExternals)lzo\include;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) - _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;%(PreprocessorDefinitions) + _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;CI=$(CI);APPVEYOR=$(APPVEYOR);APPVEYOR_BUILD_VERSION=$(APPVEYOR_BUILD_VERSION);APPVEYOR_ACCOUNT_NAME=$(APPVEYOR_ACCOUNT_NAME);APPVEYOR_REPO_COMMIT=$(APPVEYOR_REPO_COMMIT);%(PreprocessorDefinitions) PowrProf.lib;DbgHelp.lib;%(AdditionalDependencies) @@ -159,7 +159,7 @@ $(xrExternals);$(xrExternals)lzo\include;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) - _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;%(PreprocessorDefinitions) + _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;CI=$(CI);APPVEYOR=$(APPVEYOR);APPVEYOR_BUILD_VERSION=$(APPVEYOR_BUILD_VERSION);APPVEYOR_ACCOUNT_NAME=$(APPVEYOR_ACCOUNT_NAME);APPVEYOR_REPO_COMMIT=$(APPVEYOR_REPO_COMMIT);%(PreprocessorDefinitions) PowrProf.lib;DbgHelp.lib;%(AdditionalDependencies) @@ -174,7 +174,7 @@ $(xrExternals);$(xrExternals)lzo\include;$(xrExternals)pugixml\src;%(AdditionalIncludeDirectories) - _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;%(PreprocessorDefinitions) + _USRDLL;XRCORE_EXPORTS;CRYPTO_BUILD;CI=$(CI);APPVEYOR=$(APPVEYOR);APPVEYOR_BUILD_VERSION=$(APPVEYOR_BUILD_VERSION);APPVEYOR_ACCOUNT_NAME=$(APPVEYOR_ACCOUNT_NAME);APPVEYOR_REPO_COMMIT=$(APPVEYOR_REPO_COMMIT);%(PreprocessorDefinitions) PowrProf.lib;DbgHelp.lib;%(AdditionalDependencies)