Move build-ID variables to their own header
This is to reduce rebuilding by changing version.h needlessly, since only a few places use the build ID info.
This commit is contained in:
parent
8ac8446256
commit
d534a5ba36
8 changed files with 37 additions and 49 deletions
|
@ -88,7 +88,7 @@ if (NOT versionFile)
|
|||
message(FATAL_ERROR "Unable to determine FlightGear version. Version file is missing.")
|
||||
endif()
|
||||
string(STRIP "${versionFile}" FLIGHTGEAR_VERSION)
|
||||
# add a dependency on the versino file
|
||||
# add a dependency on the version file
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS version)
|
||||
|
||||
# FlightGear packaging (to build a source tarball)
|
||||
|
@ -110,12 +110,12 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
if(NOT "$ENV{BUILD_ID}" STREQUAL "")
|
||||
set(HUDSON_BUILD_ID $ENV{BUILD_ID})
|
||||
set(HUDSON_BUILD_NUMBER $ENV{BUILD_NUMBER})
|
||||
message(STATUS "running under Hudson/Jenkins, build-number is ${HUDSON_BUILD_NUMBER}")
|
||||
set(JENKINS_BUILD_ID $ENV{BUILD_ID})
|
||||
set(JENKINS_BUILD_NUMBER $ENV{BUILD_NUMBER})
|
||||
message(STATUS "running under Jenkins, build-number is ${JENKINS_BUILD_NUMBER}")
|
||||
else()
|
||||
set(HUDSON_BUILD_NUMBER 0)
|
||||
set(HUDSON_BUILD_ID "none")
|
||||
set(JENKINS_BUILD_NUMBER 0)
|
||||
set(JENKINS_BUILD_ID "none")
|
||||
endif()
|
||||
|
||||
#####################################################################################
|
||||
|
@ -558,6 +558,12 @@ configure_file (
|
|||
"${PROJECT_BINARY_DIR}/src/Include/version.h"
|
||||
)
|
||||
|
||||
# finally the build-id info
|
||||
configure_file (
|
||||
"${PROJECT_SOURCE_DIR}/src/Include/build.h.cmake-in"
|
||||
"${PROJECT_BINARY_DIR}/src/Include/build.h"
|
||||
)
|
||||
|
||||
add_subdirectory(3rdparty)
|
||||
add_subdirectory(utils)
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
REM
|
||||
|
||||
ECHO OFF
|
||||
|
||||
SET /P FLIGHTGEAR_VERSION=<version
|
||||
|
||||
SET HUDSON_BUILD_NUMBER=0
|
||||
SET HUDSON_BUILD_ID=none
|
||||
SET REVISION=none
|
||||
|
||||
IF DEFINED BUILD_ID SET HUDSON_BUILD_ID=%BUILD_ID%
|
||||
IF DEFINED BUILD_NUMBER SET HUDSON_BUILD_NUMBER=%BUILD_NUMBER%
|
||||
|
||||
SET Header=src\Include\version.h
|
||||
|
||||
ECHO // version.h generated by version.bat on %DATE% > %Header%
|
||||
|
||||
ECHO #define FLIGHTGEAR_VERSION "%FLIGHTGEAR_VERSION%" >> %Header%
|
||||
ECHO #define HUDSON_BUILD_ID "%HUDSON_BUILD_ID%" >> %Header%
|
||||
ECHO #define HUDSON_BUILD_NUMBER %HUDSON_BUILD_NUMBER% >> %Header%
|
||||
ECHO #define REVISION "%REVISION%" >> %Header%
|
||||
|
||||
|
||||
|
10
src/Include/build.h.cmake-in
Normal file
10
src/Include/build.h.cmake-in
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
#define FLIGHTGEAR_VERSION "@FLIGHTGEAR_VERSION@"
|
||||
|
||||
#define JENKINS_BUILD_NUMBER @JENKINS_BUILD_NUMBER@
|
||||
#define JENKINS_BUILD_ID "@JENKINS_BUILD_ID@"
|
||||
#define REVISION "@REVISION@"
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,10 +1,6 @@
|
|||
|
||||
#define FLIGHTGEAR_VERSION "@FLIGHTGEAR_VERSION@"
|
||||
|
||||
#define HUDSON_BUILD_NUMBER @HUDSON_BUILD_NUMBER@
|
||||
#define HUDSON_BUILD_ID "@HUDSON_BUILD_ID@"
|
||||
#define REVISION "@REVISION@"
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,10 +20,7 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
|
@ -62,6 +59,7 @@
|
|||
#include <Viewer/fgviewer.hxx>
|
||||
#include "main.hxx"
|
||||
#include <Include/version.h>
|
||||
#include <Include/build.h>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_init.hxx>
|
||||
#include <Main/options.hxx>
|
||||
|
@ -295,9 +293,9 @@ int main ( int argc, char **argv )
|
|||
} else {
|
||||
global_crashRptEnabled = true;
|
||||
|
||||
crAddProperty("hudson-build-id", HUDSON_BUILD_ID);
|
||||
crAddProperty("hudson-build-id", JENKINS_BUILD_ID);
|
||||
char buf[16];
|
||||
::snprintf(buf, 16, "%d", HUDSON_BUILD_NUMBER);
|
||||
::snprintf(buf, 16, "%d", JENKINS_BUILD_NUMBER);
|
||||
crAddProperty("hudson-build-number", buf);
|
||||
crAddProperty("git-revision", REVISION);
|
||||
crAddProperty("build-type", FG_BUILD_TYPE);
|
||||
|
|
|
@ -69,6 +69,7 @@ extern bool global_crashRptEnabled;
|
|||
#include <Viewer/WindowSystemAdapter.hxx>
|
||||
#include <Navaids/NavDataCache.hxx>
|
||||
#include <Include/version.h>
|
||||
#include <Include/build.h>
|
||||
|
||||
#include "fg_commands.hxx"
|
||||
#include "fg_io.hxx"
|
||||
|
@ -493,8 +494,8 @@ int fgMainInit( int argc, char **argv )
|
|||
SG_LOG( SG_GENERAL, SG_INFO, "FlightGear: Version " << version );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "FlightGear: Build Type " << FG_BUILD_TYPE );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "Built with " << SG_COMPILER_STR);
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "Jenkins number/ID " << HUDSON_BUILD_NUMBER << ":"
|
||||
<< HUDSON_BUILD_ID);
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "Jenkins number/ID " << JENKINS_BUILD_NUMBER << ":"
|
||||
<< JENKINS_BUILD_ID);
|
||||
|
||||
// seed the random number generator
|
||||
sg_srandom_time();
|
||||
|
@ -512,7 +513,7 @@ int fgMainInit( int argc, char **argv )
|
|||
bool showLauncher = flightgear::Options::checkForArg(argc, argv, "launcher");
|
||||
// an Info.plist bundle can't define command line arguments, but it can set
|
||||
// environment variables. This avoids needed a wrapper shell-script on OS-X.
|
||||
showLauncher |= (::getenv("FG_LAUNCHER") != 0);
|
||||
showLauncher |= (::getenv("FG_LAUNCHER") != nullptr);
|
||||
if (showLauncher) {
|
||||
// to minimise strange interactions when launcher and config files
|
||||
// set overlaping options, we disable the default files. Users can
|
||||
|
@ -624,7 +625,7 @@ int fgMainInit( int argc, char **argv )
|
|||
// clean up here; ensure we null globals to avoid
|
||||
// confusing the atexit() handler
|
||||
delete globals;
|
||||
globals = NULL;
|
||||
globals = nullptr;
|
||||
|
||||
// delete the NavCache here. This will cause the destruction of many cached
|
||||
// objects (eg, airports, navaids, runways).
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
|
||||
#include <osg/Version>
|
||||
#include <Include/version.h>
|
||||
#include <Include/build.h>
|
||||
#include <simgear/version.h>
|
||||
|
||||
using std::string;
|
||||
|
@ -244,8 +245,8 @@ void fgSetDefaults ()
|
|||
osg::Referenced::getThreadSafeReferenceCounting());
|
||||
#endif
|
||||
v->setValueReadOnly("revision", REVISION);
|
||||
v->setValueReadOnly("build-number", HUDSON_BUILD_NUMBER);
|
||||
v->setValueReadOnly("build-id", HUDSON_BUILD_ID);
|
||||
v->setValueReadOnly("build-number", JENKINS_BUILD_NUMBER);
|
||||
v->setValueReadOnly("build-id", JENKINS_BUILD_ID);
|
||||
v->setValueReadOnly("hla-support", bool(FG_HAVE_HLA));
|
||||
v->setValueReadOnly("build-type", FG_BUILD_TYPE);
|
||||
|
||||
|
@ -2752,7 +2753,7 @@ void Options::showVersion() const
|
|||
{
|
||||
cout << "FlightGear version: " << FLIGHTGEAR_VERSION << endl;
|
||||
cout << "Revision: " << REVISION << endl;
|
||||
cout << "Build-Id: " << HUDSON_BUILD_ID << endl;
|
||||
cout << "Build-Id: " << JENKINS_BUILD_ID << endl;
|
||||
cout << "Build-Type: " << FG_BUILD_TYPE << endl;
|
||||
cout << "FG_ROOT=" << globals->get_fg_root().utf8Str() << endl;
|
||||
cout << "FG_HOME=" << globals->get_fg_home().utf8Str() << endl;
|
||||
|
@ -2789,7 +2790,7 @@ void Options::printJSONReport() const
|
|||
cJSON_AddItemToObject(rootNode, "general", generalNode);
|
||||
cJSON_AddStringToObject(generalNode, "name", "FlightGear");
|
||||
cJSON_AddStringToObject(generalNode, "version", FLIGHTGEAR_VERSION);
|
||||
cJSON_AddStringToObject(generalNode, "build ID", HUDSON_BUILD_ID);
|
||||
cJSON_AddStringToObject(generalNode, "build ID", JENKINS_BUILD_ID);
|
||||
cJSON_AddStringToObject(generalNode, "build type", FG_BUILD_TYPE);
|
||||
|
||||
cJSON *configNode = cJSON_CreateObject();
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <Main/fg_props.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Include/version.h>
|
||||
#include <Include/build.h>
|
||||
|
||||
#include "flarm.hxx"
|
||||
|
||||
|
|
Loading…
Reference in a new issue