Add correct rpath for dawn samples on linux when using gn build

Dawn Samples missing correct rpath settings on linux platform in
BUILD.gn. This failed program to find .so like libdawn_native on linux.
This commit is contained in:
Yan,Shaobo 2018-08-20 23:36:17 +08:00 committed by Corentin Wallez
parent 5800712897
commit d958b68cb2
1 changed files with 18 additions and 22 deletions

View File

@ -134,6 +134,20 @@ config("libdawn_public") {
]
}
# Executable needs an rpath to find our shared libraries on OSX and Linux
config("dawn_shared_library_public") {
if (is_mac) {
ldflags = [
"-rpath",
"@executable_path/",
]
}
if (is_linux) {
configs = [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
}
config("dawn_internal") {
include_dirs = [ "src" ]
@ -158,23 +172,16 @@ config("dawn_internal") {
defines += [ "DAWN_ENABLE_BACKEND_VULKAN" ]
}
configs = [ ":libdawn_public" ]
configs = [
":libdawn_public",
":dawn_shared_library_public",
]
# Only internal Dawn targets can use this config, this means only targets in
# this BUILD.gn file.
visibility = [ ":*" ]
}
# Executable needs an rpath to find our shared libraries on OSX
config("dawn_shared_library_public") {
if (is_mac) {
ldflags = [
"-rpath",
"@executable_path/",
]
}
}
static_library("dawn_common") {
sources = [
"src/common/Assert.cpp",
@ -253,7 +260,6 @@ shared_library("libdawn") {
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs = [ ":dawn_shared_library_public" ]
}
}
@ -601,7 +607,6 @@ shared_library("libdawn_native") {
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs += [ ":dawn_shared_library_public" ]
}
}
@ -655,7 +660,6 @@ shared_library("libdawn_wire") {
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs += [ ":dawn_shared_library_public" ]
}
}
@ -732,10 +736,6 @@ dawn_generator("mock_dawn_gen") {
test("dawn_unittests") {
configs += [ ":dawn_internal" ]
if (is_linux) {
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
deps = [
":dawn_common",
":dawn_headers",
@ -788,10 +788,6 @@ test("dawn_unittests") {
test("dawn_end2end_tests") {
configs += [ ":dawn_internal" ]
if (is_linux) {
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
deps = [
":dawn_common",
":dawn_utils",