Add --arch to Premake build options

This commit is contained in:
tempura-sukiyaki 2021-05-25 09:50:08 +09:00
parent cadea925c3
commit 7488cd73ff
3 changed files with 45 additions and 7 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

@ -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"