summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@blame.services>2022-11-17 11:25:45 +0100
committerDave Davenport <qball@blame.services>2022-11-17 11:25:45 +0100
commitfb80595725054c5f592b0348c0d4457d1a835963 (patch)
tree6d287d390bef1135fac4dc5dbc6785e9b1e127f9
parent53391da45a63301f651d8e004294387e3430f34b (diff)
[Build] Add option to build with lto to meson.
Fix error in test. Issue: #1743
-rw-r--r--meson.build7
-rw-r--r--meson_options.txt1
-rw-r--r--test/box-test.c4
3 files changed, 10 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 5aa3d483..185224a3 100644
--- a/meson.build
+++ b/meson.build
@@ -30,6 +30,13 @@ foreach f : flags
endif
endforeach
+if get_option('lto')
+ add_project_arguments('-flto', language: 'c')
+ add_project_arguments('-Werror=odr', language: 'c')
+ add_project_arguments('-Werror=lto-type-mismatch', language: 'c')
+ add_project_arguments('-Werror=strict-aliasing', language: 'c')
+endif
+
plugindir = join_paths(get_option('libdir'), meson.project_name())
themedir = join_paths(get_option('datadir'), meson.project_name(), 'themes')
desktop_install_dir = join_paths(get_option('datadir'), 'applications')
diff --git a/meson_options.txt b/meson_options.txt
index 9ca68fc6..09e89b5a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,3 +2,4 @@ option('drun', type: 'boolean', value: true, description: 'Desktop file mode')
option('window', type: 'boolean', value: true, description: 'Window switcher mode')
option('check', type: 'feature', description: 'Build and run libcheck-based tests')
option('imdkit', type: 'boolean', value: true, description: 'IMDKit support')
+option('lto', type: 'boolean', value: false, description: 'Compile with lto')
diff --git a/test/box-test.c b/test/box-test.c
index dafc526f..12b83200 100644
--- a/test/box-test.c
+++ b/test/box-test.c
@@ -97,8 +97,8 @@ char *helper_get_theme_path(const char *file, G_GNUC_UNUSED const char *ext) {
}
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
void rofi_add_warning_message(G_GNUC_UNUSED GString *msg) {}
-int textbox_get_estimated_char_height(void);
-int textbox_get_estimated_char_height(void) { return 16; }
+double textbox_get_estimated_char_height(void);
+double textbox_get_estimated_char_height(void) { return 16; }
double textbox_get_estimated_ch(void);
double textbox_get_estimated_ch(void) { return 8; }
void rofi_view_get_current_monitor(G_GNUC_UNUSED int *width,