1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-27 23:14:05 +00:00

cmake: Generate Revision.h in the build directory

This commit is contained in:
orbea 2021-11-28 12:18:44 -08:00 committed by Sergey Lipskiy
parent 727639c8ba
commit 9d0e92a10d
5 changed files with 11 additions and 7 deletions

View File

@ -11,22 +11,25 @@ option(ANDROID "Set to ON if targeting an Android device" ${ANDROID})
option(GL_PROFILE "Set to ON to turn on GL profiling" ${GL_PROFILE})
# run script to generate Revision.h
set(PATH_REVISION "Revision.h")
set(PATH_REVISION "${CMAKE_CURRENT_BINARY_DIR}/inc/Revision.h")
find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/../.git")
add_custom_command(
OUTPUT ${PATH_REVISION}
COMMAND ${CMAKE_SOURCE_DIR}/getRevision.sh
COMMAND
OUTPUT=${PATH_REVISION} ${CMAKE_SOURCE_DIR}/getRevision.sh
COMMENT "Generate Git version"
)
else(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/../.git")
add_custom_command(
OUTPUT ${PATH_REVISION}
COMMAND ${CMAKE_SOURCE_DIR}/getRevision.sh --nogit
COMMAND
OUTPUT=${PATH_REVISION} ${CMAKE_SOURCE_DIR}/getRevision.sh --nogit
COMMENT "Generate version"
)
endif(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/../.git")
set_property(SOURCE ${PATH_REVISION} PROPERTY SKIP_AUTOGEN ON)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/inc")
project( GLideN64 )

View File

@ -1,9 +1,9 @@
#include <algorithm>
#include <Revision.h>
#include "assert.h"
#include "math.h"
#include "Platform.h"
#include "GLideN64.h"
#include "Revision.h"
#include "RSP.h"
#include "Config.h"
#include "Combiner.h"

View File

@ -1,4 +1,4 @@
#include "Revision.h"
#include <Revision.h>
char pluginName[] = "GLideN64";
char pluginNameWithRevision[] = "GLideN64 rev." PLUGIN_REVISION;
wchar_t pluginNameW[] = L"GLideN64";

View File

@ -4,7 +4,7 @@ set -eu
cd -- "$(cd -- "${0%/*}/" && pwd -P)"
header='./Revision.h'
header="${OUTPUT:-./Revision.h}"
if [ "${1:-}" != --nogit ]
then
@ -23,6 +23,7 @@ printf '%s\n' "current revision $rev" "last build revision $lastrev"
if [ "$lastrev" != "$rev" ]
then
[ "$header" = "${header##*/}" ] || mkdir -p -- "${header%/*}"
printf '%s\n' "#define PLUGIN_REVISION $rev" \
"#define PLUGIN_REVISION_W L$rev" > "$header"
fi

View File

@ -3,8 +3,8 @@
#include "../GLideN64.h"
#include "../GLideNUI/GLideNUI.h"
#include "../Config.h"
#include "../Revision.h"
#include <DisplayWindow.h>
#include <Revision.h>
void PluginAPI::DllAbout(/*HWND _hParent*/)
{