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=["external/tinygettext/",
28 "external/squirrel/include/",
31 env.ParseConfig("sdl-config --libs --cflags")
32 self.libtinygettext = env.StaticLibrary("tinygettext", Glob("external/tinygettext/*.cpp"))
34 def build_binreloc(self):
35 env = Environment(CPPPATH=["external/binreloc/", "."])
36 self.libbinreloc = env.StaticLibrary("binreloc", "external/binreloc/binreloc.c")
38 def build_findlocale(self):
39 env = Environment(CPPPATH=["external/findlocale/", "."])
40 self.libfindlocale = env.StaticLibrary("findlocale", "external/findlocale/findlocale.c")
42 def build_squirrel(self):
43 env = Environment(CPPPATH=["external/squirrel/include/"])
44 self.libsquirrel = env.StaticLibrary("squirrel",
45 Glob("external/squirrel/squirrel/*.cpp") +
46 Glob("external/squirrel/sqstdlib/*.cpp") +
47 Glob("external/squirrel/sqstdlib/*.c"))
49 def build_supertux(self):
50 self.env = Environment(CPPPATH=["external/squirrel/include/",
51 "external/findlocale/",
55 "/usr/include/AL/", # yuck
57 CXXFLAGS=["-O2", "-g3",
68 "-Winit-self", # only works with >= -O1
69 "-Wno-unused-parameter"])
72 self.env.ParseConfig("sdl-config --libs --cflags")
73 self.env.ParseConfig("pkg-config --libs --cflags openal")
74 self.env.ParseConfig("pkg-config --libs --cflags vorbis vorbisfile ogg")
75 self.env.Append(LIBS=[self.libsquirrel, self.libbinreloc, self.libtinygettext, self.libfindlocale])
76 self.env.Append(LIBS=["SDL_image", "curl", "GL", "physfs"])
80 config_h = open('config.h', 'w')
81 config_h.write('#define PACKAGE_NAME "Supertux"\n')
82 config_h.write('#define PACKAGE_VERSION "Milestone 2"\n')
83 config_h.write('#define ENABLE_BINRELOC 1\n')
84 config_h.write('#define APPDATADIR "data"\n')
85 config_h.write('#define HAVE_LIBCURL 1\n')
86 config_h.write('#define HAVE_OPENGL 1\n')
87 config_h.write('#define DEBUG 1\n')
88 config_h.write('#define ICONV_CONST %s\n' % self.iconv_const)
91 version_h = open('version.h', 'w')
95 supertux_sources = Glob("src/*.cpp") + Glob("src/*/*.cpp") + Glob("src/supertux/menu/*.cpp")
97 # optional video drivers
98 supertux_sources += Glob("src/video/gl/*.cpp")
99 supertux_sources += Glob("src/video/sdl/*.cpp")
101 self.libsupertux = self.env.StaticLibrary("supertux", supertux_sources)
102 self.env.Program("supertux", ["src/main.cpp", self.libsupertux])
104 def build_tests(self):
105 for filename in Glob("test/*_test.cpp", strings=True):
106 self.env.Program(filename[:-4], [filename, self.libsupertux])