Skip to content

Commit c25a0eb

Browse files
authored
Fix Meson build with GDC (#195)
1 parent 395cb08 commit c25a0eb

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

meson.build

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('dcontainers', 'd',
2-
meson_version: '>=0.44',
2+
meson_version: '>=0.52',
33
license: 'BSL-1.0',
44
version: '0.8.0'
55
)
@@ -30,6 +30,7 @@ dcontainers_src = [
3030
'src/containers/unrolledlist.d'
3131
]
3232

33+
dc = meson.get_compiler('d')
3334
src_dir = include_directories('src/')
3435

3536
#
@@ -58,15 +59,25 @@ dcontainers_dep = declare_dependency(
5859
#
5960
# Tests
6061
#
61-
extra_args = ['-main']
62+
if dc.get_id() == 'gcc'
63+
test_link_args = []
64+
test_main_file = configure_file(capture: true,
65+
command: ['echo', 'int main(string[] args) { return 0; }'],
66+
output: 'unittest_main.d'
67+
)
68+
else
69+
test_link_args = ['-main']
70+
test_main_file = []
71+
endif
6272

6373
dcontainers_test_exe = executable('test_dcontainers',
6474
[dcontainers_src,
6575
'test/compile_test.d',
66-
'test/external_allocator_test.d'],
76+
'test/external_allocator_test.d',
77+
test_main_file],
6778
include_directories: [src_dir],
6879
d_unittest: true,
69-
link_args: extra_args
80+
link_args: test_link_args
7081
)
7182
test('test_dcontainers', dcontainers_test_exe)
7283

0 commit comments

Comments
 (0)