blender/extern/verse/dist/SConstruct

147 lines
4.6 KiB
Python
Raw Normal View History

2006-10-02 13:29:17 +00:00
#!/usr/bin/env python
#
# I think it is quite straight-forward to add new platforms,
# just look at the old makefile and at the existing platforms.
#
# This SConstruct creates a configuration file which can be
# used for tweaking a build.
#
# For more about SConstruct, see <http://www.scons.org/>.
#
import os
import os.path
import sys
2006-10-02 13:29:17 +00:00
import re
import time
import string
from distutils import sysconfig
Import('env')
2006-10-02 13:29:17 +00:00
defines = []
cflags = []
debug_flags = []
extra_flags = []
release_flags = []
warn_flags = []
platform_libs = []
platform_libpath = []
platform_linkflags = []
ourplatform = env['OURPLATFORM']
if ourplatform == 'win32-vc':
print "Building on win32"
defines += ['_WIN32']
warn_flags = ['/Wall']
platform_libs = ['ws2_32']
elif ourplatform == 'win32-mingw':
defines += ['_WIN32', 'WIN32']
platform_libs = ['shell32', 'kernel32', 'gdi32', 'user32', 'ws2_32']
elif ourplatform == 'linux2':
print "Building on linux2"
elif ourplatform == 'openbsd3':
print "Building on openbsd3"
root_build_dir = env['BF_BUILDDIR']
if env['VERSE_BUILD_BINARY'] == 'release':
cflags = extra_flags + release_flags + warn_flags
if ourplatform == 'win32-vc':
defines += ['NDEBUG']
else:
cflags = extra_flags + debug_flags + warn_flags
if ourplatform == 'win32-vc':
#defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
platform_linkflags += ['/DEBUG','/PDB:verse.pdb']
2006-10-02 13:29:17 +00:00
verse_env = env.Copy()
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'
])
2006-10-02 13:29:17 +00:00
cmd_gen_deps = (['v_gen_pack_init.c'])
proto_env = env.Copy()
proto_env.Append(CPPDEFINES=['V_GENERATE_FUNC_MODE'])
mkprot_tool = proto_env.Program(target = 'mkprot', source = cmd_gen_files)
mkprot_re = re.compile('v_cmd_def_([a-z]{1}).c')
def mkprot_emitter(target = None, source = None, env = None):
newtargets = list()
for s in source:
p, f = os.path.split(str(s))
m = mkprot_re.match(f)
if m:
newtargets.append("v_gen_pack_"+m.group(1)+"_node.c")
newtargets.extend(['verse.h'])
env.Depends(newtargets, mkprot_tool)
return (newtargets, source)
2006-10-02 13:29:17 +00:00
mkprot_bld = Builder(action = "\"" + mkprot_tool[0].abspath + "\" -src=\""+os.getcwd()+os.sep+"extern"+os.sep+"verse"+os.sep+"dist"+os.sep+os.sep+"\" -dst=\""+os.path.abspath(env['BF_BUILDDIR'])+os.sep+"extern"+os.sep+"verse"+os.sep+"dist"+os.sep+os.sep+"\"",
emitter = mkprot_emitter)
2006-10-02 13:29:17 +00:00
verse_env['BUILDERS']['Protocol'] = mkprot_bld
2006-10-02 13:29:17 +00:00
cmd_gen_deps.extend(verse_env.Protocol('do_mkprot', cmd_gen_files))
2006-10-02 13:29:17 +00:00
cmd_gen_deps.pop()
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',
'verse_ms.c'
])
2006-10-02 13:29:17 +00:00
lib_source_files.extend(cmd_gen_deps)
server_source_files = (['vs_connection.c',
'vs_main.c',
2006-10-02 13:29:17 +00:00
'vs_master.c',
'vs_node_audio.c',
'vs_node_bitmap.c',
'vs_node_curve.c',
'vs_node_geometry.c',
'vs_node_head.c',
'vs_node_material.c',
'vs_node_object.c',
'vs_node_particle.c',
'vs_node_storage.c',
'vs_node_text.c'
])
verselib_env = verse_env.Copy()
verselib_env.Append(CPPDEFINES = defines)
verseserver_env = verse_env.Copy()
verseserver_env.Append(CPPDEFINES = defines)
2006-10-02 13:29:17 +00:00
verseserver_env.Append (LIBPATH = ['.'])
verseserver_env.Append (LIBS= ['verse'])
verseserver_env.Append (LIBS= platform_libs)
verselib_env.BlenderLib(libname='verse', sources=lib_source_files, includes=["."], defines = defines, libtype=['core', 'intern', 'player'], priority = [5, 5, 100])
verseserver_env.BlenderProg(builddir="#"+root_build_dir+os.sep, progname='verse', sources=server_source_files, libs=[],
libpath='#'+env['BF_BUILDDIR']+'/lib')
2006-10-02 13:29:17 +00:00