From 5bcf53414280040fc433107d682242b3370c4ccc Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Wed, 1 Mar 2023 08:42:22 -0500 Subject: [PATCH] build: Add ci profile that uses `--release` As we add more rust crates in performance-critical places, we run into some performance issues with debug builds. This makes it hard to get a good feel for the performance of the application, as something may be slow simply because it's not been optimized by the compiler. This commit adds a ci profile to our meson options, and adjusts our CI configuration to use it. Regular builds should continue to use the development profile. Also renames `default` to `release` --- .gitlab-ci.yml | 1 + meson.build | 2 +- meson_options.txt | 8 +++++--- src/meson.build | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e91844f..bfc19da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ variables: MANIFEST_PATH: "build-aux/flatpak/org.gnome.Loupe.Devel.json" FLATPAK_MODULE: "loupe" APP_ID: "org.gnome.Loupe.Devel" + CONFIG_OPTS: "-Dprofile=ci" RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo" flatpak: diff --git a/meson.build b/meson.build index 4d0e9af..319dcd4 100644 --- a/meson.build +++ b/meson.build @@ -22,7 +22,7 @@ iv_pkgdatadir = iv_datadir / meson.project_name() profile = '' version_suffix = '' -if get_option('profile') == 'development' +if get_option('profile') != 'release' profile = '.Devel' vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip() if vcs_tag == '' diff --git a/meson_options.txt b/meson_options.txt index a9e396d..39c56f3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,9 +1,11 @@ option( 'profile', type: 'combo', + description: 'The build profiles for the application. Use development or ci for the .Devel app ID. ci also produces optimized bundles.', choices: [ - 'default', - 'development' + 'release', + 'development', + 'ci', ], - value: 'default' + value: 'release' ) diff --git a/src/meson.build b/src/meson.build index 78ede3d..d41fced 100644 --- a/src/meson.build +++ b/src/meson.build @@ -18,13 +18,13 @@ run_command( cargo_options = [ '--manifest-path', source_root / 'Cargo.toml' ] cargo_options += [ '--target-dir', build_root / 'src' ] -if get_option('profile') == 'default' +if get_option('profile') == 'development' + rust_target = 'debug' + message('Building in debug mode') +else cargo_options += [ '--release' ] rust_target = 'release' message('Building in release mode') -else - rust_target = 'debug' - message('Building in debug mode') endif cargo_env = { 'CARGO_HOME': build_root / 'cargo-home' }