Fix the @rpath of dawn_components

When the libdawn_native target was renamed to dawn_native, the output
library name stayed the same (GN inserts a lib prefix if it isn't
present) but the @rpath annotation changed to be just dawn_native.dylib.

Fix this by adding the lib prefix in the rpath annotation. This requires
changing libdawn_proc to dawn_proc otherwise the rpath annotation would
be liblibdawn_proc.dylib.

Bug: dawn:380
Change-Id: Id8610a6318af3468dcc486ee8d3c035f0273fe0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-09 17:31:40 +00:00 committed by Commit Bot service account
parent 0074b6e710
commit 6574f92747
2 changed files with 24 additions and 16 deletions

View File

@ -49,11 +49,11 @@ import("dawn_overrides_with_defaults.gni")
template("dawn_component") {
# Copy the target_name in the local scope so it doesn't get shadowed in the
# definition of targets.
libname = target_name
name = target_name
# The config that will apply to dependents of the shared library so they know
# they should "import" the symbols
config("${libname}_shared_public_config") {
config("${name}_shared_public_config") {
defines = [ "${invoker.DEFINE_PREFIX}_SHARED_LIBRARY" ]
# Executable needs an rpath to find our shared libraries on OSX and Linux
@ -68,8 +68,9 @@ template("dawn_component") {
}
}
shared_library("${libname}_shared") {
output_name = libname
shared_library("${name}_shared") {
# The "tool" for creating shared libraries will automatically add the "lib" prefix
output_name = name
# Copy all variables except "configs", which has a default value
forward_variables_from(invoker, "*", [ "configs" ])
@ -81,7 +82,7 @@ template("dawn_component") {
if (is_mac) {
ldflags = [
"-install_name",
"@rpath/${libname}.dylib",
"@rpath/lib${name}.dylib",
]
}
@ -89,7 +90,7 @@ template("dawn_component") {
if (!defined(public_configs)) {
public_configs = []
}
public_configs += [ ":${libname}_shared_public_config" ]
public_configs += [ ":${name}_shared_public_config" ]
# Tell sources of this library to export the symbols (and not import)
if (!defined(defines)) {
@ -106,8 +107,8 @@ template("dawn_component") {
}
}
static_library("${libname}_static") {
output_name = libname + "_static"
static_library("${name}_static") {
output_name = name + "_static"
complete_static_lib = dawn_complete_static_libs
@ -118,14 +119,14 @@ template("dawn_component") {
}
}
group(libname) {
group(name) {
if (is_component_build) {
public_deps = [
":${libname}_shared",
":${name}_shared",
]
} else {
public_deps = [
":${libname}_static",
":${name}_static",
]
}
}

View File

@ -88,25 +88,32 @@ source_set("dawncpp") {
}
###############################################################################
# libdawn_proc
# dawn_proc
###############################################################################
dawn_json_generator("libdawn_proc_gen") {
dawn_json_generator("dawn_proc_gen") {
target = "dawn_proc"
outputs = [
"src/dawn/dawn_proc.c",
]
}
dawn_component("libdawn_proc") {
dawn_component("dawn_proc") {
DEFINE_PREFIX = "WGPU"
public_deps = [
":dawn_headers",
]
deps = [
":libdawn_proc_gen",
":dawn_proc_gen",
]
sources = get_target_outputs(":libdawn_proc_gen")
sources = get_target_outputs(":dawn_proc_gen")
sources += [ "${dawn_root}/src/include/dawn/dawn_proc.h" ]
}
# Temporary group while we do a 3-way patch with Chromium
group("libdawn_proc") {
public_deps = [
":dawn_proc",
]
}