|
1 | 1 | BuildExe "Immediate" example |
2 | 2 | ============================= |
| 3 | + |
| 4 | +Basic Procedure |
| 5 | +---------------- |
| 6 | + |
| 7 | +BuildExe has an "immediate" mode where it can directly provide us the Target (singular) without going through the intermediate steps that we followed in the "script" mode. |
| 8 | + |
| 9 | +..uml:: |
| 10 | + |
| 11 | + usecase "main.cpp" as main_cpp |
| 12 | + usecase "compile.toml" as compile_toml |
| 13 | + usecase "host_or_cross_toolchain.toml" as host_or_cross_toolchain |
| 14 | + |
| 15 | + rectangle "./buildexe" as buildexe_exe |
| 16 | + artifact "./hello_world" as hello_world_exe |
| 17 | + |
| 18 | + main_cpp -right-> buildexe_exe |
| 19 | + compile_toml -up-> buildexe_exe |
| 20 | + host_or_cross_toolchain -up-> buildexe_exe |
| 21 | + buildexe_exe -right-> hello_world_exe |
| 22 | + |
| 23 | + |
| 24 | +What is the point of the "script" mode then? |
| 25 | +++++++++++++++++++++++++++++++++++++++++++++ |
| 26 | + |
| 27 | +The "immediate" mode has a lot of limitations but it is also useful in certain scenarios |
| 28 | + |
| 29 | +**Limitations** |
| 30 | + |
| 31 | +* Cannot build more than one target at a time |
| 32 | +* No customizability allowed. |
| 33 | + * Which means that apart from just building the target you cannot do anything else. |
| 34 | + * For example: Setting dependencies between targets, running custom generators, running static analysis tools and so on. |
| 35 | + |
| 36 | +**Usecase** |
| 37 | + |
| 38 | +* Simple way to build one target. |
| 39 | +* Completely run time dependent. Change your ``build.toml`` file and you can build a new target. |
| 40 | +* Very easy to know how a particular target is built. |
| 41 | + * For example. In a large project it might be very hard to visualize how a single target is built due to various code generation and library / target dependencies. |
| 42 | + * Since .toml is easily readable, we can understand the sources, search directories and flags that the target requires at a glance. |
| 43 | +* Can be shipped to customers for a pain free build process i.e removes technical debt. |
| 44 | + * Building your artifact is as simple as ``buildexe --config build.toml --config %BUILDCC_HOME/host/host_or_cross_toolchain.toml`` |
| 45 | + * build.toml contains the target information. |
| 46 | + * host_or_cross_toolchain.toml contains the host/cross toolchain information |
| 47 | + * We can combine the two into one .toml file. |