-------------------------------- -- -- -- Spectre build config -- -- -- -------------------------------- Import(".bam/utils.lua") Import(".bam/functions.lua") CheckVersion("0.5") -------------------------------- -- -- -- Environment Setup -- -- -- -------------------------------- -- Target specified on command line or get host system. TARGET_OS = ScriptArgs.target or host_system() if not valid_system(TARGET_OS) then print ("System not supported" ) print ("Supported systems are: " .. supported_systems() ) return 1 end -- paths used when building. paths = { -- Root build directory. build = ScriptArgs.build_dir or "build", -- Directory where internal object/libs files are -- stored to produce the final library. intermediate = PathJoin("spectre", TARGET_OS), object = "obj", examples = "examples_" .. TARGET_OS } -------------------------------- -- -- -- Global Build Settings -- -- -- -------------------------------- global_settings = NewSettings(); -- Build type -------------------------------- global_settings.debug = 1 global_settings.optimize = 0 if ScriptArgs.type ~= nil and ScriptArgs.type:match("^release") then global_settings.debug = 0 if ScriptArgs.type == "release-fast" then global_settings.optimize = 1 end end -- Output configuration -------------------------------- -- Output path for static libraries. global_settings.lib.prefix = Path(paths.build) .. "/" global_settings.link.Output = function(settings, input) return Path(PathJoin(paths.build, input)) end global_settings.cc.Output = function(settings, input) local path = PathJoin(paths.build, paths.intermediate) return Path(PathJoin(PathJoin(path, paths.object), PathBase(input))) end -- Compiler configuration -------------------------------- -- MSVC complains about exception handler without this flag. if global_settings.cc.exe_cxx == "cl" then global_settings.cc.flags:Add('/EHsc') end -------------------------------- -- -- -- Build Targets -- -- -- -------------------------------- Import("engine.build.lua") Import("examples/build.lua") -- Set engine library as default target DefaultTarget(libspectre)