Skip to content

Commit 3ba3be5

Browse files
committed
add more variables to pkg-config file, to detect libc++ or libstdc++ of the build libraries
1 parent 5fca947 commit 3ba3be5

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

src/libs/core/meson.build

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,10 @@ liboopetris_core = library(
2222
install: true,
2323
)
2424

25-
## remove '-stdlib=libc++' from the list, if it's present
26-
core_dep_compile_args = []
27-
foreach value : core_lib.get('compile_args')
28-
if value != '-stdlib=libc++'
29-
core_dep_compile_args += value
30-
endif
31-
endforeach
32-
3325
liboopetris_core_dep = declare_dependency(
3426
link_with: liboopetris_core,
3527
include_directories: core_lib.get('inc_dirs'),
36-
compile_args: core_dep_compile_args,
28+
compile_args: core_lib.get('compile_args'),
3729
dependencies: core_lib.get('deps'),
3830
version: meson.project_version(),
3931
)
@@ -45,6 +37,14 @@ install_headers(
4537
preserve_path: true,
4638
)
4739

40+
## remove '-stdlib=libc++' from the list, if it's present
41+
core_dep_compile_args = []
42+
foreach value : core_lib.get('compile_args')
43+
if value != '-stdlib=libc++'
44+
core_dep_compile_args += value
45+
endif
46+
endforeach
47+
4848
# generate pkgconfig files
4949
pkg = import('pkgconfig')
5050

@@ -54,7 +54,8 @@ pkg.generate(
5454
name: 'oopetris-core',
5555
filebase: 'oopetris-core',
5656
subdirs: 'oopetris',
57-
extra_cflags: core_lib.get('compile_args'),
57+
extra_cflags: core_dep_compile_args,
58+
variables: ['compiler=' + pkg_cpp_compiler, 'cpp_stdlib=' + pkg_cpp_stdlib],
5859
)
5960

6061
# setting this to strings, so += {...} gets detected as an error, if it is done after that

src/libs/meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ core_lib += {
44
'inc_dirs': [core_lib.get('inc_dirs'), include_directories('.')],
55
}
66

7+
pkg_cpp_compiler = cpp.get_id()
8+
pkg_cpp_stdlib = 'unknown'
9+
if cpp.get_id() == 'clang'
10+
pkg_cpp_stdlib = build_with_libcpp ? 'libc++' : 'libstdc++'
11+
endif
12+
713
subdir('core')
814

915
recordings_lib += {

src/libs/recordings/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pkg.generate(
4949
filebase: 'oopetris-recordings',
5050
subdirs: 'oopetris',
5151
extra_cflags: recordings_lib.get('compile_args'),
52+
variables: ['compiler=' + pkg_cpp_compiler, 'cpp_stdlib=' + pkg_cpp_stdlib],
5253
)
5354

5455
# setting this to strings, so += {...} gets detected as an error, if it is done after that

0 commit comments

Comments
 (0)