NeoKiller needs more developers! Click here for more details.

Compiling with Code::Blocks

From NeoKiller

Jump to:navigation, search

The recommended IDE for both compiling and editing the NeoKiller code is Code::Blocks. This document outlines the steps to both setup Code::Blocks correctly to edit the NeoKiller code, and the relevant steps leading up to committing code to the repository.


Configuring Code::Blocks correctly

If you plan to commit any code to the NeoKiller project using the Code::Blocks interface, there are several steps you need to go through to ensure that Code::Blocks does not mangle our source code in any way. These settings presume you have the Source code formatter (AStyle) plugin installed, please install it if you haven't already.

All these instructions refer to settings within the 'Configure editor' panel in C::B (Settings-> Editor). When referring to combo boxes, there will simply be lists of combo boxes with either a ☑ (box should be ticked) or ☐ (box should not be ticked) next to it.

General settings

Default encoding: UTF-8
TAB Options
☑ Use TAB character
☑ TAB indents
End-of-line options
End-of-line mode: LF

Source formatter

Style: Custom
☑ Use TABs instead of spaces
☑ Force using TABs
☑ Indent classes
☑ Indent switches
☑ Indent case: statement in switches
☐ Indent brackets
☐ Indent blocks
☑ Indent namespaces
☑ Indent labels
☑ Indent multi-line preprocessor definitions
Brackets: Attach
☐ Break closing headers from Attach or Linux brackets
☑ Pad empty lines around header blocks
☐ Break 'else if()' header combinations into seperate lines
☑ Insert space padding around operators
☐ Insert space padding around parentheses on the outside
☑ Insert space padding around parentheses on the inside
☑ Remove extra space padding around parenthesis
☐ Don't break complex statements
☐ Don't break one-line blocks
☐ Convert TABs to spaces
☑ Fill empty lines with the whitespace of their previous lines

Pre-commit steps to perform

  1. Ensure you have followed the steps above.
  2. Make sure that any C++ files have a .cpp extension and any header files have a .h extension.
  3. Ensure your headers follow the header format.
  4. Ensure your .cpp files follow the code format.
  5. Choose the Plugins menu and click "Source code formatter (AStyle)" (this will automatically format your source code to our coding style).
  6. Add our licensing header to the very top of the file (we don't generally accept files not licensed under the GNU GPL v3).
  7. If your code includes any classes, outsource any class, function and variable declarations to a header file of the same name and include the header in your .cpp file.
  8. Make sure that there are no compile errors with your file, even with the strictest compiler settings.