I am new to CMake and I am trying Integrate CMake with Eclipse.
Below is the example of the file structure that I have.
PROJECT
build/linux
build/linux/Release (Should contain the release libraries and files)
build/linux/Debug (Should contain the debug version of the files)
SRC
subProject_1
.cpp (all source files) and CMakeLists.txt 1 for this folder (creating a static library)
subproject_2
.cpp (all source files) and CMakeLists.txt 2 for this folder (creating a static library)
subproject_3
.cpp (all source files) and CMakeLists.txt 3 for this folder (creating the executable)
Include
subProject_1
.h (all the header files)
subProject_2
.h (all the header files)
subProject_3
.h (all the header files)
Can you please let me know how would I be able to integrate CMake to Eclipse. I would like to do a in Source build so that I can sub version my code.
I have tried different options of placing the main CMakelist in project folder, project/build/linux folder and so on. I can get the project working but I dont get to see the source folder as well as the include folder on eclipse.
I have tried both 1st and 2nd option specified in http://www.vtk.org/Wiki/CMake:Eclipse_UNIX_Tutorial#CMake_with_Eclipse
It's usually very simple: from a clean build directory, you configure cmake using Eclipse as generator (it's easier if you use cmake-gui), and then you import the build directory into Eclipse (File, Import, General, Existing Projects into Workspace).
Related
I currently switched to eclipse and trying to migrate my projects. I created a java-workspace and used 'File->Open Projects from File System'.
The project with all the folders is added, not only the 'src' but everything I put into it (datasheets, documentation,...). Also the libraries are added two times. One time in the folder and what seems like a link to the compiled library.
folder structure
In netbeans I just added the desired library to the /libs folder and linked it to the project.
Can I manually add folders and/ or libraries to existing projects? Why are there two instances of the libraries?
By using Open Projects from File System, folders containing .java files has been configured as source folders (source code intended to be compiled). This can be undone via right-click Build Path > Remove from Build Path (the reverse function is Build Path > Use as Source Folder).
In the Package Explorer, source folders are shown as virtual folders. If the source folder is not a subfolder of the project, it is displayed as virtual folder in addition to the project subfolder to be able to navigate to that non-source project subfolder (in your case you have a single src source folder and in addition to the non-source folder lib you have multiple virtual lib/... source folders).
The node Referenced Libraries lists all JARs and class folders on the Java Build Path (classpath/modulepath). To remove something from the Build Path, right-click it and choose Build Path > Remove from Build Path. JARs can be added to the Build Path by right-clicking the JAR and choosing Build Path > Add to Build Path. Class folders can be added only via Project > Properties: Java Build Path in the tab Libraries with the button Add Class Folder....
I dont know if this is a workaround or good practice for migration:
Create a new Java-Project in Eclipse
add desired Folder structure (including /libs)
In 'Project->Properties -- Libraries' add libraries manually
Clean and Build Project
I have to test functionality and stability but it seems ok.
I am new in the cmake world and I am not even sure if what I try to achieve is possible or not.
Currently, I have an eclipse project file which contains many targets (they have some files in common, some are different (I used the exclusions in Eclipse to do it)).
One of my colleague uses the CLion for that so he created a CmakeLists.txt files for that. Is it possible to use these CmakeLists.txt files to create a project in eclipse? Is it possible to have this way a multiple targets in one project file?
Is it possible to use these CmakeLists.txt files to create a project in eclipse?
Yes, use the following from your source root to generate Eclipse project files which support in-source builds.
$ cmake -G"Eclipse CDT4 - Unix Makefiles" .
If you want to do out-of-source builds, there are a few wrinkles to be aware of. Have a look at this cmake wiki page about the Eclipse CDT generator for more details.
Note that Eclipse also supports importing projects from existing makefiles, which means you can just use the "Unix Makefile" generator to generate makefiles, and import from those.
See this cmake wiki page for details on that
Is it possible to have this way a multiple targets in one project file?
Yes it is. All targets specified in your CMakeLists.txt file(s) will be included in the generated project file.
Thank you for a quick answer. I looked into what you sent me but my indexing still does not work. In my project I have following structure:
Folder main with main.c
Folder platform with three different folders: folder a with a.c file, folder b with b.c file and folder c.c file, and one platform.h file common for all those files with declaration of function "platform()". The main function calls the function "platform()" from platform.h which definition is different for each target (a, b, and c respectively defined in a.c, b.c and c.c file). When I create the eclipse project I do get the folder called "[Targets]" but the indexing does not work which means it does not show me the function from the proper target.
Is it possible to be able to switch from one target to another with the "hammer" sign?
Many thanks.
Using eclipse to create an Autotools-based project.
Starting from the "Hello World C++ Autotools Project" in the project creation wizard.
Here are the following steps.
Add a folder to the project called include.
Add a file to the include folder called Application.h.
Add #include <Application.h> entry into the src/proj.cpp file.
Trying to compile gets me a fatal error: Application.h: No such file or directory.
What is the autotools-fu I need to add my include folder to -I search path?
The Autotools plugin sorta follows the design of the GNU autoconf toolset, and so you need to configure the source files that are used by autoconf, automake, etc.
Start with the Autotools hello world project (I named mine AutoHello)
Project->New->Source folder->Folder name: include
Add the header file Application.h to the include folder. I just generated a new simple one, but you can copy an existing one too.
Add include/Makefile to the AC_CONFIG_FILES definition in configure.ac. (Note: *.ac files can be thought of as autoconf source files)
Add include to the SUBDIRS definition in Makefile.am (Note: *.am files can be thought of as automake source files)
Add a new file include/Makefile.am which will handle the automake behavior of the include folder.
Add a definition include_HEADERS to include/Makefile.am which lists all the headers contained in the folder. For this little example we simply list Application.h
In src/Makefile.am, add a definition a_out_CPPFLAGS. Give it a value of -I$(top_srcdir)/include. This tells our make target to add include as an include search path when compiling.
Project->Reconfigure Project
And that should give you a project that will compile a target that uses header files that are located in the include folder.
I created an Eclipse project and I need to use the Super CSV library with Dozer. I downloaded the Super CSV and created a new folder "super-csv" in /usr/lib.
Now I have: /usr/lib/super-csv/super-csv that contains the super csv jar (+ javadoc and source),
/usr/lib/super-csv/super-csv-dozer that contains the super csv dozer jar, javadoc and source plus a "lib" folder.
Inside /usr/lib/super-csv/super-csv-dozer/lib there are many .jar files that are needed for super-csv-dozer to work, so I added it as native library for super-csv-dozer entry in library tab of java build path in Eclipse.
When I try to compile the project, I receive a java.lang.ClassNotFoundException pointing a class that is contained in one of the jar files in the lib folder.
Everything works only if I manually add every jar in lib folder as an external jar.
Can someone explain me where I am doing wrong?
I'd recommend using Maven - it's a widely used tool for Java builds. To start using Super CSV, it would be as simple as adding the 2 dependencies (listed on the Super CSV website), and your Eclipse project would be ready to go.
There's a bit of a learning curve though, so if you want to just add the jars to Eclipse's build path manually, I'd recommend creating a lib directory at the root of your project and putting all of the jars there.
my-project
|-src
| |- (your source in here)
|
|-lib
|-commons-beanutils-1.8.3.jar
|-commons-lang-2.5.jar
|-commons-logging-1.1.1.jar
|-dozer-5.3.2.jar
|-slf4j-api-1.7.1.jar
|-super-csv-2.0.1.jar
|-super-csv-dozer-2.0.1.jar
You can then add them to the build path (here's a good guide).
Just a note: if you're not using the Dozer extension, then you'll only need super-csv-2.0.1.jar on the build path.
I need a step to step on how to plug tess4j to Eclipse.
I found this online:
creating a lib directory and copied the tess4j.jar and its required jar in;
added the jars to build path
copied the tessdata directory and tessdll.dll file into the project root directory.
Now it just works.
I only know basic Java so I have no idea what creating a lib directory and copy directory file means at all.
Can someone help me to plug this library and make it work for eclipse because I am working in a project that needs ocr.
creating a lib directory and copied the tess4j.jar and its required jar in;
A JAR (Java ARchive) file is a collection of compiled Java classes. This is the usual way to distribute Java libraries. You should create a new folder in your project (right click your project, "New", "Folder") and copy/move the JAR you downloaded to this newly created directory. If tess4j has dependencies, i.e. needs other JARs to work, you have to put them in this directory.
added the jars to build path
You need to tell Eclipse to add the JARs to the build path, i.e. Eclipse needs to know where to get the tess4j classes from. Locate the lib folder and select all JAR files. Right click them and select "Build Path", "Add to Build Path".
copied the tessdata directory and tessdll.dll file into the project root directory.
Should be clear ;-)