Commit 1797b2a4 authored by Thomas Guillem's avatar Thomas Guillem

contrib: libplacebo: fix pthread link

parent 9e2aa213
From e4626984de40115af22041087936c3ad68401f75 Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Thu, 8 Nov 2018 10:09:19 +0100
Subject: [PATCH 1/2] build: fix lpthread dependency with glslang
"-pthread" is enough for a dynamic build. Indeed, the pthread API is used
within libplacebo, so the compiler know that it shoud link with pthread in that
case.
However, this may fail with static builds. If the code using libplacebo.a and
all glslang .a doesn't use the pthread API, the compiler won't link with
pthread. To work-around this issue, make libplacebo depends on -lpthread, if
present.
---
src/meson.build | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/meson.build b/src/meson.build
index 4d791c30d9..25b898b7a4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -90,6 +90,7 @@ tests = [
glslang_combined = disabler()
glslang_min_ver = 2763
glslang_req = get_option('glslang')
+glslang_pthread_deps = []
glslang_deps = [
cxx.find_library('glslang', required: glslang_req),
cxx.find_library('HLSL', required: glslang_req),
@@ -105,12 +106,14 @@ foreach d : glslang_deps
endforeach
if glslang_found
+ glslang_pthread_deps += cxx.find_library('pthread', required: false)
+
glslang_ver = cxx.get_define('GLSLANG_PATCH_LEVEL',
prefix: '#include <glslang/Include/revision.h>'
).to_int()
if glslang_ver >= glslang_min_ver
- glslang_combined = declare_dependency(dependencies: glslang_deps)
+ glslang_combined = declare_dependency(dependencies: glslang_deps + glslang_pthread_deps)
else
error('glslang revision @0@ too old! Must be at least @1@'
.format(glslang_ver, glslang_min_ver))
--
2.19.1
From 9b3c97d83d92b2f56120c08cd796e81410da45f2 Mon Sep 17 00:00:00 2001
From fd85596f1d684be20d383b7d6b01d19a6a576fdc Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Wed, 24 Oct 2018 10:28:55 +0200
Subject: [PATCH] meson: fix glslang search path
Subject: [PATCH 2/2] meson: fix glslang search path
---
src/meson.build | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/meson.build b/src/meson.build
index 6b2b07d56b..ff58b60f5f 100644
index 25b898b7a4..c63996f53f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -25,6 +25,12 @@ build_opts = [
......@@ -24,9 +24,9 @@ index 6b2b07d56b..ff58b60f5f 100644
cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')
@@ -91,12 +97,12 @@ glslang_combined = disabler()
glslang_min_ver = 2763
@@ -92,12 +98,12 @@ glslang_min_ver = 2763
glslang_req = get_option('glslang')
glslang_pthread_deps = []
glslang_deps = [
- cxx.find_library('glslang', required: glslang_req),
- cxx.find_library('HLSL', required: glslang_req),
......@@ -43,9 +43,9 @@ index 6b2b07d56b..ff58b60f5f 100644
]
glslang_found = true
@@ -106,11 +112,13 @@ endforeach
@@ -109,11 +115,13 @@ if glslang_found
glslang_pthread_deps += cxx.find_library('pthread', required: false)
if glslang_found
glslang_ver = cxx.get_define('GLSLANG_PATCH_LEVEL',
- prefix: '#include <glslang/Include/revision.h>'
+ prefix: '#include <glslang/Include/revision.h>',
......@@ -53,8 +53,8 @@ index 6b2b07d56b..ff58b60f5f 100644
).to_int()
if glslang_ver >= glslang_min_ver
- glslang_combined = declare_dependency(dependencies: glslang_deps)
+ glslang_combined = declare_dependency(dependencies: glslang_deps,
- glslang_combined = declare_dependency(dependencies: glslang_deps + glslang_pthread_deps)
+ glslang_combined = declare_dependency(dependencies: glslang_deps + glslang_pthread_deps,
+ include_directories : prefix_include)
else
error('glslang revision @0@ too old! Must be at least @1@'
......
......@@ -26,7 +26,8 @@ $(TARBALLS)/$(PLACEBO_ARCHIVE):
libplacebo: $(PLACEBO_ARCHIVE) .sum-libplacebo
$(UNPACK)
$(APPLY) $(SRC)/libplacebo/0001-meson-fix-glslang-search-path.patch
$(APPLY) $(SRC)/libplacebo/0001-build-fix-lpthread-dependency-with-glslang.patch
$(APPLY) $(SRC)/libplacebo/0002-meson-fix-glslang-search-path.patch
$(MOVE)
.libplacebo: libplacebo crossfile.meson
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment