Re: Compiling with Eclipse
- From: martu <martu_xd gmx de>
- To: gtkmm-list gnome org
- Subject: Re: Compiling with Eclipse
- Date: Wed, 11 Jul 2012 17:58:34 +0200
I think he means the project-properties->C/C++ Build->Setting->Tool settings and there the includes for the C++ compiler and libraries for the linker.
As for cmake. If you want to distibute the source I would also recommend cmake as it makes it easier for others to build your project. But integrating cmake with Eclipse (so you see the errors and warnings in the source code) is kinda difficult.
I don't know any complete good tutorial for this right now so I'll write here how I do this.
First the cmake files here is a good tutorial for cmake with gtkmm:
https://live.gnome.org/gtkmm/UsingCMake
For integrating cmake with eclipse with an out-of-source-build (recommended)
create a new build-directory in the project root.
An in the build directory other for the specific configurations (Release, Debug and so on)
Then in eclipse right-click on the project->Make Targets->Create
For the target name enter something like cmake_Release.
Untick the "Same as target name" and "Use builder settings" options.
Leave the Make target name empty. And use this build command
"cmake -E chdir Release/ cmake ../../ -DCMAKE_BUILD_TYPE:STRING=Release"
The "cmake -E chdir Release/" will go to the Release directory and execute the following command: "cmake ../../ -DCMAKE_BUILD_TYPE:STRING=Release"
Which executes cmake and tell it to use the Release configuration for building and use the CMakeLists.txt in the project-root directory (remember this command is executed in project-root/build/Release/)
Do this for every target (propably Release and Debug) and execute them (right-click on the project->Make Targets->build choose configuration and build)
This will only generate the build system eclipse is finally going to use, so nothing is being build now.
For the actual building part go to project-properties->C/C++ build in the Builder Settings tab untick "Generate Makefiles automatically" and "Use default build command". As the Build command use "make -C ${workspace_loc:/__PROJECT_NAME__/build/Release}" For the Release configuration or with ".../build/Debug" for the Debug configuration. As the build directory use "make -C ${workspace_loc:/__PROJECT_NAME__/build/Release}" for Release (analog for Debug configuration).
In the Behaviour Tab tick "Build (incremental build)" and set it to "all".
Also tick the "Clean" option and set it to "clean".
For all of these setting don't forget to change the configuration which is selectable above the Tabs.
After all this you should be able use the normal "Build-button" in eclipse and have the errors and warnings directly displayed in the code. The cmake build-system (the stuff with the "Make Targets") only needs to be regenerated when you change the CMakeLists.txt files or (not sure about this) when you add/remove source files.
The Execute button in eclipse will (propably) not work as it doesn't know where the resulting binaries are. But for this just navigate in eclipse to the directory with the binaries, right-click then and choose "Run as".
On Wed, 11 Jul 2012 12:10:35 -0300
Rodrigo Nunes <rnsribeiro gmail com> wrote:
> I searched for this tab Project -> Project Paths and have not found it, and
> how to make a CMake file, could you hand me a sample file or a link to some
> tutorial that I can be checking.
>
> if possible thank you very much.
>
> Em quarta-feira, 11 de julho de 2012, Fernando Herrero Carrón escreveu:
>
> > El mié, 11-07-2012 a las 09:51 -0300, Rodrigo Nunes escribió:
> > > Forgive my ignorance, but how do I change this in eclipse?
> > > I've tried everything here and I can not solve.
> >
> > I believe it's not possible to use pkg-config automatically within
> > eclipse. You can run that command on your terminal and then throw the
> > library and path flags in your project settings. You can do this in the
> > Project -> Project Paths tab.
> >
> > Or else, I would recommend using CMake to build your projects. You can
> > write a CMakeLists.txt file that takes care of automatic discovery, and
> > then use the "cmake -G" command to generate an Eclipse project for you
> > (you only need to do this once). Then, in Eclipse, you can "Import ->
> > Existing projects", and everytime you build, cmake will take care for
> > you to provide the appropriate flags.
> >
> > Hope this helps,
> > Fernando
> >
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org <javascript:;>
> > https://mail.gnome.org/mailman/listinfo/gtkmm-list
> >
>
>
> --
> Pensamentos viram palavras,
> Palavras viram ações,
> Ações viram hábitos,
> Hábitos viram caráter,
> E o caráter vira o seu destino.
--
martu <martu_xd gmx de>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]