diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d64ddae..3f08ae20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,9 +5,7 @@ on: push: branches: [ "main" ] paths-ignore: - - '**/README.md' - - '**/LICENSE' - - '**/.github/**' + - '**/*.md' pull_request: branches: [ "main" ] paths-ignore: @@ -46,6 +44,11 @@ jobs: cc: clang cxx: clang++ name: Linux-x64-clang + - runner: ubuntu-latest + preset: linux-cross-arm64 + cc: gcc + cxx: g++++ + name: Linux-cross-arm64 build_type: - Debug - Release @@ -64,12 +67,18 @@ jobs: brew bundle install - name: Install Linux dependencies - if: ${{ matrix.os.preset == 'linux' }} + if: ${{ matrix.os.runner == 'ubuntu-latest' }} run: | sudo apt update sudo apt install -y --no-install-recommends \ ninja-build cmake g++ curl pkg-config autoconf automake libtool libltdl-dev make python3-jinja2 libx11-dev libxft-dev libxext-dev libwayland-dev libxkbcommon-dev libegl1-mesa-dev libibus-1.0-dev libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev + - name: Install Linux Cross-compilation dependencies + if: ${{ matrix.os.preset == 'linux-cross-arm64' }} + run: | + sudo apt install -y --no-install-recommends \ + gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu + - name: Install Windows dependencies if: ${{ matrix.os.runner == 'windows-latest' }} run: choco install ninja @@ -83,7 +92,15 @@ jobs: with: vcpkgJsonGlob: vcpkg.json + - name: Configure cross-compiled build + if: ${{ matrix.os.preset == 'linux-cross-arm64' }} + run: | + cmake --preset linux + ninja -f build-${{ matrix.build_type }}.ninja -C builds/linux/ HogMaker + cmake --preset linux-cross-arm64 -DHogMaker_DIR=$PWD/builds/linux/ -DBUILD_TESTING=OFF -DENABLE_LOGGER=ON -DFORCE_PORTABLE_INSTALL=ON -DBUILD_EDITOR=OFF -DUSE_EXTERNAL_PLOG=ON + - name: Configure CMake + if: ${{ matrix.os.preset != 'linux-cross-arm64' }} env: CC: ${{ matrix.os.cc }} CXX: ${{ matrix.os.cxx }} @@ -93,6 +110,7 @@ jobs: run: cmake --build --preset ${{ matrix.os.preset }} --config ${{ matrix.build_type }} --verbose - name: Run ${{ matrix.build_type }} Unittests + if: ${{ matrix.os.preset != 'linux-cross-arm64' }} run: ctest --preset ${{ matrix.os.preset }} -C ${{ matrix.build_type }} - name: Local install diff --git a/BUILD.md b/BUILD.md index 84522335..1e31a793 100644 --- a/BUILD.md +++ b/BUILD.md @@ -152,24 +152,22 @@ Once CMake finishes, the built files will be put in `builds/linux/build/Debug` o ## Cross-compilation In order to cross-compile Descent3 to another platform (for example, Linux ARM64), you'll need to build auxiliary -tools which needed to build data files. First create build-native directory and configure project in it: +tools natively which are needed to build data files. First create build-native directory and configure project in it: ```shell mkdir build-native cd build-native cmake .. -make HogMaker +cmake --build . --target HogMaker ``` -Now you ready for cross-compilation. Create cross-compile directory and configure project in it, but this time add -`-DCMAKE_TOOLCHAIN_FILE=MyToolchain.cmake` and `-DHogMaker_DIR=//`. For example, if + they’ll be put in `builds//build//`. For example, if you’re using Linux and you create a “Release” build, then the files will - be located at `builds/linux/Release`. + be located at `builds/linux/build/Release`. 9. Copy all the new engine files into `D3-open-source` and overwrite any conflicts. diff --git a/cmake/toolchains/linux-aarch64-gcc-toolchain.cmake b/cmake/toolchains/linux-aarch64-gcc-toolchain.cmake new file mode 100644 index 00000000..59237cbd --- /dev/null +++ b/cmake/toolchains/linux-aarch64-gcc-toolchain.cmake @@ -0,0 +1,12 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) +set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) + +set(CMAKE_CROSSCOMPILING ON) \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e1e98bec..1b34f7e4 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,11 +1,7 @@ -if(CMAKE_CROSSCOMPILING) - find_package(HogMaker) -else() - add_executable( - HogMaker - HogMaker/HogFormat.cpp - HogMaker/HogMaker.cpp - ) - target_include_directories(HogMaker PRIVATE ${PROJECT_BINARY_DIR}/lib) - export(TARGETS HogMaker FILE "${CMAKE_BINARY_DIR}/HogMakerConfig.cmake") -endif() +add_executable( + HogMaker + HogMaker/HogFormat.cpp + HogMaker/HogMaker.cpp +) +target_include_directories(HogMaker PRIVATE ${PROJECT_BINARY_DIR}/lib) +export(TARGETS HogMaker FILE "${CMAKE_BINARY_DIR}/HogMakerConfig.cmake") \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json index 8ef14ccb..4360dee9 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,5 +1,5 @@ { - "builtin-baseline": "198d68dbcc6c907cb3d0b9b1d93c3df6ecf93c62", + "builtin-baseline": "e60236ee051183f1122066bee8c54a0b47c43a60", "dependencies": [ "glm", "gtest", @@ -7,20 +7,27 @@ "zlib", { "name": "sdl2", - "version>=": "2.30.3", - "features": ["x11","wayland", "alsa"], - "platform": "linux" + "version>=": "2.30.8", + "features": ["x11", "wayland", "alsa"], + "default-features": false, + "platform": "linux & !native" }, { "name": "sdl2", - "version>=": "2.30.3", + "version>=": "2.30.8", + "features": ["x11","wayland", "alsa"], + "platform": "linux & native" + }, + { + "name": "sdl2", + "version>=": "2.30.8", "platform": "!linux" } ], "overrides": [ { "name": "sdl2", - "version": "2.30.3" + "version": "2.30.8" } ] -} +} \ No newline at end of file