forked from kallisti5/guisan
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConstruct
154 lines (138 loc) · 5.11 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import os
env = Environment(ENV = os.environ)
# enable choosing other compilers
env["CC"] = os.getenv("CC") or env["CC"]
env["CXX"] = os.getenv("CXX") or env["CXX"]
env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_"))
env["LIBVER"] = "1.1.0"
env["PREFIX_PATH"] = ARGUMENTS.get('prefix', "/usr/local")
env["INCLUDE_PATH"] = ARGUMENTS.get('include', env['PREFIX_PATH'] + "/include")
env["LIB_PATH"] = ARGUMENTS.get('lib', env['PREFIX_PATH'] + "/lib")
def CheckPKGConfig(context, version):
context.Message( 'Checking for pkg-config... ' )
ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
context.Result( ret )
return ret
def CheckPKG(context, name):
context.Message( 'Checking for %s... ' % name )
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
context.Result( ret )
return ret
conf = Configure(env, custom_tests = { 'CheckPKGConfig' : CheckPKGConfig,
'CheckPKG' : CheckPKG })
if not conf.CheckPKGConfig('0.15.0'):
print('pkg-config >= 0.15.0 not found.')
Exit(1)
env['HAVE_OPENGL'] = conf.CheckPKG('gl')
env['HAVE_SDL2'] = conf.CheckPKG('sdl2')
env['HAVE_SDL2_TTF'] = conf.CheckPKG('SDL2_ttf')
if env['HAVE_SDL2']:
if not conf.CheckPKG('SDL2_image'):
print('SDL2_image not found. Disabling SDL2 support.')
env['HAVE_SDL2'] = 0
if env['HAVE_SDL2_TTF']:
env.Append(CPPDEFINES = ['USE_SDL2_TTF'])
env = conf.Finish()
env.Append(CPPPATH = ['#include/'])
env.Append(LIBPATH = ['#src/'])
env.Append(CFLAGS = ['-g'])
env.Append(CPPFLAGS = ['-g'])
Export("env")
# Main static library
SConscript('src/SConscript')
# Example code
SConscript('examples/SConscript')
# TODO: install
common_headers = [
'include/guisan/actionevent.hpp',
'include/guisan/actionlistener.hpp',
'include/guisan/cliprectangle.hpp',
'include/guisan/color.hpp',
'include/guisan/containerevent.hpp',
'include/guisan/containerlistener.hpp',
'include/guisan/deathlistener.hpp',
'include/guisan/defaultfont.hpp',
'include/guisan/event.hpp',
'include/guisan/exception.hpp',
'include/guisan/focushandler.hpp',
'include/guisan/focuslistener.hpp',
'include/guisan/font.hpp',
'include/guisan/genericinput.hpp',
'include/guisan/glut.hpp',
'include/guisan/graphics.hpp',
'include/guisan/gui.hpp',
'include/guisan/imagefont.hpp',
'include/guisan/image.hpp',
'include/guisan/imageloader.hpp',
'include/guisan/inputevent.hpp',
'include/guisan/input.hpp',
'include/guisan/keyevent.hpp',
'include/guisan/key.hpp',
'include/guisan/keyinput.hpp',
'include/guisan/keylistener.hpp',
'include/guisan/listmodel.hpp',
'include/guisan/mouseevent.hpp',
'include/guisan/mouseinput.hpp',
'include/guisan/mouselistener.hpp',
'include/guisan/opengl.hpp',
'include/guisan/platform.hpp',
'include/guisan/rectangle.hpp',
'include/guisan/sdl.hpp',
'include/guisan/selectionevent.hpp',
'include/guisan/selectionlistener.hpp',
'include/guisan/stringlistmodel.hpp',
'include/guisan/text.hpp',
'include/guisan/widget.hpp',
'include/guisan/widgetlistener.hpp',
'include/guisan/x.hpp'
]
widget_headers = [
'include/guisan/widgets/adjustingcontainer.hpp',
'include/guisan/widgets/button.hpp',
'include/guisan/widgets/checkbox.hpp',
'include/guisan/widgets/container.hpp',
'include/guisan/widgets/dropdown.hpp',
'include/guisan/widgets/icon.hpp',
'include/guisan/widgets/imagebutton.hpp',
'include/guisan/widgets/imagetextbutton.hpp',
'include/guisan/widgets/inputbox.hpp',
'include/guisan/widgets/label.hpp',
'include/guisan/widgets/listbox.hpp',
'include/guisan/widgets/messagebox.hpp',
'include/guisan/widgets/progressbar.hpp',
'include/guisan/widgets/radiobutton.hpp',
'include/guisan/widgets/scrollarea.hpp',
'include/guisan/widgets/slider.hpp',
'include/guisan/widgets/tabbedarea.hpp',
'include/guisan/widgets/tab.hpp',
'include/guisan/widgets/textbox.hpp',
'include/guisan/widgets/textfield.hpp',
'include/guisan/widgets/passwordfield.hpp',
'include/guisan/widgets/togglebutton.hpp',
'include/guisan/widgets/window.hpp'
]
sdl2_headers = [
'include/guisan/sdl/sdlgraphics.hpp',
'include/guisan/sdl/sdl2graphics.hpp',
'include/guisan/sdl/sdlimage.hpp',
'include/guisan/sdl/sdlimageloader.hpp',
'include/guisan/sdl/sdlinput.hpp',
'include/guisan/sdl/sdlpixel.hpp',
'include/guisan/sdl/sdltruetypefont.hpp'
]
opengl_headers = [
'include/guisan/opengl/openglgraphics.hpp',
'include/guisan/opengl/openglimage.hpp',
'include/guisan/opengl/openglsdlimageloader.hpp'
]
env.Install(env["LIB_PATH"], 'src/libguisan.a')
env.Install(env["LIB_PATH"] + "/pkgconfig", 'src/guisan.pc')
env.Install(env["INCLUDE_PATH"], 'include/guisan.hpp')
# install common headers + widgets
env.Install(env["INCLUDE_PATH"] + '/guisan', common_headers)
env.Install(env["INCLUDE_PATH"] + '/guisan/widgets', widget_headers)
if env['HAVE_SDL2']:
env.Install(env["INCLUDE_PATH"] + '/guisan/sdl', sdl2_headers)
if env['HAVE_OPENGL']:
env.Install(env["INCLUDE_PATH"] + '/guisan/opengl', opengl_headers)
env.Alias('install', env["PREFIX_PATH"])