Difference between revisions of "Setting up Development Environment"

From 3dbrew
Jump to navigation Jump to search
(Added sf2dlib, gl3ds, caelina, and 3ds-cmake)
(Replace "Optional Tools and Libraries" section with a link to "Homebrew Libraries and Tools")
Line 2: Line 2:
 
* Install [http://devkitpro.org/ devkitARM]. If it's already installed, update it. On Windows there's a GUI installer. On Linux/Mac there's a perl-script. Make sure you also select ctrulib when installing.
 
* Install [http://devkitpro.org/ devkitARM]. If it's already installed, update it. On Windows there's a GUI installer. On Linux/Mac there's a perl-script. Make sure you also select ctrulib when installing.
 
* Download the files in the [https://github.com/smealum/ctrulib/archive/master.zip ctrulib repository] (even though the library has already been installed) because the repository contains a 3DS project template and examples.
 
* Download the files in the [https://github.com/smealum/ctrulib/archive/master.zip ctrulib repository] (even though the library has already been installed) because the repository contains a 3DS project template and examples.
 +
* Depending on the kind of homebrew you want to develop, you may be interested in installing and using additional libraries and tools which don't ship alongside devkitARM/libctru. A list of them can be found in [[Homebrew Libraries and Tools]].
  
 
==Linux==
 
==Linux==
Line 26: Line 27:
 
source ~/.bashrc
 
source ~/.bashrc
 
</pre>
 
</pre>
 
==Optional Tools and Libraries==
 
There are a number of other things which don't ship alongside devkitARM but which you might be interested in obtaining:
 
 
* Lectem has written a [https://github.com/Lectem/3ds-cmake CMake build system] for 3DS homebrew as a modern alternative to plain Makefiles
 
* An alternative GPU shader assembler called nihstro is available at [http://4dsdev.org/thread.php?id=14 4dsdev]. Windows binaries are available, while it needs to be compiled from source on other platforms.
 
* xerpi has written a simple 2D graphics library called [https://github.com/xerpi/sf2dlib sf2dlib]
 
* There are two incomplete OpenGL implementations available for 3DS development: [https://github.com/machinamentum/Caelina Caelina] and [https://github.com/cpp3ds/gl3ds gl3ds]
 
  
 
= Building the examples =
 
= Building the examples =

Revision as of 14:27, 23 August 2015

Setup

  • Install devkitARM. If it's already installed, update it. On Windows there's a GUI installer. On Linux/Mac there's a perl-script. Make sure you also select ctrulib when installing.
  • Download the files in the ctrulib repository (even though the library has already been installed) because the repository contains a 3DS project template and examples.
  • Depending on the kind of homebrew you want to develop, you may be interested in installing and using additional libraries and tools which don't ship alongside devkitARM/libctru. A list of them can be found in Homebrew Libraries and Tools.

Linux

  • First get the devkitARM updater Perl script for Linux.
  • Run it with superuser privileges if your /opt directory is not marked world read-writeable.
  • Get ctrulib from Smealum's GitHub repository, build and install it.
sudo apt-get install git curl
curl -L http://sourceforge.net/projects/devkitpro/files/Automated%20Installer/devkitARMupdate.pl/download -o devkitARMupdate.pl
chmod +x ./devkitARMupdate.pl
sudo -s
./devkitARMupdate.pl /opt/devkitpro
cd /opt/devkitpro
git clone https://github.com/smealum/ctrulib.git
cd ctrulib/libctru
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=$DEVKITPRO/devkitARM
make
make install
exit
echo "export DEVKITPRO=/opt/devkitpro" >> ~/.bashrc
echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bashrc
echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bashrc
source ~/.bashrc

Building the examples

3DS examples are still being created. Currently there are a few examples in the separate ctrulib download under the "examples" folder.

  • arm11u: simple homebrew example
  • sdmc: demonstrates how to access files on the SD card
  • mic: demonstrates how to read sound from the microphone
  • gpu: demonstrates how to render 3D geometry with the GPU

Building the examples on Linux with Netbeans

  • Go to File->New Project...
  • Select C/C++ Project with existing code
  • Navigate to the examples directory and select the folder for the project you want to build; eg. /home/vtsingaras/3ds/examples/app_launch
  • Leave Configuration Mode to 'Automatic' and click 'Finish'.
  • It will fail to build. Now edit Makefile and insert these two lines, adjusting for your devkitpro path, at the top:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=/opt/devkitpro/devkitARM
  • Right-click the project and go to Properties->Code Assistance and click C Compiler.
  • In include directories enter
/opt/devkitpro/devkitARM/include;/opt/devkitpro/ctrulib/libctru/include

adjusting again for your devkitPro path.

  • Do the same for 'C++ Compiler'.
  • Go to 'Run' and click 'Clean and Build Project'.
  • Now right-click on the project and select Code Assistance->Reparse Project.

Now you can use Netbeans' code completion feature and build your project from the Run menu.

Building homebrew for distribution

To build your homebrew open a terminal, browse to your homebrew's folder and run make.

  • This will build a .elf file and a .3dsx file together with an icon. The icon and .3dsx file are the format required for the Homebrew Channel.
  • To build a Gateway-compatible .3ds file you need to strip the .elf file and use makerom on it (with the provided RSF file):
arm-none-eabi-strip [ELF file]
makerom -f cci -o [.3ds file] -rsf [RSF file] -target d -exefslogo -elf [ELF file] -icon [icon file] -banner [banner file]