Browse Source

Update switch instructions

pull/4570/merge
ephphatha 4 years ago committed by Anders Jenbo
parent
commit
4eb42ad0fc
  1. 56
      Packaging/switch/build.sh
  2. 11
      Packaging/switch/packages.txt
  3. 50
      docs/building.md

56
Packaging/switch/build.sh

@ -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

11
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

50
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. 7. Use build/debug etc. commands inside Visual Studio Solution like with any normal Visual Studio project.
</details> </details>
<details><summary>Nintendo Switch</summary>
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=<path to devkit> 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)
</details>
<details><summary>Android</summary> <details><summary>Android</summary>
### Installing dependencies ### 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/` You can find the compiled APK in `/android-project/app/build/outputs/apk/`
</details> </details>
<details><summary>Nintendo Switch</summary>
### 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)
</details>
<details><summary>Nintendo 3DS</summary> <details><summary>Nintendo 3DS</summary>
### Installing dependencies ### Installing dependencies

Loading…
Cancel
Save