Making a PSP project in Code::Blocks in linux

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Making a PSP project in Code::Blocks in linux

Post by J.F. »

Code::Blocks is a nice IDE, but it's mostly geared towards "normal" gcc projects. There are so many bells and whistles that I think people get intimidated and decide to use something else. Well, here's the SIMPLEST way to make Code::Blocks work for you. Note that all of this was done on the latest Ubuntu 8.04 with Code::Blocks v8.02 and the latest toolchain and SDK. I assume you have installed all the PSP stuff and can compile from a shell.

1 - Start Code::Blocks and click "creat a new project".

2 - Select "Empty project".

3 - Set "Project title:" - for example, "BasiliskII".

4 - Set "Folder to creat project in:" - use the browse button to navigate to where the PSP project makefile is. For example, "/home/jlfenton/projects/psp/BasiliskII-1.0/src/PSP".

5 - Edit "Resulting filename:" - Code::Blocks wants to put the project file into a subdirectory with the same name as the project title. Delete the subdirectory for the filename so that the project file is created in the same directory as the makefile. For example, change "/home/jlfenton/projects/psp/BasiliskII-1.0/src/PSP/BasiliskII/BasiliskII.cbp" to "/home/jlfenton/projects/psp/BasiliskII-1.0/src/PSP/BasiliskII.cbp".

That step is important! When using a custom makefile, Code::Blocks sets the working directory to the path to the project file, not the makefile! It won't be able to find the makefile if you don't make the project file in the same directory as the makefile.

6 - Click "Next", then click "Finish". The options on the dialog with the finish button don't matter because we're using a custom makefile.

You should now see the Project under workspace on the left in the Management panel.

7 - Right click the project and select "Properties...".

8 - Click "This is a custom Makefile" and set the "Makefile:" field to the name of the PSP makefile.

9 - Click "OK". Nothing else matters, including the EnvVars options - Code::Blocks doesn't seem to set the environment variables with custom makefiles, so don't even bother trying to set them in Code::Blocks' settings.

10 - Right click the project and select "Build options...".

11 - Go to the ""Make" commands" tab. If the fields are disabled, you forgot to click the check box in step 8 for a custom makefile. Go do that.

12 - Delete "$target" from all the fields... there is no target here. We're keeping it as simple as possible.

13 - Now we add in the environment variables that we couldn't add in the Code::Blocks settings. Do this by pasting the following in front of "$make" in each of the fields.

Code: Select all

export PSPDEV="/usr/local/pspdev" && export PSPSDK="$PSPDEV/psp/sdk" && export PSPPATH="$PSPDEV/bin:$PSPDEV/psp/bin:$PSPSDK/bin" && export PATH="$PATH:$PSPPATH" && export PKG_CONFIG_PATH="$PSPDEV/psp/lib/pkgconfig" && 
14 - Click "OK". Nothing else matters.

15 - Right click the project and select "Add files..." or "Add files recursively" to add the various code files to the project. You could actually build the project without this step, but it's hard to edit the files if they aren't added to the project. :)

You're done! Just click build. Note that while EVERYTHING is handled by the makefile (set paths for includes and libs and such in the makefile), Code::Blocks does pick up the error messages allowing you to easily go to the bad line to edit it (as long as the file is part of the project). Just use a standard PSPSDK makefile for your project.

Note that while it looks like a lot of steps, that's because I separated out every single action into its own step. You're really only doing TWO THINGS - setting the project to use a custom makefile, and setting the make command lines.
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

I have recently given up eclipse to use codeblack which is much lighter and very happy with it.
By the way did you linked codeblock and psplink ?
--pspZorba--
NO to K1.5 !
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

pspZorba wrote:I have recently given up eclipse to use codeblack which is much lighter and very happy with it.
By the way did you linked codeblock and psplink ?
No. I don't use psplink for debugging. I'm more "old school" and use logging. I suppose it COULD be used with psplink, I just haven't looked into that.
Post Reply