X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=SConscript;h=13b6d4d129781d7037118da5ced5e13e849b92b6;hb=abcb5a66b00aff23c5f1587646f9298fc0a9d8be;hp=b89700c3e93a405eebce21b6dc377ff5fcf4f054;hpb=256cda48160476c31398ad07ca5b9c009067651d;p=supertux.git diff --git a/SConscript b/SConscript index b89700c3e..13b6d4d12 100644 --- a/SConscript +++ b/SConscript @@ -1,2 +1,104 @@ -# needed so that scons -U works correctly -Default(".") +# SuperTux +# Copyright (C) 2009 Ingo Ruhnke +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +class Project: + def __init__(self): + self.build_squirrel() + self.build_tinygettext() + self.build_binreloc() + self.build_supertux() + self.build_tests() + + def build_tinygettext(self): + env = Environment(CPPPATH=["external/tinygettext/", + "external/squirrel/include/", + ".", + "src"]) + env.ParseConfig("sdl-config --libs --cflags") + self.libtinygettext = env.StaticLibrary("tinygettext", Glob("external/tinygettext/*.cpp")) + + def build_binreloc(self): + env = Environment(CPPPATH=["external/binreloc/", "."]) + self.libbinreloc = env.StaticLibrary("binreloc", "external/binreloc/binreloc.c") + + def build_squirrel(self): + env = Environment(CPPPATH=["external/squirrel/include/"]) + self.libsquirrel = env.StaticLibrary("squirrel", + Glob("external/squirrel/squirrel/*.cpp") + + Glob("external/squirrel/sqstdlib/*.cpp") + + Glob("external/squirrel/sqstdlib/*.c")) + + def build_supertux(self): + self.env = Environment(CPPPATH=["external/squirrel/include/", + "external/", + "external/obstack", + "src/", + "/usr/include/AL/", # yuck + "."], + CXXFLAGS=["-O2", "-g3", + "-ansi", + "-pedantic", + "-Wall", + "-Wextra", + "-Wnon-virtual-dtor", + # "-Weffc++", + # "-Wconversion", + "-Werror", + # "-Wshadow", + "-Wcast-qual", + "-Winit-self", # only works with >= -O1 + "-Wno-unused-parameter"]) + + # Add libraries + self.env.ParseConfig("sdl-config --libs --cflags") + self.env.ParseConfig("pkg-config --libs --cflags openal") + self.env.ParseConfig("pkg-config --libs --cflags vorbis vorbisfile ogg") + self.env.Append(LIBS=[self.libsquirrel, self.libbinreloc, self.libtinygettext]) + self.env.Append(LIBS=["SDL_image", "curl", "GL", "physfs"]) + + # Create config.h + self.iconv_const = 0 + config_h = open('config.h', 'w') + config_h.write('#define PACKAGE_NAME "Supertux"\n') + config_h.write('#define PACKAGE_VERSION "Milestone 2"\n') + config_h.write('#define ENABLE_BINRELOC 1\n') + config_h.write('#define APPDATADIR "data"\n') + config_h.write('#define HAVE_LIBCURL 1\n') + config_h.write('#define HAVE_OPENGL 1\n') + config_h.write('#define DEBUG 1\n') + config_h.write('#define ICONV_CONST %s\n' % self.iconv_const) + config_h.close() + + version_h = open('version.h', 'w') + version_h.close() + + # base source + supertux_sources = Glob("src/*.cpp") + Glob("src/*/*.cpp") + + # optional video drivers + supertux_sources += Glob("src/video/gl/*.cpp") + supertux_sources += Glob("src/video/sdl/*.cpp") + + self.libsupertux = self.env.StaticLibrary("supertux", supertux_sources) + self.env.Program("supertux", ["src/main.cpp", self.libsupertux]) + + def build_tests(self): + for filename in Glob("test/*_test.cpp", strings=True): + self.env.Program(filename[:-4], [filename, self.libsupertux]) + +project = Project() + +# EOF #