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()
27 def build_tinygettext(self):
28 env = Environment(CPPPATH=[".", "src"])
29 env.ParseConfig("sdl-config --libs --cflags")
30 self.libtinygettext = env.StaticLibrary("tinygettext", Glob("external/tinygettext/tinygettext/*.cpp"))
32 def build_binreloc(self):
33 env = Environment(CPPPATH=["external/binreloc/", "."])
34 self.libbinreloc = env.StaticLibrary("binreloc", "external/binreloc/binreloc.c")
36 def build_findlocale(self):
37 env = Environment(CPPPATH=["external/findlocale/", "."])
38 self.libfindlocale = env.StaticLibrary("findlocale", "external/findlocale/findlocale.c")
40 def build_squirrel(self):
41 env = Environment(CPPPATH=["external/squirrel/include/"])
42 self.libsquirrel = env.StaticLibrary("squirrel",
43 Glob("external/squirrel/squirrel/*.cpp") +
44 Glob("external/squirrel/sqstdlib/*.cpp") +
45 Glob("external/squirrel/sqstdlib/*.c"))
47 def build_miniswig(self):
48 env = Environment(CPPPATH=[".", "tools/miniswig/"])
49 miniswig_bin = env.Program('miniswig',
50 ['tools/miniswig/parser.yy',
51 'tools/miniswig/lexer.ll',
52 'tools/miniswig/create_docu.cpp',
53 'tools/miniswig/xmlwriter.cpp',
54 'tools/miniswig/create_wrapper.cpp',
55 'tools/miniswig/main.cpp',
56 'tools/miniswig/tree.cpp'])
58 # env = self.env.Clone()
59 # env.Append(MINISWIG=miniswig_bin)
61 # env.Depends(env.Command('src/scripting/miniswig.tmp', 'src/scripting/wrapper.interface.hpp',
62 # ["$CXX -E -Isrc/ -x c -CC $SOURCE -o $TARGET -DSCRIPTING_API"]),
63 # ['src/scripting/interface.hpp',
64 # 'src/scripting/game_objects.hpp'])
66 # env.Depends(env.Command(['src/scripting/wrapper.cpp', 'src/scripting/wrapper.hpp'], 'src/scripting/miniswig.tmp',
67 # ["$MINISWIG --input $SOURCE --output-cpp ${TARGETS[0]} --output-hpp ${TARGETS[1]} "+
68 # "--module windstille --select-namespace Scripting"]),
71 # g++ -x "c++" -E -CC -DSCRIPTING_API src/scripting/wrapper.interface.hpp -o miniswig.tmp -Isrc
72 # tools/miniswig/miniswig --input miniswig.tmp \
73 # --output-cpp src/scripting/wrapper.cpp \
74 # --output-hpp src/scripting/wrapper.hpp \
76 # --select-namespace scripting
78 def build_supertux(self):
79 self.env = Environment(CPPPATH=["external/squirrel/include/",
80 "external/findlocale/",
83 "external/tinygettext/",
85 "/usr/include/AL/", # yuck
87 CXXFLAGS=["-O2", "-g3",
98 "-Winit-self", # only works with >= -O1
99 "-Wno-unused-parameter"])
102 self.env.ParseConfig("sdl-config --libs --cflags")
103 self.env.ParseConfig("pkg-config --libs --cflags openal")
104 self.env.ParseConfig("pkg-config --libs --cflags vorbis vorbisfile ogg")
105 self.env.Append(LIBS=[self.libsquirrel, self.libbinreloc, self.libtinygettext, self.libfindlocale])
106 self.env.Append(LIBS=["SDL_image", "curl", "GL", "GLEW", "physfs"])
110 config_h = open('config.h', 'w')
111 config_h.write('#define PACKAGE_NAME "Supertux"\n')
112 config_h.write('#define PACKAGE_VERSION "Milestone 2"\n')
113 config_h.write('#define ENABLE_BINRELOC 1\n')
114 config_h.write('#define APPDATADIR "data"\n')
115 config_h.write('#define HAVE_LIBCURL 1\n')
116 config_h.write('#define HAVE_OPENGL 1\n')
117 config_h.write('#define ICONV_CONST %s\n' % self.iconv_const)
120 version_h = open('version.h', 'w')
124 supertux_sources = Glob("src/*.cpp") + Glob("src/*/*.cpp") + Glob("src/supertux/menu/*.cpp")
126 # optional video drivers
127 supertux_sources += Glob("src/video/gl/*.cpp")
128 supertux_sources += Glob("src/video/sdl/*.cpp")
130 self.libsupertux = self.env.StaticLibrary("supertux", supertux_sources)
131 self.env.Program("supertux", ["src/main.cpp", self.libsupertux])
133 def build_tests(self):
134 for filename in Glob("test/*_test.cpp", strings=True):
135 self.env.Program(filename[:-4], [filename, self.libsupertux])