diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2006-08-22 17:04:07 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2006-08-22 17:04:07 +0400 |
commit | 7fd8ce8156fcada505c73f5fb7af4b8ced755a3e (patch) | |
tree | ffdff3e1b4526ad4a5a885db1a5b2fd52d710952 /extern/verse | |
parent | f21f3cb290e221e4b4610e43c17e9702b43a1cb5 (diff) |
* Patch #4909 by Joseph Eagar (joeedh)
- this patch adds verse support for SCons, which can be enabled by
giving WITH_BF_VERSE=1, ie. on command-line
- this patch also adds a custom lib dir possibility. From the patch description:
"To set a custom ../lib dir, put LCGDIR="path to lib dir, including the platform folder name!" in your user-config.py."
* Fixed win32-vc-config.py so that it links to the proper library. Reported by Brandano.
Diffstat (limited to 'extern/verse')
-rw-r--r-- | extern/verse/dist/SConstruct | 174 |
1 files changed, 67 insertions, 107 deletions
diff --git a/extern/verse/dist/SConstruct b/extern/verse/dist/SConstruct index ac6f6031b99..42c9a58a8c4 100644 --- a/extern/verse/dist/SConstruct +++ b/extern/verse/dist/SConstruct @@ -23,12 +23,9 @@ import time import string from distutils import sysconfig -root_build_dir = '..' + os.sep + 'build' + os.sep - -config_file = 'config.opts' -version = '1.0' +Import('env') -env = Environment () +root_build_dir = '..' + os.sep + 'build' + os.sep defines = [] cflags = [] @@ -40,121 +37,89 @@ platform_libs = [] platform_libpath = [] platform_linkflags = [] -if sys.platform == 'win32': +window_system = env['OURPLATFORM'] +if window_system == 'win32-vc': print "Building on win32" defines += ['_WIN32'] warn_flags = ['/Wall'] platform_libs = ['ws2_32'] -elif sys.platform == 'linux2': +elif window_system == 'win32-mingw': + defines += ['_WIN32', 'WIN32'] + platform_libs = ['shell32', 'kernel32', 'gdi32', 'user32', 'ws2_32'] +elif window_system == 'linux2': print "Building on linux2" -elif sys.platform == 'openbsd3': +elif window_system== 'openbsd3': print "Building on openbsd3" -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 for verse SCons user definable options.\n") - config.write ("BUILD_BINARY = 'release'\n") - config.write ("REGEN_PROTO = 'yes'\n") - 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'])) - -user_options_env = Environment() -user_options = Options (config_file) -user_options.AddOptions( - (EnumOption ('BUILD_BINARY', 'release', - 'Build a release or debug binary.', - allowed_values = ('release', 'debug'))), - ('BUILD_DIR', 'Target directory for intermediate files.', - root_build_dir), - (EnumOption ('REGEN_PROTO', 'yes', - 'Whether to regenerate the protocol files', - allowed_values = ('yes', 'no'))), - ('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') -) -user_options.Update (user_options_env) -user_options_dict = user_options_env.Dictionary() - -root_build_dir = user_options_dict['BUILD_DIR'] - -if user_options_dict['BUILD_BINARY'] == 'release': +user_options_dict = env #user_options_env.Dictionary() + +root_build_dir = user_options_dict['BF_BUILDDIR'] + os.sep + "extern" + os.sep + "verse" + +if user_options_dict['VERSE_BUILD_BINARY'] == 'release': cflags = extra_flags + release_flags + warn_flags - if sys.platform == 'win32': + if window_system == 'win32-vc': defines += ['NDEBUG'] else: cflags = extra_flags + debug_flags + warn_flags - if sys.platform == 'win32': + if window_system== 'win32-vc': #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib?? platform_linkflags += ['/DEBUG','/PDB:verse.pdb'] -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 = env.Copy() #Environment() +library_env.Replace (CC = user_options_dict['CC']) +library_env.Replace (CXX = user_options_dict['CXX']) +#library_env.Replace (PATH = user_options_dict['PATH']) +#library_env.Replace (AR = user_options_dict['TARGET_AR']) cmd_gen_files = (['v_cmd_gen.c', - 'v_cmd_def_a.c', - 'v_cmd_def_b.c', - 'v_cmd_def_c.c', - 'v_cmd_def_g.c', - 'v_cmd_def_m.c', - 'v_cmd_def_o.c', - 'v_cmd_def_s.c', - 'v_cmd_def_t.c' - ]) + 'v_cmd_def_a.c', + 'v_cmd_def_b.c', + 'v_cmd_def_c.c', + 'v_cmd_def_g.c', + 'v_cmd_def_m.c', + 'v_cmd_def_o.c', + 'v_cmd_def_s.c', + 'v_cmd_def_t.c' + ]) cmd_gen_deps = (['v_gen_pack_init.c', - 'v_gen_pack_a_node.c', - 'v_gen_pack_b_node.c', - 'v_gen_pack_c_node.c', - 'v_gen_pack_g_node.c', - 'v_gen_pack_m_node.c', - 'v_gen_pack_o_node.c', - 'v_gen_pack_s_node.c', - 'v_gen_pack_t_node.c', - ]) - -if user_options_dict['REGEN_PROTO']=='yes': + 'v_gen_pack_a_node.c', + 'v_gen_pack_b_node.c', + 'v_gen_pack_c_node.c', + 'v_gen_pack_g_node.c', + 'v_gen_pack_m_node.c', + 'v_gen_pack_o_node.c', + 'v_gen_pack_s_node.c', + 'v_gen_pack_t_node.c', + ]) + +if user_options_dict['VERSE_REGEN_PROTO']=='yes': cmd_gen_env = library_env.Copy() cmd_gen_env.Append(CPPDEFINES=['V_GENERATE_FUNC_MODE']) mkprot = cmd_gen_env.Program(target='mkprot', source=cmd_gen_files) cmd_gen_env.Command('regen', '' , './mkprot') lib_source_files = (['v_cmd_buf.c', - 'v_connect.c', - 'v_connection.c', - 'v_encryption.c', - 'v_func_storage.c', - 'v_man_pack_node.c', - 'v_network.c', - 'v_network_in_que.c', - 'v_network_out_que.c', - 'v_pack.c', - 'v_pack_method.c', - 'v_prime.c', - 'v_randgen.c', - 'v_util.c', - 'v_bignum.c' - ]) + 'v_connect.c', + 'v_connection.c', + 'v_encryption.c', + 'v_func_storage.c', + 'v_man_pack_node.c', + 'v_network.c', + 'v_network_in_que.c', + 'v_network_out_que.c', + 'v_pack.c', + 'v_pack_method.c', + 'v_prime.c', + 'v_randgen.c', + 'v_util.c', + 'v_bignum.c' + ]) lib_source_files += cmd_gen_deps server_source_files = (['vs_connection.c', 'vs_main.c', - 'vs_node_audio.c', + 'vs_node_audio.c', 'vs_node_bitmap.c', 'vs_node_curve.c', 'vs_node_geometry.c', @@ -166,26 +131,21 @@ server_source_files = (['vs_connection.c', 'vs_node_text.c' ]) -verse_example_sources = (['examples/list-nodes.c']) - verselib_env = library_env.Copy() verselib_env.Append(CPPDEFINES = defines) -verseserver_env = library_env.Copy() +#server commented out for now, though maybe there +#should be an option to build it. +verseserver_env = env.Copy() verseserver_env.Append(CPPDEFINES = defines) -verseserver_env.Append (LIBS=['libverse']) -verseserver_env.Append (LIBPATH = ['.']) +verseserver_env.Append (LIBS=['verse']) verseserver_env.Append (LIBS= platform_libs) -verseexample_env = library_env.Copy() -verseexample_env.Append(CPPDEFINES = defines) -verseexample_env.Append (LIBS=['libverse']) -verseexample_env.Append (LIBPATH = ['.']) -verseexample_env.Append (LIBS= platform_libs) -verseexample_env.Append (CPPPATH = ['.']) +verselib = env.BlenderLib(libname='verse', sources=lib_source_files, includes=[], defines=defines, libtype=['core', 'intern'], priority = [5, 5]) -verselib = verselib_env.Library(target='libverse', source=lib_source_files) -if user_options_dict['REGEN_PROTO']=='yes': +verseserver_env.BlenderProg(builddir="#"+root_build_dir, progname="verse", + sources=server_source_files, libs=['verse'], + libpath='#'+user_options_dict['BF_BUILDDIR']+'/lib') + +if user_options_dict['VERSE_REGEN_PROTO']=='yes': verselib_env.Depends(verselib, mkprot) -verseserver_env.Program(target='verse', source=server_source_files) -verseexample_env.Program(target='list-nodes', source=verse_example_sources) |