From 1768d90d6ac0896b68334cde28c85c07ac6f8b58 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Tue, 19 Dec 2023 04:16:12 +0000 Subject: [PATCH] [*] Harden --- Core/Actions/Actions.lua | 5 ++-- Core/BuildHooks/BuildHooks.lua | 10 +++++-- Core/project.lua | 49 +++++++++++++++------------------- Core/solution.lua | 3 ++- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/Core/Actions/Actions.lua b/Core/Actions/Actions.lua index d826564..72d9156 100644 --- a/Core/Actions/Actions.lua +++ b/Core/Actions/Actions.lua @@ -1,5 +1,6 @@ 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() if (isCmakeToolChain) then @@ -19,7 +20,7 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args) local command = "" - if (isCmakeToolChain) then + if (isCmakeToolChain or isWin32Make) then command = "" elseif (cdAware) then command = "cd \"" .. cwd .. "\" && " diff --git a/Core/BuildHooks/BuildHooks.lua b/Core/BuildHooks/BuildHooks.lua index b51f6e7..ba65b88 100644 --- a/Core/BuildHooks/BuildHooks.lua +++ b/Core/BuildHooks/BuildHooks.lua @@ -7,8 +7,9 @@ end -- file name, type, directory, extension, is windows, configuration, real name local function formatCpy(name, type, dir, ex, iswin, config, platformName, arch, realName) local pathSuffix = ""; + local hack2 = os.host() == "windows" and _ACTION == "gmake2" - if (iswin) then + if (iswin and not hack2) then pathSuffix = "*\""; else 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 outputTarget = string.format("%s/%s", dir, name) 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 local function gnuCoreUtilsMkdirRecursive(dir) diff --git a/Core/project.lua b/Core/project.lua index 79dd8dd..a4e4642 100644 --- a/Core/project.lua +++ b/Core/project.lua @@ -93,24 +93,12 @@ local function setBestDebugDir(dest) end local function configureProjectForCompiler() - if (targetingCmake) then - filter {"toolset:msc"} - end + filter {"toolset:msc"} + buildoptions {"-utf-8"} + filter {} - if (bugHack) then - 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 + filter {"toolset:msc", "files:**.cpp or files:**.cc or files:**.cxx"} buildoptions {"/experimental:module-", "/Zc:__cplusplus"} - end - filter {} end @@ -133,23 +121,28 @@ local function configureProjectForPlatform(platform, projectType) else staticruntime("Off") end - + if (not Aurora.Settings.bBasicMitigations) then - buildoptions { - --"/GS-", - "/sdl-" - } - flags "NoBufferSecurityCheck" end - if (Aurora.Settings.bHotswap) then - justmycode("On") - else - justmycode("Off") - end - 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 if ((projectType == "SharedLib") or (projectType == "StaticLib")) then diff --git a/Core/solution.lua b/Core/solution.lua index 88b5728..5b9f1e7 100644 --- a/Core/solution.lua +++ b/Core/solution.lua @@ -57,7 +57,8 @@ local function auStartSolution(sln) 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"} buildoptions {"-stdlib=libc++"} auFilter{}