Skip to content

Setup SGDK with CodeBlocks

Stephane Dallongeville edited this page Mar 12, 2021 · 14 revisions

Here's how to use SGDK within Code::Blocks IDE

  1. Download Code::Blocks and install it ( http://www.codeblocks.org/ )
  2. Launch Code::Blocks and go to the Setting --> Compiler and debugger menu

https://github.com/Stephane-D/SGDK/wiki/images/cb_01.jpg

  1. Create a new compiler configuration by doing a copy of the basic GNU GCC Compiler. Name it as you want ("Sega Genesis Compiler" here).

https://github.com/Stephane-D/SGDK/wiki/images/cb_02.jpg

  1. Toolchain executables tab, enter the SGDK path in the Compiler's installation directory. Unfortunately it does not accept variable name so you have to enter it to its own. Then set the executable filename as on the picture:

https://github.com/Stephane-D/SGDK/wiki/images/cb_03.jpg

At this point we already finished the compiler configuration :)

Now here's how to do your own project and compile it:

  1. Do a new project

https://github.com/Stephane-D/SGDK/wiki/images/cb_04.jpg

  1. Choose a empty project type and click on "Go" button

https://github.com/Stephane-D/SGDK/wiki/images/cb_05.jpg

  1. Click on Next...

https://github.com/Stephane-D/SGDK/wiki/images/cb_06.jpg

  1. Choose a name and a directory for your project, others box are automatically filled but you can modify them if you want, then click on Next.

https://github.com/Stephane-D/SGDK/wiki/images/cb_07.jpg

  1. Choose the genesis compiler you just set up (Sega Genesis Compiler here). Uncheck the Debug configuration which is useless here and rename the Release configuration to default as this is the only used here. Change the outputs directory to "out" then click on finish.

https://github.com/Stephane-D/SGDK/wiki/images/cb_08.jpg

  1. Open the contextual menu on the project and choose Properties...

https://github.com/Stephane-D/SGDK/wiki/images/cb_09.jpg

  1. Use the provided makefile.gen file in SGDK as the project makefile. Don't forget to check the This is a custom Makefile checkbox. Then click to the Project's build options button.

https://github.com/Stephane-D/SGDK/wiki/images/cb_10.jpg

  1. Select the default configuration in left column, check if the Selected compiler is the good one (Sega Genesis Compiler here) and go to the last tab Make. Then modify the make commands as here:

https://github.com/Stephane-D/SGDK/wiki/images/cb_11.jpg

  1. Validate your changes and now you can add files to your project, your files should be localized in your project directory as following:
    • Source files (C, S): root directory or src directory
    • Include files (H, INC): root directory or inc directory
    • Resource files (RES): root directory or res directory
  2. Compile your project in the Build menu, Build command or press Ctrl+F9 keys. If all is correctly setup you should obtain a rom.bin file in the out directory of your project directory :)
Clone this wiki locally