forked from bartvdbraak/blender
fix for cmake not having the correct svn revision in buildinfo, now generate a header every build with the time, date, svn revision.
This commit is contained in:
parent
197a57db69
commit
b8e3f4ee30
@ -916,28 +916,6 @@ elseif(APPLE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# buildinfo
|
|
||||||
if(WITH_BUILDINFO)
|
|
||||||
# BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
|
|
||||||
if(UNIX)
|
|
||||||
execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
execute_process(COMMAND svnversion ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE BUILD_REV RESULT_VARIABLE BUILD_REV_RETURN OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(BUILD_REV_RETURN)
|
|
||||||
set(BUILD_REV "unknown")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
execute_process(COMMAND svnversion ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE BUILD_REV RESULT_VARIABLE BUILD_REV_RETURN OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(BUILD_REV_RETURN)
|
|
||||||
set(BUILD_REV "unknown")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Common.
|
# Common.
|
||||||
|
|
||||||
|
34
build_files/cmake/buildinfo.cmake
Normal file
34
build_files/cmake/buildinfo.cmake
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# this is called by cmake as an extermal process from
|
||||||
|
# ./source/creator/CMakeLists.txt to write ./source/creator/buildinfo.h
|
||||||
|
|
||||||
|
# the FindSubversion.cmake module is part of the standard distribution
|
||||||
|
include(FindSubversion)
|
||||||
|
# extract working copy information for SOURCE_DIR into MY_XXX variables
|
||||||
|
if(Subversion_FOUND)
|
||||||
|
Subversion_WC_INFO(${SOURCE_DIR} MY)
|
||||||
|
else()
|
||||||
|
set(MY_WC_REVISION "unknown")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
|
||||||
|
if(UNIX)
|
||||||
|
execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# write a file with the SVNVERSION define
|
||||||
|
file(WRITE buildinfo.h.txt
|
||||||
|
"#define BUILD_REV ${MY_WC_REVISION}\n"
|
||||||
|
"#define BUILD_DATE ${BUILD_DATE}\n"
|
||||||
|
"#define BUILD_TIME ${BUILD_TIME}\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
# copy the file to the final header only if the version changes
|
||||||
|
# reduces needless rebuilds
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
buildinfo.h.txt buildinfo.h)
|
@ -395,7 +395,7 @@ void PAINT_OT_face_select_hide(wmOperatorType *ot)
|
|||||||
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects.");
|
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int face_select_reveal_exec(bContext *C, wmOperator *op)
|
static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Object *ob= CTX_data_active_object(C);
|
Object *ob= CTX_data_active_object(C);
|
||||||
paintface_reveal(ob);
|
paintface_reveal(ob);
|
||||||
|
@ -107,13 +107,17 @@ if(WIN32 AND NOT UNIX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_BUILDINFO)
|
if(WITH_BUILDINFO)
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# These defines could all be moved into the header below
|
||||||
string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}")
|
string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}")
|
||||||
string(REPLACE " " "\ " BUILDINFO_CXXFLAGS "${CMAKE_CXX_FLAGS}")
|
string(REPLACE " " "\ " BUILDINFO_CXXFLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
string(REPLACE " " "\ " BUILDINFO_LINKFLAGS "${PLATFORM_LINKFLAGS}")
|
string(REPLACE " " "\ " BUILDINFO_LINKFLAGS "${PLATFORM_LINKFLAGS}")
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DBUILD_DATE="${BUILD_DATE}"
|
# # define in header now, else these get out of date on rebuilds.
|
||||||
-DBUILD_TIME="${BUILD_TIME}"
|
# -DBUILD_DATE="${BUILD_DATE}"
|
||||||
-DBUILD_REV="${BUILD_REV}"
|
# -DBUILD_TIME="${BUILD_TIME}"
|
||||||
|
# -DBUILD_REV="${BUILD_REV}"
|
||||||
|
-DWITH_BUILDINFO_HEADER # alternative to lines above
|
||||||
-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
|
-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
|
||||||
-DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
|
-DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
|
||||||
-DBUILD_CFLAGS="${BUILDINFO_CFLAGS}"
|
-DBUILD_CFLAGS="${BUILDINFO_CFLAGS}"
|
||||||
@ -122,6 +126,32 @@ if(WITH_BUILDINFO)
|
|||||||
-DBUILD_SYSTEM="CMake"
|
-DBUILD_SYSTEM="CMake"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# write header for values that change each build
|
||||||
|
# note, generaed file is in build dir's source/creator
|
||||||
|
# except when used as an include path.
|
||||||
|
|
||||||
|
# include the output directory, where the buildinfo.h file is generated
|
||||||
|
include_directories(${CMAKE_BINARY_DIR}/source/creator)
|
||||||
|
message(WARNING "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
# a custom target that is always built
|
||||||
|
add_custom_target(buildinfo ALL
|
||||||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h)
|
||||||
|
|
||||||
|
# creates svnheader.h using cmake script
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
|
||||||
|
-P ${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo.cmake)
|
||||||
|
|
||||||
|
# buildinfo.h is a generated file
|
||||||
|
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
|
||||||
|
PROPERTIES GENERATED TRUE
|
||||||
|
HEADER_FILE_ONLY TRUE)
|
||||||
|
|
||||||
|
# add deps below
|
||||||
|
# -------------- done with header values.
|
||||||
|
|
||||||
list(APPEND SRC
|
list(APPEND SRC
|
||||||
buildinfo.c
|
buildinfo.c
|
||||||
)
|
)
|
||||||
@ -144,6 +174,11 @@ else()
|
|||||||
add_executable(blender ${EXETYPE} ${SRC})
|
add_executable(blender ${EXETYPE} ${SRC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_BUILDINFO)
|
||||||
|
# explicitly say that the executable depends on the buildinfo
|
||||||
|
add_dependencies(blender buildinfo)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Post build steps for bundling/packaging.
|
# Post build steps for bundling/packaging.
|
||||||
|
|
||||||
set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
|
set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
|
||||||
|
@ -27,15 +27,21 @@
|
|||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef WITH_BUILDINFO_HEADER
|
||||||
|
#include "buildinfo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BUILD_DATE
|
#ifdef BUILD_DATE
|
||||||
|
|
||||||
/* copied from BLI_utildefines.h */
|
/* copied from BLI_utildefines.h */
|
||||||
#define STRINGIFY_ARG(x) #x
|
#define STRINGIFY_ARG(x) #x
|
||||||
#define STRINGIFY(x) STRINGIFY_ARG(x)
|
#define STRINGIFY(x) STRINGIFY_ARG(x)
|
||||||
|
|
||||||
|
/* currently only these are defined in the header */
|
||||||
char build_date[]= STRINGIFY(BUILD_DATE);
|
char build_date[]= STRINGIFY(BUILD_DATE);
|
||||||
char build_time[]= STRINGIFY(BUILD_TIME);
|
char build_time[]= STRINGIFY(BUILD_TIME);
|
||||||
char build_rev[]= STRINGIFY(BUILD_REV);
|
char build_rev[]= STRINGIFY(BUILD_REV);
|
||||||
|
|
||||||
char build_platform[]= STRINGIFY(BUILD_PLATFORM);
|
char build_platform[]= STRINGIFY(BUILD_PLATFORM);
|
||||||
char build_type[]= STRINGIFY(BUILD_TYPE);
|
char build_type[]= STRINGIFY(BUILD_TYPE);
|
||||||
|
|
||||||
|
@ -97,6 +97,10 @@
|
|||||||
#include "GPU_draw.h"
|
#include "GPU_draw.h"
|
||||||
#include "GPU_extensions.h"
|
#include "GPU_extensions.h"
|
||||||
|
|
||||||
|
#ifdef WITH_BUILDINFO_HEADER
|
||||||
|
#define BUILD_DATE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* for passing information between creator and gameengine */
|
/* for passing information between creator and gameengine */
|
||||||
#ifdef WITH_GAMEENGINE
|
#ifdef WITH_GAMEENGINE
|
||||||
#include "GEN_messaging.h"
|
#include "GEN_messaging.h"
|
||||||
@ -141,7 +145,7 @@ extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
|
|||||||
char bprogname[FILE_MAX]; /* from blenpluginapi:pluginapi.c */
|
char bprogname[FILE_MAX]; /* from blenpluginapi:pluginapi.c */
|
||||||
char btempdir[FILE_MAX];
|
char btempdir[FILE_MAX];
|
||||||
|
|
||||||
#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
|
#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d)\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
|
||||||
|
|
||||||
/* Initialise callbacks for the modules that need them */
|
/* Initialise callbacks for the modules that need them */
|
||||||
static void setCallbacks(void);
|
static void setCallbacks(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user