From bec2c9673008ac575b7b6607effef9874e7da4fc Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Wed, 27 Jun 2018 10:30:59 +0900 Subject: [PATCH] Update docs for nintendo switch --- doc/nimc.rst | 52 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/doc/nimc.rst b/doc/nimc.rst index fb4c792da..a3adcc143 100644 --- a/doc/nimc.rst +++ b/doc/nimc.rst @@ -232,38 +232,48 @@ Cross compilation for Nintendo Switch ===================================== Simply add --os:nintendoswitch -to your usual ``nim c`` or ``nim cpp`` command. DevkitPro setup must be the same as -what is the default with their new installer -[here for Mac/Linux](https://github.com/devkitPro/pacman/releases) or -[here for Windows](https://github.com/devkitPro/installer/releases). +to your usual ``nim c`` or ``nim cpp`` command and set the ``SWITCH_LIBS`` +and ``SWITCH_INCLUDES`` environment variables to something like: -For example:: +.. code-block:: console + export SWITCH_INCLUDES="-I$DEVKITPRO/libnx/include" + export SWITCH_LIBS="-specs=$DEVKITPRO/libnx/switch.specs -L$DEVKITPRO/libnx/lib -lnx" + +or setup a nim.cfg file like so: + +.. code-block:: Nim + #nim.cfg + --passC="-I$DEVKITPRO/libnx/include" + --passL="-specs=$DEVKITPRO/libnx/switch.specs -L$DEVKITPRO/libnx/lib -lnx" + +The DevkitPro setup must be the same as the default with their new installer +`here for Mac/Linux `_ or +`here for Windows `_. + +For example, with the above mentioned config:: nim c --os:nintendoswitch switchhomebrew.nim This will generate a file called ``switchhomebrew.elf`` which can then be turned into an nro file with the ``elf2nro`` tool in the DevkitPro release. Examples can be found at -[the nim-libnx github repo](https://github.com/jyapayne/nim-libnx.git). +`the nim-libnx github repo `_ or you can use +`the switch builder tool `_. -Environment variables are ``DEVKITPRO`` for the devkitpro path, ``SWITCH_LIBS`` for any extra -libraries required by your application (``-lLIBNAME`` or ``-LLIBPATH``), and -``SWITCH_INCLUDES`` for any extra include files (``-IINCLUDE_PATH``). - -There are some directories expected to exist in a specific structure for now until I -figure out a better way to specify them. They are: ``DEVKITPRO/portlibs/switch/lib``, -``DEVKITPRO/libnx/lib``, ``DEVKITPRO/portlibs/switch/include``, and ``DEVKITPRO/libnx/include``. +Environment variables are: + - ``SWITCH_LIBS`` for any extra libraries required by your application (``-lLIBNAME`` or ``-LLIBPATH``) + - ``SWITCH_INCLUDES`` for any extra include files (``-IINCLUDE_PATH``) There are a few things that don't work because the DevkitPro libraries don't support them. They are: - 1. Waiting for a subprocess to finish. A subprocess can be started, but right - now it can't be waited on, which sort of makes subprocesses a bit hard to use - 2. Dynamic calls. DevkitPro libraries have no dlopen/dlclose functions. - 3. Command line parameters. It doesn't make sense to have these for a console - anyways, so no big deal here. - 4. mqueue. Sadly there are no mqueue headers. - 5. ucontext. No headers for these either. No coroutines for now :( - 6. nl_types. No headers for this. +1. Waiting for a subprocess to finish. A subprocess can be started, but right + now it can't be waited on, which sort of makes subprocesses a bit hard to use +2. Dynamic calls. DevkitPro libraries have no dlopen/dlclose functions. +3. Command line parameters. It doesn't make sense to have these for a console + anyways, so no big deal here. +4. mqueue. Sadly there are no mqueue headers. +5. ucontext. No headers for these either. No coroutines for now :( +6. nl_types. No headers for this. DLL generation ==============