From 49ce9b153df07647a3fd70bf2fdec705d927455c Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 18 Jun 2016 00:13:37 +0200 Subject: [PATCH] scmrev: Add "distributor" option. Used to distinguish between Dolphin distributions (e.g. "dolphin-emu.org", "Ishiiruka", etc.). --- CMakeLists.txt | 6 ++++++ Source/Core/Common/Common.h | 1 + Source/Core/Common/Version.cpp | 1 + Source/Core/Common/make_scmrev.h.js | 9 +++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ae2cca0f2..2d8e3f81dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,11 @@ option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF) # of our software in the wild. option(ENABLE_ANALYTICS "Enables opt-in Analytics collection" ON) +# Name of the Dolphin distributor. If you redistribute Dolphin builds (forks, +# unofficial builds) please consider identifying your distribution with a +# unique name here. +set(DISTRIBUTOR "None" CACHE STRING "Name of the distributor.") + # Enable SDL for default on operating systems that aren't OSX, Android, Linux or Windows. if(NOT APPLE AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT MSVC) option(ENABLE_SDL "Enables SDL as a generic controller backend" ON) @@ -935,6 +940,7 @@ file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h "#define SCM_DESC_STR \"" ${DOLPHIN_WC_DESCRIBE} "\"\n" "#define SCM_BRANCH_STR \"" ${DOLPHIN_WC_BRANCH} "\"\n" "#define SCM_IS_MASTER " ${DOLPHIN_WC_IS_STABLE} "\n" + "#define SCM_DISTRIBUTOR_STR \"" ${DISTRIBUTOR} "\"\n" ) include_directories("${PROJECT_BINARY_DIR}/Source/Core/Common") diff --git a/Source/Core/Common/Common.h b/Source/Core/Common/Common.h index 7f8e6ce639..4d60332d6c 100644 --- a/Source/Core/Common/Common.h +++ b/Source/Core/Common/Common.h @@ -15,6 +15,7 @@ extern const std::string scm_branch_str; extern const std::string scm_rev_str; extern const std::string scm_rev_git_str; extern const std::string netplay_dolphin_ver; +extern const std::string scm_distributor_str; // Force enable logging in the right modes. For some reason, something had changed // so that debugfast no longer logged. diff --git a/Source/Core/Common/Version.cpp b/Source/Core/Common/Version.cpp index 8c97ed78a9..c02a83a21c 100644 --- a/Source/Core/Common/Version.cpp +++ b/Source/Core/Common/Version.cpp @@ -36,3 +36,4 @@ const std::string scm_rev_git_str = SCM_REV_STR; const std::string scm_desc_str = SCM_DESC_STR; const std::string scm_branch_str = SCM_BRANCH_STR; +const std::string scm_distributor_str = SCM_DISTRIBUTOR_STR; diff --git a/Source/Core/Common/make_scmrev.h.js b/Source/Core/Common/make_scmrev.h.js index 1d5fa902f4..4d9c4806d9 100644 --- a/Source/Core/Common/make_scmrev.h.js +++ b/Source/Core/Common/make_scmrev.h.js @@ -76,7 +76,11 @@ var gitexe = GetGitExe(); var revision = GetFirstStdOutLine(gitexe + cmd_revision); var describe = GetFirstStdOutLine(gitexe + cmd_describe); var branch = GetFirstStdOutLine(gitexe + cmd_branch); -var isStable = +("master" == branch || "stable" == branch); +var isStable = +("master" == branch || "stable" == branch); + +// Get environment information. +var distributor = wshShell.ExpandEnvironmentStrings("%DOLPHIN_DISTRIBUTOR%"); +if (distributor == "%DOLPHIN_DISTRIBUTOR%") distributor = "None"; // remove hash (and trailing "-0" if needed) from description describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2'); @@ -85,7 +89,8 @@ var out_contents = "#define SCM_REV_STR \"" + revision + "\"\n" + "#define SCM_DESC_STR \"" + describe + "\"\n" + "#define SCM_BRANCH_STR \"" + branch + "\"\n" + - "#define SCM_IS_MASTER " + isStable + "\n"; + "#define SCM_IS_MASTER " + isStable + "\n" + + "#define SCM_DISTRIBUTOR_STR \"" + distributor + "\"\n"; // check if file needs updating if (out_contents == GetFileContents(outfile))