Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 219 lines (193 sloc) 6.635 kB
7f42485 Force scons to honor the host envionment.
jbrandmeyer authored
1 import os
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
2 import sys
7f42485 Force scons to honor the host envionment.
jbrandmeyer authored
3
3476e6a Update the build scripts.
jbrandmeyer authored
4 ################################################################################
5 # A set of helper functions that are used later on for various tasks.
6
7 def AddDebugFlags(env):
8 if ARGUMENTS.has_key("with-debug"):
9 if ARGUMENTS['with-debug'] == "none":
10 env.Append( DEFINES='NDEBUG', CCFLAGS='-O2')
11 elif ARGUMENTS['with-debug'] == "standard":
12 env.Append( CCFLAGS=['-O2', '-malign-double'])
13 elif ARGUMENTS['with-debug'] == "full":
14 env.Append( CCFLAGS='-g', DEFINES="_GLIBCXX_DEBUG")
15 elif release:
9edcede Sync up with autotools
jbrandmeyer authored
16 env.Append( CCFLAGS=['-O2', '-g', '-malign-double'])
3476e6a Update the build scripts.
jbrandmeyer authored
17 else:
18 env.Append( CCFLAGS=['-O0', '-g'])
19
20 def AddThreadingFlags(env):
21 env.Append( LIBS='boost_thread')
22 if sys.platform == 'win32' and env['CC'] == 'gcc':
23 env.Append( CCFLAGS='-mthreads')
24 else:
25 env.Append( CCFLAGS='-pthread')
26
27 ################################################################################
28
29 # When packaging a release, set this value to true.
9edcede Sync up with autotools
jbrandmeyer authored
30 release = True
3476e6a Update the build scripts.
jbrandmeyer authored
31
1aec802 Initial import of work to date.
jbrandmeyer authored
32 SetOption( "implicit_cache", 1)
94062f2 Force SCons to not add a 'lib' prefix to site-packages/cvisual.so.
jbrandmeyer authored
33 EnsurePythonVersion( 2, 2)
34
35 # TODO: Add support to build a gch for wrap_gl.hpp, display_kernel.hpp,
36 # and renderable.hpp
37 # TODO: Make a configuration section for the following tests:
38 # existence and suitability of FTGL.
39 # The FTGL header file problem
40 # The existence and suitability of Boost.Python
41 # The existence of gtkmm
42 # The existence of gtkglextmm
43 # The existence and suitability of gle
44 # The particular version of Python to install against.
45 # The prefix.
46
47 # Build a configuration header file.
3476e6a Update the build scripts.
jbrandmeyer authored
48 base = Environment( CCFLAGS=['-pipe'],
49 LINKFLAGS=['-Wl,--warn-once'],
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
50 ENV = os.environ,
f2299f2 Forward-port num_util from old VPython
jbrandmeyer authored
51 CPPPATH=['include', '/usr/include/python2.3'])
c9cc337 Port to Gtkmm 2.4;
jbrandmeyer authored
52
3476e6a Update the build scripts.
jbrandmeyer authored
53 # Add flags for debugging symbols and optimization.
54 AddDebugFlags( base)
55 # Crank up the warnings
70d2010 Raise the warning level even higher, adding "-std=c++98 -pedantic".
jbrandmeyer authored
56 # Crank up the warnings. Note that I am disabling the warning WRT use of long long,
57 # since it really is needed in src/gtk2/rate.cpp.
3476e6a Update the build scripts.
jbrandmeyer authored
58 base.Append( CCFLAGS=['-Wall', '-W', '-Wsign-compare', '-Wconversion',
f2299f2 Forward-port num_util from old VPython
jbrandmeyer authored
59 '-std=c++98', '-Wdisabled-optimization',
70d2010 Raise the warning level even higher, adding "-std=c++98 -pedantic".
jbrandmeyer authored
60 '-pedantic', '-Wno-long-long'] )
1aec802 Initial import of work to date.
jbrandmeyer authored
61
3476e6a Update the build scripts.
jbrandmeyer authored
62 core = base.Copy()
63 # Workaround brain-dead behavior in FTGL's header file layout
c59b46a Fix platform detection for FTGL's include path.
jbrandmeyer authored
64 # Add compiler flags for threading support.
3476e6a Update the build scripts.
jbrandmeyer authored
65 AddThreadingFlags( core)
c59b46a Fix platform detection for FTGL's include path.
jbrandmeyer authored
66
c9cc337 Port to Gtkmm 2.4;
jbrandmeyer authored
67 core.ParseConfig( 'pkg-config --cflags --libs sigc++-2.0')
f2299f2 Forward-port num_util from old VPython
jbrandmeyer authored
68 core.Append( LIBS=['gle', 'python2.3'])
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
69
70 srcs = [ "src/core/arrow.cpp",
1aec802 Initial import of work to date.
jbrandmeyer authored
71 "src/core/util/displaylist.cpp",
72 "src/core/util/errors.cpp",
73 "src/core/util/extent.cpp",
74 "src/core/util/lighting.cpp",
75 "src/core/util/quadric.cpp",
76 "src/core/util/rgba.cpp",
77 "src/core/util/texture.cpp",
78 "src/core/util/vector.cpp",
79 "src/core/util/clipping_plane.cpp",
80 "src/core/util/tmatrix.cpp",
5bd1153 Add gl_free to the set of built files;
jbrandmeyer authored
81 "src/core/util/gl_free.cpp",
9edcede Sync up with autotools
jbrandmeyer authored
82 "src/core/util/icososphere.cpp",
8b8f6d0 Add missing files to SConstruct.
jbrandmeyer authored
83 "src/core/axial.cpp",
1aec802 Initial import of work to date.
jbrandmeyer authored
84 "src/core/box.cpp",
85 "src/core/cone.cpp",
86 "src/core/cylinder.cpp",
87 "src/core/ellipsoid.cpp",
88 "src/core/pyramid.cpp",
89 "src/core/renderable.cpp",
c293ba5 Rename render_core -> display_kernel
jbrandmeyer authored
90 "src/core/display_kernel.cpp",
802abae Commit work to date for mouse handling.
jbrandmeyer authored
91 "src/core/mouseobject.cpp",
1aec802 Initial import of work to date.
jbrandmeyer authored
92 "src/core/ring.cpp",
e1f8a00 Rename 'simple_displayobject' to 'primitive'.
jbrandmeyer authored
93 "src/core/primitive.cpp",
8b8f6d0 Add missing files to SConstruct.
jbrandmeyer authored
94 "src/core/rectangular.cpp",
1aec802 Initial import of work to date.
jbrandmeyer authored
95 "src/core/sphere.cpp",
1af3825 First implementation of pixelmapped fonts with Gtk & FTGL.
jbrandmeyer authored
96 "src/core/frame.cpp",
21a6725 First curve reimplememtation.
jbrandmeyer authored
97 "src/core/label.cpp",
c9cc337 Port to Gtkmm 2.4;
jbrandmeyer authored
98 "src/core/unused_curve.cpp",
99 "src/core/unused_convex.cpp",
100 "src/core/unused_faces.cpp" ]
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
101
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
102 if sys.platform == 'win32':
103 srcs.append( 'src/win32/render_surface.cpp')
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
104 srcs.append( 'src/win32/timer.cpp')
9c22945 Update build file for new Windows random number generator.
jbrandmeyer authored
105 srcs.append( 'src/win32/random_device.cpp')
a2b6d1f First shot at a GL font for Windows.
jbrandmeyer authored
106 srcs.append( 'src/win32/font.cpp')
884b6a0 For all test programs, use realmain() in lieu of main() or WinMain().
jbrandmeyer authored
107 # TODO: Write a file_texture.cpp implementation for Windows,
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
108
3476e6a Update the build scripts.
jbrandmeyer authored
109 core.Append( LIBS=['opengl32', 'gdi32', 'glu32', 'comctl32', 'crypt32'])
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
110 core.Append( CPPPATH='include/win32')
372d25d Update build scripts
jbrandmeyer authored
111 libname = 'bin/vpython-core'
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
112 else:
113 srcs.append( 'src/gtk2/render_surface.cpp')
9edcede Sync up with autotools
jbrandmeyer authored
114 srcs.append( 'src/gtk2/text.cpp')
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
115 srcs.append( 'src/gtk2/file_texture.cpp')
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
116 srcs.append( 'src/gtk2/timer.cpp')
117 srcs.append( 'src/gtk2/random_device.cpp')
aa8b99c Update the build script for the new files.
jbrandmeyer authored
118 srcs.append( 'src/gtk2/display.cpp')
6d374c6 Add rate() function implementation for Linux and OSX.
jbrandmeyer authored
119 srcs.append( 'src/gtk2/rate.cpp')
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
120
9edcede Sync up with autotools
jbrandmeyer authored
121 core.ParseConfig( 'pkg-config --cflags --libs gtkglextmm-1.2 '
122 + 'fontconfig gthread-2.0 pangomm-1.4 pangoft2')
3476e6a Update the build scripts.
jbrandmeyer authored
123 core.Append( LIBS=["GL", "GLU"], LINKFLAGS="-Wl,--no-undefined")
aa2f3c7 Segragate out platform-specific code into separate directories.
jbrandmeyer authored
124 core.Append( CPPPATH='include/gtk2')
372d25d Update build scripts
jbrandmeyer authored
125 libname='lib/vpython-core'
1aec802 Initial import of work to date.
jbrandmeyer authored
126
3476e6a Update the build scripts.
jbrandmeyer authored
127 # Build libvpython-core.dylib
128 if sys.platform == 'darwin':
129 core.SharedLibrary(
130 target=target,
131 source=source,
132 SHLIBSUFFIX = '.dylib',
133 SHLINKFLAGS = '$LINKFLAGS -dynamic' )
e0f8f0c Work around a lack of support for 'foo in bar' in some Python versions.
jbrandmeyer authored
134 # Build libvpython-core.{so,dll}
3476e6a Update the build scripts.
jbrandmeyer authored
135 else:
136 core.SharedLibrary(
137 target = libname,
138 source = srcs )
1aec802 Initial import of work to date.
jbrandmeyer authored
139
140
141 ################################################################################
142 # Build the test programs.
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
143 tests = core.Copy()
3476e6a Update the build scripts.
jbrandmeyer authored
144 tests.Append( LIBS=['vpython-core'] )
884b6a0 For all test programs, use realmain() in lieu of main() or WinMain().
jbrandmeyer authored
145 if sys.platform == 'win32':
3476e6a Update the build scripts.
jbrandmeyer authored
146 tests.Append( LINKFLAGS='-mwindows', LIBPATH='bin')
884b6a0 For all test programs, use realmain() in lieu of main() or WinMain().
jbrandmeyer authored
147 main = 'src/win32/winmain.cpp'
148 else:
3476e6a Update the build scripts.
jbrandmeyer authored
149 tests.Append( LIBPATH='lib')
884b6a0 For all test programs, use realmain() in lieu of main() or WinMain().
jbrandmeyer authored
150 main = 'src/gtk2/main.cpp'
151
152 def Test( name):
153 tests.Program( target='bin/' + name,
154 source=['src/test/' + name + '.cpp', main])
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
155
884b6a0 For all test programs, use realmain() in lieu of main() or WinMain().
jbrandmeyer authored
156 Test('sphere_lod_test')
157 Test('arrow_transparent_test')
158 Test('sphere_texture_test')
159 Test('arrow_scaling_test')
160 Test('sphere_transparent_test')
161 Test('texture_sharing_test')
162 Test('box_test')
163 Test('cone_test')
164 Test('cylinder_test')
165 Test('ring_test')
166 Test('pyramid_test')
167 Test('ellipsoid_test')
70d2010 Raise the warning level even higher, adding "-std=c++98 -pedantic".
jbrandmeyer authored
168 # Test('psphere_texture_test')
884b6a0 For all test programs, use realmain() in lieu of main() or WinMain().
jbrandmeyer authored
169 Test('selection_test')
2b4af0c Remove stuff related to partial features not in CVS.
jbrandmeyer authored
170 # Test('conference_demo')
21a6725 First curve reimplememtation.
jbrandmeyer authored
171 Test('curve_test')
372d25d Update build scripts
jbrandmeyer authored
172 Test('label_test')
e11b929 Add an implementation and some tests of the convex object.
jbrandmeyer authored
173 Test('convex_test')
aa8b99c Update the build script for the new files.
jbrandmeyer authored
174 Test('bounce_test')
246d30e Commit work-to-date for using this file on Windows and Linux.
jbrandmeyer authored
175 if sys.platform != 'win32':
884b6a0 For all test programs, use realmain() in lieu of main() or WinMain().
jbrandmeyer authored
176 Test('gtk_style_test')
372d25d Update build scripts
jbrandmeyer authored
177
178 main = "src/gtk2/main.cpp"
94062f2 Force SCons to not add a 'lib' prefix to site-packages/cvisual.so.
jbrandmeyer authored
179 tests.Replace( LINKFLAGS="")
372d25d Update build scripts
jbrandmeyer authored
180 Test('object_zsort_bench')
181 Test('model_zsort_bench')
182 Test('sincos_matrix_bench')
3cff8b4 Add a bench test for this particular matrix inverse operation.
jbrandmeyer authored
183 Test('matrix_inverse_bench')
3476e6a Update the build scripts.
jbrandmeyer authored
184 base.Program( target='bin/sleep_test', source='src/test/sleep_test.cpp')
8b8f6d0 Add missing files to SConstruct.
jbrandmeyer authored
185
186 ################################################################################
187 # Build the extension module.
3476e6a Update the build scripts.
jbrandmeyer authored
188 from vpython_config_helpers import PythonPlugin, SetupPythonConfVars
189
8b8f6d0 Add missing files to SConstruct.
jbrandmeyer authored
190 py = core.Copy()
f2299f2 Forward-port num_util from old VPython
jbrandmeyer authored
191 # SetupPythonConfVars(py)
404056f Tweak the build script to build a working import module.
jbrandmeyer authored
192 py.Append( CPPPATH='/usr/include/python2.3',
f2299f2 Forward-port num_util from old VPython
jbrandmeyer authored
193 LIBS=['vpython-core', 'boost_python'],
404056f Tweak the build script to build a working import module.
jbrandmeyer authored
194 LIBPATH='lib',
70d2010 Raise the warning level even higher, adding "-std=c++98 -pedantic".
jbrandmeyer authored
195 # Boost.Python's headers produce prodigious amounts of warnings WRT unused
196 # parameters.
f2299f2 Forward-port num_util from old VPython
jbrandmeyer authored
197 CPPFLAGS=['-Wno-unused', '-DHAVE_CONFIG_H'])
3476e6a Update the build scripts.
jbrandmeyer authored
198
199 cvisual = PythonPlugin( env=py,
94062f2 Force SCons to not add a 'lib' prefix to site-packages/cvisual.so.
jbrandmeyer authored
200 target='site-packages/cvisual',
8b8f6d0 Add missing files to SConstruct.
jbrandmeyer authored
201 source=['src/python/wrap_display_kernel.cpp',
202 'src/python/wrap_vector.cpp',
203 'src/python/wrap_rgba.cpp',
204 'src/python/wrap_primitive.cpp',
404056f Tweak the build script to build a working import module.
jbrandmeyer authored
205 'src/python/num_util.cpp',
f2299f2 Forward-port num_util from old VPython
jbrandmeyer authored
206 'src/python/num_util_impl_numeric.cpp',
207 'src/python/num_util_impl_numarray.cpp',
dc31d9a Add new files to site-packages/libcvisual.so
jbrandmeyer authored
208 'src/python/slice.cpp',
209 'src/python/curve.cpp',
94062f2 Force SCons to not add a 'lib' prefix to site-packages/cvisual.so.
jbrandmeyer authored
210 'src/python/faces.cpp',
adc93a5 Expose the convex object to Python.
jbrandmeyer authored
211 'src/python/convex.cpp',
dc31d9a Add new files to site-packages/libcvisual.so
jbrandmeyer authored
212 'src/python/cvisualmodule.cpp',
0243be6 Wrap vector_array and scalar_array
jbrandmeyer authored
213 'src/python/wrap_arrayobjects.cpp',
214 'src/python/scalar_array.cpp',
215 'src/python/vector_array.cpp' ])
3476e6a Update the build scripts.
jbrandmeyer authored
216
217 # Establish the default target.
218 Default(cvisual)
Something went wrong with that request. Please try again.