From: Matthias Braun Date: Tue, 16 Nov 2004 17:46:56 +0000 (+0000) Subject: add variants and link executable to toplevel X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6ba9f9063a8b4537b1d20450269a04eb9a06465d;p=supertux.git add variants and link executable to toplevel SVN-Revision: 2097 --- diff --git a/SConstruct b/SConstruct index 0787d54fd..557be7e9e 100644 --- a/SConstruct +++ b/SConstruct @@ -44,10 +44,12 @@ opts.Add('LIBS', 'Additional libraries', '') opts.Add('DESTDIR', \ 'destination directory for installation. It is prepended to PREFIX', '') opts.Add('PREFIX', 'Installation prefix', '/usr/local') +opts.Add(ListOption('VARIANT', 'Build variant', 'optimize', + ['optimize', 'debug', 'profile'])) env = Environment(options = opts) conf = Configure(env, custom_tests = { - 'CheckSDLConfig' : CheckSDLConfig + 'CheckSDLConfig' : CheckSDLConfig }) # TODO check -config apps in the Configure context @@ -67,13 +69,21 @@ if not conf.CheckLib('GL'): env = conf.Finish() +if str(env['VARIANT']) == "optimize": + env.Append(CXXFLAGS = "-O2 -g") +elif str(env['VARIANT']) == "debug": + env.Append(CXXFLAGS = "-O0 -g3") + env.Append(CPPDEFINES = "DEBUG") +elif str(env['VARIANT']) == "profile": + env.Append(CXXFLAGS = "-pg -O2") + env.ParseConfig('sdl-config --cflags --libs') env.Append(CPPPATH = ["#", "#/src", "#/lib"]) env.Append(CPPDEFINES = \ {'DATA_PREFIX':"'\"" + env['PREFIX'] + "/share/supertux\"'" , 'LOCALEDIR' :"'\"" + env['PREFIX'] + "/locales\"'"}) -build_dir="build/" + env['PLATFORM'] +build_dir="build/" + env['PLATFORM'] + "/" + str(env['VARIANT']) env.Append(LIBS = ["supertux"]) env.Append(LIBPATH=["#" + build_dir + "/lib"]) @@ -81,8 +91,3 @@ env.Append(LIBPATH=["#" + build_dir + "/lib"]) env.Export(["env", "Glob"]) env.SConscript("lib/SConscript", build_dir=build_dir + "/lib", duplicate=0) env.SConscript("src/SConscript", build_dir=build_dir + "/src", duplicate=0) - -#for i in env.items(): -# print str(i) - -# link all program targets to top builddir as a convenience diff --git a/src/SConscript b/src/SConscript index 7d937e686..ccb8f8cdc 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,5 +1,13 @@ Import('*') -supertux_src = Glob(dirs=[".", "object"], pattern="*.cpp") -env.Program(target="#/supertux", source = supertux_src) +supertux_src = Glob( + dirs=[".", "object"], + pattern="*.cpp" +) +app = env.Program( + target="supertux", + source = supertux_src +) +# hacky way for now... +AddPostAction(app, "ln -s $TARGET .")