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()
25 def build_tinygettext(self):
26 env = Environment(CPPPATH=["external/tinygettext/",
27 "external/squirrel/include/",
30 env.ParseConfig("sdl-config --libs --cflags")
31 self.libtinygettext = env.StaticLibrary("tinygettext", Glob("external/tinygettext/*.cpp"))
33 def build_binreloc(self):
34 env = Environment(CPPPATH=["external/binreloc/", "."])
35 self.libbinreloc = env.StaticLibrary("binreloc", "external/binreloc/binreloc.c")
37 def build_squirrel(self):
38 env = Environment(CPPPATH=["external/squirrel/include/"])
39 self.libsquirrel = env.StaticLibrary("squirrel",
40 Glob("external/squirrel/squirrel/*.cpp") +
41 Glob("external/squirrel/sqstdlib/*.cpp") +
42 Glob("external/squirrel/sqstdlib/*.c"))
44 def build_supertux(self):
45 self.env = Environment(CPPPATH=["external/squirrel/include/",
49 "/usr/include/AL/", # yuck
51 CXXFLAGS=["-O2", "-g3",
62 "-Winit-self", # only works with >= -O1
63 "-Wno-unused-parameter"])
66 self.env.ParseConfig("sdl-config --libs --cflags")
67 self.env.ParseConfig("pkg-config --libs --cflags openal")
68 self.env.ParseConfig("pkg-config --libs --cflags vorbis vorbisfile ogg")
69 self.env.Append(LIBS=[self.libsquirrel, self.libbinreloc, self.libtinygettext])
70 self.env.Append(LIBS=["SDL_image", "curl", "GL", "physfs"])
74 config_h = open('config.h', 'w')
75 config_h.write('#define PACKAGE_NAME "Supertux"\n')
76 config_h.write('#define PACKAGE_VERSION "Milestone 2"\n')
77 config_h.write('#define ENABLE_BINRELOC 1\n')
78 config_h.write('#define APPDATADIR "data"\n')
79 config_h.write('#define HAVE_LIBCURL 1\n')
80 config_h.write('#define HAVE_OPENGL 1\n')
81 config_h.write('#define DEBUG 1\n')
82 config_h.write('#define ICONV_CONST %s\n' % self.iconv_const)
85 version_h = open('version.h', 'w')
89 supertux_sources = Glob("src/*.cpp") + Glob("src/*/*.cpp")
91 # optional video drivers
92 supertux_sources += Glob("src/video/gl/*.cpp")
93 supertux_sources += Glob("src/video/sdl/*.cpp")
95 self.libsupertux = self.env.StaticLibrary("supertux", supertux_sources)
96 self.env.Program("supertux", ["src/main.cpp", self.libsupertux])
98 def build_tests(self):
99 for filename in Glob("test/*_test.cpp", strings=True):
100 self.env.Program(filename[:-4], [filename, self.libsupertux])