I am working on several C++ projects on my local computer. They all use some common libs and headers. The file structure is like this:
-bin
-lib
-include
-devel
-project1
-src
-project2
-src
-doc
I am using Eclipse IDE and i set all the relative paths. It compiles the executables to the bin folder and uses libs/includes within the structure. It works fine.
Now I need to import all the projects into an SVN repository so that different people can access and develop codes.
And i wondering if there is a way to have this structure in the SVN server? So when someone checks out a project, he can just start working on it without organising the libs or headers. He will just check out, and all the relative linking will be done.
I am using Eclipse with subclipse plugin.
why u don't use maven? with SVN or GIT it's very good...
Related
I am using automake to build several projects in C++ and the projects will have quite some files in common. I have one git repository for each of the projects and one repository for the common files. Each project is going to be distributed as a separate package.
My file structure looks something like this:
project_1
src
include
project_2
src
include
common_files
src
include
How should I setup automake within each project and within the common_files to reflect this structure and make each of the projects possible to distribute?
Many thanks for suggestions.
/M
This is about how to integrate the azure-storage C++ toolkit in CMake.
I try to build a tool in our application that connects to Azure blob storage, lists files/containers, reads data, etc., I work on Linux (Ubuntu 17.04). I have built both the cpprestsdk and azure-storage tools from source.
I am able to compile some things because I literally add
-I/apps/azure/inst/include
to the CMAKE_CXX_FLAGS. As you can see I used CMAKE_INSTALL_PREFIX=/apps/azure/inst, used it for both cpprest and azure-storage.
In the lib subdirectory there is a cpprestsdk/ directory that contains .cmake files. But I need a .cmake file for azure-storage that I can include in my own CMakeLists.txt, which adds stuff I need (flags, libs, etc.). Looking at the samples reveals that these are built in a way that will only work during the build of the sdk.
Does anyone know if there is such a .cmake include file, and if so .... where is it installed?
OK well, I could find nothing and nobody posts an answer, so I've been experimenting. The short answer is: use the cpprest stuff and add some azure-storage directives yourself.
The only thing I could find is CMake code in the README.md of cpprest. I took that in and added my own azure storage dir name where that could be needed.
Added:
find_path( AZURE_INST_DIR "" HINTS /apps/azure/inst REQUIRED )
The whole thing works because the big bulk of dependencies is under cpprest, azure-storage itself does not have extra dependencies (thank god!).
Note gcc users: turn off -Wshadow and -Woverloaded-virtual because the cpprest and azure-storage code is riddled with those (apparently these are not available in Visual studio).
I have a problem using libclang:
I built libclang locally. It resides somewhere like clang-llvm/…/libclang.3.4.dylib.
Then I developed a foundation tool using that dylib. (exactly: I copied a version to my project folder and linked against this.) The foundation tool works fine. But, of course, at load time it uses the dylib in my local build folder. This is unacceptable, because the user of the tool has to install clang to use my tool.
So I copied libclang.3.4.dylib to a location inside /usr/…/libclang.3.4.dylib and changed the installation path to that location using install_name_path -id /usr/…/libclang.3.4.dylib /usr/…/libclang.3.4.dylib.
After that my tool finds the dylib there but does not work since the parser cannot find stdarg.h any more in the file, that is parsed by my tool.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:12:10: fatal error: 'stdarg.h' file not found
How can I set the installation path of libclang.3.4.dylib to something public?
Amin, my good friend.
<sarcasm>
From what you wrote it should be OBVIOUS to EVERYONE that you have to create a release build of your tool and NOT a debug build. Xcode should have told you that in the form of CLEAR and EASY to understand error messages.
</sarcasm>
Solution: Use a release build of your tool instead of a debug build.
:)
I'm refactoring a large platform independent c++ framework so that it's libraries and execuables no longer have to be in the same directory (or even repository) and it is proving quite challenging. The framework was currently used only by me and it should now address our whole working group so I have to keep it as modular and as automatized as possible.
My basic structure looks like this
apps/
app1, app2, ...
libs/
core, lib1, lib2, ...
bin:
app1, app2, libcore, liblib1, liblib2, ... (on NIX)
app1.exe, app2.exe, core.dll, lib1.dll, lib2.dll, ... (on Windows)
Apps depend on libs, and all libs depend on the core lib. This all works fine in the same root directory and with the add_subdirectory mechanism.
Project dependencies were handeled by the order in which I was calling add_subdirectory: first libs (core being the first), then apps. Cmake was kind enough to set ${core_SOURCE_IR} to the respective directory and all binaries (libs and apps) were generated in the same directory.
What I need advice with is:
should I move to a find_package based approach (write for each lib and FindLib.cmake file)
how the apps and libs will find each other
where to put the binaries
how to pass along include directories of dependent targets
ExternalProject_Add ?
Thank you
I'd recommend using INSTALL(TARGETS... along with INSTALL(EXPORT...
For full details, run:
cmake --help-command INSTALL
FIND_PACKAGE is generally used to find an external project which is already installed (and which wasn't installed with CMake's INSTALL(EXPORT... command) and ExternalProject_Add is used to download, configure, build and install an external project.
If you use INSTALL(EXPORT... with each of your libs and exes, and then just INCLUDE the installed <target>.cmake in your main CMakeLists.txt, these will become available as proper CMake targets, with their dependencies per configuration already set.
As to where to install these export files - that's up to you, but as long as the path you specify is the same place you use when you INCLUDE the file later, it should work fine.
First, you can add_subdirectory()es in any order without caring about dependencies. CMake handles them when all CMakeLists.txt are parsed.
Second, if you wish any your lib or app to be buildable stand-alone, you certainly should use something like find_package(). It can be find_library() and find_file(lib.h) for simple cases.
In this case after find_package() invocation you will have LIB_INCLUDE_DIRS, LIB_LIBRARY_DIRS, LIB_LIBRARIES variables defined, which can be passed to include_directories(), link_directories() and target_link_libraries() respectively. That's how apps will find libs.
As for where to put binaries - in *NIX it's wide practice to place them into ${CMAKE_INSTALL_PREFIX}/bin.
Please comment on this answer, if there is something unclear for you.
My Problem is related to this one:
Eclipse c++ How to work with existing makefile
Basicly i have the same structure (without the configure). I have subfolders like lib1, lib2, lib3 etc... and they each have a makefile. Then I already have one makefile outside of the subfolders that calls my build steps.
What i want to do is add a new subfolder (e.g lib4) and let Eclipse create the makefile for this subfolder and edit the "main" makefile.
I use Eclipse Indigo SR2 for Linux 64Bit.
I wonder if that is even possible for Eclipse or if the makefiles have to be created/edited by hand?
Any help is appreciated :)
This is a classic scenario to use the Autotools. (or write the whole configure script yourself, which can often be simpler.)
I've never used it with Eclipse, but a little search found this:
http://www.eclipse.org/linuxtools/projectPages/autotools/