From 2a89fb887e6e9cc50a30ec67fb9cb3e8b06a59cd Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 19 Oct 2010 05:00:36 +0000 Subject: [PATCH] * Enable compile and link flags to build info also on Windows and in SCons. * Added build_system SCons or CMake * Write the new build info also to system-info.txt --- build_files/scons/tools/Blender.py | 13 ++++++++++++- release/scripts/modules/sys_info.py | 6 +++++- source/blender/python/intern/bpy_app.c | 4 ++++ source/creator/CMakeLists.txt | 10 +++++++--- source/creator/buildinfo.c | 2 ++ source/creator/creator.c | 3 +++ 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 1f503a5ea2d..cab245a4518 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -295,8 +295,14 @@ def buildinfo(lenv, build_type): build_rev = '-UNKNOWN-' if lenv['BF_DEBUG']: build_type = "Debug" + build_cflags = ' '.join(lenv['CFLAGS'] + lenv['CCFLAGS'] + lenv['BF_DEBUG_CCFLAGS'] + lenv['CPPFLAGS']) + build_cxxflags = ' '.join(lenv['CCFLAGS'] + lenv['CXXFLAGS'] + lenv['CPPFLAGS']) else: build_type = "Release" + build_cflags = ' '.join(lenv['CFLAGS'] + lenv['CCFLAGS'] + lenv['REL_CFLAGS'] + lenv['REL_CCFLAGS'] + lenv['CPPFLAGS']) + build_cxxflags = ' '.join(lenv['CCFLAGS'] + lenv['CXXFLAGS'] + lenv['REL_CXXFLAGS'] + lenv['REL_CCFLAGS'] + lenv['CPPFLAGS']) + + build_linkflags = ' '.join(lenv['PLATFORM_LINKFLAGS']) obj = [] if lenv['BF_BUILDINFO']: @@ -305,7 +311,12 @@ def buildinfo(lenv, build_type): '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"' + ]) lenv.Append (CPPPATH = [root_build_dir+'source/blender/blenkernel']) diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index b6f429141bf..58fb1aba377 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -68,7 +68,11 @@ def write_sysinfo(op): output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type)) output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time)) output.write('platform: {}\n'.format(bpy.app.build_platform)) - output.write('binary path: {}\n\n'.format(bpy.app.binary_path)) + output.write('binary path: {}\n'.format(bpy.app.binary_path)) + output.write('build cflags: {}\n'.format(bpy.app.build_cflags)) + output.write('build cxxflags: {}\n'.format(bpy.app.build_cxxflags)) + output.write('build linkflags: {}\n'.format(bpy.app.build_linkflags)) + output.write('build system: {}\n'.format(bpy.app.build_system)) # python info output.write('\nPython:\n') diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 39494678a12..b7a277c76b0 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -42,6 +42,7 @@ extern char build_type[]; extern char build_cflags[]; extern char build_cxxflags[]; extern char build_linkflags[]; +extern char build_system[]; #endif static PyTypeObject BlenderAppType; @@ -61,6 +62,7 @@ static PyStructSequence_Field app_info_fields[] = { {"build_cflags", ""}, {"build_cxxflags", ""}, {"build_linkflags", ""}, + {"build_system", ""}, {0} }; @@ -105,6 +107,7 @@ static PyObject *make_app_info(void) SetStrItem(build_cflags); SetStrItem(build_cxxflags); SetStrItem(build_linkflags); + SetStrItem(build_system); #else SetStrItem("Unknown"); SetStrItem("Unknown"); @@ -114,6 +117,7 @@ static PyObject *make_app_info(void) SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); + SetStrItem("Unknown"); #endif #undef SetIntItem diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 65099761fad..27640cbc185 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -95,15 +95,19 @@ IF(WIN32) ENDIF(WIN32) IF(WITH_BUILDINFO) + STRING(REPLACE " " "\ " BUILDINFO_CFLAGS ${CMAKE_C_FLAGS}) + STRING(REPLACE " " "\ " BUILDINFO_CXXFLAGS ${CMAKE_CXX_FLAGS}) + STRING(REPLACE " " "\ " BUILDINFO_LINKFLAGS ${PLATFORM_LINKFLAGS}) ADD_DEFINITIONS( -DBUILD_DATE="${BUILD_DATE}" -DBUILD_TIME="${BUILD_TIME}" -DBUILD_REV="${BUILD_REV}" -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}" -DBUILD_TYPE="${CMAKE_BUILD_TYPE}" - -DBUILD_CFLAGS="${CMAKE_C_FLAGS}" - -DBUILD_CXXFLAGS="${CMAKE_CXX_FLAGS}" - -DBUILD_LINKFLAGS="${PLATFORM_LINKFLAGS}" + -DBUILD_CFLAGS="${BUILDINFO_CFLAGS}" + -DBUILD_CXXFLAGS="${BUILDINFO_CXXFLAGS}" + -DBUILD_LINKFLAGS="${BUILDINFO_LINKFLAGS}" + -DBUILD_SYSTEM="CMake" ) LIST(APPEND EXESRC buildinfo.c) diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index cf6f5a11c45..2203a97aa91 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -40,10 +40,12 @@ char build_type[]= STRINGIFY(BUILD_TYPE); char build_cflags[]= STRINGIFY(BUILD_CFLAGS); char build_cxxflags[]= STRINGIFY(BUILD_CXXFLAGS); char build_linkflags[]= STRINGIFY(BUILD_LINKFLAGS); +char build_system[]= STRINGIFY(BUILD_SYSTEM); #else char build_cflags[]= "unmaintained buildsystem alert!"; char build_cxxflags[]= "unmaintained buildsystem alert!"; char build_linkflags[]= "unmaintained buildsystem alert!"; +char build_system[]= "unmaintained buildsystem alert!"; #endif #endif // BUILD_DATE diff --git a/source/creator/creator.c b/source/creator/creator.c index 117efe6bba6..ed2f671a161 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -121,6 +121,7 @@ extern char build_type[]; extern char build_cflags[]; extern char build_cxxflags[]; extern char build_linkflags[]; +extern char build_system[]; #endif /* Local Function prototypes */ @@ -190,6 +191,7 @@ static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(dat printf ("\tbuild c flags: %s\n", build_cflags); printf ("\tbuild c++ flags: %s\n", build_cxxflags); printf ("\tbuild link flags: %s\n", build_linkflags); + printf ("\tbuild system: %s\n", build_system); #endif exit(0); @@ -1054,6 +1056,7 @@ int main(int argc, char **argv) strip_quotes(build_cflags); strip_quotes(build_cxxflags); strip_quotes(build_linkflags); + strip_quotes(build_system); #endif BLI_threadapi_init();