Commit 83659026 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

leveldb: Fix the LEVELDB_EXPORT definition in component builds.

LEVELDB_EXPORT is defined in include/leveldb/export.h, and depends on
the definition of LEVELDB_SHARED_LIBRARY. In order for LEVELDB_EXPORT to
be defined consistently, LEVELDB_SHARED_LIBRARY must have the same
definition in leveldb and all targets using it.

Previously, LEVELDB_SHARED_LIBRARY was only defined for component builds
in the //third_party/leveldatabase target. This CL makes the definition
apply to //third_party/leveldatabase dependencies as well.

This CL also renames the //third_party/leveldb target to
//third_party/leveldb_static, to clarify its purpose.

The CL is associated with Bug 823071 because it blocks
https://crrev.com/c/1201856 from landing, which is relevant to that bug.

Bug: 823071
Change-Id: I4216fa52b5f7ed9540ec63be7c16dc7150e9c766
Reviewed-on: https://chromium-review.googlesource.com/1203876
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarChris Mumford <cmumford@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590131}
parent fa020b88
...@@ -118,17 +118,24 @@ leveldb_sources = [ ...@@ -118,17 +118,24 @@ leveldb_sources = [
"src/util/status.cc", "src/util/status.cc",
] ]
config("leveldb_component_config") {
if (is_component_build) {
# Must be exported to all dependencies so LEVELDB_EXPORT is correctly
# defined throughout the component build.
defines += [ "LEVELDB_SHARED_LIBRARY" ]
}
}
component("leveldatabase") { component("leveldatabase") {
sources = leveldb_sources sources = leveldb_sources
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
if (is_component_build) { public_configs = [
defines += [ "LEVELDB_SHARED_LIBRARY" ] ":leveldb_config",
} ":leveldb_component_config",
]
public_configs = [ ":leveldb_config" ]
deps = [ deps = [
"//base", "//base",
...@@ -150,8 +157,14 @@ component("leveldatabase") { ...@@ -150,8 +157,14 @@ component("leveldatabase") {
defines += [ "LEVELDB_COMPILE_LIBRARY" ] defines += [ "LEVELDB_COMPILE_LIBRARY" ]
} }
static_library("leveldb") { # leveldb does not mark symbols used by tests or its command-line utility as
visibility = [ ":*" ] # LEVELDB_EXPORT. So, these targets can only be linked statically against the
# leveldb source code.
static_library("leveldb_static") {
visibility = [
":leveldb_testutil",
":leveldb_leveldbutil",
]
sources = leveldb_sources sources = leveldb_sources
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
...@@ -191,6 +204,9 @@ if (!is_ios && !is_android) { ...@@ -191,6 +204,9 @@ if (!is_ios && !is_android) {
} }
static_library("leveldb_testutil") { static_library("leveldb_testutil") {
testonly = true
visibility = [ ":*" ]
sources = [ sources = [
"src/util/histogram.cc", "src/util/histogram.cc",
"src/util/histogram.h", "src/util/histogram.h",
...@@ -204,7 +220,7 @@ if (!is_ios && !is_android) { ...@@ -204,7 +220,7 @@ if (!is_ios && !is_android) {
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
public_deps = [ public_deps = [
":leveldb", ":leveldb_static",
] ]
deps = [ deps = [
"//base", "//base",
...@@ -349,7 +365,7 @@ if (!is_ios && !is_android) { ...@@ -349,7 +365,7 @@ if (!is_ios && !is_android) {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [ deps = [
":leveldb", ":leveldb_static",
] ]
} }
......
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