[meson] Turn benchmark to a feature
diff --git a/.circleci/config.yml b/.circleci/config.yml
index a423193..9df4f49 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -226,7 +226,7 @@
# test a meson based dist
- run: meson dist -Cbuild && rm -rf build
# test experimental APIs
- - run: meson build -Dexperimental_api=true -Dbenchmark=true -Dexperimental_api=true -Doptimization=2 && ninja -j9 -Cbuild test # or meson test -Cbuild
+ - run: meson build -Dexperimental_api=true -Dexperimental_api=true -Doptimization=2 && ninja -j9 -Cbuild test # or meson test -Cbuild
# run benchmarks
- run: build/perf/perf && meson test -Cbuild --benchmark && rm -rf build # or ninja -Cbuild benchmark
# mingw
diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml
index a731233..bf8e3df 100644
--- a/.github/workflows/linux-ci.yml
+++ b/.github/workflows/linux-ci.yml
@@ -17,7 +17,7 @@
- name: install meson and fonttools
run: sudo pip3 install meson fonttools
- name: run
- run: meson build -Db_coverage=true -Dglib=enabled -Dcairo=enabled -Dicu=enabled -Dgraphite=enabled -Dfreetype=enabled -Dbenchmark=true -Doptimization=2
+ run: meson build -Db_coverage=true -Dglib=enabled -Dcairo=enabled -Dicu=enabled -Dgraphite=enabled -Dfreetype=enabled -Doptimization=2
- name: ci
run: meson test --print-errorlogs -Cbuild
diff --git a/meson.build b/meson.build
index 29988f8..ea9cb32 100644
--- a/meson.build
+++ b/meson.build
@@ -344,7 +344,10 @@
subdir('test')
endif
-if get_option('benchmark')
+if not get_option('benchmark').disabled() and \
+ ((host_machine.system() != 'windows' and \
+ not meson.is_subproject() and \
+ not meson.is_cross_build()) or get_option('benchmark').enabled())
subdir('perf')
endif
diff --git a/meson_options.txt b/meson_options.txt
index a61de2d..1590e0f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,7 +28,7 @@
option('gtk_doc', type: 'feature', value: 'auto', yield: true,
description: 'Generate documentation with gtk-doc')
-option('benchmark', type : 'boolean', value : false,
+option('benchmark', type: 'feature', value: 'auto',
description: 'Enable benchmark tests')
option('icu_builtin', type: 'boolean', value: false,
description: 'Don\'t separate ICU support as harfbuzz-icu module')