Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » ExternLibrary Stereotype(How to use an external library without specify an hard path?)
ExternLibrary Stereotype [message #1783909] Tue, 20 March 2018 10:01 Go to next message
Yoann Farré is currently offline Yoann FarréFriend
Messages: 235
Registered: November 2017
Senior Member
Hello everyone,

I'm trying to generate C++ code from a model and I want to parametrize automatically my new CDT project. For that, I use the stereotype ExternLibrary (filling the fields "includePaths", "libPaths" and "libs" to specify the use of my own libraries) like in the documentation : https://wiki.eclipse.org/Papyrus/Codegen/Cpp_description#CDT_integration

It works fine but I have to enter hard paths (like "C:/libs"). I also use boost and in the field "libs", i just have to specify "boost_system" without indicating the path.

I would not like to indicate a hard path.

For example, I would use a plugin to store my libraries and just like boost, have to indicate only the name of the library. How could I do that?

Thank you for reading.

Yoann.



Re: ExternLibrary Stereotype [message #1784107 is a reply to message #1783909] Thu, 22 March 2018 15:41 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi Yoann,

for #includes and libraries, you can just indicate the name of the include file/library, respectively. For instance, for the pthread library the "include" attribute contains "pthread.h" and the "libs" attribute contains just "pthread". If you need to indicate directories in which these files can be found, you need some sort of a file location. The code generator will just copy the strings, so everything that CDT supports for specifying directory locations is implicitly is supported.

A common use case might be to reference a file or library relative to the workspace. This can be done via the String "${workspace_loc:/<your project name>/...".

Hope that helps

Ansgar
Re: ExternLibrary Stereotype [message #1784164 is a reply to message #1784107] Fri, 23 March 2018 07:38 Go to previous messageGo to next message
Yoann Farré is currently offline Yoann FarréFriend
Messages: 235
Registered: November 2017
Senior Member
Hi Ansgar,

Thank you for your reply and for the explanation. I finally use the option you give. At first, I hoped to use a path like "platform:/plugin/<myPluginName>/lib/..." but I noticed that this notation was not supported by CDT.

Yoann.
Re: ExternLibrary Stereotype [message #1797910 is a reply to message #1784164] Thu, 08 November 2018 12:00 Go to previous messageGo to next message
Yoann Farré is currently offline Yoann FarréFriend
Messages: 235
Registered: November 2017
Senior Member
Hello ,

I come back on this thread because I would include "iostream" in my C++ build settings (add "iostream" in Include files (-include)). I try to do that through the model and the "ExternLibrary" stereotype ( includes field) but I can only add a file (file.h). Can I do this with this stereotype or is this a bug?

Yoann.
Re: ExternLibrary Stereotype [message #1797964 is a reply to message #1797910] Fri, 09 November 2018 09:30 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi Yoann,

if you use the stereotype "ExternLibrary", you can only influence the "-I" compiler option via the "includePaths" attribute, i.e. add paths for finding includes but do add includes itself. If you think that it should be possible as well to configure the CDT project with automatic includes, you can post a bug with severity "enhancements".
However, if you declare a class or primitive type inside the stereotyped package with the name "iostream" and then declare a dependency towards this type from your class, the required #include will be generated file (not the automatic include for all files via the CDT settings). You need to tag the "iostream" type with the "External" stereotype and set its incPath to ensure that the .h extension is suppressed.
A potential alternative is to the use "Include" stereotype on your class.
Re: ExternLibrary Stereotype [message #1797968 is a reply to message #1797964] Fri, 09 November 2018 10:08 Go to previous messageGo to next message
Yoann Farré is currently offline Yoann FarréFriend
Messages: 235
Registered: November 2017
Senior Member
Hi Ansgar,

Thanks for your reply.

In fact, I would access to iostream potentially in each class generated from the model, so it seems to be quite burdensome to add a dependency or an "include" stereotype on all classes. For the moment, it's easier to complete the C++ build settings with iostream. I'll post a bug because I find it would be a useful feature. Thanks again.

Yoann.
Re: ExternLibrary Stereotype [message #1797969 is a reply to message #1797968] Fri, 09 November 2018 10:27 Go to previous message
Yoann Farré is currently offline Yoann FarréFriend
Messages: 235
Registered: November 2017
Senior Member
Link to new bug/enhancement report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=540959

Yoann.
Previous Topic:Document generation from a model
Next Topic:Roadmap for Papyrus Compare
Goto Forum:
  


Current Time: Fri Apr 19 13:11:34 GMT 2024

Powered by FUDForum. Page generated in 0.01950 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top