From 5fa1ae5f02c069607766932618bbcab8ddf9d9dd Mon Sep 17 00:00:00 2001 From: Adonis Ling Date: Thu, 30 May 2024 11:10:05 +0800 Subject: [PATCH] Build the executables statically in release mode on Linux --- .github/workflows/ci_meson.yml | 2 +- meson.build | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_meson.yml b/.github/workflows/ci_meson.yml index 37f21a7..714d4be 100644 --- a/.github/workflows/ci_meson.yml +++ b/.github/workflows/ci_meson.yml @@ -6,7 +6,7 @@ on: jobs: linux: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: diff --git a/meson.build b/meson.build index fdc0f51..be98bc8 100644 --- a/meson.build +++ b/meson.build @@ -34,9 +34,15 @@ flags += ['-Werror', '-Wall', '-Wextra', '-Wpedantic'] link_flags = [] -if (build_type.startswith('debug') and compiler == 'gcc') +if build_type.startswith('debug') flags += ['-fsanitize=address', '-fno-omit-frame-pointer'] - link_flags += ['-Wl,-Bstatic', '-lasan', '-Wl,-Bdynamic'] + if host_machine.system() == 'linux' + link_flags += ['-Wl,-Bstatic', '-lasan', '-Wl,-Bdynamic'] + elif host_machine.system() == 'darwin' + link_flags += ['-fsanitize=address'] + endif +elif build_type.startswith('release') and host_machine.system() == 'linux' + link_flags += ['-static'] endif executable(