Part 4 : Several useful CMake functions
- 4.1) The runExample function
- 4.2) The runPythonExample function
- 4.3) The plotPerf function
- 4.4) Summary
- 4.5) Functions to check Python environnement and build python module
Before going further in this tutorial, we have to develop two small functions which will simplify the rest of the tutorial.
- A function to lauch automatically the programs to be timed (runExample).
- A function to plot the result of the timer to have a automatic vizualisation of what we are doing (plotPerf).
These two functions will be in the file runExample.cmake.
First we have to defined two target :
- A target to run all the timing process (run_all).
- A target to plot all the results (plot_all).
We have also to define the output directory of all the produced files.
The header of the file runExample.cmake is :
1 2 3 4 5 6 |
add_custom_target(run_all) add_custom_target(plot_all) add_dependencies(plot_all run_all) set(OUTPUT_PERF_DIR "${CMAKE_BINARY_DIR}/Performances") |