Update docs for nintendo switch

This commit is contained in:
Joey Yakimowich-Payne 2018-06-27 10:30:59 +09:00
commit bec2c96730

View file

@ -232,26 +232,36 @@ Cross compilation for Nintendo Switch
===================================== =====================================
Simply add --os:nintendoswitch Simply add --os:nintendoswitch
to your usual ``nim c`` or ``nim cpp`` command. DevkitPro setup must be the same as to your usual ``nim c`` or ``nim cpp`` command and set the ``SWITCH_LIBS``
what is the default with their new installer and ``SWITCH_INCLUDES`` environment variables to something like:
[here for Mac/Linux](https://github.com/devkitPro/pacman/releases) or
[here for Windows](https://github.com/devkitPro/installer/releases).
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 <https://github.com/devkitPro/pacman/releases>`_ or
`here for Windows <https://github.com/devkitPro/installer/releases>`_.
For example, with the above mentioned config::
nim c --os:nintendoswitch switchhomebrew.nim nim c --os:nintendoswitch switchhomebrew.nim
This will generate a file called ``switchhomebrew.elf`` which can then be turned into 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 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 <https://github.com/jyapayne/nim-libnx.git>`_ or you can use
`the switch builder tool <https://github.com/jyapayne/switch-builder.git>`_.
Environment variables are ``DEVKITPRO`` for the devkitpro path, ``SWITCH_LIBS`` for any extra Environment variables are:
libraries required by your application (``-lLIBNAME`` or ``-LLIBPATH``), and - ``SWITCH_LIBS`` for any extra libraries required by your application (``-lLIBNAME`` or ``-LLIBPATH``)
``SWITCH_INCLUDES`` for any extra include files (``-IINCLUDE_PATH``). - ``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``.
There are a few things that don't work because the DevkitPro libraries don't support them. There are a few things that don't work because the DevkitPro libraries don't support them.
They are: They are: