Build for armv7 windows

No installer as armv7 windows has no x86 emulation
This commit is contained in:
Benau 2022-09-18 23:54:44 +08:00
parent f270b4acf8
commit dd6768911d
9 changed files with 48 additions and 20 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
arch: [i686, x86_64, aarch64]
arch: [i686, x86_64, armv7, aarch64]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
@ -31,6 +31,8 @@ jobs:
echo "cmake_arch=Win32" >> $GITHUB_ENV
elif [ ${{ matrix.arch }} = "x86_64" ]; then
echo "cmake_arch=x64" >> $GITHUB_ENV
elif [ ${{ matrix.arch }} = "armv7" ]; then
echo "cmake_arch=ARM" >> $GITHUB_ENV
else
echo "cmake_arch=ARM64" >> $GITHUB_ENV
fi
@ -83,8 +85,8 @@ jobs:
sudo wget https://github.com/supertuxkart/dependencies/releases/download/preview/mxe_static_mingw.zip
sudo unzip mxe_static_mingw.zip
sudo rm mxe_static_mingw.zip
- name: Install MinGW for aarch64
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'aarch64' }}
- name: Install MinGW for armv7 or aarch64
if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'armv7' || matrix.arch == 'aarch64' ) }}
run: |
cd /
sudo wget https://github.com/mstorsjo/llvm-mingw/releases/download/20210423/llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64.tar.xz
@ -120,17 +122,17 @@ jobs:
cd build
cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -A ${{ env.cmake_arch }} -DCHECK_ASSETS=OFF
- name: Configure bulid for MinGW (i686 or x86_64)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch != 'aarch64' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch != 'armv7' && matrix.arch != 'aarch64' }}
run: |
mkdir -p build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON
- name: Configure bulid for MinGW (aarch64)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'aarch64' }}
- name: Configure bulid for MinGW (armv7 or aarch64)
if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'armv7' || matrix.arch == 'aarch64' ) }}
run: |
mkdir -p build
cd build
cmake .. -DLLVM_ARCH=aarch64 -DLLVM_PREFIX=/llvm-mingw -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=/llvm-mingw -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON
- name: Build for MSVC
if: ${{ matrix.os == 'windows-latest' }}
working-directory: build
@ -238,11 +240,14 @@ jobs:
mv tools/run_game.bat SuperTuxKart-${{ env.release_tag }}-win
mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686
mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64
mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7
mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64
mv i686 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686/bin
mv x86_64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64/bin
mv armv7 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7/bin
mv aarch64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin
# libwinpthread-1.dll is useless because we statically link
rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7/bin/libwinpthread-1.dll
rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin/libwinpthread-1.dll
- name: Start packaging STK
if: ${{ env.release_tag != '' }}

View File

@ -149,6 +149,8 @@ if (CMAKE_GENERATOR_PLATFORM)
endif()
if(arch_lower MATCHES "arm64" OR arch_lower MATCHES "aarch64" OR ${CMAKE_GENERATOR} MATCHES "(ARM64)" OR ${BUILD_ARCH} MATCHES "(ARM64)")
set(DEPENDENCIES "dependencies-win-aarch64")
elseif(arch_lower MATCHES "armv7" OR arch_lower MATCHES "armv7" OR ${CMAKE_GENERATOR} MATCHES "(ARM)" OR ${BUILD_ARCH} MATCHES "(ARM)")
set(DEPENDENCIES "dependencies-win-armv7")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(DEPENDENCIES "dependencies-win-x86_64")
else()

View File

@ -150,7 +150,7 @@ Open your file browser and find somewhere you want to put the development versio
4. If you got the stable version, download the Windows dependencies package from [SuperTuxKart on GitHub - Dependencies Releases](https://github.com/supertuxkart/dependencies/releases), find the stk-code version there and download the `dependencies(arch).zip` as needed and unpack the archive into the `stk-code` directory.
5. If you got the development version go to SuperTuxKart-dev in your file browser, then visit [SuperTuxKart on GitHub - Dependencies latest preview release](https://github.com/supertuxkart/dependencies/releases/tag/preview)
and unpack the archive into the `stk-code` directory. Download `i686` if you use Win32 generator of MSVC, `x86_64` for x64 and `aarch64` for ARM64.
and unpack the archive into the `stk-code` directory. Download `i686` if you use Win32 generator of MSVC, `x86_64` for x64, `armv7` for ARM and `aarch64` for ARM64.
6. Download CMake from here: [CMake - download page](https://cmake.org/download/), install it; once CMake is installed, double click on the CMake icon on your desktop, and point it towards your `stk-code` directory in the 'Where is the source code' field, and point 'Where to build the binaries' to a new directory called `build` or `bld` inside the stk-code directory.
@ -180,7 +180,7 @@ Visual Studio 2013| 13
2. Download a source package from either [SuperTuxKart on GitHub](https://github.com/supertuxkart/stk-code/releases) or [SuperTuxKart.net - Source Control](https://supertuxkart.net/Source_control)
NOTE: the `stk-code` and `stk-assets` directories **must** be in the same directory, `stk-assets` is not needed if you download the full source tarball `(SuperTuxKart-version-src.tar.xz)`.
3. Download the Windows dependencies package from [SuperTuxKart on GitHub - Dependencies latest preview release](https://github.com/supertuxkart/dependencies/releases/tag/preview)
and unpack the archive into the `stk-code` directory. Download `i686` if you use Win32 generator of MSVC, `x86_64` for x64 and `aarch64` for ARM64.
and unpack the archive into the `stk-code` directory. Download `i686` if you use Win32 generator of MSVC, `x86_64` for x64, `armv7` for ARM and `aarch64` for ARM64.
4. Download CMake from here: [CMake - download page](https://cmake.org/download/); and install it. Navigate to the `stk-code` directory; and create an directory called "build":
```cmd
@ -209,10 +209,10 @@ SuperTuxKart can now be run as `bin\Debug\supertuxkart.exe` or `bin\Release\supe
3. Download a source package from either [SuperTuxKart on GitHub](https://github.com/supertuxkart/stk-code/releases) or [SuperTuxKart.net - Source Control](https://supertuxkart.net/Source_control)
NOTE: the `stk-code` and `stk-assets` directories **must** be in the same directory, `stk-assets` is not needed if you download the full source tarball `(SuperTuxKart-version-src.tar.xz)`. Also make sure they lie within the C drive.
4. Download the Windows dependencies package from [SuperTuxKart on GitHub - Dependencies latest preview release](https://github.com/supertuxkart/dependencies/releases/tag/preview)
and unpack the archive into the `stk-code` directory. Download `i686` if you compile for Intel / AMD 32-bit Windows, `x86_64` for Intel / AMD 64-bit Windows and `aarch64` for ARM64 Windows.
and unpack the archive into the `stk-code` directory. Download `i686` if you compile for Intel / AMD 32-bit, `x86_64` for Intel / AMD 64-bit, `armv7` for ARM 32-bit and `aarch64` for ARM 64-bit version of Windows.
6. Download CMake from here: [CMake - download page](https://cmake.org/download/), install it; once CMake is installed, double click on the CMake icon on your desktop, and point it towards your `stk-code` directory in the 'Where is the source code' field, and point 'Where to build the binaries' to a new directory called `build` inside the stk-code directory.
7. Press the `Add Entry` button and add the values below:
* Name: `LLVM_ARCH` Type: `STRING` Value: `i686`, `x86_64` or `aarch64`
* Name: `LLVM_ARCH` Type: `STRING` Value: `i686`, `x86_64`, `armv7` or `aarch64`
* Name: `LLVM_PREFIX` Type: `STRING` Value: `C:/llvm-mingw`
* Name: `CMAKE_MAKE_PROGRAM` Type: `STRING` Value: `C:/llvm-mingw/ninja.exe`
* Name: `USE_WIIUSE` Type: `BOOL` Value: `Empty (unchecked)`

View File

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
# STK Fix llvm mingw crashes
if (MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(USE_AS_MAX_PORTABILITY 1)
ADD_DEFINITIONS(-DAS_MAX_PORTABILITY)
endif()
@ -114,6 +115,12 @@ set(BUILD_ARCH "unknown")
if (CMAKE_GENERATOR_PLATFORM)
set(BUILD_ARCH "${CMAKE_GENERATOR_PLATFORM}")
endif()
if (MSVC AND (${CMAKE_GENERATOR} MATCHES "(ARM)" OR ${BUILD_ARCH} MATCHES "(ARM)"))
set(USE_AS_MAX_PORTABILITY 1)
ADD_DEFINITIONS(-DAS_MAX_PORTABILITY)
endif()
if(MSVC AND CMAKE_CL_64 AND NOT ${CMAKE_GENERATOR_PLATFORM} MATCHES "(ARM64)")
enable_language(ASM_MASM)
if(CMAKE_ASM_MASM_COMPILER_WORKS)
@ -134,13 +141,15 @@ endif()
if(${ARCHFLAGS} MATCHES "^arm")
enable_language(ASM)
if(CMAKE_ASM_COMPILER_WORKS)
set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_arm.cpp ../../source/as_callfunc_arm_gcc.S)
if (NOT APPLE)
set_property(SOURCE ../../source/as_callfunc_arm_gcc.S APPEND PROPERTY COMPILE_FLAGS " -Wa,-mimplicit-it=always")
if (NOT USE_AS_MAX_PORTABILITY)
if(CMAKE_ASM_COMPILER_WORKS)
set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_arm.cpp ../../source/as_callfunc_arm_gcc.S)
if (NOT APPLE)
set_property(SOURCE ../../source/as_callfunc_arm_gcc.S APPEND PROPERTY COMPILE_FLAGS " -Wa,-mimplicit-it=always")
endif()
else()
message(FATAL ERROR "ARM target requires a working assembler")
endif()
else()
message(FATAL ERROR "ARM target requires a working assembler")
endif()
endif()

View File

@ -163,7 +163,7 @@ strings
//! define a break macro for debugging.
#if defined(_DEBUG)
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE) && !defined (_M_ARM)
#if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration
#include <crtdbg.h>
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}

View File

@ -208,6 +208,10 @@ void determineOSVersion()
#endif
#ifdef WIN32
#ifdef _MSC_VER
#pragma comment (lib, "Advapi32.lib")
#endif
// (C) 2014-2015 Wildfire Games (0 A.D.), ported by Joerg Henrichs.
HKEY hKey;

View File

@ -712,7 +712,7 @@ namespace UserConfigParams
PARAM_DEFAULT( FloatUserConfigParam(3, "font_size",
&m_video_group, "The size of fonts. 0 is the smallest and 6 is the biggest") );
#if defined(_IRR_COMPILE_WITH_DIRECT3D_9_) && defined(_M_ARM64)
#if defined(_IRR_COMPILE_WITH_DIRECT3D_9_) && (defined(_M_ARM64) || defined(_M_ARM))
PARAM_PREFIX StringUserConfigParam m_render_driver
PARAM_DEFAULT( StringUserConfigParam("directx9", "render_driver",
&m_video_group, "Render video driver to use, at the moment gl or directx9 is supported.") );

View File

@ -26,6 +26,9 @@
#ifdef _WIN32
#include <windows.h>
#include <shellapi.h>
#ifdef _MSC_VER
#pragma comment (lib, "Shell32.lib")
#endif
#endif
#ifndef SERVER_ONLY

View File

@ -240,7 +240,12 @@
stackframe.AddrPC.Mode = AddrModeFlat;
stackframe.AddrStack.Mode = AddrModeFlat;
stackframe.AddrFrame.Mode = AddrModeFlat;
#if defined(_M_ARM64)
#if defined(_M_ARM)
stackframe.AddrPC.Offset = pContext->Pc;
stackframe.AddrStack.Offset = pContext->Sp;
stackframe.AddrFrame.Offset = pContext->R11;
const DWORD machine_type = IMAGE_FILE_MACHINE_ARM;
#elif defined(_M_ARM64)
stackframe.AddrPC.Offset = pContext->Pc;
stackframe.AddrStack.Offset = pContext->Sp;
stackframe.AddrFrame.Offset = pContext->Fp;