[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter describes how to compile files, build executables and run
them. Most capabilities can be accessed through the Build
menu item,
or through the Build
and Run
contextual menu items, as
described in the following section.
When compiler messages are detected by GPS, an entry is added in the Locations tree, allowing you to easily navigate through the compiler messages (see 2.8 The Locations Tree), or even to automatically correct some errors or warnings (see 13.3 Code Fixing).
9.1 The Build Menu 9.2 Integrating existing build procedures with the GPS build system
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If errors or warnings occur during the compilation, the corresponding locations will appear in the Locations Tree. If the corresponding Preference is set, the source lines will be highlighted in the editors (see 15.1 The Preferences Dialog). To remove the highlighting on these lines, remove the files from the Locations Tree.
Build
contextual menu accessible from a project
entity contains the same entries.
When running an application from GPS, a new execution window is added in the bottom area where input and output of the application is handled. This window is never closed automatically, even when the application terminates, so that you can still have access to the application's output. If you explicitly close an execution window while an application is still running, a dialog window will be displayed to confirm whether the application should be terminated.
When using an external terminal, GPS launches an external terminal utility that will take care of the execution and input/output of your application. This external utility can be configured in the preferences dialog (Helpers->Execute command).
Similarly, the Run
contextual menu accessible from a project
entity contains the same entries.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Since the multi-language build system provided by GPS is based on makefiles, it is possible to integrate existing build scripts and makefiles. In the following section, we will call such projects that integrate with existing build procedures a foreign project.
You first need to provide your own Makefile.<project>
file, that will
provide stubs to the real build commands.
Then to tell GPS that it should not generate automatically the makefile corresponding to a given project, set the read-only attribute on the makefile, e.g under Unix:
$ chmod -w Makefile.<project> |
> attrib +r Makefile.<project> |
This way when saving the project, GPS knows that the existing makefile should not be overridden.
Depending on your project, you will need to define some or all of the following targets in the makefile stub:
For example, suppose we have a foreign project called Foo
,
with an existing makefile, here is how Makefile.foo would look like:
ifeq ($(FOO_PROJECT),) FOO_PROJECT=True ifeq ($(BASE_DIR),) BASE_DIR=$(shell pwd) FOO_ROOT=True # Redirect clean to the real clean rule internal-clean: $(MAKE) clean # Ditto for the build rule internal-build: $(MAKE) build endif FOO_BASE_DIR := $(BASE_DIR) # Add our source directories to the default search path # so that other projects can reference our include files FOO_SRC_DIRS = $(FOO_BASE_DIR)/include $(FOO_BASE_DIR)/include2 SRC_DIRS += $(FOO_SRC_DIRS) # Add <build>/libfoo.a, built by the internal-build rule above, to the # list of libraries to link with LDFLAGS += $(FOO_BASE_DIR)/<build>/libfoo.a ifneq ($(FOO_ROOT),True) DEPS_PROJECTS += $(FOO_BASE_DIR)/foo endif endif |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |