Build/Boilerplate/workspace.lua
Reece 615bcb53b9 Initial commit
Publish a collection of boilerplate and an additional json parser.
This meta build chain as-is should replace a lot of the premake5.lua in the AuroraEngine repo
2021-05-20 13:56:44 +01:00

122 lines
3.8 KiB
Lua

local toolPlatforms = {"win32", "linux"}
-------------------------------------------------------
-- build platform
-------------------------------------------------------
local isWin = _G.win32
local isToolChain = false
for k in pairs(toolPlatforms) do
if (_G[toolPlatforms[k]]) then
isToolChain = true
end
end
printHeader("configuration", "platforms")
print("isWin", isWin)
print("isDevelopmentPlatform", isToolChain)
print()
-------------------------------------------------------
-- create workspace
-------------------------------------------------------
local target = require("platform")
workspace "Aurora Project"
configurations { "Debug", "Release", "Ship" }
platforms(target)
architecture(target[1])
location(getroot() .. "/Build_CompilerWorkingDirectory/")
symbols "On"
staticruntime "On"
visibility "Hidden"
editandcontinue "Off"
flags
{
"NoIncrementalLink",
"MultiProcessorCompile"--,
--"NoEditAndContinue"
}
filter "configurations:Debug"
defines { "DEBUG" }
targetdir(getroot() .. "/Build_CompilerWorkingDirectory/Bin/Debug")
debugdir( getroot() .. "/Build_Develop")
filter "configurations:Release or configurations:Ship"
defines { "NDEBUG" }
optimize "Speed"
filter "configurations:Release"
defines {"INTERNAL", "STAGING"}
targetdir(getroot() .. "/Build_CompilerWorkingDirectory/Bin/Release")
debugdir(getroot() .. "/Build_Stage")
filter "configurations:Ship"
defines {"SHIP"}
targetdir(getroot() .. "/Build_CompilerWorkingDirectory/Bin/Ship")
debugdir(getroot() .. "/Build_Ship")
filter {}
if ((not isWin) or (_G.forceClang)) then
usingClang = true
_G.usingClang = true
toolset "clang"
buildoptions {"-fms-extensions"}
filter {"files:**.cpp"} -- TODO: `.. " or files:**.cc"` should be possible
buildoptions {"-stdlib=libc++"}
filter {}
filter {"files:**.cc"}
buildoptions {"-stdlib=libc++"}
filter {}
disablewarnings
{
-- we live life on the edge
"unused-result",
-- warning: unused unused enumeration
"unused-value",
"unknown-warning-option"
}
elseif (isWin) then
usingMSVC = true
disablewarnings "4996" -- The whiny C99 is no longer supported nag, please needlessly use _s and _'d functions
disablewarnings "4251" -- MSVC's hurrdurr abis will break if you dynamically link classes
-- counter: fuck off, we have full control of the build process, and we only link against
-- dynamic c/stl runtimes. which brainlet thought this was a good idea?
-- even microsofts docs doesn't state what is guaranteed to be safe. raii works so who cares
disablewarnings "4244" -- conversion from 'double' to 'float', possible loss of data
-- this warning is extremely important; however, we're making a game engine.
-- pragma warning push, disable and/or static_casts to hint we expect floating point precision
-- loss is extremely annoying and impractical. further, projects including harfbuzz, freetype,
-- and v8 don't seem to care about these warnings either
end
if (_G.linux and usingClang) then
linkoptions {"-nodefaultlibs"}
links "c++abi"
links "c++"
links "c"
links "gcc"
links "gcc_s"
links "m"
end
if (isWin) then
-- yeaaa, no
defines "_CRT_SECURE_NO_WARNINGS"
end