Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Setup Dependencies Linux
if: runner.os == 'Linux'
run: |
dependencies=(
nxdk_dependencies=(
"bison"
"build-essential"
"clang"
Expand All @@ -73,18 +73,24 @@ jobs:
"lld"
"llvm"
)
moonlight_dependencies=(
)
dependencies=("${nxdk_dependencies[@]}" "${moonlight_dependencies[@]}")
sudo apt-get update
sudo apt-get install --no-install-recommends -y "${dependencies[@]}"

- name: Setup Dependencies macOS
if: runner.os == 'macOS'
run: |
dependencies=(
nxdk_dependencies=(
"cmake"
"coreutils"
"lld"
"llvm"
)
moonlight_dependencies=(
)
dependencies=("${nxdk_dependencies[@]}" "${moonlight_dependencies[@]}")
brew install "${dependencies[@]}"

- name: Setup Dependencies Windows
Expand All @@ -94,15 +100,15 @@ jobs:
msystem: MINGW64
update: true
install: >-
make
cmake
git
bison
cmake
flex
mingw-w64-x86_64-gcc
mingw-w64-x86_64-llvm
git
make
mingw-w64-x86_64-clang
mingw-w64-x86_64-gcc
mingw-w64-x86_64-lld
mingw-w64-x86_64-llvm

- name: Setup python
id: setup-python
Expand Down
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[submodule "third-party/doxyconfig"]
path = third-party/doxyconfig
url = https://github.com/LizardByte/doxyconfig.git
branch = master
[submodule "third-party/googletest"]
path = third-party/googletest
url = https://github.com/google/googletest.git
branch = main
[submodule "third-party/moonlight-common-c"]
path = third-party/moonlight-common-c
url = https://github.com/moonlight-stream/moonlight-common-c.git
Expand Down
30 changes: 30 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-24.04
tools:
python: "miniconda-latest"
commands:
- |
if [ -f readthedocs_build.sh ]; then
doxyconfig_dir="."
else
doxyconfig_dir="./third-party/doxyconfig"
fi
chmod +x "${doxyconfig_dir}/readthedocs_build.sh"
export DOXYCONFIG_DIR="${doxyconfig_dir}"
"${doxyconfig_dir}/readthedocs_build.sh"

# using conda, we can get newer doxygen and graphviz than ubuntu provide
# https://github.com/readthedocs/readthedocs.org/issues/8151#issuecomment-890359661
conda:
environment: third-party/doxyconfig/environment.yml

submodules:
include: all
recursive: true
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set(XBOX_ISO "${CMAKE_PROJECT_NAME}.iso")
#
# Options
#
option(BUILD_DOCS "Build documentation" ON)
option(BUILD_TESTS "Build tests" OFF)

# add custom modules
Expand Down Expand Up @@ -101,6 +102,13 @@ target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "")
add_dependencies(${CMAKE_PROJECT_NAME} moonlight-common-c)

#
# documentation
#
if(BUILD_DOCS)
add_subdirectory(third-party/doxyconfig docs)
endif()

#
# tests
#
Expand Down
84 changes: 80 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,86 @@ Nothing works, except the splash screen.

## Build

### Pre-Build
### Prerequisites

1. Clone the repository with submodules, or update them after cloning.

```bash
git submodule update --init --recursive
```

2. Install nxdk prerequisites. Then run the following from mingw64 or bash shell:
2. Install nxdk prerequisites.

#### Windows

> [!NOTE]
> You must use the mingw64 shell on Windows.

```bash
pacman -Syu
nxdk_dependencies=(
"bison"
"cmake"
"flex"
"git"
"make"
"mingw-w64-x86_64-clang"
"mingw-w64-x86_64-gcc"
"mingw-w64-x86_64-lld"
"mingw-w64-x86_64-llvm"
)
moonlight_dependencies=(
"mingw-w64-x86_64-doxygen"
"mingw-w64-x86_64-graphviz"
"mingw-w64-ucrt-x86_64-nodejs"
)
dependencies=("${nxdk_dependencies[@]}" "${moonlight_dependencies[@]}")
pacman -S "${dependencies[@]}"
```

#### Debian/Ubuntu Linux

```bash
nxdk_dependencies=(
"bison"
"build-essential"
"clang"
"cmake"
"flex"
"git"
"lld"
"llvm"
)
moonlight_dependencies=(
"doxygen"
"graphviz"
"nodejs"
)
dependencies=("${nxdk_dependencies[@]}" "${moonlight_dependencies[@]}")
apt install "${dependencies[@]}"
```

#### macOS

```bash
nxdk_dependencies=(
"cmake"
"coreutils"
"lld"
"llvm"
)
moonlight_dependencies=(
"doxygen"
"graphviz"
"node"
)
dependencies=("${nxdk_dependencies[@]}" "${moonlight_dependencies[@]}")
brew install "${dependencies[@]}"
```

### Pre-Build

1. Run the following from mingw64 or bash shell:

```bash
export NXDK_DIR="$(pwd)/third-party/nxdk"
Expand Down Expand Up @@ -102,7 +173,7 @@ If you only want the emulator without the ROM/HDD support bundle, run:
scripts\setup-xemu.cmd --skip-support-files
```

## Todo:
## Todo

- Build
- [x] Build in GitHub CI
Expand Down Expand Up @@ -147,4 +218,9 @@ scripts\setup-xemu.cmd --skip-support-files
- [ ] Save config and pairing states, probably use nlohmann/json
- [ ] Host pairing
- [ ] Possibly, GPU overclocking, see https://github.com/GXTX/XboxOverclock
- [ ] Docs via doxygen
- [x] Docs via doxygen

<details style="display: none;">
<summary></summary>
[TOC]
</details>
101 changes: 51 additions & 50 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
set -euo pipefail

usage() {
echo "Usage: $0 [--build-dir <dir> | <dir>] [--clean|clean] [--distclean|distclean]"
return 0
echo "Usage: $0 [--build-dir <dir> | <dir>] [--clean|clean] [--distclean|distclean]"
return 0
}

PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
Expand All @@ -15,59 +15,59 @@ DISTCLEAN_BUILD=0
POSITIONAL_BUILD_DIR_SET=0

while [[ "$#" -gt 0 ]]; do
case "$1" in
--build-dir|-B)
if [[ "$#" -lt 2 ]]; then
usage
exit 1
fi
BUILD_DIR="$2"
POSITIONAL_BUILD_DIR_SET=1
shift 2
;;
--clean|clean)
CLEAN_BUILD=1
shift
;;
--distclean|distclean)
DISTCLEAN_BUILD=1
CLEAN_BUILD=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
if [[ "${POSITIONAL_BUILD_DIR_SET}" -eq 0 ]]; then
BUILD_DIR="$1"
POSITIONAL_BUILD_DIR_SET=1
shift
else
echo "Unknown argument: $1"
usage
exit 1
fi
;;
esac
case "$1" in
--build-dir|-B)
if [[ "$#" -lt 2 ]]; then
usage
exit 1
fi
BUILD_DIR="$2"
POSITIONAL_BUILD_DIR_SET=1
shift 2
;;
--clean|clean)
CLEAN_BUILD=1
shift
;;
--distclean|distclean)
DISTCLEAN_BUILD=1
CLEAN_BUILD=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
if [[ "${POSITIONAL_BUILD_DIR_SET}" -eq 0 ]]; then
BUILD_DIR="$1"
POSITIONAL_BUILD_DIR_SET=1
shift
else
echo "Unknown argument: $1"
usage
exit 1
fi
;;
esac
done

case "${BUILD_DIR}" in
/*)
BUILD_DIR_PATH="${BUILD_DIR}"
;;
*)
BUILD_DIR_PATH="${PROJECT_ROOT}/${BUILD_DIR}"
;;
/*)
BUILD_DIR_PATH="${BUILD_DIR}"
;;
*)
BUILD_DIR_PATH="${PROJECT_ROOT}/${BUILD_DIR}"
;;
esac

# Set the NXDK_DIR environment variable
export NXDK_DIR="${NXDK_DIR:-${PROJECT_ROOT}/third-party/nxdk}"

if [[ ! -d "${NXDK_DIR}" ]]; then
echo "NXDK directory not found: ${NXDK_DIR}"
echo "Run: git submodule update --init --recursive"
exit 1
echo "NXDK directory not found: ${NXDK_DIR}"
echo "Run: git submodule update --init --recursive"
exit 1
fi

# Activate the nxdk environment
Expand All @@ -77,7 +77,7 @@ eval "$("${NXDK_DIR}/bin/activate" -s)"
cd "${NXDK_DIR}"

if [[ "${DISTCLEAN_BUILD}" -eq 1 ]]; then
make distclean
make distclean
fi

# Build nxdk with the specified options
Expand All @@ -87,16 +87,17 @@ make tools
cd "${PROJECT_ROOT}"

if [[ "${CLEAN_BUILD}" -eq 1 ]]; then
rm -rf "${BUILD_DIR_PATH}"
rm -rf "${BUILD_DIR_PATH}"
fi

# Configure the project
cmake \
-G "Unix Makefiles" \
-B "${BUILD_DIR_PATH}" \
-S . \
-DCMAKE_TOOLCHAIN_FILE="${NXDK_DIR}/share/toolchain-nxdk.cmake" \
-DCMAKE_DEPENDS_USE_COMPILER=FALSE
-DBUILD_DOCS=OFF \
-DCMAKE_TOOLCHAIN_FILE="${NXDK_DIR}/share/toolchain-nxdk.cmake" \
-DCMAKE_DEPENDS_USE_COMPILER=FALSE

# Build the project
cmake --build "${BUILD_DIR_PATH}"
Loading
Loading