diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index ea9052e8..e734fd4c 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -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 diff --git a/Bootstrap.mak b/Bootstrap.mak index 06e0f20c..9c6c32b3 100644 --- a/Bootstrap.mak +++ b/Bootstrap.mak @@ -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 diff --git a/modules/vstudio/tests/_tests.lua b/modules/vstudio/tests/_tests.lua index 664cea23..4957eb60 100644 --- a/modules/vstudio/tests/_tests.lua +++ b/modules/vstudio/tests/_tests.lua @@ -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", diff --git a/modules/vstudio/tests/cs2005/test_debug_props_2019.lua b/modules/vstudio/tests/cs2005/test_debug_props_2019.lua new file mode 100644 index 00000000..c9d4917f --- /dev/null +++ b/modules/vstudio/tests/cs2005/test_debug_props_2019.lua @@ -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 [[ + portable + true + false + ]] + end + + function suite.debugSymbols_onSymbolsFlag() + symbols "On" + prepare() + test.capture [[ + pdbonly + true + false + ]] + end + + function suite.debugSymbols_fullSymbolsFlag() + symbols "Full" + prepare() + test.capture [[ + full + true + false + ]] + end + + function suite.debugSymbols_offSymbolsFlag() + symbols "Off" + prepare() + test.capture [[ + none + false + false + ]] + end + +--- +--- Check handling of debug parameters. +--- + + function suite.debugCommandParameters() + debugargs "foobar" + + local cfg = test.getconfig(prj, "Debug") + dn2005.debugCommandParameters(cfg) + + test.capture [[ + foobar + ]] + end + + function suite.debugStartArguments() + debugargs "foobar" + local cfg = test.getconfig(prj, "Debug") + cs2005.localDebuggerCommandArguments(cfg) + test.capture [[ +foobar + ]] + end + +-- +-- Check handling of optimization flags. +-- + + function suite.optimize_onOptimizeFlag() + optimize "On" + prepare() + test.capture [[ + portable + true + true + ]] + end + + function suite.optimize_onOptimizeSizeFlag() + optimize "Size" + prepare() + test.capture [[ + portable + true + true + ]] + end + + function suite.optimize_onOptimizeSpeedFlag() + optimize "Speed" + prepare() + test.capture [[ + portable + true + true + ]] + end diff --git a/modules/vstudio/vs2005_dotnetbase.lua b/modules/vstudio/vs2005_dotnetbase.lua index bb3543f9..d0b8e6a1 100644 --- a/modules/vstudio/vs2005_dotnetbase.lua +++ b/modules/vstudio/vs2005_dotnetbase.lua @@ -278,11 +278,27 @@ -- function dotnetbase.debugProps(cfg) - if cfg.symbols == p.ON then - _p(2,'true') - _p(2,'full') + if _ACTION >= "vs2019" then + if cfg.symbols == "Full" then + _p(2,'full') + _p(2,'true') + elseif cfg.symbols == p.OFF then + _p(2,'none') + _p(2,'false') + elseif cfg.symbols == p.ON or cfg.symbols == "FastLink" then + _p(2,'pdbonly') + _p(2,'true') + else + _p(2,'portable') + _p(2,'true') + end else - _p(2,'pdbonly') + if cfg.symbols == p.ON then + _p(2,'true') + _p(2,'full') + else + _p(2,'pdbonly') + end end _p(2,'%s', iif(config.isOptimizedBuild(cfg), "true", "false")) end diff --git a/premake5.lua b/premake5.lua index 777a9d97..60f7ce8d 100644 --- a/premake5.lua +++ b/premake5.lua @@ -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"