2 # Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.de>
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http:#www.gnu.org/licenses/>.
20 self.build_tinygettext()
22 self.build_findlocale()
26 def build_tinygettext(self):
27 env = Environment(CPPPATH=[".", "src"])
28 env.ParseConfig("sdl-config --libs --cflags")
29 self.libtinygettext = env.StaticLibrary("tinygettext", Glob("external/tinygettext/tinygettext/*.cpp"))
31 def build_binreloc(self):
32 env = Environment(CPPPATH=["external/binreloc/", "."])
33 self.libbinreloc = env.StaticLibrary("binreloc", "external/binreloc/binreloc.c")
35 def build_findlocale(self):
36 env = Environment(CPPPATH=["external/findlocale/", "."])
37 self.libfindlocale = env.StaticLibrary("findlocale", "external/findlocale/findlocale.c")
39 def build_squirrel(self):
40 env = Environment(CPPPATH=["external/squirrel/include/"])
41 self.libsquirrel = env.StaticLibrary("squirrel",
42 Glob("external/squirrel/squirrel/*.cpp") +
43 Glob("external/squirrel/sqstdlib/*.cpp") +
44 Glob("external/squirrel/sqstdlib/*.c"))
46 def build_supertux(self):
47 self.env = Environment(CPPPATH=["external/squirrel/include/",
48 "external/findlocale/",
51 "external/tinygettext/",
53 "/usr/include/AL/", # yuck
55 CXXFLAGS=["-O2", "-g3",
66 "-Winit-self", # only works with >= -O1
67 "-Wno-unused-parameter"])
70 self.env.ParseConfig("sdl-config --libs --cflags")
71 self.env.ParseConfig("pkg-config --libs --cflags openal")
72 self.env.ParseConfig("pkg-config --libs --cflags vorbis vorbisfile ogg")
73 self.env.Append(LIBS=[self.libsquirrel, self.libbinreloc, self.libtinygettext, self.libfindlocale])
74 self.env.Append(LIBS=["SDL_image", "curl", "GL", "physfs"])
78 config_h = open('config.h', 'w')
79 config_h.write('#define PACKAGE_NAME "Supertux"\n')
80 config_h.write('#define PACKAGE_VERSION "Milestone 2"\n')
81 config_h.write('#define ENABLE_BINRELOC 1\n')
82 config_h.write('#define APPDATADIR "data"\n')
83 config_h.write('#define HAVE_LIBCURL 1\n')
84 config_h.write('#define HAVE_OPENGL 1\n')
85 config_h.write('#define ICONV_CONST %s\n' % self.iconv_const)
88 version_h = open('version.h', 'w')
92 supertux_sources = Glob("src/*.cpp") + Glob("src/*/*.cpp") + Glob("src/supertux/menu/*.cpp")
94 # optional video drivers
95 supertux_sources += Glob("src/video/gl/*.cpp")
96 supertux_sources += Glob("src/video/sdl/*.cpp")
98 self.libsupertux = self.env.StaticLibrary("supertux", supertux_sources)
99 self.env.Program("supertux", ["src/main.cpp", self.libsupertux])
101 def build_tests(self):
102 for filename in Glob("test/*_test.cpp", strings=True):
103 self.env.Program(filename[:-4], [filename, self.libsupertux])