CMake adjusted to allow proper releasing.
Mac side is ready.
This commit is contained in:
+11
-15
@@ -79,22 +79,18 @@ set(SM_VERSION_MINOR 0)
|
|||||||
set(SM_VERSION_PATCH 7)
|
set(SM_VERSION_PATCH 7)
|
||||||
set(SM_VERSION_TRADITIONAL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}")
|
set(SM_VERSION_TRADITIONAL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}")
|
||||||
|
|
||||||
if(WITH_FULL_RELEASE EQUAL ON)
|
# Using the deprecated version for now to keep cmake 2.8 users happy.
|
||||||
set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}")
|
exec_program(git "${SM_ROOT_DIR}"
|
||||||
else()
|
ARGS "rev-parse" "--short" "HEAD"
|
||||||
# Using the deprecated version for now to keep cmake 2.8 users happy.
|
OUTPUT_VARIABLE SM_VERSION_GIT_HASH
|
||||||
exec_program(git "${SM_ROOT_DIR}"
|
RETURN_VALUE ret
|
||||||
ARGS "rev-parse" "--short" "HEAD"
|
)
|
||||||
OUTPUT_VARIABLE SM_VERSION_GIT_HASH
|
|
||||||
RETURN_VALUE ret
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT (ret STREQUAL "0"))
|
if(NOT (ret STREQUAL "0"))
|
||||||
set(SM_VERSION_GIT_HASH "UNKNOWN")
|
set(SM_VERSION_GIT_HASH "UNKNOWN")
|
||||||
set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-${SM_VERSION_GIT_HASH}")
|
set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-${SM_VERSION_GIT_HASH}")
|
||||||
else()
|
else()
|
||||||
set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-git-${SM_VERSION_GIT_HASH}")
|
set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-git-${SM_VERSION_GIT_HASH}")
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Allow for finding our libraries in a standard location.
|
# Allow for finding our libraries in a standard location.
|
||||||
|
|||||||
@@ -29,14 +29,26 @@ File.open("#{Dir.pwd}/ProductInfo.h", "r") do |f|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# open ver.h in read-only mode
|
|
||||||
File.open("#{Dir.pwd}/ver.h", "r") do |f|
|
# Determine if the Cmake generated verstub.cpp is available.
|
||||||
# read each line, matching for product version
|
File.open("#{Dir.pwd}/verstub.cpp", "r") do |verFile|
|
||||||
f.each do |line|
|
verFile.each do |verLine|
|
||||||
if line.match( /^#define\s+product_version\s+"(.*?)"/ )
|
if verLine.match( /^extern char const \* const product_version \= "(.*?)"/ )
|
||||||
version = $1
|
version = $1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (version.length == 0)
|
||||||
|
# open ver.h in read-only mode
|
||||||
|
File.open("#{Dir.pwd}/ver.h", "r") do |f|
|
||||||
|
# read each line, matching for product version
|
||||||
|
f.each do |line|
|
||||||
|
if line.match( /^#define\s+product_version\s+"(.*?)"/ )
|
||||||
|
version = $1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# replace whitespace with hyphens in the version string
|
# replace whitespace with hyphens in the version string
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ include_directories(${PROJECT_BINARY_DIR})
|
|||||||
|
|
||||||
add_executable("VersionUpdater" Main.cpp "${PROJECT_BINARY_DIR}/version.hpp")
|
add_executable("VersionUpdater" Main.cpp "${PROJECT_BINARY_DIR}/version.hpp")
|
||||||
|
|
||||||
|
if (WITH_FULL_RELEASE)
|
||||||
|
sm_add_compile_definition("VersionUpdater" IS_FULL_RELEASE)
|
||||||
|
message(STATUS "Full release mode engaged.")
|
||||||
|
endif()
|
||||||
|
|
||||||
set_property(TARGET "VersionUpdater" PROPERTY FOLDER "Internal Libraries")
|
set_property(TARGET "VersionUpdater" PROPERTY FOLDER "Internal Libraries")
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ int smVersionMajor = @SM_VERSION_MAJOR@;
|
|||||||
int smVersionMinor = @SM_VERSION_MINOR@;
|
int smVersionMinor = @SM_VERSION_MINOR@;
|
||||||
int smVersionPatch = @SM_VERSION_PATCH@;
|
int smVersionPatch = @SM_VERSION_PATCH@;
|
||||||
char const * const smVersionGitHash = "@SM_VERSION_GIT_HASH@";
|
char const * const smVersionGitHash = "@SM_VERSION_GIT_HASH@";
|
||||||
|
#if defined(IS_FULL_RELEASE)
|
||||||
|
char const * const smVersionFull = "@SM_VERSION_TRADITIONAL@";
|
||||||
|
#else
|
||||||
char const * const smVersionFull = "@SM_VERSION_FULL@";
|
char const * const smVersionFull = "@SM_VERSION_FULL@";
|
||||||
|
#endif
|
||||||
char const * const smVersionTraditional = "@SM_VERSION_TRADITIONAL@";
|
char const * const smVersionTraditional = "@SM_VERSION_TRADITIONAL@";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user