83 lines
2.1 KiB
Lua
83 lines
2.1 KiB
Lua
--------------------------------
|
|
-- --
|
|
-- 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 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 = {
|
|
build = ScriptArgs.build_dir or "build",
|
|
object = "obj",
|
|
examples = "examples"
|
|
}
|
|
|
|
--------------------------------
|
|
-- --
|
|
-- 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
|
|
--------------------------------
|
|
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)
|
|
return Path(PathJoin(PathJoin(paths.build, 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)
|