-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConstruct
124 lines (97 loc) · 3.9 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#######################3
# BUILD NOTES
#
# needs sdl2, sdl_mixer, sdl_image, python-devel
#
import fnmatch
import os
import sys
build_debug_mode = True
def populate_c_matches(matches, dir):
for root, dirnames, filenames in os.walk(dir):
for filename in fnmatch.filter(filenames, '*.c'):
matches.append(os.path.join(root, filename))
def populate_h_matches(matches, dir):
for root, dirnames, filenames in os.walk(dir):
for filename in fnmatch.filter(filenames, '*.h'):
path = os.path.dirname(os.path.join( root, filename))
if not path in matches:
matches.append(path)
def configure_linux(IncludePaths, Libs):
def configure_portaudio(includes,libs):
includes.append('/usr/include/portaudio/')
libs.extend(['libportaudio', 'asound'])
def configure_python(includes, libs):
includes.append('/usr/include/python3.6m/')
libs.extend( [ 'python3.6m', 'pthread', 'dl', 'util', 'm' ] )
def configure_sdl(includes,libs):
includes.append('/usr/include/SDL2/')
libs.extend( ['SDL2', 'SDL2_image', 'SDLmain' ] )
def configure_opengl(includes,libs):
libs.extend( ['GL'])
includes.append('./gl_includes/')
def configure_chipmunk(includes,libs):
libs.extend( ['libchipmunk' ] )
includes.append('./cp_includes/')
configure_chipmunk(IncludePaths, Libs)
configure_opengl(IncludePaths, Libs)
configure_portaudio(IncludePaths, Libs) # first because python also needs pthread
configure_python(IncludePaths, Libs)
configure_sdl(IncludePaths, Libs)
def configure_win32(IncludePaths, Libs):
def configure_portaudio(includes,libs):
includes.append('C:\\clibs\\portaudio-r1891-build\\include\\')
libs.append('C:\\clibs\\portaudio-r1891-build\\lib\\Win32\\ReleaseMinDependency\\portaudio_x86.lib')
def configure_python(includes, libs):
includes.append('C:\\Python34\\include\\')
libs.append( 'C:\\Python34\\libs\\python34.lib' )
def configure_sdl(includes,libs):
includes.append('C:\\clibs\\SDL2-2.0.1\\include\\')
includes.append('C:\\clibs\\SDL2_mixer-2.0.0\\include\\')
includes.append('C:\\clibs\\SDL2_image-2.0.0\\include\\')
libs.append( 'C:\\clibs\\SDL2-2.0.1\\lib\\x86\\SDL2.lib' )
libs.append( 'C:\\clibs\\SDL2-2.0.1\\lib\\x86\\SDL2main.lib' )
libs.append( 'C:\\clibs\\SDL2_image-2.0.0\\lib\\x86\\SDL2_image.lib' )
libs.append('C:\\clibs\\SDL2_mixer-2.0.0\\lib\\x86\\SDL2_mixer.lib' )
def configure_opengl(includes,libs):
includes.append('gl_includes\\')
libs.append('opengl32.lib')
def configure_chipmunk(includes,libs):
includes.append('cp_includes\\')
libs.append('lib\\chipmunk.lib')
configure_chipmunk(IncludePaths, Libs)
configure_opengl(IncludePaths, Libs)
configure_portaudio(IncludePaths, Libs) # first because python also needs pthread
configure_python(IncludePaths, Libs)
configure_sdl(IncludePaths, Libs)
Libs = []
SourceFiles = []
IncludePaths = []
CCFLAGS = ""
LINKFLAGS = ""
populate_c_matches(SourceFiles, 'src')
populate_h_matches(IncludePaths, 'src')
if sys.platform == 'linux2':
env = Environment()
if sys.platform == 'win32':
env = Environment( MSVC_VERSION='14.0', TARGET_ARCH='x86' )
if sys.platform == 'linux2':
configure_linux(IncludePaths, Libs)
CCFLAGS='-pthread -Wno-incompatible-pointer-types'
if sys.platform == 'win32':
configure_win32(IncludePaths, Libs)
CCFLAGS='/MT /O2'
LINKFLAGS='/SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt.lib'
if build_debug_mode:
print SourceFiles
print IncludePaths
print Libs
env.Program(
'./bin/beagle_runtime',
SourceFiles,
CPPPATH= IncludePaths,
LIBPATH=['.','./lib/'],
LIBS=Libs,
LINKFLAGS = LINKFLAGS,
CCFLAGS=CCFLAGS
)