Fixed bug during compilation with mingw & improved git revision support for automatic up to date revision number.

pull/279/head
Léo Terziman 2014-05-19 14:36:24 +02:00
parent d531945888
commit 311f5b47ca
3 changed files with 31 additions and 3 deletions

View File

@ -7,10 +7,37 @@ set (ASSIMP_VERSION_MINOR 0)
set (ASSIMP_VERSION_PATCH 1) # subversion revision?
set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
set (ASSIMP_SOVERSION 3)
SET ( PROJECT_VERSION "${ASSIMP_VERSION}" )
set (PROJECT_VERSION "${ASSIMP_VERSION}")
set(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources")
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_COMMIT_HASH)
set(GIT_COMMIT_HASH 0)
endif(NOT GIT_COMMIT_HASH)
configure_file(
${CMAKE_SOURCE_DIR}/revision.h.in
${CMAKE_BINARY_DIR}/revision.h
)
include_directories(${CMAKE_BINARY_DIR})
option(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
set(LIBASSIMP_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}" )

View File

@ -63,7 +63,7 @@ ASSIMP_API unsigned int aiGetCompileFlags () {
}
// include current build revision, which is even updated from time to time -- :-)
#include "../revision.h"
#include "revision.h"
// ------------------------------------------------------------------------------------------------
ASSIMP_API unsigned int aiGetVersionRevision ()

View File

@ -1,6 +1,7 @@
#ifndef ASSIMP_REVISION_H_INC
#define ASSIMP_REVISION_H_INC
#define GitVersion 0xA0bA3A8;
#define GitVersion 0x@GIT_COMMIT_HASH@
#define GitBranch "@GIT_BRANCH@"
#endif // ASSIMP_REVISION_H_INC