[OpendTect_Developers] R: R: CMake Help

Corrao Antonio Antonio.Corrao at eni.com
Mon Jul 9 15:08:55 CEST 2012


Kristopher,
thank you for your prompt response. As I remarked, one problem I had with pmake mkshobjlib was precisely that it used to unpack libraries and link plugins object files + library unpacked object files.
This approach fails for quite large (static) libraries (the link command is too long to fit shell buffers), depending on the number of libraries and object files contained in each library: letting the linker create a .so file adding the -Lmylib directives works and does not need to unpack libmylib.a.

It seems that the behavior now is similar, and will require some modifications:

>>> set ( OD_MODULE_STATIC_LIBS "path/to/your/static/lib.a" "path/to/your/second/static/lib.a" )
>>> cmake will extract the object files from these, and put them into your plugin.

I will browse cmake documentation and your macro first, before getting back to you.
Best regards,
AC


Antonio Corrao
[cid:image001.gif at 01CC1F96.78739D20]
Geophysical Studies & Geophysics for Reservoir
eni S.p.A. - Exploration & Production Division
5° P.U. - Via Emilia, 1 - 20097
Room: 4020E - 4th floor East side
San Donato Milanese (MI), Italy
mailto: antonio.corrao at eni.com<mailto:antonio.corrao at eni.com>
Phone: +39 02 520 61150
Fax:     +39 02 520 63897

Da: developers-bounces at opendtect.org [mailto:developers-bounces at opendtect.org] Per conto di Kristofer Tingdahl
Inviato: lunedì 9 luglio 2012 14.36
A: developers at opendtect.org
Oggetto: Re: [OpendTect_Developers] R: CMake Help

Dear Antonio,


thanks for your e-mail. CMake is relatively easy to understand once you know the basics. The reason we switched was primarily that we felt pmake was not a standard, off the shelf system, and there were hence no exerience of it among external developers.

I will seek to elaborate on some solutions below:

On Mon, Jul 9, 2012 at 12:26 PM, Corrao Antonio <Antonio.Corrao at eni.com<mailto:Antonio.Corrao at eni.com>> wrote:
Dear all,
I started planning for migrating my home written plugins (currently deployed on version 4.2) to version 4.4.
The main difficulty I have found is related to external libraries: all my plugin link external libraries (either dynamic or static ones), both commercial and in-house developed.

The Pmake system was fairly easy to grasp, and I did make all modifications needed to support such functionalities (the original mkshlibs script did not handle large libraries too well - unpacking them - but it was easy to customize).

Now, I have no experience with cmake and it seems fairly elaborate to digest from scratch. Do you have any example of cmake file for a plugin that links external shared/static libraries?
Also, I would appreciate some pointers to cmake tutorials/how-to(s) in order to have a minimal understanding of how it works (without spending too much time) and to be able to do small modifications.

To link in a static library into your plugin, simply do:

set ( OD_MODULE_STATIC_LIBS "path/to/your/static/lib.a" "path/to/your/second/static/lib.a" )

cmake will extract the object files from these, and put them into your plugin.

Shared external libraries are added by the

set ( OD_MODULE_EXTERNAL_LIBS "path/to/your/shared/libA.so" "path/to/your/second/shared/libB.so" )


In general, the documentation of CMake is rather comprehensive, and should be a good starting point for it: http://www.cmake.org/cmake/help/v2.8.8/cmake.html

In our implementation, there is a large macro doing most of the work, and that is sitting in CMakeModules/ODMacroUtils.cmake

The OD_INIT_MODULE() macro is called once for each module (in your case plugin) and adds the executables and libraries to the make-system. Hence the CMakeLists.txt in each module sets up a number of variables, and then calls this macro. You can however work completely independent from our system, and not use our macros.


If there are any more specific questions you have, like "How do I do X with CMake?", let us know!


Sincerely,


Kristofer Tingdahl
--
Kristofer Tingdahl, Ph. D.
CEO
dGB Earth Sciences
http://www.dgbes.com

eni spa
Sede Legale
Piazzale Enrico Mattei, 1
00144 Roma - Italia

Capitale sociale
euro 4.005.358.876,00 i.v.
Codice Fiscale e Registro Imprese di Roma n. 00484960588
Partita IVA n. 00905811006
R.E.A. Roma n. 756453

Sedi secondarie:
Via Emilia, 1 e Piazza Ezio Vanoni, 1
20097 San Donato Milanese (Milano) - Italia

eni.com<http://www.eni.com>

________________________________
Message for the recipient only, if received in error, please notify the sender and read http://www.eni.com/disclaimer/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20120709/31660084/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 1368 bytes
Desc: image001.gif
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20120709/31660084/attachment.gif>


More information about the Developers mailing list