|
2 | 2 | 'io.elementary.code', |
3 | 3 | 'vala', 'c', |
4 | 4 | meson_version: '>= 0.58.0', |
5 | | - version: '8.1.0' |
| 5 | + version: '8.1.1' |
6 | 6 | ) |
7 | 7 |
|
8 | 8 | add_project_arguments([ |
@@ -73,6 +73,40 @@ if get_option('development') and git.found () |
73 | 73 | branch = output.stdout().strip() |
74 | 74 | endif |
75 | 75 |
|
| 76 | +# Profiler linking code taken from https://github.com/RidgeRun/gst-inference/blob/master/meson.build |
| 77 | +# with some amendments |
| 78 | +# 'libprofiler' and 'libtcmalloc' are provided by installing (e.g.) 'google-perftools' and 'libgoogle-pertools-dev' |
| 79 | +# Profiling is not active unless either the correct environment variables are set at runtime |
| 80 | +# or the profiling is switched on/off in the code using the CPU_PROFILING and HEAP_PROFILING conditional compilation flags |
| 81 | +# with the commands Profiler.start (<path-to-profile-output>) and Profiler.stop () and the corresponding HeapProfiler functions |
| 82 | +# It is advisable not to run cpu profiling at the same time as heap profiling |
| 83 | +# If meson options are changed then rebuild with 'cd .. && sudo rm -R ./build && build' |
| 84 | +# See https://github.com/gperftools/gperftools/blob/master/docs/cpuprofile.adoc |
| 85 | +# and https://github.com/gperftools/gperftools/blob/master/docs/heapprofile.adoc |
| 86 | +if get_option('cpu-profiling-enabled') |
| 87 | + profiler_dep = dependency ('libprofiler') |
| 88 | + if(profiler_dep.found()) |
| 89 | + message('CPU profiling enabled: Building with profiling support.') |
| 90 | + add_global_link_arguments ('-lprofiler', language: 'c') |
| 91 | + add_project_arguments ('--define=PROFILING', language: 'vala') |
| 92 | + dependencies += profiler_dep |
| 93 | + else |
| 94 | + message('MESON_FAIL: CPU profiling requested but libprofiler (gperftools) not found.') |
| 95 | + endif |
| 96 | +endif |
| 97 | +if get_option('heap-profiling-enabled') |
| 98 | + heap_profiler_dep = dependency ('libtcmalloc') |
| 99 | + if(heap_profiler_dep.found()) |
| 100 | + message('Heap profiling enabled: Building with heap profiling support.') |
| 101 | + add_global_link_arguments ('-ltcmalloc', language: 'c') |
| 102 | + add_project_arguments ('--define=HEAP_PROFILING', language: 'vala') |
| 103 | + dependencies += heap_profiler_dep |
| 104 | + else |
| 105 | + message('MESON_FAIL: Heap profiling requested but libtcmalloc (gperftools) not found.') |
| 106 | + endif |
| 107 | +endif |
| 108 | + |
| 109 | + |
76 | 110 | subdir('data') |
77 | 111 | subdir('src') |
78 | 112 | if get_option('plugins') |
|
0 commit comments