-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New CMake structure and plugin-based blocks architecture #137
New CMake structure and plugin-based blocks architecture #137
Conversation
fc6064d
to
aefcd01
Compare
85a25df
to
ec5adf7
Compare
1a4d18f
to
de59b01
Compare
@diegoferigo ping me when the PR is ready for review. |
Destructors must be defined in the cpp due to sizeof issues caused by the pimpl implemented with unique pointer. The root of this error is related that the forward declaration of the impl type in the header.
Now wbt::Block instances are allocated by the S-Function using dlopen and they need to know the name of the library that contains them. This information is now stored in the Simulink Library as an additional parameter of every S-Function block.
e620c8e
to
e6de553
Compare
@traversaro It is already. I had the last minor edit in pipeline, just squashed it. |
Despite there is some ongoing work on a standalone version of We might consider in the future to use a submodule pointing to the new library. Merging as soon as Travis passes again against the latest |
New CMake structure
After the previous big refactorings (#56, #77, #115) the wb-toolbox became more modular and these modules have been kept as independent as possible.
After these changes to the C++ side, this PR split the components at the CMake level in the following components:
Core
Block
,Signal
,BlockInformation
,Log
Mex
BlockInformation
for using block libraries with SimulinkCoder
BlockInformation
for using block libraries with Simulink Coder outputLibrary
Block
Core
,Mex
andCoder
represent the real machinery of the toolbox (whose targets are named just Toolbox* for the time being). They will represent the new project described in #83.New plugin-based blocks architecture
Simulink
Until now the mex generated from the S-Function was dynamically linked to the analogous of the
Library
component. The split introduced a problem due to the factory machinery. SinceMex
is standalone, it doesn't know any information about the library containing thewbt::Block
objects to allocate (they can also be different libraries) and hence the factory function was an unresolved symbol in the S-Function itself.This PR introduces a new plugin-based approach to tackle this problem. The S-Function running in Simulink uses
dlopen
in a plugin fashion to get theBlock
object, which must know the name of the library file that contains it. This information is stored in the Simulink Library (.slx
file).Simulink Coder (C++)
Instead, the
Library
component can be linked either dynamically or statically withCoder
and a main function in order to use it as a standalone C++ application after the code has been generated by Simulink Coder.cc @traversaro @DanielePucci @pattacini