[*] Harden

This commit is contained in:
Reece Wilson 2023-12-19 04:16:12 +00:00
parent 9724a3eb35
commit 1768d90d6a
4 changed files with 34 additions and 33 deletions

View File

@ -1,5 +1,6 @@
local isUnixPremake = os.host() == "linux" or os.host() == "mac" local isUnixPremake = os.host() == "linux" or os.host() == "mac"
local isCmakeToolChain = false local isCmakeToolChain = false
local isWin32Make = os.host() == "windows" and _ACTION == "gmake2"
local getPremakeExec = function() local getPremakeExec = function()
if (isCmakeToolChain) then if (isCmakeToolChain) then
@ -19,7 +20,7 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args)
local command = "" local command = ""
if (isCmakeToolChain) then if (isCmakeToolChain or isWin32Make) then
command = "" command = ""
elseif (cdAware) then elseif (cdAware) then
command = "cd \"" .. cwd .. "\" && " command = "cd \"" .. cwd .. "\" && "

View File

@ -7,8 +7,9 @@ end
-- file name, type, directory, extension, is windows, configuration, real name -- file name, type, directory, extension, is windows, configuration, real name
local function formatCpy(name, type, dir, ex, iswin, config, platformName, arch, realName) local function formatCpy(name, type, dir, ex, iswin, config, platformName, arch, realName)
local pathSuffix = ""; local pathSuffix = "";
local hack2 = os.host() == "windows" and _ACTION == "gmake2"
if (iswin) then if (iswin and not hack2) then
pathSuffix = "*\""; pathSuffix = "*\"";
else else
pathSuffix = "\""; pathSuffix = "\"";
@ -26,8 +27,13 @@ local function formatCpy(name, type, dir, ex, iswin, config, platformName, arch,
local outputPath = string.format("%s/%s%s", dir, name, ex) local outputPath = string.format("%s/%s%s", dir, name, ex)
local outputTarget = string.format("%s/%s", dir, name) local outputTarget = string.format("%s/%s", dir, name)
local uglyBuildPath = string.format("%%{cfg.targetdir}/%s%s", name, ex) local uglyBuildPath = string.format("%%{cfg.targetdir}/%s%s", name, ex)
local hack = "{COPY}"
return string.format("{COPY} \"%s\" \"%s%s", uglyBuildPath, outputPath, pathSuffix), outputPath, uglyBuildPath if (hack2) then
hack = "cp -rf"
end
return string.format("%s \"%s\" \"%s%s", hack, uglyBuildPath, outputPath, pathSuffix), outputPath, uglyBuildPath
end end
local function gnuCoreUtilsMkdirRecursive(dir) local function gnuCoreUtilsMkdirRecursive(dir)

View File

@ -93,24 +93,12 @@ local function setBestDebugDir(dest)
end end
local function configureProjectForCompiler() local function configureProjectForCompiler()
if (targetingCmake) then filter {"toolset:msc"}
filter {"toolset:msc"} buildoptions {"-utf-8"}
end filter {}
if (bugHack) then filter {"toolset:msc", "files:**.cpp or files:**.cc or files:**.cxx"}
buildoptions {"-utf-8"}
end
if (targetingCmake) then
filter {"toolset:msc", "files:**.cpp or files:**.cc or files:**.cxx"}
elseif (bugHack) then
filter {"files:**.cpp or files:**.cc or files:**.cxx"}
end
if (bugHack) then
buildoptions {"/experimental:module-", "/Zc:__cplusplus"} buildoptions {"/experimental:module-", "/Zc:__cplusplus"}
end
filter {} filter {}
end end
@ -133,23 +121,28 @@ local function configureProjectForPlatform(platform, projectType)
else else
staticruntime("Off") staticruntime("Off")
end end
if (not Aurora.Settings.bBasicMitigations) then if (not Aurora.Settings.bBasicMitigations) then
buildoptions {
--"/GS-",
"/sdl-"
}
flags "NoBufferSecurityCheck" flags "NoBufferSecurityCheck"
end end
if (Aurora.Settings.bHotswap) then
justmycode("On")
else
justmycode("Off")
end
defines "_CRT_SECURE_NO_WARNINGS" defines "_CRT_SECURE_NO_WARNINGS"
filter {"toolset:msc"}
if (not Aurora.Settings.bBasicMitigations) then
buildoptions {
--"/GS-",
"/sdl-"
}
end
if (Aurora.Settings.bHotswap) then
justmycode("On")
else
justmycode("Off")
end
filter {}
else else
if ((projectType == "SharedLib") or if ((projectType == "SharedLib") or
(projectType == "StaticLib")) then (projectType == "StaticLib")) then

View File

@ -57,7 +57,8 @@ local function auStartSolution(sln)
end end
end) end)
if (Aurora.Settings.bForceLLVMStl) then local gmakeOnWin32 = os.host() == "windows" and _ACTION == "gmake2"
if (Aurora.Settings.bForceLLVMStl and not gmakeOnWin32) then
auFilter {"files:**.cpp or files:**.cc or files:**.cxx", "toolset:clang"} auFilter {"files:**.cpp or files:**.cc or files:**.cxx", "toolset:clang"}
buildoptions {"-stdlib=libc++"} buildoptions {"-stdlib=libc++"}
auFilter{} auFilter{}