Organizing large c/c++ project in Eclipse - eclipse-cdt

I'm trying to set up eclipse cdt (Indigo) for a large development project and need some help on organizing the eclipse workspace. The project is in its startup phase, parts are completed, but much more is to be developed. The project covers several products each consisting of several processes and a common set of libraries. The structure is about as follows:
top/
Library/
Math/
Sys/
Com/
Include/
Math/
Sys/
Com/
Product/
Prod1/
Prod2/
I created a top workspace and want to use this for the whole project. I'm currently strugling with the Library and Include part. I need to create a new library called Err and a corresponding Err directory under the Include branch which is outside of the scope of the project created under the Library folder. Should I create this as a separate Err project in Eclipse? I tried this and the folder under Library was fine, but how then do I create the corresponding folder and files under the Include branch?
Is this the best way to organize the project or should I use one common project for all the libraries or divide the whole thing into several workspaces?

Related

Setting up C++ include settings for a large library such as Paraview and QT in Eclipse

I have an application where I am compiling against the libraries Qt (5.11) and Paraview (5.6). I am developing in C++ and I am also coding in Eclipse.
Yes, I am aware that Paraview is more of an application then a library. However, I will be using it as a library to intergrate Paraview in my application in order to visualize some data. I could use QT creator and that would take care of the QT library. However, I am not very familiar with QT creator as an IDE and my entire workflow has been based around eclipse. For this, I would like to utilize components that I am familiar with.
Now, as many of you know, the QT library is large, very large. So is Paraview. I could create a search path for each folder containing the header files I need in the C++ include settings. If I go in this direction, then my library search path will be long, very long. Also, there might be a situation where I need to change computers (for whatever reason), I would then need to edit the search paths for the new computer and that will take time.I had thought that I could only include the paths to the include files that I needed. And I have started to do that. However, when I compile my application, I noticed that the libraries would use include files that are located in a directory that Eclipse is not even searching in. At the end of the day, I would need to include all of the directories to which the header files are stored in.
I was wondering if there might be a better method to reference all of the files that my project needs? Both come with make files (I believe that Qt includes a QMake file?). Is there a simpler method to include all of the files instead of editing the C++ include path for eclipse? I did see an option for QMake in Eclipse, is there anything that I can do with that feature to compile to QT library with my application?
Thank you and any feedback is appreciated. Also, feel free to suggest edits or clarification so that my description is clear.
Note some good practices when working with eclipse and qt or other large library.
Include the directories with a headers
If you use option "Generate Makefile automatically", add group include path with GUI Eclipse:
copy the directories with a headers (via system explorer);
go to project properties/C/C++Build/Settings/Tool Settings/GCC C++
Compiler/Includes.
paste directories (Ctrl+V) into "Include paths" list.
If you are using a qt-eclipse-integration plugin, you can add folders via the Discovered scanner configuration. You can find it if open: project properties/C/C++ Include Paths and Symbols/Add Contributed...
Create new project
if you already have a customized project, you can use it as a template:
make a copy of the customized project and name "mytempate";
delete all files from "mytempate".
When you want to create a new project, copy the template and specify (in the copy dialog) the path where the source codes are located.
Now you have a finished new project with settings and code.
Change computers
Use one of the ways:
1. Export C/C++ project settings for use in another workspace via project properties/C/C++ General/Paths and symbols/Includes/Export Settings...
2. Pack in the archive eclipse and workspace and copy your another computer.

CMake solution sub-directory

I have a big CMake solution which contain 5 projects. On this 1 project creates Main executable and rest of the 4(3 static + 1 dynamic) projects creates libraries which are linked to the main project.
MainSolution:
|-MainExecutablePrj
|-StaticLib_1Prj
|-StaticLib_2Prj
|-StaticLib_3Prj
|-DynamicLib_1Prj
The entire project is to be build for both windows and linux platforms. Now I need to create an Sub directory under MainSolution and create some testcase projects which uses the DynamicLib_1 (.lib/.so). So far what I have done is I will have different solution for each test cases and copy the required .h files and .lib(.so) files and build the test case solutions.
Its very hard for me to maintain the source code and whenever there is an change on the dynamic library I need to copy all the necessary files and rebuild the test cases again.
So I wanted to include the Test cases solutions inside my main project, so that whenever I change dynamic library project it builds the test case projects as well.
I very well know to add those test case solutions as projects under the MainSolution but I wanted to create sub-directory and put all the test case projects under that folder.
MainSolution:
|-TestCasesFolder
|-TestCase_1Prj
|-TestCase_2Prj
|-...
|-MainExecutablePrj
|-StaticLib_1Prj
|-StaticLib_2Prj
|-StaticLib_3Prj
|-DynamicLib_1Prj
Can someone help me on this
It should not be necessary to copy any files.
Let CMake find the built libraries with find_library and add a hint to the path of subdirectories build folder
Let CMake include the header files from your subproject with include_directories. Add a prefix to make it platform independent.
Regarding the tests:
All unit tests for a subproject should be places within the structure of this project and not in the root project. Place all integration tests in the root project or a separate test project as part of the root project.
Example Structure

Multiple c++ Eclipse Helios Projects with Source in a Single Directory

I'm working on a legacy codebase that has all the code for multiple c++ executables and static libraries in a single folder.
I'm wondering if its possible to create projects in Eclipse Helios for each of these without moving the corresponding source to its own directory?
You can create Eclipse projects anywhere, then in each of the project do:
RMB on project->New->Folder, expand Advanced>>, select Link to alternate location (Linked Folder) and browse to the directory where your shared sources are located.
Or you can have one project with multiple targets instead.

Project files in KDevelop

I am trying to use KDevelop to write a cmake based simple application. KDevelop created two myProject.kdev4 project files: one in the project folder and one in .kdev4 hidden subfolder. Both are non-empty. Which ones should I check in? How can I make kdevelop use just one project file (and preferably not use hidden folders)?
The .kdev4 file is used for kdevelop specific information (It mainly only tells KDevelop to use the CMake project manager). The folder includes user specific configuration (If you are familiar with Visual Studio, it is like the .user files).
Usually only the CMakeLists.txt files are needed as they should have all the relevant generic data. You can throw in the .kdev4 file so that you don't need to 'import' the project through the CMakeLists.txt on another machine. But the .kdev4 folder should stay in your local machine, as you don't want to mix user's configurations.

Adding common library files to Flex Builder?

So I'm playing around with an ActionScript library (Flare, to be specific) in Flex Builder 3. I'd like to have this functionality available to all projects in my workspace without having to copy it to every one. What's the easiest way to do this?
I'm not sure this is the best way, but you can link to a folder or file from within a project. You right-click on the project, and choose "New <whatever>" and click on the Advanced button to access the link functionality. From there, you can use the file navigator to choose a file or folder. Afterwards it will show up in the project properties under the build path (the tab for library paths).
We use this because we split off a large chunk of our code into a separate library project, but that code still references a ton of image files in the original projects root directory. So we create a link to that image directory and all is well again. Maybe this will help you also.
We have a shared folder "flex" that we place our common libs. In the properties for the project, under flex build path, set the library path to your location for flare.