mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 19:01:24 +00:00
Add static library versions of libdawn*
Chromium will want to have both static and shared library versions of Dawn to use in non-component and component builds respectively. The *_export.h files are modified to noop when *_SHARED_LIBRARY is not defined so that the static library doesn't export symbols that aren't imported in dependents (this would break compilation on Windows). A dawn_library_combo is introduced in BUILD.gn that factors out all the logic needed to produce shared libraries and handle the _EXPORT macros. Also contains a fix to dawncpp to export only the methods that aren't defined in the header (otherwise they get defined multiple times) BUG=dawn:85 Change-Id: Ib747deb9308e1165dd66002487147ba279d3eac0 Reviewed-on: https://dawn-review.googlesource.com/c/3761 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
97d2a71684
commit
bd48385d50
257
BUILD.gn
257
BUILD.gn
@ -132,31 +132,115 @@ template("dawn_generator") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Template to produce static and shared versions of Dawn's libraries
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# Template that produces static and shared versions of the same library.
|
||||||
|
# - The shared version exports symbols and has dependent import the symbols
|
||||||
|
# as libname.so with target name libname_shared
|
||||||
|
# - The static library doesn't export symbols nor make dependents import them
|
||||||
|
# - The libname target is an alias for libname_shared. This is mostly to keep
|
||||||
|
# the GN convention that target_type(name) defines a "name" target.
|
||||||
|
#
|
||||||
|
# The DEFINE_PREFIX must be provided and must match the respective "_export.h"
|
||||||
|
# file.
|
||||||
|
#
|
||||||
|
# Example usage:
|
||||||
|
#
|
||||||
|
# dawn_static_and_shared_library("my_library") {
|
||||||
|
# // my_library_export.h must use the MY_LIBRARY_IMPLEMENTATION and
|
||||||
|
# // MY_LIBRARY_SHARED_LIBRARY macros.
|
||||||
|
# DEFINE_PREFIX = "MY_LIBRARY"
|
||||||
|
#
|
||||||
|
# sources = [...]
|
||||||
|
# deps = [...]
|
||||||
|
# configs = [...]
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# executable("foo") {
|
||||||
|
# deps = [ ":my_library_shared" ] // or :my_library for the same effect
|
||||||
|
# }
|
||||||
|
template("dawn_static_and_shared_library") {
|
||||||
|
# Copy the target_name in the local scope so it doesn't get shadowed in the
|
||||||
|
# definition of targets.
|
||||||
|
libname = 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") {
|
||||||
|
defines = [ "${invoker.DEFINE_PREFIX}_SHARED_LIBRARY" ]
|
||||||
|
|
||||||
|
# Executable needs an rpath to find our shared libraries on OSX and Linux
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-rpath",
|
||||||
|
"@executable_path/",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
if (is_linux) {
|
||||||
|
configs = [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_library("${libname}_shared") {
|
||||||
|
output_name = libname
|
||||||
|
|
||||||
|
# Copy all variables except "configs", which has a default value
|
||||||
|
forward_variables_from(invoker, "*", [ "configs" ])
|
||||||
|
if (defined(invoker.configs)) {
|
||||||
|
configs += invoker.configs
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell dependents where to find this shared library
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-install_name",
|
||||||
|
"@rpath/${libname}.dylib",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use the config that makes the ${DEFINE_PREFIX}_EXPORT macro do something
|
||||||
|
if (!defined(public_configs)) {
|
||||||
|
public_configs = []
|
||||||
|
}
|
||||||
|
public_configs += [ ":${libname}_shared_public_config" ]
|
||||||
|
|
||||||
|
# Tell sources of this library to export the symbols (and not import)
|
||||||
|
if (!defined(defines)) {
|
||||||
|
defines = []
|
||||||
|
}
|
||||||
|
defines += [ "${invoker.DEFINE_PREFIX}_IMPLEMENTATION" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
static_library("${libname}_static") {
|
||||||
|
output_name = libname
|
||||||
|
|
||||||
|
# Copy all variables except "configs", which has a default value
|
||||||
|
forward_variables_from(invoker, "*", [ "configs" ])
|
||||||
|
if (defined(invoker.configs)) {
|
||||||
|
configs += invoker.configs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group(libname) {
|
||||||
|
public_deps = [
|
||||||
|
":${libname}_shared",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Common dawn libraries and configs
|
# Common dawn libraries and configs
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
config("libdawn_public") {
|
config("dawn_public") {
|
||||||
include_dirs = [
|
include_dirs = [
|
||||||
target_gen_dir,
|
target_gen_dir,
|
||||||
"src/include",
|
"src/include",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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") {
|
config("dawn_internal") {
|
||||||
include_dirs = [ "src" ]
|
include_dirs = [ "src" ]
|
||||||
|
|
||||||
@ -181,10 +265,7 @@ config("dawn_internal") {
|
|||||||
defines += [ "DAWN_ENABLE_BACKEND_VULKAN" ]
|
defines += [ "DAWN_ENABLE_BACKEND_VULKAN" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
configs = [
|
configs = [ ":dawn_public" ]
|
||||||
":libdawn_public",
|
|
||||||
":dawn_shared_library_public",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Only internal Dawn targets can use this config, this means only targets in
|
# Only internal Dawn targets can use this config, this means only targets in
|
||||||
# this BUILD.gn file.
|
# this BUILD.gn file.
|
||||||
@ -220,7 +301,7 @@ static_library("dawn_common") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Dawn headers and libdawn.so
|
# Dawn headers
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
dawn_generator("dawn_headers_gen") {
|
dawn_generator("dawn_headers_gen") {
|
||||||
@ -233,7 +314,7 @@ dawn_generator("dawn_headers_gen") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
source_set("dawn_headers") {
|
source_set("dawn_headers") {
|
||||||
public_configs = [ ":libdawn_public" ]
|
public_configs = [ ":dawn_public" ]
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_headers_gen",
|
":dawn_headers_gen",
|
||||||
]
|
]
|
||||||
@ -246,6 +327,10 @@ source_set("dawn_headers") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# libdawn
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
dawn_generator("libdawn_gen") {
|
dawn_generator("libdawn_gen") {
|
||||||
target = "libdawn"
|
target = "libdawn"
|
||||||
outputs = [
|
outputs = [
|
||||||
@ -254,11 +339,9 @@ dawn_generator("libdawn_gen") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
config("libdawn_export") {
|
dawn_static_and_shared_library("libdawn") {
|
||||||
defines = [ "DAWN_IMPLEMENTATION" ]
|
DEFINE_PREFIX = "DAWN"
|
||||||
}
|
|
||||||
|
|
||||||
source_set("libdawn_sources") {
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":dawn_headers",
|
":dawn_headers",
|
||||||
]
|
]
|
||||||
@ -267,31 +350,10 @@ source_set("libdawn_sources") {
|
|||||||
":libdawn_gen",
|
":libdawn_gen",
|
||||||
]
|
]
|
||||||
sources = get_target_outputs(":libdawn_gen")
|
sources = get_target_outputs(":libdawn_gen")
|
||||||
|
|
||||||
# Put the export config public so that dependents use the same declspec.
|
|
||||||
public_configs = [ ":libdawn_export" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_library("libdawn") {
|
|
||||||
public_deps = [
|
|
||||||
":dawn_headers",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps = [
|
|
||||||
":libdawn_sources",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Tell dependents where to find this shared library
|
|
||||||
if (is_mac) {
|
|
||||||
ldflags = [
|
|
||||||
"-install_name",
|
|
||||||
"@rpath/${target_name}.dylib",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# libdawn_native.so
|
# libdawn_native
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
config("libdawn_native_internal") {
|
config("libdawn_native_internal") {
|
||||||
@ -303,10 +365,6 @@ config("libdawn_native_internal") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config("libdawn_native_export") {
|
|
||||||
defines = [ "DAWN_NATIVE_IMPLEMENTATION" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
dawn_generator("libdawn_native_utils_gen") {
|
dawn_generator("libdawn_native_utils_gen") {
|
||||||
target = "dawn_native_utils"
|
target = "dawn_native_utils"
|
||||||
outputs = [
|
outputs = [
|
||||||
@ -324,6 +382,7 @@ source_set("libdawn_native_headers") {
|
|||||||
public_deps = [
|
public_deps = [
|
||||||
":dawn_headers",
|
":dawn_headers",
|
||||||
]
|
]
|
||||||
|
public_configs = [ ":dawn_public" ]
|
||||||
sources = [
|
sources = [
|
||||||
"src/include/dawn_native/DawnNative.h",
|
"src/include/dawn_native/DawnNative.h",
|
||||||
"src/include/dawn_native/dawn_native_export.h",
|
"src/include/dawn_native/dawn_native_export.h",
|
||||||
@ -339,20 +398,16 @@ source_set("libdawn_native_headers") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The meat of the compilation for libdawn_native so that we can cheaply have
|
# The meat of the compilation for libdawn_native so that we can cheaply have
|
||||||
# shared_library / static_library / component versions of it.
|
# shared_library / static_library versions of it. It compiles all the files
|
||||||
|
# except those that define exported symbols.
|
||||||
source_set("libdawn_native_sources") {
|
source_set("libdawn_native_sources") {
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
":dawn_common",
|
||||||
|
":libdawn_native_headers",
|
||||||
":libdawn_native_utils_gen",
|
":libdawn_native_utils_gen",
|
||||||
"${dawn_spirv_tools_dir}:spvtools_val",
|
"${dawn_spirv_tools_dir}:spvtools_val",
|
||||||
"third_party:spirv_cross",
|
"third_party:spirv_cross",
|
||||||
]
|
]
|
||||||
public_deps = [
|
|
||||||
":libdawn_native_headers",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Put the export config public so that dependents use the same declspec.
|
|
||||||
public_configs = [ ":libdawn_native_export" ]
|
|
||||||
|
|
||||||
configs += [ ":libdawn_native_internal" ]
|
configs += [ ":libdawn_native_internal" ]
|
||||||
libs = []
|
libs = []
|
||||||
@ -383,7 +438,6 @@ source_set("libdawn_native_sources") {
|
|||||||
"src/dawn_native/ComputePassEncoder.h",
|
"src/dawn_native/ComputePassEncoder.h",
|
||||||
"src/dawn_native/ComputePipeline.cpp",
|
"src/dawn_native/ComputePipeline.cpp",
|
||||||
"src/dawn_native/ComputePipeline.h",
|
"src/dawn_native/ComputePipeline.h",
|
||||||
"src/dawn_native/DawnNative.cpp",
|
|
||||||
"src/dawn_native/Device.cpp",
|
"src/dawn_native/Device.cpp",
|
||||||
"src/dawn_native/Device.h",
|
"src/dawn_native/Device.h",
|
||||||
"src/dawn_native/Error.cpp",
|
"src/dawn_native/Error.cpp",
|
||||||
@ -447,7 +501,6 @@ source_set("libdawn_native_sources") {
|
|||||||
"src/dawn_native/d3d12/CommandBufferD3D12.h",
|
"src/dawn_native/d3d12/CommandBufferD3D12.h",
|
||||||
"src/dawn_native/d3d12/ComputePipelineD3D12.cpp",
|
"src/dawn_native/d3d12/ComputePipelineD3D12.cpp",
|
||||||
"src/dawn_native/d3d12/ComputePipelineD3D12.h",
|
"src/dawn_native/d3d12/ComputePipelineD3D12.h",
|
||||||
"src/dawn_native/d3d12/D3D12Backend.cpp",
|
|
||||||
"src/dawn_native/d3d12/DescriptorHeapAllocator.cpp",
|
"src/dawn_native/d3d12/DescriptorHeapAllocator.cpp",
|
||||||
"src/dawn_native/d3d12/DescriptorHeapAllocator.h",
|
"src/dawn_native/d3d12/DescriptorHeapAllocator.h",
|
||||||
"src/dawn_native/d3d12/DeviceD3D12.cpp",
|
"src/dawn_native/d3d12/DeviceD3D12.cpp",
|
||||||
@ -505,7 +558,6 @@ source_set("libdawn_native_sources") {
|
|||||||
"src/dawn_native/metal/Forward.h",
|
"src/dawn_native/metal/Forward.h",
|
||||||
"src/dawn_native/metal/InputStateMTL.h",
|
"src/dawn_native/metal/InputStateMTL.h",
|
||||||
"src/dawn_native/metal/InputStateMTL.mm",
|
"src/dawn_native/metal/InputStateMTL.mm",
|
||||||
"src/dawn_native/metal/MetalBackend.mm",
|
|
||||||
"src/dawn_native/metal/PipelineLayoutMTL.h",
|
"src/dawn_native/metal/PipelineLayoutMTL.h",
|
||||||
"src/dawn_native/metal/PipelineLayoutMTL.mm",
|
"src/dawn_native/metal/PipelineLayoutMTL.mm",
|
||||||
"src/dawn_native/metal/QueueMTL.h",
|
"src/dawn_native/metal/QueueMTL.h",
|
||||||
@ -531,7 +583,6 @@ source_set("libdawn_native_sources") {
|
|||||||
sources += [
|
sources += [
|
||||||
"src/dawn_native/null/DeviceNull.cpp",
|
"src/dawn_native/null/DeviceNull.cpp",
|
||||||
"src/dawn_native/null/DeviceNull.h",
|
"src/dawn_native/null/DeviceNull.h",
|
||||||
"src/dawn_native/null/NullBackend.cpp",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,7 +602,6 @@ source_set("libdawn_native_sources") {
|
|||||||
"src/dawn_native/opengl/Forward.h",
|
"src/dawn_native/opengl/Forward.h",
|
||||||
"src/dawn_native/opengl/InputStateGL.cpp",
|
"src/dawn_native/opengl/InputStateGL.cpp",
|
||||||
"src/dawn_native/opengl/InputStateGL.h",
|
"src/dawn_native/opengl/InputStateGL.h",
|
||||||
"src/dawn_native/opengl/OpenGLBackend.cpp",
|
|
||||||
"src/dawn_native/opengl/PersistentPipelineStateGL.cpp",
|
"src/dawn_native/opengl/PersistentPipelineStateGL.cpp",
|
||||||
"src/dawn_native/opengl/PersistentPipelineStateGL.h",
|
"src/dawn_native/opengl/PersistentPipelineStateGL.h",
|
||||||
"src/dawn_native/opengl/PipelineGL.cpp",
|
"src/dawn_native/opengl/PipelineGL.cpp",
|
||||||
@ -621,7 +671,6 @@ source_set("libdawn_native_sources") {
|
|||||||
"src/dawn_native/vulkan/TextureVk.h",
|
"src/dawn_native/vulkan/TextureVk.h",
|
||||||
"src/dawn_native/vulkan/UtilsVulkan.cpp",
|
"src/dawn_native/vulkan/UtilsVulkan.cpp",
|
||||||
"src/dawn_native/vulkan/UtilsVulkan.h",
|
"src/dawn_native/vulkan/UtilsVulkan.h",
|
||||||
"src/dawn_native/vulkan/VulkanBackend.cpp",
|
|
||||||
"src/dawn_native/vulkan/VulkanError.cpp",
|
"src/dawn_native/vulkan/VulkanError.cpp",
|
||||||
"src/dawn_native/vulkan/VulkanError.h",
|
"src/dawn_native/vulkan/VulkanError.h",
|
||||||
"src/dawn_native/vulkan/VulkanFunctions.cpp",
|
"src/dawn_native/vulkan/VulkanFunctions.cpp",
|
||||||
@ -632,29 +681,47 @@ source_set("libdawn_native_sources") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# The shared library for libdawn_native for use by samples, tests, etc.
|
# The static and shared libraries for libdawn_native. Most of the files are
|
||||||
shared_library("libdawn_native") {
|
# already compiled in libdawn_native_sources, but we still need to compile
|
||||||
deps = [
|
# files defining exported symbols.
|
||||||
":libdawn_native_sources",
|
dawn_static_and_shared_library("libdawn_native") {
|
||||||
]
|
DEFINE_PREFIX = "DAWN_NATIVE"
|
||||||
|
|
||||||
#Make headers publically visible
|
#Make headers publically visible
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":libdawn_native_headers",
|
":libdawn_native_headers",
|
||||||
]
|
]
|
||||||
public_configs = [ ":libdawn_public" ]
|
|
||||||
|
|
||||||
# Tell dependents where to find this shared library
|
deps = [
|
||||||
if (is_mac) {
|
":libdawn_native_sources",
|
||||||
ldflags = [
|
":dawn_common",
|
||||||
"-install_name",
|
]
|
||||||
"@rpath/${target_name}.dylib",
|
sources = [
|
||||||
]
|
"src/dawn_native/DawnNative.cpp",
|
||||||
|
]
|
||||||
|
configs = [ ":libdawn_native_internal" ]
|
||||||
|
|
||||||
|
if (dawn_enable_d3d12) {
|
||||||
|
sources += [ "src/dawn_native/d3d12/D3D12Backend.cpp" ]
|
||||||
|
}
|
||||||
|
if (dawn_enable_metal) {
|
||||||
|
sources += [ "src/dawn_native/metal/MetalBackend.mm" ]
|
||||||
|
}
|
||||||
|
if (dawn_enable_null) {
|
||||||
|
sources += [ "src/dawn_native/null/NullBackend.cpp" ]
|
||||||
|
}
|
||||||
|
if (dawn_enable_opengl) {
|
||||||
|
sources += [ "src/dawn_native/opengl/OpenGLBackend.cpp" ]
|
||||||
|
deps += [ "third_party:glad" ]
|
||||||
|
}
|
||||||
|
if (dawn_enable_vulkan) {
|
||||||
|
sources += [ "src/dawn_native/vulkan/VulkanBackend.cpp" ]
|
||||||
|
deps += [ "third_party:vulkan_headers" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# libdawn_wire.so
|
# libdawn_wire
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Public libdawn_wire headers so they can be publically visible for
|
# Public libdawn_wire headers so they can be publically visible for
|
||||||
@ -663,16 +730,13 @@ source_set("libdawn_wire_headers") {
|
|||||||
public_deps = [
|
public_deps = [
|
||||||
":dawn_headers",
|
":dawn_headers",
|
||||||
]
|
]
|
||||||
|
public_configs = [ ":dawn_public" ]
|
||||||
sources = [
|
sources = [
|
||||||
"src/include/dawn_wire/Wire.h",
|
"src/include/dawn_wire/Wire.h",
|
||||||
"src/include/dawn_wire/dawn_wire_export.h",
|
"src/include/dawn_wire/dawn_wire_export.h",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
config("libdawn_wire_export") {
|
|
||||||
defines = [ "DAWN_WIRE_IMPLEMENTATION" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
dawn_generator("libdawn_wire_gen") {
|
dawn_generator("libdawn_wire_gen") {
|
||||||
target = "dawn_wire"
|
target = "dawn_wire"
|
||||||
outputs = [
|
outputs = [
|
||||||
@ -684,14 +748,16 @@ dawn_generator("libdawn_wire_gen") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
source_set("libdawn_wire_sources") {
|
dawn_static_and_shared_library("libdawn_wire") {
|
||||||
|
DEFINE_PREFIX = "DAWN_WIRE"
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
":dawn_common",
|
||||||
":libdawn_wire_gen",
|
":libdawn_wire_gen",
|
||||||
":libdawn_wire_headers",
|
":libdawn_wire_headers",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [ ":dawn_internal" ]
|
configs = [ ":dawn_internal" ]
|
||||||
sources = get_target_outputs(":libdawn_wire_gen")
|
sources = get_target_outputs(":libdawn_wire_gen")
|
||||||
sources += [ "src/dawn_wire/WireCmd.h" ]
|
sources += [ "src/dawn_wire/WireCmd.h" ]
|
||||||
|
|
||||||
@ -699,30 +765,6 @@ source_set("libdawn_wire_sources") {
|
|||||||
public_deps = [
|
public_deps = [
|
||||||
":libdawn_wire_headers",
|
":libdawn_wire_headers",
|
||||||
]
|
]
|
||||||
public_configs = [ ":libdawn_public" ]
|
|
||||||
|
|
||||||
# Put the export config public so that dependents use the same declspec.
|
|
||||||
public_configs += [ ":libdawn_wire_export" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_library("libdawn_wire") {
|
|
||||||
deps = [
|
|
||||||
":libdawn_wire_sources",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Make headers publically visible
|
|
||||||
public_deps = [
|
|
||||||
":libdawn_wire_headers",
|
|
||||||
]
|
|
||||||
public_configs = [ ":libdawn_public" ]
|
|
||||||
|
|
||||||
# Tell dependents where to find this shared library
|
|
||||||
if (is_mac) {
|
|
||||||
ldflags = [
|
|
||||||
"-install_name",
|
|
||||||
"@rpath/${target_name}.dylib",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -806,6 +848,7 @@ test("dawn_unittests") {
|
|||||||
":dawn_utils",
|
":dawn_utils",
|
||||||
":libdawn",
|
":libdawn",
|
||||||
":libdawn_native_sources",
|
":libdawn_native_sources",
|
||||||
|
":libdawn_native",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
":mock_dawn_gen",
|
":mock_dawn_gen",
|
||||||
"third_party:gmock_and_gtest",
|
"third_party:gmock_and_gtest",
|
||||||
|
@ -130,9 +130,9 @@ namespace dawn {
|
|||||||
{% macro render_cpp_method_declaration(type, method) %}
|
{% macro render_cpp_method_declaration(type, method) %}
|
||||||
{% set CppType = as_cppType(type.name) %}
|
{% set CppType = as_cppType(type.name) %}
|
||||||
{% if method.return_type.name.concatcase() == "void" and type.is_builder -%}
|
{% if method.return_type.name.concatcase() == "void" and type.is_builder -%}
|
||||||
{{CppType}} const&
|
DAWN_EXPORT {{CppType}} const&
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{as_cppType(method.return_type.name)}}
|
DAWN_EXPORT {{as_cppType(method.return_type.name)}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{{" "}}{{method.name.CamelCase()}}(
|
{{" "}}{{method.name.CamelCase()}}(
|
||||||
{%- for arg in method.arguments -%}
|
{%- for arg in method.arguments -%}
|
||||||
@ -149,7 +149,7 @@ namespace dawn {
|
|||||||
{% for type in by_category["object"] %}
|
{% for type in by_category["object"] %}
|
||||||
{% set CppType = as_cppType(type.name) %}
|
{% set CppType = as_cppType(type.name) %}
|
||||||
{% set CType = as_cType(type.name) %}
|
{% set CType = as_cType(type.name) %}
|
||||||
class DAWN_EXPORT {{CppType}} : public ObjectBase<{{CppType}}, {{CType}}> {
|
class {{CppType}} : public ObjectBase<{{CppType}}, {{CType}}> {
|
||||||
public:
|
public:
|
||||||
using ObjectBase::ObjectBase;
|
using ObjectBase::ObjectBase;
|
||||||
using ObjectBase::operator=;
|
using ObjectBase::operator=;
|
||||||
@ -160,8 +160,8 @@ namespace dawn {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend ObjectBase<{{CppType}}, {{CType}}>;
|
friend ObjectBase<{{CppType}}, {{CType}}>;
|
||||||
static void DawnReference({{CType}} handle);
|
static DAWN_EXPORT void DawnReference({{CType}} handle);
|
||||||
static void DawnRelease({{CType}} handle);
|
static DAWN_EXPORT void DawnRelease({{CType}} handle);
|
||||||
};
|
};
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -164,10 +164,8 @@ dawn_fuzzer_test("dawn_wire_server_and_frontend_fuzzer") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"${dawn_top_level}:libdawn_sources",
|
"${dawn_top_level}:libdawn_static",
|
||||||
"${dawn_top_level}:libdawn_native_sources",
|
"${dawn_top_level}:libdawn_native_static",
|
||||||
"${dawn_top_level}:libdawn_wire_sources",
|
"${dawn_top_level}:libdawn_wire_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
additional_configs = [ "${dawn_top_level}:dawn_shared_library_public" ]
|
|
||||||
}
|
}
|
||||||
|
@ -15,18 +15,22 @@
|
|||||||
#ifndef DAWN_EXPORT_H_
|
#ifndef DAWN_EXPORT_H_
|
||||||
#define DAWN_EXPORT_H_
|
#define DAWN_EXPORT_H_
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(DAWN_SHARED_LIBRARY)
|
||||||
# if defined(DAWN_IMPLEMENTATION)
|
# if defined(_WIN32)
|
||||||
# define DAWN_EXPORT __declspec(dllexport)
|
# if defined(DAWN_IMPLEMENTATION)
|
||||||
# else
|
# define DAWN_EXPORT __declspec(dllexport)
|
||||||
# define DAWN_EXPORT __declspec(dllimport)
|
# else
|
||||||
# endif
|
# define DAWN_EXPORT __declspec(dllimport)
|
||||||
#else
|
# endif
|
||||||
# if defined(DAWN_IMPLEMENTATION)
|
# else // defined(_WIN32)
|
||||||
# define DAWN_EXPORT __attribute__((visibility("default")))
|
# if defined(DAWN_IMPLEMENTATION)
|
||||||
# else
|
# define DAWN_EXPORT __attribute__((visibility("default")))
|
||||||
# define DAWN_EXPORT
|
# else
|
||||||
# endif
|
# define DAWN_EXPORT
|
||||||
#endif
|
# endif
|
||||||
|
# endif // defined(_WIN32)
|
||||||
|
#else // defined(DAWN_SHARED_LIBRARY)
|
||||||
|
# define DAWN_EXPORT
|
||||||
|
#endif // defined(DAWN_SHARED_LIBRARY)
|
||||||
|
|
||||||
#endif // DAWN_EXPORT_H_
|
#endif // DAWN_EXPORT_H_
|
||||||
|
@ -15,18 +15,22 @@
|
|||||||
#ifndef DAWNNATIVE_EXPORT_H_
|
#ifndef DAWNNATIVE_EXPORT_H_
|
||||||
#define DAWNNATIVE_EXPORT_H_
|
#define DAWNNATIVE_EXPORT_H_
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(DAWN_NATIVE_SHARED_LIBRARY)
|
||||||
# if defined(DAWN_NATIVE_IMPLEMENTATION)
|
# if defined(_WIN32)
|
||||||
# define DAWN_NATIVE_EXPORT __declspec(dllexport)
|
# if defined(DAWN_NATIVE_IMPLEMENTATION)
|
||||||
# else
|
# define DAWN_NATIVE_EXPORT __declspec(dllexport)
|
||||||
# define DAWN_NATIVE_EXPORT __declspec(dllimport)
|
# else
|
||||||
# endif
|
# define DAWN_NATIVE_EXPORT __declspec(dllimport)
|
||||||
#else
|
# endif
|
||||||
# if defined(DAWN_NATIVE_IMPLEMENTATION)
|
# else // defined(_WIN32)
|
||||||
# define DAWN_NATIVE_EXPORT __attribute__((visibility("default")))
|
# if defined(DAWN_NATIVE_IMPLEMENTATION)
|
||||||
# else
|
# define DAWN_NATIVE_EXPORT __attribute__((visibility("default")))
|
||||||
# define DAWN_NATIVE_EXPORT
|
# else
|
||||||
# endif
|
# define DAWN_NATIVE_EXPORT
|
||||||
#endif
|
# endif
|
||||||
|
# endif // defined(_WIN32)
|
||||||
|
#else // defined(DAWN_NATIVE_SHARED_LIBRARY)
|
||||||
|
# define DAWN_NATIVE_EXPORT
|
||||||
|
#endif // defined(DAWN_NATIVE_SHARED_LIBRARY)
|
||||||
|
|
||||||
#endif // DAWNNATIVE_EXPORT_H_
|
#endif // DAWNNATIVE_EXPORT_H_
|
||||||
|
@ -15,18 +15,22 @@
|
|||||||
#ifndef DAWNWIRE_EXPORT_H_
|
#ifndef DAWNWIRE_EXPORT_H_
|
||||||
#define DAWNWIRE_EXPORT_H_
|
#define DAWNWIRE_EXPORT_H_
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(DAWN_WIRE_SHARED_LIBRARY)
|
||||||
# if defined(DAWN_WIRE_IMPLEMENTATION)
|
# if defined(_WIN32)
|
||||||
# define DAWN_WIRE_EXPORT __declspec(dllexport)
|
# if defined(DAWN_WIRE_IMPLEMENTATION)
|
||||||
# else
|
# define DAWN_WIRE_EXPORT __declspec(dllexport)
|
||||||
# define DAWN_WIRE_EXPORT __declspec(dllimport)
|
# else
|
||||||
# endif
|
# define DAWN_WIRE_EXPORT __declspec(dllimport)
|
||||||
#else
|
# endif
|
||||||
# if defined(DAWN_WIRE_IMPLEMENTATION)
|
# else // defined(_WIN32)
|
||||||
# define DAWN_WIRE_EXPORT __attribute__((visibility("default")))
|
# if defined(DAWN_WIRE_IMPLEMENTATION)
|
||||||
# else
|
# define DAWN_WIRE_EXPORT __attribute__((visibility("default")))
|
||||||
# define DAWN_WIRE_EXPORT
|
# else
|
||||||
# endif
|
# define DAWN_WIRE_EXPORT
|
||||||
#endif
|
# endif
|
||||||
|
# endif // defined(_WIN32)
|
||||||
|
#else // defined(DAWN_WIRE_SHARED_LIBRARY)
|
||||||
|
# define DAWN_WIRE_EXPORT
|
||||||
|
#endif // defined(DAWN_WIRE_SHARED_LIBRARY)
|
||||||
|
|
||||||
#endif // DAWNWIRE_EXPORT_H_
|
#endif // DAWNWIRE_EXPORT_H_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user