-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Xbox | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [ opened, synchronize ] | ||
|
||
jobs: | ||
xbox: | ||
runs-on: ubuntu-latest | ||
env: | ||
NXDK_DIR: /opt/nxdk | ||
steps: | ||
- name: Install APT packages | ||
run: sudo apt-get update && sudo apt-get install -y clang llvm lld bison flex cmake git gettext smpq | ||
|
||
- name: Clone NXDK Repo | ||
shell: bash | ||
run: git clone --recursive --depth 1 --branch devilutionx https://github.com/glebm/nxdk.git "$NXDK_DIR" | ||
|
||
- name: Build NXDK | ||
shell: bash | ||
run: PATH="${NXDK_DIR}/bin:$PATH" make -j $(nproc) -C "$NXDK_DIR" NXDK_ONLY=1 | ||
|
||
- name: Work around https://github.com/XboxDev/nxdk/issues/467 | ||
run: > | ||
mkdir -p "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys" && | ||
echo "#pragma once // Generated" > "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys/types.h" && | ||
echo "typedef long off_t;" >> "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys/types.h" | ||
- name: Work around https://github.com/XboxDev/nxdk/issues/464 | ||
run: > | ||
mkdir -p "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys" && | ||
echo "#pragma once // Generated" > "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys/stat.h" && | ||
echo "#include <stddef.h>" >> "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys/stat.h" && | ||
echo "struct _stat { size_t st_size; int st_mode; int st_mtime; int st_atime; int st_nlink; };" >> "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys/stat.h" && | ||
echo "struct _stati64 { size_t st_size; int st_mode; int st_mtime; int st_atime; int st_nlink; };" >> "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys/stat.h" && | ||
echo "static int _stati64(const char* x, ...) { return 0; };" >> "${NXDK_DIR}/lib/xboxrt/libc_extensions/sys/stat.h" | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure CMake | ||
working-directory: ${{github.workspace}} | ||
run: cmake -S. -Bbuild-xbox -DCMAKE_TOOLCHAIN_FILE=/opt/nxdk/share/toolchain-nxdk.cmake | ||
|
||
- name: Build | ||
working-directory: ${{github.workspace}} | ||
shell: bash | ||
run: cmake --build build-xbox -j $(nproc) --target package | ||
|
||
- name: Upload-Package | ||
if: ${{ !env.ACT }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: devilutionx | ||
path: build-xbox/devilutionx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,7 @@ endif() | |
if(UWP_LIB) | ||
include(platforms/uwp_lib) | ||
endif() | ||
|
||
if(NXDK) | ||
include(platforms/xbox_nxdk) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
set(NONET ON) | ||
set(ASAN OFF) | ||
set(UBSAN OFF) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/xbox_nxdk/finders") | ||
|
||
set(DEVILUTIONX_SYSTEM_BZIP2 OFF) | ||
|
||
set(CMAKE_THREAD_LIBS_INIT "-lpthread") | ||
set(CMAKE_HAVE_THREADS_LIBRARY 1) | ||
set(CMAKE_USE_WIN32_THREADS_INIT 0) | ||
set(CMAKE_USE_PTHREADS_INIT 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(NOT TARGET PNG::PNG) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(PNG REQUIRED IMPORTED_TARGET libpng) | ||
add_library(PNG::PNG ALIAS PkgConfig::PNG) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if(NOT TARGET SDL2::SDL2) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2) | ||
add_library(SDL2::SDL2 ALIAS PkgConfig::SDL2) | ||
add_library(SDL2_nomain INTERFACE) | ||
add_library(SDL2::SDL2main ALIAS SDL2_nomain) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if(NOT TARGET ZLIB::ZLIB) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(ZLIB REQUIRED IMPORTED_TARGET zlib) | ||
add_library(ZLIB::ZLIB ALIAS PkgConfig::ZLIB) | ||
endif() |