diff --git a/Packaging/switch/build.sh b/Packaging/switch/build.sh deleted file mode 100755 index e6b77e4a6..000000000 --- a/Packaging/switch/build.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -DEVKITPRO="${DEVKITPRO:-/opt/devkitpro}" - -declare -r DIR="$(dirname "${BASH_SOURCE[0]}")" -cd "$DIR" - -main() { - prepare_devkitpro - set -x - install_deps - build -} - -build() { - mkdir -p ../../build - cd ../../build - rm -f CMakeCache.txt - DEVKITPRO="$DEVKITPRO" cmake .. -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_TOOLCHAIN_FILE=../CMake/switch/devkita64-libnx.cmake - DEVKITPRO="$DEVKITPRO" make -j "$(getconf _NPROCESSORS_ONLN)" - cd - -} - -install_deps() { - "$DEVKITPRO/pacman/bin/pacman" -S --needed --noconfirm --quiet \ - switch-mesa switch-glad switch-glm switch-libpng \ - switch-sdl2 switch-libsodium libnx devkitA64 devkitA64 \ - general-tools switch-tools devkitpro-pkgbuild-helpers -} - -prepare_devkitpro() { - if [[ -d $DEVKITPRO ]]; then - return; - fi - if which dpkg > /dev/null; then - install_devkitpro_debian - else - >&2 printf "Please set DEVKITPRO:\nhttps://devkitpro.org/wiki/Getting_Started\n" - exit 1 - fi -} - -install_devkitpro_debian() { - >&2 echo 'Installing devkitpro-pacman.deb from GitHub...' - local -r dpkg_path=/tmp/devkitpro-pacman.deb - set -x - \curl -L https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb -o "$dpkg_path" - sudo dpkg -i "$dpkg_path" - rm "$dpkg_path" - { set +x; } 2>/dev/null -} - -main diff --git a/Packaging/switch/packages.txt b/Packaging/switch/packages.txt new file mode 100644 index 000000000..6a4c87f3e --- /dev/null +++ b/Packaging/switch/packages.txt @@ -0,0 +1,11 @@ +switch-mesa +switch-glad +switch-glm +switch-libpng +switch-sdl2 +switch-libsodium +libnx +devkitA64 +general-tools +switch-tools +switch-bzip2 diff --git a/docs/building.md b/docs/building.md index bdac2d24f..54f457a8b 100644 --- a/docs/building.md +++ b/docs/building.md @@ -190,24 +190,6 @@ The location of this tool will need to be [added to the system's PATH environmen 7. Use build/debug etc. commands inside Visual Studio Solution like with any normal Visual Studio project. -
Nintendo Switch -Run: - -``` -Packaging/switch/build.sh -``` - -This will install the [Switch devkit](https://switchbrew.org/wiki/Setting_up_Development_Environment) and build a DevilutionX Switch package. If you already have the devkit installed, or are on a non-Debian system, pass the the devkit path to the script like this: - -``` -DEVKITPRO= Packaging/switch/build.sh -``` - -The nro-file will be generated in the build folder. Test with an emulator (RyuJinx) or real hardware. - -[Nintendo Switch manual](docs/manual/platforms/switch.md) -
-
Android ### Installing dependencies @@ -222,6 +204,38 @@ In Android Studio, go to "Build -> Make Project" or use the shortcut Ctrl+F9 You can find the compiled APK in `/android-project/app/build/outputs/apk/`
+
Nintendo Switch + +### Installing dependencies + +https://devkitpro.org/wiki/Getting_Started + + +- Install (dkp-)pacman: https://devkitpro.org/wiki/devkitPro_pacman + +- Install required packages with (dkp-)pacman: +``` +sudo (dkp-)pacman -S --needed - < Packaging/switch/packages.txt +``` + +- Install smpq (if building from git or a source archive without devilutionx.mpq) +DevilutionX requires some core assets to render UI elements and fonts even if game data is not available. While some +platforms can load this from the filesystem as loose files the switch build currently only supports bundling the mpq +archive inside the nro. If you're building DevilutionX on a supported platform a prebuilt binary may be available from +your package distribution system (e.g. `sudo apt install smpq` or `yum install smpq`), on windows you can +[download the latest version from Launchpad.net](https://launchpad.net/smpq/+download), and unix based OSes can build +from source using [tools/build_and_install_smpq.sh](../tools/build_and_install_smpq.sh) + +### Compiling +```bash +cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_ASSETS_MPQ=ON +cmake --build build -j $(getconf _NPROCESSORS_ONLN) +``` +The nro-file will be generated in the build folder. Test with an emulator (RyuJinx) or real hardware. + +[Nintendo Switch manual](manual/platforms/switch.md) +
+
Nintendo 3DS ### Installing dependencies