diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-11-29 10:19:00 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-11-29 10:19:00 +0000 |
| commit | 7c3eb2d6dbe2d99a868de887c37dd06aa8fd068a (patch) | |
| tree | bba0f35ae24dbdf2d7de2071d953b2f2ff1097ad /other/sdl/sdl.bam | |
| parent | 4004d13b48fd303c982dbcf7c432add64d128637 (diff) | |
| download | zcatch-7c3eb2d6dbe2d99a868de887c37dd06aa8fd068a.tar.gz zcatch-7c3eb2d6dbe2d99a868de887c37dd06aa8fd068a.zip | |
made sdl like a little bampack
Diffstat (limited to 'other/sdl/sdl.bam')
| -rw-r--r-- | other/sdl/sdl.bam | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/other/sdl/sdl.bam b/other/sdl/sdl.bam new file mode 100644 index 00000000..d7135e7c --- /dev/null +++ b/other/sdl/sdl.bam @@ -0,0 +1,76 @@ +SDL = { + basepath = PathPath(_REQUIREDNAME), + + OptFind = function (name, required) + local check = function(option) + option.value = nil + option.use_sdlconfig = nil + option.use_win32sdl = nil + option.use_osxframework = nil + option.lib_path = nil + + if ExecuteSilent("sdl-config") > 0 and ExecuteSilent("sdl-config --cflags") == 0 then + option.value = 1 + option.use_sdlconfig = 1 + end + + if platform == "win32" then + option.value = 1 + option.use_win32sdl = 1 + end + + if platform == "macosx" then + option.value = 1 + option.use_osxframework = 1 + end + end + + local apply = function(option, settings) + if option.use_sdlconfig then + settings.cc.flags = settings.cc.flags .. " -I/usr/include/SDL " + settings.linker.flags = settings.linker.flags .. " `sdl-config --libs` " + end + + if option.use_osxframework then + client_settings.linker.frameworks:add("SDL") + client_settings.cc.includes:add("/Library/Frameworks/SDL.framework/Headers") + end + + if option.use_win32sdl then + settings.cc.includes:add(SDL.basepath .. "/include") + settings.linker.libpath:add(SDL.basepath .. "/vc2005libs") + settings.linker.libs:add("SDL") + settings.linker.libs:add("SDLmain") + end + end + + local save = function(option, output) + output:option(option, "value") + output:option(option, "use_sdlconfig") + output:option(option, "use_win32sdl") + output:option(option, "use_osxframework") + end + + local display = function(option) + if option.value then + if option.use_sdlconfig then return "using sdl-config" end + if option.use_win32sdl then return "using supplied win32 libraries" end + if option.use_osxframework then return "using osx framework" end + return "using unknown method" + else + if option.required then + return "not found (required)" + else + return "not found (optional)" + end + end + end + + local o = MakeOption(name, 0, check, save, display) + o.apply = apply + o.include_path = nil + o.lib_path = nil + o.required = required + return o + end +} |