Use gmake2 premake action

The gmake action is long deprecated and subject for removal in the
future. Switch to gmake2.

A major benefit is gmake2 is much better at parallelizing, and so on a
16 core I get a speed up of over a 30%.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2024-10-11 18:45:14 +02:00
parent 31365e7aed
commit 7d6a0c695a
3 changed files with 14 additions and 12 deletions

View file

@ -39,15 +39,15 @@ function m.init(source_root, have_std, runner, includes, root_includes)
-- With gmake, create a Utility project that generates the test root file
-- This is a workaround for https://github.com/premake/premake-core/issues/286
if _ACTION == "gmake" then
if _ACTION == "gmake2" then
project "cxxtestroot"
kind "Utility"
kind "Makefile"
-- Note: this command is not silent and clutters the output
-- Reported upstream: https://github.com/premake/premake-core/issues/954
prebuildmessage 'Generating test root file'
prebuildcommands { m.exepath.." --root "..m.rootoptions.." --runner="..m.runner.." -o "..path.getabsolute(m.rootfile) }
buildoutputs { m.rootfile }
buildmessage 'Generating test root file'
buildcommands { m.exepath.." --root "..m.rootoptions.." --runner="..m.runner.." -o "..path.getabsolute(m.rootfile) }
cleancommands { "rm " .. path.getabsolute(m.rootfile) }
end
end
@ -56,7 +56,7 @@ function m.configure_project(hdrfiles)
-- Generate the root file, or make sure the utility for generating
-- it is a dependancy with gmake.
if _ACTION == "gmake" then
if _ACTION == "gmake2" then
dependson { "cxxtestroot" }
else
prebuildmessage 'Generating test root file'
@ -78,9 +78,11 @@ function m.configure_project(hdrfiles)
-- Add source files
files { m.rootfile }
for _,hdrfile in ipairs(hdrfiles) do
local srcfile = string.sub(hdrfile, 1, -3) .. ".cpp"
files { srcfile }
if not (_ACTION == "gmake2") then
for _,hdrfile in ipairs(hdrfiles) do
local srcfile = string.sub(hdrfile, 1, -3) .. ".cpp"
files { srcfile }
end
end
end

View file

@ -395,7 +395,7 @@ function project_set_build_flags()
end
-- Adding the executable path and taking care of correct escaping
if _ACTION == "gmake" then
if _ACTION == "gmake2" then
linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
elseif _ACTION == "codeblocks" then
linkoptions { "-Wl,-R\\\\$$$ORIGIN" }

View file

@ -86,10 +86,10 @@ export HOSTTYPE="$HOSTTYPE"
echo "Premake args: ${premake_args}"
if [ "$OS" != "Darwin" ]; then
# shellcheck disable=SC2086
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake2 || die "Premake failed"
else
# shellcheck disable=SC2086
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} gmake || die "Premake failed"
${premake_command} --file="premake5.lua" --outpath="../workspaces/gcc/" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} gmake2 || die "Premake failed"
# Also generate xcode workspaces if on OS X
# shellcheck disable=SC2086
${premake_command} --file="premake5.lua" --outpath="../workspaces/xcode4" --macosx-version-min="${MIN_OSX_VERSION}" ${premake_args} xcode4 || die "Premake failed"