diff options
author | Michel Selten <michel@mselten.demon.nl> | 2004-03-01 00:40:48 +0300 |
---|---|---|
committer | Michel Selten <michel@mselten.demon.nl> | 2004-03-01 00:40:48 +0300 |
commit | 70a4ead0ae6f8ffabb1178ec2ed4d1fafa3e232e (patch) | |
tree | 2a81baeb98325e8e74ea4bea96074ec74508f563 /SConstruct | |
parent | 5998c12c607ea0bfe0d9934f7b9011636ad3936a (diff) |
SCons updates
* Blender static now links. By default this option is disabled on all
platforms. Simply set the option in config.opts to 'true'.
* Added the following flags to config.opts:
- HOST_CC. This is the C compiler for the host platform. This value is the
same as TARGET_CC when not cross compiling.
- HOST_CXX. This is the C++ compiler for the host platform. This value is
the same as TARGET_CXX when not cross compiling.
- TARGET_CC. This is the C compiler for the target platform.
- TARGET_CXX. This is the C++ compiler for the target platform.
- TARGET_AR. This is the linker command for linking libraries.
- PATH This is the standard search path
All SConscript files have been updated to reflect these changes. Now it's
possible to change only the root SConstruct file, and all compiler specific
variables are passed automatically to all SConscript files. Of course, this
does not apply to makesdna because there the host and target platform is
different from all other libraries.
To pass a variable that applies to all platforms, all we now have to do is
set the correct value in library_env
Note: as usual, to get the latest options in the config.opts file, first
remove your version.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct index ae2242e7c63..e29f6423f06 100644 --- a/SConstruct +++ b/SConstruct @@ -217,8 +217,6 @@ elif sys.platform == 'cygwin': sdl_libpath = sdl_env.Dictionary()['LIBPATH'] sdl_lib = sdl_env.Dictionary()['LIBS'] #sdl_cflags = '-DWIN32' - # We need to force the Cygwin environment to use the g++ linker. - link_env.Replace (CC='g++') # Python variables. python_include = sysconfig.get_python_inc () python_libpath = sysconfig.get_python_lib (0, 1) + '/config' @@ -521,6 +519,7 @@ if os.path.exists (config_file): print "Using config file: " + config_file else: print "Creating new config file: " + config_file + env_dict = env.Dictionary() config=open (config_file, 'w') config.write ("# Configuration file containing user definable options.\n") config.write ("VERSION = '2.32-cvs'\n") @@ -540,6 +539,13 @@ else: config.write ("USE_OPENAL = %r\n"%(use_openal)) config.write ("USE_FMOD = %r\n"%(use_fmod)) config.write ("USE_QUICKTIME = %r\n"%(use_quicktime)) + config.write ("\n# Compiler information.\n") + config.write ("HOST_CC = %r\n"%(env_dict['CC'])) + config.write ("HOST_CXX = %r\n"%(env_dict['CXX'])) + config.write ("TARGET_CC = %r\n"%(env_dict['CC'])) + config.write ("TARGET_CXX = %r\n"%(env_dict['CXX'])) + config.write ("TARGET_AR = %r\n"%(env_dict['AR'])) + config.write ("PATH = %r\n"%(os.environ['PATH'])) config.write ("\n# External library information.\n") config.write ("PYTHON_INCLUDE = %r\n"%(python_include)) config.write ("PYTHON_LIBPATH = %r\n"%(python_libpath)) @@ -634,6 +640,12 @@ user_options.AddOptions ( (BoolOption ('USE_QUICKTIME', 'Set to 1 to add support for QuickTime.', 'false')), + ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'), + ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'), + ('TARGET_CC', 'C compiler for the target platform.'), + ('TARGET_CXX', 'C++ compiler for the target platform.'), + ('TARGET_AR', 'Linker command for linking libraries.'), + ('PATH', 'Standard search path'), ('PYTHON_INCLUDE', 'Include directory for Python header files.'), ('PYTHON_LIBPATH', 'Library path where the Python lib is located.'), ('PYTHON_LIBRARY', 'Python library name.'), @@ -701,18 +713,31 @@ else: platform_linkflags += ['/DEBUG','/PDB:blender.pdb'] #----------------------------------------------------------------------------- +# Generic library generation environment. This one is the basis for each +# library. +#----------------------------------------------------------------------------- +library_env = Environment () +library_env.Replace (CC = user_options_dict['TARGET_CC']) +library_env.Replace (CXX = user_options_dict['TARGET_CXX']) +library_env.Replace (PATH = user_options_dict['PATH']) +library_env.Replace (AR = user_options_dict['TARGET_AR']) +library_env.Append (CCFLAGS = cflags) +library_env.Append (CXXFLAGS = cxxflags) +library_env.Append (CPPDEFINES = defines) + +#----------------------------------------------------------------------------- # Settings to be exported to other SConscript files #----------------------------------------------------------------------------- Export ('cflags') Export ('defines') -Export ('cxxflags') Export ('window_system') Export ('extra_includes') Export ('platform_libs') Export ('platform_libpath') Export ('platform_linkflags') Export ('user_options_dict') +Export ('library_env') BuildDir (root_build_dir+'/intern', 'intern', duplicate=0) SConscript (root_build_dir+'intern/SConscript') @@ -757,7 +782,13 @@ libraries = (['blender_creator', link_env.Append (LIBS=libraries) link_env.Append (LIBPATH=libpath) -link_env.Append (CPPDEFINES=defines) +link_env.Replace (CC = user_options_dict['TARGET_CC']) +link_env.Replace (CXX = user_options_dict['TARGET_CXX']) +link_env.Replace (PATH = user_options_dict['PATH']) +link_env.Replace (AR = user_options_dict['TARGET_AR']) +link_env.Append (CCFLAGS = cflags) +link_env.Append (CXXFLAGS = cxxflags) +link_env.Append (CPPDEFINES = defines) if user_options_dict['USE_INTERNATIONAL'] == 1: link_env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY']) @@ -837,7 +868,6 @@ if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1: 'BUILD_TYPE=\'"dynamic"\'', 'NAN_BUILDINFO', 'BUILD_PLATFORM=\'"%s"\''%(sys.platform)]) - dy_blender.Append (CCFLAGS=cflags) d_obj = [dy_blender.Object (root_build_dir+'source/creator/d_buildinfo', [root_build_dir+'source/creator/buildinfo.c'])] if sys.platform == 'win32': @@ -847,13 +877,16 @@ if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1: dy_blender.Program (target='blender', source=d_obj) if user_options_dict['BUILD_BLENDER_STATIC'] == 1: st_blender = link_env.Copy () + # The next line is to make sure that the LINKFLAGS are appended at the end + # of the link command. This 'trick' is needed because the GL and GLU static + # libraries need to be at the end of the command. + st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS") if user_options_dict['USE_BUILDINFO'] == 1: st_blender.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time), 'BUILD_DATE=\'"%s"\''%(build_date), 'BUILD_TYPE=\'"static"\'', 'NAN_BUILDINFO', 'BUILD_PLATFORM=\'"%s"\''%(sys.platform)]) - st_blender.Append (CCFLAGS=cflags) st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC']) s_obj = [st_blender.Object (root_build_dir+'source/creator/s_buildinfo', [root_build_dir+'source/creator/buildinfo.c'])] |