KDevelop

From OpenTTD
Jump to: navigation, search


KDevelop is an IDE developed for KDE Platform. It runs natively on many Unix-like systems including MacOS.

Notice.png

Note
To avoid performing steps manually, use this automated KDevelop 4 project generator: http://bugs.openttd.org/task/6577

Contents

Importing OpenTTD to KDevelop

To import OpenTTD project into KDevelop follow these steps:

  • prepare OpenTTD source code as usual, configure
  • in KDevelop, select Project -> Open / import project...
  • navigate to the root folder of source code e.g. ~/OpenTTD and choose Makefile file
  • enter name of the project and select "Custom Makefile Project Manager"

Now you should be able to build the project (Project -> Build all Projects).

Running/debugging

In order to run/debug the project from KDevelop you have to create a "Launch configuration":

  • from menu select Run -> Configure Launches...
  • on the left, select your project instead of "Global"
  • click Add New... button and select Compiled Binary
  • next to Executable enter full path to OpenTTD binary e.g. ~/OpenTTD/bin/openttd
  • next to Arguments enter any custom options e.g. -d 1
  • next to Working Directory enter full path to the run directory e.g. ~/OpenTTD/bin

Now you should be able to run and debug the project (Run -> Execute launch, Run -> Debug launch).

Useful tips

KDevelop comes with a background parser which gives you a real-time information on the code. It needs some tweaks however:

  • Exclude "objs" directory from the project: open the Projects toolbox, locate "objs" directory in the tree, right click and select Exclude Item From Project. This can be also done via project configuration window (Project -> Open Configuration... -> Project Filter).
  • In project options (Project -> Open Configuration...), select Custom Defines And Includes -> Includes/Imports and add:
    • path to the "stdafx.h" file e.g. ~/OpenTTD/src/stdafx.h
    • path to the "objs/lang" directory e.g. ~/OpenTTD/objs/lang
    • path to the "objs/setting" directory e.g. ~/OpenTTD/objs/setting
  • In project options, select Custom Defines And Includes -> Defines and add any macros you may find useful e.g. ENABLE_NETWORK. You can find OpenTTD macros in the output of configure and in the config.log file (search for -D compiler options e.g. -DENABLE_NETWORK).

KDevelop also has an internal VCS GUI tool. If you have imported a Mercurial or Git "working copy" then just open the VCS Changes toolbox.

In the "Find/Replace in Files" dialog it might be necessary to add ",/objs/" to the Exclude pattern. You can also add some file extensions specific to OpenTTD e.g. nut or ini.

See also

Personal tools