You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/target-declaration.mdx
+51-2
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,8 @@ A target specification may have optional parameters, the names and values of whi
28
28
-[**build-type**](#build-type): One of Debug (the default), Release, RelWithDebInfo and MinSizeRel.
29
29
-[**cargo-dependencies**](#cargo-dependencies): (Rust only) list of dependencies to include in the generated Cargo.toml file.
30
30
-[**cargo-features**](#cargo-features): (Rust only) List of string names of features to include.
31
-
-[**cmake-include**](#cmake-include): List of paths to cmake files to guide compilation.
31
+
-[**cmake-include**](#cmake-include): List of paths to cmake files to be included in the generated CMakeLists.txt.
32
+
-[**cmake-init-include**](#cmake-init-include): List of paths to cmake files to be included at the beginning of the generated CMakeLists.txt.
32
33
-[**compiler**](#compiler): A string giving the name of the target language compiler to use.
33
34
-[**docker**](#docker): A boolean to generate a Dockerfile.
34
35
-[**external-runtime-path**](#external-runtime-path): Specify a pre-compiled external runtime library located to link to instead of the default.
@@ -57,6 +58,7 @@ c={
57
58
build: <string>,
58
59
build-type: <Debug, Release, RelWithDebInfo, or MinSizeRel>,
59
60
cmake-include: <string or list of strings>,
61
+
cmake-init-include: <string or list of strings>,
60
62
compiler: <string>,
61
63
compiler-flags: <string or list of strings>,
62
64
docker: <true or false>,
@@ -74,6 +76,7 @@ cpp={
74
76
`target Cpp {
75
77
build-type: <Debug, Release, RelWithDebInfo, or MinSizeRel>,
76
78
cmake-include: <string or list of strings>,
79
+
cmake-init-include: <string or list of strings>,
77
80
compiler: <string>,
78
81
external-runtime-path: <string>,
79
82
export-dependency-graph <true or false>,
@@ -289,7 +292,7 @@ target Cpp {
289
292
};
290
293
```
291
294
292
-
This will optionally append additional custom CMake instructions to the generated `CMakeLists.txt`, drawing these instructions from the specified text files (e.g, `foo.txt`). The specified files are resolved using the same file search algorithm as used for the [files](#files) target parameter. Those files will be copied into the `src-gen` directory that contains the generated sources. This is done to make the generated code more portable<spanclass="lf-c"> (a feature that is useful in [federated execution](../writing-reactors/distributed-execution.mdx))</span>.
295
+
This will optionally include custom CMake files at the bottom of the generated `CMakeLists.txt`. The specified files are resolved using the same file search algorithm as used for the [files](#files) target parameter. Those files will be copied into the `src-gen` directory that contains the generated sources. This is done to make the generated code more portable<spanclass="lf-c"> (a feature that is useful in [federated execution](../writing-reactors/distributed-execution.mdx))</span>.
293
296
294
297
The cmake-include target property can be used, for example, to add dependencies on various packages (e.g., by using the [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html) and [`target_link_libraries`](https://cmake.org/cmake/help/latest/command/target_link_libraries.html) commands).
295
298
@@ -323,6 +326,52 @@ See [`AsyncCallback.lf`](https://github.com/lf-lang/lingua-franca/blob/master/te
This will optionally include custom CMake files at the beginning of the generated `CMakeLists.txt`. The specified files are resolved using the same file search algorithm as used for the [files](#files) target parameter. Those files will be copied into the `src-gen` directory that contains the generated sources. This is done to make the generated code more portable<spanclass="lf-c"> (a feature that is useful in [federated execution](../writing-reactors/distributed-execution.mdx))</span>.
346
+
347
+
The cmake-init-include target property is needed if you would like to change the toolchain file of CMake to enable cross-compilation. This has to be done before the `project()` statement found at the very beginning of a `CMakeLists.txt`
348
+
349
+
For example, the following CMake file sets up cross compilation targeting an Arm-based microcontroller.
0 commit comments