SDL Wii/installation help

From WiiBrew
Jump to navigation Jump to search

Overview

This is meant as a more detailed guide to getting SDL Wii working under Devkitpro and actually being able to compile successfully, based on my own trial-and-error and advice from #wiidev on EFNet.

These directions target a Windows environment.

Procedure

1. Grab the latest version of the devkitpro automatic updater and run it. Choose "keep downloaded files" as it frees you from having to redownload should something go bad with the installation / you screw up the toolchain somehow.

Don't put the toolchain into a path with spaces. I suggest using c:\devkitpro as the installation path.

I chose the following:

  • base system (obviously)
  • devkitPPC and all suboptions
  • devkitARM and all suboptions (I needed this toolchain in order to compile the SVN version of libfat, it needs both PPC and ARM - you may not need this)
  • Programmer's Notepad

2. Get an SVN client. I recommend TortoiseSVN as it integrates neatly into Windows Explorer. Install it and reboot.

3. After reboot, go ahead and test the toolchain installation. Open Programmer's Notepad and select File -> Open Projects... - browse to the devkitpro folder, then /examples/wii/template and choose template.pnproj.

Notice that a project hierarchy appears in the Projects window. You will see a makefile and some folders. Inside the folder source is the file template.c.

Remember this folder structure! Why? It's very easy to use this template makefile when it's time to create your own project, and in order for things to compile properly, this structure has to be followed.

Press alt-1 to make the project. If everything is good, you'll see something like this in the Output window:

> "make" 
template.c
linking ... template.elf
output ... template.dol

> Process Exit Code: 0
> Time Taken: 00:03

If not, you'll have some debugging work to do before proceeding.

4. Let's grab the latest SVN version of libogc now. Open Windows Explorer. Under File you will see some new menu options. Choose SVN Checkout... and you will see a popup like this:

Svn template.png

The repository URL for libogc is:

https://devkitpro.svn.sourceforge.net/svnroot/devkitpro/trunk/libogc

To keep things simple, specify c:\libogc as the checkout directory. Like before, don't use a path with spaces in it. Keep Checkout Depth as Fully recursive and leave Omit externals unchecked. HEAD revision simply means the latest revision, which is what we want. Whack OK and take a break while the sources are downloaded.

5. Once the sources are downloaded, let's try and compile libogc. Close the TortoiseSVN status window and open a command prompt. Browse to the libogc folder and use this arcane command to make the new libraries:

make

Things will chug along for a while - be patient. Don't worry about any warnings that come by - worry if there are errors or if the compilations aborts out. If everything works out well, you will see something like this:

Make libogc.png

Now, invoke the power of ancient magic to install the new libraries:

make install

Go ahead and open the template project from step 3 again. Press alt-2 to make clean, which deletes all of the object files and compiled executables, and press alt-1 to make again, with the new libraries this time. Again, hopefully everything goes well.

6. Download and copy the PPC ported libraries to your PPC portlibs folder (on Windows this is c:\devkitPro\portlibs\ppc). If the folder does not exist, create it. Note that the files you need are marked with PPC in the filename. These files are needed for the next step, which is:

7. Go back to Windows Explorer and choose SVN checkout... again. The repository URL for SDL-Wii is:

http://sdl-wii.googlecode.com/svn/trunk/

I suggest c:\sdl_wii as the checkout directory.

Once the sources are downloaded, browse to the '/SDL' folder via command prompt and use make to build the SDL libraries, then make install to copy the libs to the devkitpro hierarchy. The browse to the root folder ('/') and type make and use make and make install again to install the SDL extensions.

8. Back to the Programmer's Notepad and the template project. Let's make two simple modifications to make sure SDL can be linked properly:

First, double-click on template.c under the source folder, and add this below the last #include:

#include <SDL/sdl.h>

Now, double-click on makefile and change the LIBS:= line as follows:

LIBS	:= -lSDL -lwiiuse -lbte -logc -lm -lwiikeyboard

Whack File->Save All, then alt-2 (make clean) and alt-1 (make). Hopefully, everything should work well.

9. You may now proceed to the SDL Wii tutorial page and play with the examples. Of course, you don't need to do any of the installation steps (you've done them already!) For maximum enjoyment, I recommend the following:

  • Make a project folder for the tutorials (i.e. c:\projects\sdl_tutorial_1) and make a source folder under the project root (i.e. c:\projects\sdl_tutorial_1\source)
  • Use the template makefile (copy it to the project root folder you just made)
  • Grab the source code and save it in the source folder you made
  • Modify the makefile LIBS line as recommended by the tutorial.

Updating the SVN working sets

If you use Windows Explorer to browse to the folders you created with TortoiseSVN (i.e. libogc and svn_wii) you will see that they have extra icons (green checkmarks). Right-click on one of these folders, and you will see (among other options) SVN Update - this will go and grab newer versions of any files for you automatically. Sweet! Once you've updated (assuming that new files were downloaded), browse to the folders with command prompt and use make clean, make and make install to update the toolchain with the newer libraries.

More help

Google is your friend. Also, you can use the talk pages on this site.

Madmanguruman 02:28, 28 July 2009 (UTC)