buildinfo is now quoted from the build systems, avoids stripping quotes on startup.

tested with linux/cmake linux/scons windows/cmake/mingw windows/cmake/msvc
This commit is contained in:
Campbell Barton 2011-08-22 12:24:14 +00:00
parent 5394cabe24
commit 817273931a
7 changed files with 35 additions and 57 deletions

View File

@ -62,6 +62,22 @@ set(CMAKE_BUILD_TYPE_INIT "Release")
# quiet output for Makefiles, 'make -s' helps too
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
#-----------------------------------------------------------------------------
# Set policy
# see "cmake --help-policy CMP0003"
# So library linking is more sane
cmake_policy(SET CMP0003 NEW)
# So BUILDINFO and BLENDERPATH strings are automatically quoted
cmake_policy(SET CMP0005 NEW)
# So syntax problems are errors
cmake_policy(SET CMP0010 NEW)
# Input directories must have CMakeLists.txt
cmake_policy(SET CMP0014 NEW)
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)

View File

@ -27,9 +27,9 @@ 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"
"#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

View File

@ -145,11 +145,6 @@ endmacro()
macro(SETUP_LIBDIRS)
# see "cmake --help-policy CMP0003"
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs

View File

@ -364,16 +364,16 @@ def buildinfo(lenv, build_type):
obj = []
if lenv['BF_BUILDINFO']:
lenv.Append (CPPDEFINES = ['BUILD_TIME="%s"'%(build_time),
'BUILD_DATE="%s"'%(build_date),
'BUILD_TYPE="%s"'%(build_type),
'BUILD_REV="%s"'%(build_rev),
lenv.Append (CPPDEFINES = ['BUILD_TIME=\\"%s\\"'%(build_time),
'BUILD_DATE=\\"%s\\"'%(build_date),
'BUILD_TYPE=\\"%s\\"'%(build_type),
'BUILD_REV=\\"%s\\"'%(build_rev),
'NAN_BUILDINFO',
'BUILD_PLATFORM="%s:%s"'%(platform.system(), platform.architecture()[0]),
'BUILD_PLATFORM=\\"%s:%s\\"'%(platform.system(), platform.architecture()[0]),
'BUILD_CFLAGS=\\"%s\\"'%(build_cflags),
'BUILD_CXXFLAGS=\\"%s\\"'%(build_cxxflags),
'BUILD_LINKFLAGS=\\"%s\\"'%(build_linkflags),
'BUILD_SYSTEM="SCons"'
'BUILD_SYSTEM=\\"SCons\\"'
])
lenv.Append (CPPPATH = [root_build_dir+'source/blender/blenkernel'])

View File

@ -25,9 +25,6 @@
#
# ***** END GPL LICENSE BLOCK *****
# So BUILDINFO and BLENDERPATH strings are automatically quoted
cmake_policy(SET CMP0005 NEW)
setup_libdirs()
blender_include_dirs(

View File

@ -33,28 +33,24 @@
#ifdef WITH_BUILDINFO_HEADER
#include "buildinfo.h"
# include "buildinfo.h"
#endif
#ifdef BUILD_DATE
/* copied from BLI_utildefines.h */
#define STRINGIFY_ARG(x) #x
#define STRINGIFY(x) STRINGIFY_ARG(x)
/* currently only these are defined in the header */
char build_date[]= STRINGIFY(BUILD_DATE);
char build_time[]= STRINGIFY(BUILD_TIME);
char build_rev[]= STRINGIFY(BUILD_REV);
char build_date[]= BUILD_DATE;
char build_time[]= BUILD_TIME;
char build_rev[]= BUILD_REV;
char build_platform[]= STRINGIFY(BUILD_PLATFORM);
char build_type[]= STRINGIFY(BUILD_TYPE);
char build_platform[]= BUILD_PLATFORM;
char build_type[]= BUILD_TYPE;
#ifdef BUILD_CFLAGS
char build_cflags[]= STRINGIFY(BUILD_CFLAGS);
char build_cxxflags[]= STRINGIFY(BUILD_CXXFLAGS);
char build_linkflags[]= STRINGIFY(BUILD_LINKFLAGS);
char build_system[]= STRINGIFY(BUILD_SYSTEM);
char build_cflags[]= BUILD_CFLAGS;
char build_cxxflags[]= BUILD_CXXFLAGS;
char build_linkflags[]= BUILD_LINKFLAGS;
char build_system[]= BUILD_SYSTEM;
#else
char build_cflags[]= "unmaintained buildsystem alert!";
char build_cxxflags[]= "unmaintained buildsystem alert!";

View File

@ -182,20 +182,6 @@ static void blender_esc(int sig)
}
#endif
/* buildinfo can have quotes */
#ifdef BUILD_DATE
static void strip_quotes(char *str)
{
if(str[0] == '"') {
int len= strlen(str) - 1;
memmove(str, str+1, len);
if(str[len-1] == '"') {
str[len-1]= '\0';
}
}
}
#endif
static int print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
printf (BLEND_VERSION_STRING_FMT);
@ -1181,18 +1167,6 @@ int main(int argc, const char **argv)
// need this.
BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]);
#ifdef BUILD_DATE
strip_quotes(build_date);
strip_quotes(build_time);
strip_quotes(build_rev);
strip_quotes(build_platform);
strip_quotes(build_type);
strip_quotes(build_cflags);
strip_quotes(build_cxxflags);
strip_quotes(build_linkflags);
strip_quotes(build_system);
#endif
BLI_threadapi_init();