This repository has been archived by the owner on Aug 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
SConstruct
89 lines (68 loc) · 2.34 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import sys
glutess_files = [
"dict.c",
"geom.c",
"memalloc.c",
"mesh.c",
"normal.c",
"priorityq.c",
"priorityq-heap.c",
"render.c",
"sweep.c",
"tess.c",
"tessellate.c",
"tessmono.c"
]
ACCEPTABLE_ARCHS = ['x86_64', 'x86']
def get_lib_path( base_name, is_debug, target_arch ):
# Darwin uses fat binaries, so don't append bit count
append_bits = True
if sys.platform=='darwin':
append_bits = False
if append_bits:
if target_arch == 'x86_64':
base_name += '64'
if target_arch == 'x86':
base_name += '32'
if is_debug:
base_name += '_d'
return base_name
# Get command line args
debug = int(ARGUMENTS.get( 'debug', 1 ))
arch = ARGUMENTS.get('arch', 'x86_64')
if arch not in ACCEPTABLE_ARCHS:
print "Invalid arch. valid archs are: " + ','.join( ACCEPTABLE_ARCHS )
sys.exit(1)
env = Environment( TARGET_ARCH=arch )
if sys.platform == 'win32':
#env.Append( CPPFLAGS=['-Wall'] )
if debug:
env.Append( CPPFLAGS=['/Od', # opts off
'/Zi', # pdb
'/MDd', # Mulithreaded Debug DLL
'/RTC1' # run time checks
],
LINKFLAGS=['/DEBUG' ], # linker debug info
)
else:
env.Append( CPPFLAGS=['/Ox', # opt max
'/fp:precise', # precise fp
'/d2Zi+', # undocumented release mode debugging (vs2012)
'/MD' # Multithreaded DLL
] )
else: # Not-Windows case
env.Append( CPPFLAGS=['-Wall'] )
if debug:
env.Append( CPPFLAGS=['-O0', # opts off
'-g' ] # generate debug symbols
)
else:
env.Append( CPPFLAGS=['-O3'] )
sys.stdout.write("Build arch:\t\t")
sys.stdout.write( env['TARGET_ARCH'] )
if debug:
sys.stdout.write(" Debug\n")
else:
sys.stdout.write(" Release\n")
out_path = get_lib_path( 'glutess', debug, env['TARGET_ARCH'])
env.StaticLibrary(out_path, glutess_files )