From a14d27e3ebb59612275853a3113533fa22d86332 Mon Sep 17 00:00:00 2001 From: Valen Kostich Date: Mon, 17 Jan 2022 23:34:35 +1030 Subject: [PATCH 1/4] Initial attempt at Quick Start documentation. --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1fa6268..ad1d9f4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # switch-cmake -Extensible CMake toolchain for Switch homebrew development with devkitA64 and libnx. +Extensible CMake toolchain for Nintendo Switch homebrew development with devkitA64 and libnx. ## Table of Contents @@ -26,10 +26,75 @@ Extensible CMake toolchain for Switch homebrew development with devkitA64 and li ## Introduction +This project aims to provide a CMake toolchain for Nintendo Switch homebrew development with devkitA64 and libnx. It is +intended as an alternative to the makefile-based system currently used with these tools. + ### Why CMake +[TODO] + ### Quick Start +#### Prerequisites + +First, make sure you have installed the latest release of devkitA64, the Nintendo Switch homebrew development kit +provided by devkitPro. Follow the installation guide [here](https://devkitpro.org/wiki/Getting_Started). + +**Important**: Make sure that the devkitPro environment variables have been configured properly. CMake will use these to +locate the devkitA64 tools. Specifically, the `${DEVKITPRO}` variable should point to the devkitPro installation +directory. + +You'll also need to have [CMake](https://cmake.org/download). + +___ + +#### Building the examples + +To build the template examples, clone this repository and open a terminal in the root directory. Make a build directory +with: + +```shell +$ mkdir build +``` + +Next, have CMake configure the project and generate build files with: + +```shell +$ cmake -G "Unix Makefiles" --toolchain=DevkitA64Libnx.cmake -S . -B build +``` + +Finally, build the project with + +```shell +$ cmake --build build +``` + +You should now have a `my_app.nro` executable in the `./build/templates/application/` directory. + +___ + +#### Running the examples + +Running your homebrew on your Nintendo Switch is easy when netloading with `nxlink`, which is packaged with devkitA64. + +**Important:** Your Switch needs to be running the [Atmosphère](https://github.com/Atmosphere-NX/Atmosphere) custom +firmware with `hbmenu` installed. Please also make sure the Switch is connected to the same wireless network as your +computer. + +On your Nintendo Switch, open the Gallery applet to start `hbmenu`, then press Y to start the netloader. + +In the repository's root directory, run the following command to upload and run the executable: + +```shell +$ nxlink .\build\templates\application\my_app.nro +``` + +If `nxlink` fails with the message `No response from Switch!`, try supplying the Switch's IP address via the `-a ` +argument. + +When the executable finishes uploading, you should see a `Hello World!` message in the top right of your Switch's +display. + ## Switch Homebrew ### File Formats From 34f83a4189433645d076d62dd733214d4ea8248a Mon Sep 17 00:00:00 2001 From: Valen Kostich Date: Mon, 17 Jan 2022 23:46:52 +1030 Subject: [PATCH 2/4] Better words/formatting --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ad1d9f4..62e2fff 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ Extensible CMake toolchain for Nintendo Switch homebrew development with devkitA ## Introduction -This project aims to provide a CMake toolchain for Nintendo Switch homebrew development with devkitA64 and libnx. It is -intended as an alternative to the makefile-based system currently used with these tools. +This project aims to provide a CMake toolchain for Nintendo Switch homebrew development using devkitA64 and libnx. It is +intended as an alternative to the makefile-based system currently provided with the tools. ### Why CMake @@ -86,13 +86,13 @@ On your Nintendo Switch, open the Gallery applet to start `hbmenu`, then press Y In the repository's root directory, run the following command to upload and run the executable: ```shell -$ nxlink .\build\templates\application\my_app.nro +$ nxlink ./build/templates/application/my_app.nro ``` If `nxlink` fails with the message `No response from Switch!`, try supplying the Switch's IP address via the `-a ` argument. -When the executable finishes uploading, you should see a `Hello World!` message in the top right of your Switch's +When the executable finishes uploading, you should see a `Hello World!` message in the top left of your Switch's display. ## Switch Homebrew From 359158d385b12bdc29c05f45ce60480c02be7e31 Mon Sep 17 00:00:00 2001 From: Valen Kostich Date: Tue, 25 Jan 2022 18:19:36 +1030 Subject: [PATCH 3/4] Update ignore for build files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4de93cd..018444a 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,4 @@ cmake/cmake-build-debug/ _build/ .vs .idea/ +build/ \ No newline at end of file From c6c4ecec3d9543b574d6254e46a3ca83f3135a10 Mon Sep 17 00:00:00 2001 From: Valen Kostich Date: Tue, 25 Jan 2022 20:03:40 +1030 Subject: [PATCH 4/4] Clarify CMake build parameters --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 62e2fff..3070990 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,14 @@ Next, have CMake configure the project and generate build files with: $ cmake -G "Unix Makefiles" --toolchain=DevkitA64Libnx.cmake -S . -B build ``` +The `-G "Unix Makefiles"` argument specifies which +[generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) CMake will use. In this case, CMake will +output Makefiles when the project is built. + +The `--toolchain=DevkitA64Libnx.cmake` argument specifies which +[toolchain file](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html) CMake will use. This will configure +CMake to use the DevkitPro environment and compilers. + Finally, build the project with ```shell