Hint: How to create a nice Eclipse project for working on OpenCV with cmake

asked 2014-05-18 12:41:51 -0600

MSoegtrop gravatar image

Dear OpenCV users,

in case you want to explore the OpenCV source code, it helps to create an eclipse project with cmake. Cmake has an eclipse target, which automatically creates a nicely structured eclipse project with sub-projects according to the cmake structure. Here are the instructions:

  1. Create a workspace folder, e.g. opencvws.
  2. Select this folder as workspace folder in eclipse using menu "file / switch workspace / other"
  3. Extract the opencv sources in a subfolder of the workspace folder, e.g. opencv-2.4.9
  4. In the workspace folder create am eclipse project folder e.g. eclipse-2.4.9. Note: the eclipse project folder must not be a subfolder of the opencv source folder, but a sibling. Both should be directly under the workspace folder.
  5. Open a terminal and cd to the eclipse project folder
  6. cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ../opencv-2.4.9
  7. Import the created eclipse project in eclipse using menu "file / import / general / existing eclipse project" and select the eclispe project folder you created in step 4.

See also http://www.vtk.org/Wiki/Eclipse_CDT4_Generator

I tested this with opencv 2.4.9, eclipse 3.8.1 and cmake 2.8.12.2 on Ubuntu 14.04 LTS.

I tested the project created this way for a day and things like jumping to definitions and the like worked well. I hope it helps!

Best regards,

Michael

edit retag flag offensive close merge delete

Comments

Hello Michael, since this is a Q&A forum, your hit will get pushed down the list rather fast resulting in tons of usefull information getting lost. You might be up to creating a small guide/tutorial of this and contribute it to the documentation. Here you can find information on the contribution process. It could be added to the existing eclipse tutorial or you could use your findings to update it. What do you think?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-19 03:25:52 -0600 )edit
1

Hi Steven,

sure, it makes sense, but first I try to get my renovated opencv_performance into GIT.

Best regards,

Michael

MSoegtrop gravatar imageMSoegtrop ( 2014-05-19 13:58:20 -0600 )edit