* Patch #4909 by Joseph Eagar (joeedh)
[blender.git] / extern / verse / dist / SConstruct
1 #
2 # SConstruct for Verse
3 #
4 # This file is still quite crude, but it does it's job, and
5 # is geared towards future extensions.
6 #
7 # I did this only on Windows so people should look into the
8 # if...elif...
9 # construction about the platform specific stuff.
10 #
11 # I think it is quite straight-forward to add new platforms,
12 # just look at the old makefile and at the existing platforms.
13 #
14 # This SConstruct creates a configuration file which can be
15 # used for tweaking a build.
16 #
17 # For more about SConstruct, see <http://www.scons.org/>.
18 #
19
20 import os
21 import sys
22 import time
23 import string
24 from distutils import sysconfig
25
26 Import('env')
27
28 root_build_dir = '..' + os.sep + 'build' + os.sep
29
30 defines = []
31 cflags = []
32 debug_flags = []
33 extra_flags = []
34 release_flags = []
35 warn_flags = []
36 platform_libs = []
37 platform_libpath = []
38 platform_linkflags = []
39
40 window_system = env['OURPLATFORM']
41 if window_system == 'win32-vc':
42     print "Building on win32"
43     defines += ['_WIN32']
44     warn_flags = ['/Wall']
45     platform_libs = ['ws2_32']
46 elif window_system == 'win32-mingw':
47     defines += ['_WIN32', 'WIN32']
48     platform_libs = ['shell32', 'kernel32', 'gdi32', 'user32', 'ws2_32']
49 elif window_system == 'linux2':
50     print "Building on linux2"
51 elif window_system== 'openbsd3':
52     print "Building on openbsd3"
53
54 user_options_dict = env #user_options_env.Dictionary()
55
56 root_build_dir = user_options_dict['BF_BUILDDIR'] + os.sep + "extern" + os.sep + "verse"
57
58 if user_options_dict['VERSE_BUILD_BINARY'] == 'release':
59     cflags = extra_flags + release_flags + warn_flags
60     if window_system == 'win32-vc':
61         defines += ['NDEBUG']
62 else:
63     cflags = extra_flags + debug_flags + warn_flags
64     if window_system== 'win32-vc':
65         #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
66         platform_linkflags += ['/DEBUG','/PDB:verse.pdb']
67
68 library_env = env.Copy() #Environment()
69 library_env.Replace (CC = user_options_dict['CC'])
70 library_env.Replace (CXX = user_options_dict['CXX'])
71 #library_env.Replace (PATH = user_options_dict['PATH'])
72 #library_env.Replace (AR = user_options_dict['TARGET_AR'])
73
74 cmd_gen_files = (['v_cmd_gen.c',
75                   'v_cmd_def_a.c',
76                   'v_cmd_def_b.c',
77                   'v_cmd_def_c.c',
78                   'v_cmd_def_g.c',
79                   'v_cmd_def_m.c',
80                   'v_cmd_def_o.c',
81                   'v_cmd_def_s.c',
82                   'v_cmd_def_t.c'
83                   ])
84
85 cmd_gen_deps = (['v_gen_pack_init.c',
86                  'v_gen_pack_a_node.c',
87                  'v_gen_pack_b_node.c',
88                  'v_gen_pack_c_node.c',
89                  'v_gen_pack_g_node.c',
90                  'v_gen_pack_m_node.c',
91                  'v_gen_pack_o_node.c',
92                  'v_gen_pack_s_node.c',
93                  'v_gen_pack_t_node.c',
94                 ])
95
96 if user_options_dict['VERSE_REGEN_PROTO']=='yes':
97     cmd_gen_env = library_env.Copy()
98     cmd_gen_env.Append(CPPDEFINES=['V_GENERATE_FUNC_MODE'])
99     mkprot = cmd_gen_env.Program(target='mkprot', source=cmd_gen_files)
100     cmd_gen_env.Command('regen', '' , './mkprot')
101
102 lib_source_files = (['v_cmd_buf.c',
103                      'v_connect.c',
104                      'v_connection.c',
105                      'v_encryption.c',
106                      'v_func_storage.c',
107                      'v_man_pack_node.c',
108                      'v_network.c',
109                      'v_network_in_que.c',
110                      'v_network_out_que.c',
111                      'v_pack.c',
112                      'v_pack_method.c',
113                      'v_prime.c',
114                      'v_randgen.c',
115                      'v_util.c',
116                      'v_bignum.c'
117                      ])
118 lib_source_files += cmd_gen_deps
119
120 server_source_files = (['vs_connection.c',
121                         'vs_main.c',
122                         'vs_node_audio.c',
123                         'vs_node_bitmap.c',
124                         'vs_node_curve.c',
125                         'vs_node_geometry.c',
126                         'vs_node_head.c',
127                         'vs_node_material.c',
128                         'vs_node_object.c',
129                         'vs_node_particle.c',
130                         'vs_node_storage.c',
131                         'vs_node_text.c'
132                         ])
133
134 verselib_env = library_env.Copy()
135 verselib_env.Append(CPPDEFINES = defines)
136
137 #server commented out for now, though maybe there
138 #should be an option to build it.
139 verseserver_env = env.Copy()
140 verseserver_env.Append(CPPDEFINES = defines)
141 verseserver_env.Append (LIBS=['verse'])
142 verseserver_env.Append (LIBS= platform_libs)
143
144 verselib = env.BlenderLib(libname='verse', sources=lib_source_files, includes=[], defines=defines, libtype=['core', 'intern'], priority = [5, 5])
145
146 verseserver_env.BlenderProg(builddir="#"+root_build_dir, progname="verse",
147   sources=server_source_files, libs=['verse'],
148   libpath='#'+user_options_dict['BF_BUILDDIR']+'/lib')
149  
150 if user_options_dict['VERSE_REGEN_PROTO']=='yes':
151     verselib_env.Depends(verselib, mkprot)