KDevelop is an IDE developed for KDE Platform. It runs natively on many Unix-like systems including MacOS.
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).
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).
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.
- In project options (Project -> Open Configuration...), select Custom Defines And Includes -> Includes/Imports and add two full paths. One to the "stdafx.h" file e.g. ~/OpenTTD/src/stdafx.h. Second to the "objs/lang" directory e.g. ~/OpenTTD/objs/lang.
- In project options, select Custom Defines And Includes -> Defines and add any macros you may find useful e.g. ENABLE_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.
- KDevelop website
- Building (compiling) projects with custom Makefiles at KDE UserBase Wiki