1
0
Fork 0

Change the way versioning is done. I hope this will work under windows

This commit is contained in:
Christian Schmitt 2012-12-04 19:44:28 +01:00
parent b61cfa500b
commit ccec928116
3 changed files with 23 additions and 10 deletions

View file

@ -11,7 +11,6 @@ project(TerraGear)
# read 'version' file into a variable (stripping any newlines or spaces)
file(READ version versionFile)
string(STRIP ${versionFile} TERRAGEAR_VERSION)
file(WRITE ${PROJECT_BINARY_DIR}/src/Include/version.h "#define TERRAGEAR_VERSION ${TERRAGEAR_VERSION}")
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
@ -131,9 +130,6 @@ include_directories(
${SIMGEAR_INCLUDE_DIR}
)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_BINARY_DIR}/src/Include)
add_definitions(-DHAVE_CONFIG_H)
# configure a header file to pass some of the CMake settings
@ -142,6 +138,14 @@ configure_file (
"${PROJECT_SOURCE_DIR}/src/Include/config_cmake.h.in"
"${PROJECT_BINARY_DIR}/src/Include/config.h"
)
# create a version.h file
configure_file (
"${PROJECT_SOURCE_DIR}/src/Include/version.h.cmake-in"
"${PROJECT_BINARY_DIR}/src/Include/version.h"
)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_BINARY_DIR}/src/Include)
add_subdirectory(src)
#add_subdirectory(gismodules)

View file

@ -0,0 +1,11 @@
#ifndef _VERSION_H
#define _VERSION_H
#include <string>
const std::string getTGVersion()
{
return "@TERRAGEAR_VERSION@";
}
#endif

View file

@ -45,7 +45,6 @@
#include <zlib.h>
#include <boost/foreach.hpp>
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/bucket/newbucket.hxx>
#include <simgear/misc/sg_path.hxx>
@ -306,9 +305,8 @@ struct option options[]={
int main(int argc, char** argv) {
sglog().setLogLevels( SG_ALL, SG_DEBUG );
int option;
const std::string version = SG_STRINGIZE(TERRAGEAR_VERSION);
while ((option=getopt_long(argc,argv,"h:m:x:e::f:v:j:",options,NULL))!=-1) {
while ((option=getopt_long(argc,argv,"h:m:x:e:f:v:j:",options,NULL))!=-1) {
switch (option) {
case 'h':
usage(argv[0],"");
@ -326,7 +324,7 @@ int main(int argc, char** argv) {
force=true;
break;
case 'v':
SG_LOG(SG_GENERAL,SG_INFO,argv[0] << " version " << version);
SG_LOG(SG_GENERAL,SG_INFO,argv[0] << " version " << getTGVersion());
exit(0);
break;
case 'j':
@ -338,7 +336,7 @@ int main(int argc, char** argv) {
}
}
SG_LOG(SG_GENERAL, SG_INFO, "TerraFit version " << version);
SG_LOG(SG_GENERAL, SG_INFO, "TerraFit version " << getTGVersion());
SG_LOG(SG_GENERAL, SG_INFO, "Min points = " << min_points);
SG_LOG(SG_GENERAL, SG_INFO, "Max points = " << point_limit);
SG_LOG(SG_GENERAL, SG_INFO, "Max error = " << error_threshold);
@ -368,5 +366,5 @@ int main(int argc, char** argv) {
threads[t]->join();
}
printf("Work queue is empty\n");
SG_LOG(SG_GENERAL, SG_INFO, "Work queue is empty\n");
}