Skip to content

Commit

Permalink
Simple documentation on how to use autogenerated code that uses Block…
Browse files Browse the repository at this point in the history
…Factory with CMake (#80)
  • Loading branch information
traversaro authored Sep 23, 2024
1 parent 22f6281 commit 04e2ae2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions doc/mkdocs/data/autogenerate_code.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# How to autogenerate C++ code

!!! warning
This tutorial is not yet ready
The capability of autogenerating C++ code from a Simulink model is provided by Simulink Coder. BlockFactory received a preliminary support of this toolbox, and only basic features are currently supported.
If you are already building your Simulink autogenerated code via CMake, to start using code autogenerated from models that use BlockFactory's blocks, you simply need to look for `BlockFactory` in CMake as any other dependency via:
~~~cmake
find_package(BlockFactory COMPONENTS SimulinkCoder REQUIRED)
~~~

The capability of autogenerating C++ code from a Simulink model is provided by Simulink Coder. BlockFactory received a preliminary support of this toolbox, and only basic features are currently supported. Following the previous how-to, check these links for a simple example:
and then link your target that contains the autogenerated code to the `BlockFactory::SimulinkCoder` imported target:
~~~cmake
target_link_libraries(<targetwithautogeneratecode> PRIVATE BlockFactory::SimulinkCoder)
~~~

For more advanced uses, check the following example:

- [`AutogenerationExample.mdl`](https://github.com/robotology/blockfactory/tree/master/example/matlab/AutogenerationExample.mdl) A Simulink model with the right configuration of Simulink Coder
- [`example/matlab/AutogenerationExample_grt_rtw`](https://github.com/robotology/blockfactory/tree/master/example/matlab/AutogenerationExample_grt_rtw) The folder containing the autogenerated sources
Expand Down

0 comments on commit 04e2ae2

Please sign in to comment.