Skip to content

Commit

Permalink
Build the executables statically in release mode on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
adonis0147 committed May 30, 2024
1 parent 23f2793 commit 9d144e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci_meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:

jobs:
linux:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: pip install meson ninja
Expand All @@ -26,11 +26,11 @@ jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: brew install gcc
Expand Down
10 changes: 8 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9d144e5

Please sign in to comment.