Skip to content

Building for Nintendo Switch

Vitaly Novichkov edited this page Jul 9, 2025 · 18 revisions

In September 2022, support for Nintendo Switch was added to TheXTech.

Dependencies

Building the Nintendo Switch version of the game requires the homebrew DevkitPro. DevkitPro is supported on Linux, macOS. Switch builds have primarily been tested on Linux-based operating systems. On Windows, right now the build will fail in any way because of the build-system side bugs exclusively on the Windows (a conflicting between MSyS, GNU Make, Ninja, and Windows itself that results an invalid build scripts). So, you may want to run a VM with any Linux distro installed, or use the WSL environment (however, it has other problems that might occur on your end, pay attention on this). Please follow your platform's appropriate steps to install the DevkitPro, and ensure that the environment variables DEVKITPRO and DEVKITA64 is set as per the official instructions.

Once DevkitPro is installed, you'll be using the CMake parameter -DCMAKE_TOOLCHAIN_FILE to tell CMake what parameters, compilers, and arguments it should use to cross-compile for Nintendo Switch.

For example:

# Simplest Nintendo Switch cross-compilation example
cmake \
   -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Switch.cmake \
   -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/switch
   ..

You are required to install the switch-sdl2 package using the dkp-pacman utility, for example on Linux and or on macOS:

sudo dkp-pacman -S switch-sdl2 switch-libjpeg-turbo switch-libpng switch-zlib switch-glad

Preparing to build

Before to start the build, you should obtain the source code for TheXTech. You can use the stable version as well as the latest in-development to test out any new experimental features and receive any further bugfixes earlier.

Stable version

If you want to build the stable version, you can simply download the source code archive from the official site or from GitHub releases:

And then, unpack the archive and open the terminal at the just-now unpacked directory that contains the source code for TheXTech.

Important note: Please never use the "Source code" links at Github releases: they are broken. Instead, download the thextech-full-src-v*.*.*.tar.gz or thextech-full-src-v*.*.*.tar.bz2 or thextech-full-src-v*.*.*.zip archive.

This project uses submodules and GitHub is unable to create source code packages that includes submodules too.

Development version

If you want to build the latest in-development version, then, instead of downloading the archive, you can clone the repository itself by running this in a terminal (please open the terminal at the directory where you want to put the clonned repository, so, you will know where it is):

git clone --recurse-submodules https://github.com/TheXTech/TheXTech.git

If your version of git doesn't support --recurse-submodules, make sure all submodules have been pulled. Otherwise, it won't build:

cd TheXTech
git submodule update --init --recursive

Building

At the TheXTech's source code directory, run next commands in the terminal:

  1. Make the building directory:

    mkdir build-switch
    cd build-switch
  2. Run CMake configuration:

    For the optimized, fast build

    # when you want to use the regular GNU Make
    cmake -DCMAKE_BUILD_TYPE=MinSizeRel \
          -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Switch.cmake ..
    # OR when you want to use Ninja which does better parallel processes management
    cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel \
          -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Switch.cmake ..

    For a slower, debug build (useful for symbols)

    # when you want to use the regular GNU Make
    cmake -DCMAKE_BUILD_TYPE=Debug \
          -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Switch.cmake ..
    # OR when you want to use Ninja which does better parallel processes management
    cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug \
          -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Switch.cmake ..
  3. Run the build itself:

    # Run regular GNU Make build with 4 parallel tasks
    # (suggested on 4-core CPU, if you have more cores, use a different number than 4)
    make -j 4
    # Or run a Ninja build
    ninja

Running and debugging a build

The built game will not work until you prepare the game root. You must prepare the game root before you will be able to run a game. The game root by default for Nintendo Switch is located at sdmc:/TheXTech/. Please create this directory and place your preferred game assets inside that directory before attempting to launch the Nintendo Switch version of the game.

  1. Download archives with compatible assets:
  2. To initialize the game folders, move the built thextech.nro file to the sdmc:/switch/ directory and run it through the Homebrew Launcher. You also can use the Suyu emulator (You need latest version of OS, such as later Win10, Win11, etc., in order to work! Old OS, such as earlier build of Win10, are not supported!) to verify the work of the game.
  3. Launch the game once to prepare the system directories. It should ask you to install asset packs. After you have launched the game, sdmc:/TheXTech/assets/ should exist.
  4. Unpack the content of your downloaded archive into a sdmc:/TheXTech/assets/<pack> directory, where <pack> is any name of your choosing. (The engine does not care about this name.)
  5. (Optional) Launch the game again to initialize your asset pack's worlds and battle folders. This makes it easier to place your own episodes and battle levels.
  6. Find the sdmc:/TheXTech/worlds/<pack-id>/ directory for each asset pack you have installed. (<pack-id> is determined by gameinfo.ini and may be different from <pack>. It is smbx for the SMBX 1.3 assets pack and aod for the Adventures of Demo assets pack.) Put any compatible episodes you have in the worlds/<pack-id>/ folder (all episodes made for an original SMBX 1.3 and earlier will work here). Optionally you can put a bunch of level files which will be used for battle arena purposes into the sdmc:/TheXTech/battle/<pack-id>/ directory.
  7. TheXTech should now be fully installed. Run the game and have a blast!

Troubleshooting:

  • Please ensure you have the latest DevkitPro installed
  • Please ensure that the DEVKITPRO and DEVKITA64 environment variables are set OR exported in your .bashrc (or similar)
  • Please ensure that the latest SDL2 library is built and installed in your DEVKITPRO directory
Clone this wiki locally