diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 20:41:28 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 20:41:28 +0000 |
commit | 63e39a28e492e8f9a10d05cd970da2a1d539c0f3 (patch) | |
tree | 60271c1be8eceb87e0f8206d18f65a88b5a3d286 | |
parent | 8c01b7f619cb7a166c2b78269aed9f2333ad89c9 (diff) | |
download | chromium_src-63e39a28e492e8f9a10d05cd970da2a1d539c0f3.zip chromium_src-63e39a28e492e8f9a10d05cd970da2a1d539c0f3.tar.gz chromium_src-63e39a28e492e8f9a10d05cd970da2a1d539c0f3.tar.bz2 |
Add COMPONENT_BUILD global define.
This avoids the need to define FOO_DLL macros for each project that we wish to
optionally build as a DLL (when component=="shared_library"). This in turn
means that we do not need direct_dependent_settings to define FOO_DLL, and that
means that we don't need to update projects to convert transitive dependencies
into explicit dependencies. This makes the component build more consistent
with the static build.
An alternative would be to use all_dependent_settings, but I feel that the
global approach is simpler as it creates less repetition in each target
definition for components.
A side-effect of this change is that I needed to make base_nacl_win64 be a
shared_library in the component build.
R=rvargas,bradnelson,evan
Review URL: http://codereview.chromium.org/7344022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92409 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/at_exit.cc | 2 | ||||
-rw-r--r-- | base/base.gypi | 49 | ||||
-rw-r--r-- | base/base_api.h | 4 | ||||
-rw-r--r-- | base/debug/debug_on_start_win.h | 4 | ||||
-rw-r--r-- | base/logging.h | 2 | ||||
-rw-r--r-- | build/common.gypi | 8 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/chrome_dll.gypi | 1 | ||||
-rw-r--r-- | chrome/chrome_exe.gypi | 1 | ||||
-rw-r--r-- | crypto/crypto.gyp | 6 | ||||
-rw-r--r-- | crypto/crypto_api.h | 4 | ||||
-rw-r--r-- | ipc/ipc.gypi | 1 | ||||
-rw-r--r-- | net/base/net_api.h | 4 | ||||
-rw-r--r-- | net/base/ssl_false_start_blacklist.h | 4 | ||||
-rw-r--r-- | net/net.gyp | 19 | ||||
-rw-r--r-- | sandbox/sandbox.gyp | 1 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_dummy.cc | 17 |
17 files changed, 67 insertions, 62 deletions
diff --git a/base/at_exit.cc b/base/at_exit.cc index cafe75b..c7daad4 100644 --- a/base/at_exit.cc +++ b/base/at_exit.cc @@ -22,7 +22,7 @@ static AtExitManager* g_top_manager = NULL; AtExitManager::AtExitManager() : next_manager_(g_top_manager) { // If multiple modules instantiate AtExitManagers they'll end up living in this // module... they have to coexist. -#if !defined(BASE_DLL) +#if !defined(COMPONENT_BUILD) DCHECK(!g_top_manager); #endif g_top_manager = this; diff --git a/base/base.gypi b/base/base.gypi index 79bff9b..ea23a8e 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -535,25 +535,13 @@ },], [ 'component=="shared_library"', { 'defines': [ - 'BASE_DLL', 'BASE_IMPLEMENTATION', ], 'conditions': [ ['OS=="win"', { - 'msvs_disabled_warnings': [ - 4251, - ], 'sources!': [ 'debug/debug_on_start_win.cc', ], - 'direct_dependent_settings': { - 'defines': [ - 'BASE_DLL', - ], - 'msvs_disabled_warnings': [ - 4251, - ], - }, }], ], }], @@ -605,7 +593,7 @@ 'targets': [ { 'target_name': 'base_nacl_win64', - 'type': 'static_library', + 'type': '<(component)', 'variables': { 'base_target': 1, }, @@ -631,6 +619,41 @@ 'msvs_target_platform': 'x64', }, }, + 'conditions': [ + [ 'component == "shared_library"', { + 'defines': [ + 'BASE_IMPLEMENTATION', + ], + 'sources!': [ + 'debug/debug_on_start_win.cc', + ], + }], + ], + }, + { + 'target_name': 'base_i18n_nacl_win64', + 'type': 'static_library', + # TODO(gregoryd): direct_dependent_settings should be shared with the + # 32-bit target, but it doesn't work due to a bug in gyp + 'direct_dependent_settings': { + 'include_dirs': [ + '..', + ], + }, + 'defines': [ + '<@(nacl_win64_defines)', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + 'i18n/icu_util_nacl_win64.cc', + ], + 'configurations': { + 'Common_Base': { + 'msvs_target_platform': 'x64', + }, + }, }, ], }], diff --git a/base/base_api.h b/base/base_api.h index 2361659..deeae07 100644 --- a/base/base_api.h +++ b/base/base_api.h @@ -6,7 +6,7 @@ #define BASE_BASE_API_H_ #pragma once -#if defined(BASE_DLL) +#if defined(COMPONENT_BUILD) #if defined(WIN32) #if defined(BASE_IMPLEMENTATION) @@ -19,7 +19,7 @@ #define BASE_API __attribute__((visibility("default"))) #endif -#else // defined(BASE_DLL) +#else // defined(COMPONENT_BUILD) #define BASE_API #endif diff --git a/base/debug/debug_on_start_win.h b/base/debug/debug_on_start_win.h index 4a5c120..86d4721 100644 --- a/base/debug/debug_on_start_win.h +++ b/base/debug/debug_on_start_win.h @@ -27,7 +27,7 @@ namespace debug { // There is no way for this code, as currently implemented, to work across DLLs. // TODO(rvargas): It looks like we really don't use this code, at least not for // Chrome. Figure out if it's really worth implementing something simpler. -#if !defined(BASE_DLL) +#if !defined(COMPONENT_BUILD) // Debug on start functions and data. class DebugOnStart { @@ -74,7 +74,7 @@ DECLSPEC_SELECTANY DebugOnStart::PIFV debug_on_start = &DebugOnStart::Init; #endif // _WIN64 -#endif // defined(BASE_DLL) +#endif // defined(COMPONENT_BUILD) } // namespace debug } // namespace base diff --git a/base/logging.h b/base/logging.h index 849de0e..0a3a6a3 100644 --- a/base/logging.h +++ b/base/logging.h @@ -469,7 +469,7 @@ std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) { } // MSVC doesn't like complex extern templates and DLLs. -#if !defined(COMPILER_MSVC) && defined(BASE_DLL) +#if !defined(COMPILER_MSVC) && !defined(COMPONENT_BUILD) // Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated // in logging.cc. extern template std::string* MakeCheckOpString<int, int>( diff --git a/build/common.gypi b/build/common.gypi index 4ed9fef..9b67d73 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -694,6 +694,9 @@ }, { # else: branding!="Chrome" 'defines': ['CHROMIUM_BUILD'], }], + ['component=="shared_library"', { + 'defines': ['COMPONENT_BUILD'], + }], ['toolkit_views==1', { 'defines': ['TOOLKIT_VIEWS=1'], }], @@ -922,6 +925,11 @@ }, }, }], + ['OS=="win" and component=="shared_library"', { + 'msvs_disabled_warnings': [ + 4251, # class 'std::xx' needs to have dll-interface. + ], + }], ['chromeos!=1', { 'sources/': [ ['exclude', '_chromeos\\.(h|cc)$'] ] }], diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 9edc4ef..83e8ea5 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -39,6 +39,8 @@ 'common_nacl_win64', 'common_constants_win64', 'installer_util_nacl_win64', + '../base/base.gyp:base_static_win64', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', ], 'allocator_target': '../base/allocator/allocator.gyp:allocator', 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 602e78c..e8919b0 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -588,6 +588,7 @@ '<@(nacl_win64_dependencies)', 'chrome_dll_version', 'nacl_win64', + '../base/base.gyp:base_i18n_nacl_win64', ], 'defines': [ '<@(nacl_win64_defines)', diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 6ab3910..84810ee 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -505,6 +505,7 @@ '../breakpad/breakpad.gyp:breakpad_handler_win64', '../breakpad/breakpad.gyp:breakpad_sender_win64', '../base/base.gyp:base_nacl_win64', + '../base/base.gyp:base_static_win64', '../sandbox/sandbox.gyp:sandbox_win64', ], 'defines': [ diff --git a/crypto/crypto.gyp b/crypto/crypto.gyp index a6df806..f660e4cd 100644 --- a/crypto/crypto.gyp +++ b/crypto/crypto.gyp @@ -76,14 +76,8 @@ }], [ 'component == "shared_library"', { 'defines': [ - 'CRYPTO_DLL', 'CRYPTO_IMPLEMENTATION', ], - 'direct_dependent_settings': { - 'defines': [ - 'CRYPTO_DLL', - ], - }, }], [ 'use_openssl==1', { # TODO(joth): Use a glob to match exclude patterns once the diff --git a/crypto/crypto_api.h b/crypto/crypto_api.h index b8af452..2787af8 100644 --- a/crypto/crypto_api.h +++ b/crypto/crypto_api.h @@ -6,7 +6,7 @@ #define CRYPTO_CRYPTO_API_H_ #pragma once -#if defined(CRYPTO_DLL) +#if defined(COMPONENT_BUILD) #if defined(WIN32) #if defined(CRYPTO_IMPLEMENTATION) @@ -19,7 +19,7 @@ #define CRYPTO_API __attribute__((visibility("default"))) #endif -#else // defined(CRYPTO_DLL) +#else // defined(COMPONENT_BUILD) #define CRYPTO_API #endif diff --git a/ipc/ipc.gypi b/ipc/ipc.gypi index 65966af..38aead2 100644 --- a/ipc/ipc.gypi +++ b/ipc/ipc.gypi @@ -84,6 +84,7 @@ }, 'dependencies': [ '../base/base.gyp:base_nacl_win64', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', ], # TODO(gregoryd): direct_dependent_settings should be shared with the # 32-bit target, but it doesn't work due to a bug in gyp diff --git a/net/base/net_api.h b/net/base/net_api.h index 610e974..4b017fd 100644 --- a/net/base/net_api.h +++ b/net/base/net_api.h @@ -10,7 +10,7 @@ // exported to consumers, and NET_TEST that allows unit tests to access features // not intended to be used directly by real consumers. -#if defined(NET_DLL) +#if defined(COMPONENT_BUILD) #if defined(WIN32) #if defined(NET_IMPLEMENTATION) @@ -26,7 +26,7 @@ #define NET_TEST __attribute__((visibility("default"))) #endif -#else /// defined(NET_DLL) +#else /// defined(COMPONENT_BUILD) #define NET_API #define NET_TEST #endif diff --git a/net/base/ssl_false_start_blacklist.h b/net/base/ssl_false_start_blacklist.h index 5222822..1759630 100644 --- a/net/base/ssl_false_start_blacklist.h +++ b/net/base/ssl_false_start_blacklist.h @@ -14,11 +14,11 @@ namespace net { // to TLS False Start. Because this set is several hundred long, it's // precompiled by the code in ssl_false_start_blacklist_process.cc into a hash // table for fast lookups. -class NET_TEST SSLFalseStartBlacklist { +class SSLFalseStartBlacklist { public: // IsMember returns true if the given host is in the blacklist. // host: a DNS name in dotted form (i.e. "www.example.com") - static bool IsMember(const char* host); + NET_TEST static bool IsMember(const char* host); // Hash returns the modified djb2 hash of the given string. static unsigned Hash(const char* str) { diff --git a/net/net.gyp b/net/net.gyp index 1eb0a8d..31afc17 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -822,27 +822,8 @@ ], [ 'component == "shared_library"', { 'defines': [ - 'NET_DLL', 'NET_IMPLEMENTATION', ], - 'direct_dependent_settings': { - 'defines': [ - 'NET_DLL', - ], - }, - 'conditions': [ - [ 'OS == "win"', { - 'msvs_disabled_warnings': [ - # class 'std::xx' needs to have dll-interface. - 4251, - ], - 'direct_dependent_settings': { - 'msvs_disabled_warnings': [ - 4251, - ], - }, - }], - ], }], [ 'OS == "mac"', { 'dependencies': [ diff --git a/sandbox/sandbox.gyp b/sandbox/sandbox.gyp index 26699ca..a9ea6f4 100644 --- a/sandbox/sandbox.gyp +++ b/sandbox/sandbox.gyp @@ -239,6 +239,7 @@ 'dependencies': [ '../testing/gtest.gyp:gtest', '../base/base.gyp:base_nacl_win64', + '../base/base.gyp:base_static_win64', ], 'configurations': { 'Common_Base': { diff --git a/ui/base/resource/resource_bundle_dummy.cc b/ui/base/resource/resource_bundle_dummy.cc index 82afaab..0dbf1f1 100644 --- a/ui/base/resource/resource_bundle_dummy.cc +++ b/ui/base/resource/resource_bundle_dummy.cc @@ -8,26 +8,19 @@ #include "base/logging.h" #include "base/synchronization/lock.h" -#include "ui/gfx/font.h" -#include "ui/gfx/platform_font_win.h" // NOTE(gregoryd): This is a hack to avoid creating more nacl_win64-specific // files. The font members of ResourceBundle are never initialized in our code -// so this destructor is never called. +// so we can get away with an empty class definition. namespace gfx { -Font::~Font() { - NOTREACHED(); -} -PlatformFontWin::HFontRef::~HFontRef() { - NOTREACHED(); -} +class Font {}; } namespace ui { ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; -/* static */ +// static std::string ResourceBundle::InitSharedInstance( const std::string& pref_locale) { DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; @@ -35,7 +28,7 @@ std::string ResourceBundle::InitSharedInstance( return std::string(); } -/* static */ +// static void ResourceBundle::CleanupSharedInstance() { if (g_shared_instance_) { delete g_shared_instance_; @@ -43,7 +36,7 @@ void ResourceBundle::CleanupSharedInstance() { } } -/* static */ +// static ResourceBundle& ResourceBundle::GetSharedInstance() { // Must call InitSharedInstance before this function. CHECK(g_shared_instance_ != NULL); |