KDevelop

From OpenTTD
(Difference between revisions)
Jump to: navigation, search
(Extended guide to compiling with KDevelop)
(add information on where to find OpenTTD macros like ENABLE_NETWORK)
Line 25: Line 25:
 
* Exclude "objs" directory from the project: open the ''Projects'' toolbox, locate "objs" directory in the tree, right click and select ''Exclude Item From Project''.
 
* 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 (''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''.
+
* 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 (''-D'' compiler option).
  
 
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.
 
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.

Revision as of 11:00, 22 May 2016


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

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.
  • 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. You can find OpenTTD macros in the output of configure and in the config.log file (-D compiler option).

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