From 04e2ae2acc9298f8ea7601f2bb1ff797cb837778 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Mon, 23 Sep 2024 10:11:18 +0200 Subject: [PATCH] Simple documentation on how to use autogenerated code that uses BlockFactory with CMake (#80) --- doc/mkdocs/data/autogenerate_code.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/mkdocs/data/autogenerate_code.md b/doc/mkdocs/data/autogenerate_code.md index 295ccdb..9e31bbc 100644 --- a/doc/mkdocs/data/autogenerate_code.md +++ b/doc/mkdocs/data/autogenerate_code.md @@ -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( 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