Merge branch 'master' into fix-mingw

This commit is contained in:
Nick Clark 2021-08-16 16:41:59 -04:00 committed by GitHub
commit ae86c99f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 196 additions and 11 deletions

View File

@ -13,7 +13,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: make -f Bootstrap.mak linux CONFIG=${{ matrix.config }}
run: make -f Bootstrap.mak linux PLATFORM=${{ matrix.platform }} CONFIG=${{ matrix.config }}
- name: Test
run: bin/${{ matrix.config }}/premake5 test --test-all
- name: Upload Artifacts
@ -32,7 +32,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: make -f Bootstrap.mak macosx CONFIG=${{ matrix.config }}
run: make -f Bootstrap.mak macosx PLATFORM=${{ matrix.platform }} CONFIG=${{ matrix.config }}
- name: Test
run: bin/${{ matrix.config }}/premake5 test --test-all
- name: Upload Artifacts

View File

@ -87,7 +87,7 @@ mingw: mingw-clean
if not exist build\bootstrap (mkdir build\bootstrap)
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" $(SRC) -lole32 -lversion
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --os=windows --to=build/bootstrap --cc=mingw gmake2
./build/bootstrap/premake_bootstrap --arch=$(PLATFORM) --os=windows --to=build/bootstrap --cc=mingw gmake2
$(MAKE) -C build/bootstrap config=$(CONFIG)_$(PLATFORM)
macosx: osx
@ -100,7 +100,7 @@ osx: osx-clean
mkdir -p build/bootstrap
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_MACOSX -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" -framework CoreServices -framework Foundation -framework Security -lreadline $(SRC)
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake2
./build/bootstrap/premake_bootstrap --arch=$(PLATFORM) --to=build/bootstrap gmake2
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` config=$(CONFIG)
linux-clean: nix-clean
@ -143,7 +143,7 @@ windows-base: windows-clean
if not exist build\bootstrap (mkdir build\bootstrap)
cl /Fo.\build\bootstrap\ /Fe.\build\bootstrap\premake_bootstrap.exe /DPREMAKE_NO_BUILTIN_SCRIPTS /I"$(LUA_DIR)" /I"$(LUASHIM_DIR)" user32.lib ole32.lib advapi32.lib $(SRC)
.\build\bootstrap\premake_bootstrap.exe embed
.\build\bootstrap\premake_bootstrap --to=build/bootstrap $(MSDEV)
.\build\bootstrap\premake_bootstrap --arch=$(PLATFORM) --to=build/bootstrap $(MSDEV)
windows: windows-base
devenv .\build\bootstrap\Premake5.sln /Upgrade

View File

@ -12,6 +12,7 @@ return {
"cs2005/test_compiler_props.lua",
"cs2005/test_no_warn.lua",
"cs2005/test_debug_props.lua",
"cs2005/test_debug_props_2019.lua",
"cs2005/test_files.lua",
"cs2005/test_icon.lua",
"cs2005/test_netcore.lua",

View File

@ -0,0 +1,130 @@
--
-- tests/actions/vstudio/cs2005/test_debug_props_2019.lua
-- Test debugging and optimization flags block of a Visual Studio 2019+ C# project.
-- Copyright (c) 2012-2021 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_cs2005_debug_props_2019")
local cs2005 = p.vstudio.cs2005
local dn2005 = p.vstudio.dotnetbase
local project = p.project
--
-- Setup and teardown
--
local wks, prj
function suite.setup()
p.action.set("vs2019")
wks, prj = test.createWorkspace()
end
local function prepare()
local cfg = test.getconfig(prj, "Debug")
dn2005.debugProps(cfg)
end
--
-- Check the handling of the Symbols flag.
--
function suite.debugSymbols_onNoSymbolsFlag()
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
]]
end
function suite.debugSymbols_onSymbolsFlag()
symbols "On"
prepare()
test.capture [[
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
]]
end
function suite.debugSymbols_fullSymbolsFlag()
symbols "Full"
prepare()
test.capture [[
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
]]
end
function suite.debugSymbols_offSymbolsFlag()
symbols "Off"
prepare()
test.capture [[
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<Optimize>false</Optimize>
]]
end
---
--- Check handling of debug parameters.
---
function suite.debugCommandParameters()
debugargs "foobar"
local cfg = test.getconfig(prj, "Debug")
dn2005.debugCommandParameters(cfg)
test.capture [[
<Commandlineparameters>foobar</Commandlineparameters>
]]
end
function suite.debugStartArguments()
debugargs "foobar"
local cfg = test.getconfig(prj, "Debug")
cs2005.localDebuggerCommandArguments(cfg)
test.capture [[
<StartArguments>foobar</StartArguments>
]]
end
--
-- Check handling of optimization flags.
--
function suite.optimize_onOptimizeFlag()
optimize "On"
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
]]
end
function suite.optimize_onOptimizeSizeFlag()
optimize "Size"
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
]]
end
function suite.optimize_onOptimizeSpeedFlag()
optimize "Speed"
prepare()
test.capture [[
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
]]
end

View File

@ -278,11 +278,27 @@
--
function dotnetbase.debugProps(cfg)
if cfg.symbols == p.ON then
_p(2,'<DebugSymbols>true</DebugSymbols>')
_p(2,'<DebugType>full</DebugType>')
if _ACTION >= "vs2019" then
if cfg.symbols == "Full" then
_p(2,'<DebugType>full</DebugType>')
_p(2,'<DebugSymbols>true</DebugSymbols>')
elseif cfg.symbols == p.OFF then
_p(2,'<DebugType>none</DebugType>')
_p(2,'<DebugSymbols>false</DebugSymbols>')
elseif cfg.symbols == p.ON or cfg.symbols == "FastLink" then
_p(2,'<DebugType>pdbonly</DebugType>')
_p(2,'<DebugSymbols>true</DebugSymbols>')
else
_p(2,'<DebugType>portable</DebugType>')
_p(2,'<DebugSymbols>true</DebugSymbols>')
end
else
_p(2,'<DebugType>pdbonly</DebugType>')
if cfg.symbols == p.ON then
_p(2,'<DebugSymbols>true</DebugSymbols>')
_p(2,'<DebugType>full</DebugType>')
else
_p(2,'<DebugType>pdbonly</DebugType>')
end
end
_p(2,'<Optimize>%s</Optimize>', iif(config.isOptimizedBuild(cfg), "true", "false"))
end

View File

@ -90,6 +90,23 @@
description = "Embed scripts as bytecode instead of stripped souce code"
}
newoption {
trigger = "arch",
value = "arch",
description = "Set the architecture of the binary to be built.",
allowed = {
{ "ARM", "ARM (On macOS, same as ARM64.)" },
{ "ARM64", "ARM64" },
{ "x86", "x86 (On macOS, same as x86_64.)" },
{ "x86_64", "x86_64" },
{ "Universal", "Universal Binary (macOS only)" },
--
{ "Win32", "Same as x86" },
{ "x64", "Same as x86_64" },
},
default = "x86",
}
--
-- Define the project. Put the release configuration first so it will be the
-- default when folks build using the makefile. That way they don't have to
@ -116,8 +133,29 @@
defines { "CURL_STATICLIB", "PREMAKE_CURL"}
end
filter { 'system:windows' }
platforms { 'x86', 'x64' }
filter { "system:macosx", "options:arch=ARM or arch=ARM64" }
buildoptions { "-arch arm64" }
linkoptions { "-arch arm64" }
filter { "system:macosx", "options:arch=x86 or arch=x86_64 or arch=Win32 or arch=x64" }
buildoptions { "-arch x86_64" }
linkoptions { "-arch x86_64" }
filter { "system:macosx", "options:arch=Universal" }
buildoptions { "-arch arm64", "-arch x86_64" }
linkoptions { "-arch arm64", "-arch x86_64" }
filter { "system:windows", "options:arch=ARM" }
platforms { "ARM" }
filter { "system:windows", "options:arch=ARM64" }
platforms { "ARM64" }
filter { "system:windows", "options:arch=x86 or arch=Win32" }
platforms { "Win32" }
filter { "system:windows", "options:arch=x86_64 or arch=x64" }
platforms { "x64" }
filter "configurations:Debug"
defines "_DEBUG"