Merge pull request #97 from atom/component_build

Add support for shared_library and static_library build of libchromiumcontent
This commit is contained in:
Cheng Zhao 2015-04-11 13:47:51 +08:00
commit 5c9a1d9a43
8 changed files with 623 additions and 350 deletions

View file

@ -1,136 +1,203 @@
{
'includes': [
'brightray.gypi',
],
'variables': {
'brightray_source_root': '<!(["python", "tools/brightray_source_root.py"])',
# The libraries brightray will be compiled to.
'linux_system_libraries': 'gtk+-2.0 libnotify dbus-1 x11 xrandr xext gconf-2.0'
},
'includes': [
'filenames.gypi',
],
'targets': [
{
'target_name': 'brightray',
'type': 'static_library',
'include_dirs': [
'.',
'<(libchromiumcontent_include_dir)',
'<(libchromiumcontent_include_dir)/skia/config',
'<(libchromiumcontent_include_dir)/third_party/skia/include/core',
'<(libchromiumcontent_include_dir)/third_party/WebKit',
'<(libchromiumcontent_library_dir)/gen',
'<(libchromiumcontent_src_dir)',
'<(libchromiumcontent_src_dir)/skia/config',
'<(libchromiumcontent_src_dir)/third_party/skia/include/core',
'<(libchromiumcontent_src_dir)/third_party/WebKit',
'<(libchromiumcontent_dir)/gen',
],
'direct_dependent_settings': {
'include_dirs': [
'.',
'..',
'<(libchromiumcontent_include_dir)',
'<(libchromiumcontent_include_dir)/skia/config',
'<(libchromiumcontent_include_dir)/third_party/skia/include/core',
'<(libchromiumcontent_include_dir)/third_party/icu/source/common',
'<(libchromiumcontent_include_dir)/third_party/WebKit',
'<(libchromiumcontent_library_dir)/gen',
'<(libchromiumcontent_src_dir)',
'<(libchromiumcontent_src_dir)/skia/config',
'<(libchromiumcontent_src_dir)/third_party/skia/include/core',
'<(libchromiumcontent_src_dir)/third_party/icu/source/common',
'<(libchromiumcontent_src_dir)/third_party/WebKit',
'<(libchromiumcontent_dir)/gen',
],
},
'sources': [
'browser/brightray_paths.h',
'browser/browser_client.cc',
'browser/browser_client.h',
'browser/browser_context.cc',
'browser/browser_context.h',
'browser/browser_main_parts.cc',
'browser/browser_main_parts.h',
'browser/browser_main_parts_mac.mm',
'browser/default_web_contents_delegate.cc',
'browser/default_web_contents_delegate.h',
'browser/default_web_contents_delegate_mac.mm',
'browser/devtools_contents_resizing_strategy.cc',
'browser/devtools_contents_resizing_strategy.h',
'browser/devtools_embedder_message_dispatcher.cc',
'browser/devtools_embedder_message_dispatcher.h',
'browser/devtools_manager_delegate.cc',
'browser/devtools_manager_delegate.h',
'browser/devtools_ui.cc',
'browser/devtools_ui.h',
'browser/inspectable_web_contents.cc',
'browser/inspectable_web_contents.h',
'browser/inspectable_web_contents_delegate.cc',
'browser/inspectable_web_contents_delegate.h',
'browser/inspectable_web_contents_impl.cc',
'browser/inspectable_web_contents_impl.h',
'browser/inspectable_web_contents_view.h',
'browser/inspectable_web_contents_view_mac.h',
'browser/inspectable_web_contents_view_mac.mm',
'browser/mac/bry_application.h',
'browser/mac/bry_application.mm',
'browser/mac/bry_inspectable_web_contents_view.h',
'browser/mac/bry_inspectable_web_contents_view.mm',
'browser/media/media_capture_devices_dispatcher.cc',
'browser/media/media_capture_devices_dispatcher.h',
'browser/media/media_stream_devices_controller.cc',
'browser/media/media_stream_devices_controller.h',
'browser/network_delegate.cc',
'browser/network_delegate.h',
'browser/notification_presenter.h',
'browser/notification_presenter_mac.h',
'browser/notification_presenter_mac.mm',
'browser/platform_notification_service_impl.cc',
'browser/platform_notification_service_impl.h',
'browser/linux/notification_presenter_linux.h',
'browser/linux/notification_presenter_linux.cc',
'browser/url_request_context_getter.cc',
'browser/url_request_context_getter.h',
'browser/views/inspectable_web_contents_view_views.h',
'browser/views/inspectable_web_contents_view_views.cc',
'browser/views/views_delegate.cc',
'browser/views/views_delegate.h',
'browser/web_ui_controller_factory.cc',
'browser/web_ui_controller_factory.h',
'common/application_info.h',
'common/application_info_mac.mm',
'common/application_info_win.cc',
'common/content_client.cc',
'common/content_client.h',
'common/mac/foundation_util.h',
'common/mac/main_application_bundle.h',
'common/mac/main_application_bundle.mm',
'common/main_delegate.cc',
'common/main_delegate.h',
'common/main_delegate_mac.mm',
],
'sources': [ '<@(brightray_sources)' ],
'conditions': [
# Link with libraries of libchromiumcontent.
['OS=="linux" and libchromiumcontent_component==0', {
# On Linux we have to use "--whole-archive" to force executable
# to include all symbols, otherwise we will have plenty of
# unresolved symbols errors.
'direct_dependent_settings': {
'ldflags': [
'-Wl,--whole-archive',
'<@(libchromiumcontent_libraries)',
'-Wl,--no-whole-archive',
],
}
}, { # (Release build on Linux)
'link_settings': {
'libraries': [ '<@(libchromiumcontent_libraries)' ]
},
}], # (Normal builds)
# Linux specific link settings.
['OS=="linux"', {
'cflags_cc': [
'-Wno-deprecated-register',
'-fno-rtti',
],
'link_settings': {
'ldflags': [
'<!@(pkg-config --libs-only-L --libs-only-other gtk+-2.0 libnotify dbus-1 x11 xrandr xext gconf-2.0)',
'<!@(pkg-config --libs-only-L --libs-only-other <(linux_system_libraries))',
],
'libraries': [
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/libchromiumcontent.so',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/libchromiumviews.a',
'-lpthread',
'<!@(pkg-config --libs-only-l gtk+-2.0 libnotify dbus-1 x11 xrandr xext gconf-2.0)',
'<!@(pkg-config --libs-only-l <(linux_system_libraries))',
],
},
}],
'cflags': [
'<!@(pkg-config --cflags <(linux_system_libraries))',
# Needed by using libgtk2ui:
'-Wno-deprecated-register',
],
'direct_dependent_settings': {
'cflags': [
'<!@(pkg-config --cflags <(linux_system_libraries))',
'-Wno-deprecated-register',
],
},
'conditions': [
['libchromiumcontent_component', {
'link_settings': {
'libraries': [
# libgtk2ui is always linked statically.
'<(libchromiumcontent_dir)/libgtk2ui.a',
],
},
}, {
'link_settings': {
'libraries': [
# Following libraries are required by libchromiumcontent:
'-lasound',
'-lcap',
'-lcups',
'-lrt',
'-ldl',
'-lresolv',
'-lfontconfig',
'-lfreetype',
'-lX11 -lXi -lXcursor -lXext -lXfixes -lXrender -lXcomposite -lXdamage -lXtst -lXrandr',
'-lexpat',
],
},
}],
],
}], # OS=="linux"
['OS=="mac"', {
'link_settings': {
'libraries': [
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/libchromiumcontent.dylib',
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
],
},
}],
'conditions': [
# Link with system frameworks.
['libchromiumcontent_component==0', {
'link_settings': {
'libraries': [
# ui_base.gypi:
'$(SDKROOT)/System/Library/Frameworks/Accelerate.framework',
# net.gypi:
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
'$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
'$(SDKROOT)/usr/lib/libresolv.dylib',
# media.gyp:
'$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework',
'$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreMIDI.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreVideo.framework',
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
'$(SDKROOT)/System/Library/Frameworks/QTKit.framework',
# surface.gyp:
'$(SDKROOT)/System/Library/Frameworks/IOSurface.framework',
# content_common.gypi:
'$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
# base.gyp:
'$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework',
'$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
'$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
# content_browser.gypi:
'$(SDKROOT)/usr/lib/libbsm.dylib',
],
},
}],
]
}], # OS=="mac"
['OS=="win"', {
'link_settings': {
'libraries': [
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/base_static.lib',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/chromiumcontent.dll.lib',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/chromiumviews.lib',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/sandbox_static.lib',
],
},
}],
'conditions': [
['libchromiumcontent_component', {
# sandbox and base_static are always linked statically.
'link_settings': {
'libraries': [
'<(libchromiumcontent_dir)/base_static.lib',
'<(libchromiumcontent_dir)/sandbox.lib',
],
},
}, {
# Link with system libraries.
'link_settings': {
'libraries': [
# ffmpegsumo.lib is required for linking with ffmpegsumo.dll
'<(libchromiumcontent_dir)/ffmpegsumo.lib',
# content_browser.gypi:
'-lsensorsapi.lib',
'-lportabledeviceguids.lib',
# content_common.gypi:
'-ld3d9.lib',
'-ldxva2.lib',
'-lstrmiids.lib',
'-lmf.lib',
'-lmfplat.lib',
'-lmfuuid.lib',
# media.gyp:
'-lmfreadwrite.lib',
],
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'advapi32.lib',
'dbghelp.lib',
'dwmapi.lib',
'gdi32.lib',
'netapi32.lib',
'oleacc.lib',
'powrprof.lib',
'user32.lib',
'usp10.lib',
'version.lib',
'winspool.lib',
],
'DelayLoadDLLs': [
'ffmpegsumo.dll',
# content_common.gypi:
'd3d9.dll',
'dxva2.dll',
'mf.dll',
'mfplat.dll',
],
},
},
},
}], # libchromiumcontent_component
],
}], # OS=="win"
],
},
],

View file

@ -1,49 +1,42 @@
{
'includes': [
'vendor/download/libchromiumcontent/filenames.gypi',
],
'variables': {
'libchromiumcontent_dir': 'vendor/download/libchromiumcontent',
'libchromiumcontent_library_dir': '<(libchromiumcontent_dir)/Release',
'libchromiumcontent_include_dir': '<(libchromiumcontent_dir)/src',
'libchromiumcontent_resources_dir': '<(libchromiumcontent_library_dir)',
'libchromiumcontent_src_dir': '<(libchromiumcontent_dir)/src',
'mac_deployment_target%': '10.8',
'mac_sdkroot%': 'macosx',
# Build with clang on Linux and Mac.
'clang%': 1,
# Build with clang under Linux.
'linux_clang%': 1,
'win_release_RuntimeLibrary%': '2', # /MD (nondebug DLL)
'win_debug_RuntimeLibrary%': '3', # /MTd (debug DLL)
# See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
'win_release_Optimization%': '2', # 2 = /Os
'win_debug_Optimization%': '0', # 0 = /Od
# See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
# Tri-state: blank is default, 1 on, 0 off
'win_release_OmitFramePointers%': '0',
# Tri-state: blank is default, 1 on, 0 off
'win_debug_OmitFramePointers%': '',
# See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
'win_debug_RuntimeChecks%': '3', # 3 = all checks enabled, 0 = off
# See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
'win_debug_InlineFunctionExpansion%': '', # empty = default, 0 = off,
'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
'libchromiumcontent_src_dir': '<(libchromiumcontent_root_dir)/src',
'libchromiumcontent_component%': 1,
'conditions': [
# The "libchromiumcontent_component" is defined when calling "gyp".
['libchromiumcontent_component', {
'libchromiumcontent_dir%': '<(libchromiumcontent_root_dir)/shared_library',
'libchromiumcontent_libraries%': '<(libchromiumcontent_shared_libraries)',
'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_shared_v8_libraries)',
}, {
'libchromiumcontent_dir%': '<(libchromiumcontent_root_dir)/static_library',
'libchromiumcontent_libraries%': '<(libchromiumcontent_static_libraries)',
'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_static_v8_libraries)',
}],
],
},
'target_defaults': {
'includes': [
# Rules for excluding e.g. foo_win.cc from the build on non-Windows.
'filename_rules.gypi',
],
# Putting this in "configurations" will make overrides not working.
'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'ARCHS': ['x86_64'],
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'CLANG_CXX_LIBRARY': 'libc++',
'COMBINE_HIDPI_IMAGES': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',
'GCC_ENABLE_CPP_RTTI': 'NO',
'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
'MACOSX_DEPLOYMENT_TARGET': '10.8',
'RUN_CLANG_STATIC_ANALYZER': 'YES',
'SDKROOT': '<(mac_sdkroot)',
'SDKROOT': 'macosx',
'USE_HEADER_MAP': 'NO',
'WARNING_CFLAGS': [
'-Wall',
@ -52,16 +45,80 @@
'-Wno-missing-field-initializers',
],
},
'msvs_configuration_attributes': {
'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
'CharacterSet': '1',
},
'msvs_system_include_dirs': [
'$(VSInstallDir)/VC/atlmfc/include',
],
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': ['/MP'],
'MinimalRebuild': 'false',
'BufferSecurityCheck': 'true',
'EnableFunctionLevelLinking': 'true',
'RuntimeTypeInfo': 'false',
'WarningLevel': '4',
'WarnAsError': 'true',
'DebugInformationFormat': '3',
# Programs that use the Standard C++ library must be compiled with
# C++
# exception handling enabled.
# http://support.microsoft.com/kb/154419
'ExceptionHandling': 1,
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
'MapFileName': '$(OutDir)\\$(TargetName).map',
'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
'AdditionalOptions': [
# ATL 8.0 included in WDK 7.1 makes the linker to generate
# following
# warnings:
# - warning LNK4254: section 'ATL' (50000040) merged into
# '.rdata' (40000040) with different attributes
# - warning LNK4078: multiple 'ATL' sections found with
# different attributes
'/ignore:4254',
'/ignore:4078',
# views_chromiumcontent.lib generates this warning because it's
# symobls are defined as dllexport but used as static library:
# - warning LNK4217: locally defined symbol imported in function
# - warning LNK4049: locally defined symbol imported
'/ignore:4217',
'/ignore:4049',
],
},
},
'msvs_disabled_warnings': [
4100, # unreferenced formal parameter
4127, # conditional expression is constant
4189, # local variable is initialized but not referenced
4244, # 'initializing' : conversion from 'double' to 'size_t', possible loss of data
4245, # 'initializing' : conversion from 'int' to 'const net::QuicVersionTag', signed/unsigned mismatch
4251, # class 'std::xx' needs to have dll-interface.
4310, # cast truncates constant value
4355, # 'this' : used in base member initializer list
4480, # nonstandard extension used: specifying underlying type for enum
4481, # nonstandard extension used: override specifier 'override'
4510, # default constructor could not be generated
4512, # assignment operator could not be generated
4610, # user defined constructor required
4702, # unreachable code
4819, # The file contains a character that cannot be represented in the current code page
],
'configurations': {
# The "Debug" and "Release" configurations are not actually used.
'Debug': {},
'Release': {},
'Common_Base': {
'abstract': 1,
'defines': [
'COMPONENT_BUILD',
'GURL_DLL',
'SKIA_DLL',
# We are using Release version libchromiumcontent:
'NDEBUG',
'USING_V8_SHARED',
'WEBKIT_DLL',
# From skia_for_chromium_defines.gypi:
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
'SK_SUPPORT_LEGACY_BITMAP_CONFIG',
@ -71,29 +128,11 @@
'SK_IGNORE_ETC1_SUPPORT',
'SK_IGNORE_GPU_DITHER',
],
'msvs_configuration_attributes': {
'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
'CharacterSet': '1',
},
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'advapi32.lib',
'dwmapi.lib',
'gdi32.lib',
'oleacc.lib',
'user32.lib',
],
},
},
'conditions': [
['OS!="mac"', {
'defines': [
'TOOLKIT_VIEWS',
'USE_AURA',
'VIEWS_IMPLEMENTATION',
'WEBVIEW_IMPLEMENTATION',
],
}],
['OS not in ["mac", "win"]', {
@ -101,123 +140,176 @@
'USE_X11',
],
}],
['OS=="linux"', {
'cflags_cc': [
'-D__STRICT_ANSI__',
'-std=gnu++11',
'-fno-rtti',
],
}], # OS=="linux"
['OS=="win"', {
'include_dirs': [
'<(libchromiumcontent_src_dir)/third_party/wtl/include',
],
'defines': [
'_WIN32_WINNT=0x0602',
'WINVER=0x0602',
'WIN32',
'_WINDOWS',
'NOMINMAX',
'PSAPI_VERSION=1',
'_CRT_RAND_S',
'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
'WIN32_LEAN_AND_MEAN',
'_ATL_NO_OPENGL',
'_SECURE_ATL',
],
}], # OS=="win"
],
},
'Debug': {
'inherit_from': [
'Common_Base',
}, # Common_Base
'Debug_Base': {
'abstract': 1,
'defines': [
# Use this instead of "NDEBUG" to determine whether we are in
# Debug build, because "NDEBUG" is already used by Chromium.
'DEBUG',
# Require when using libchromiumcontent.
'COMPONENT_BUILD',
'GURL_DLL',
'SKIA_DLL',
'USING_V8_SHARED',
'WEBKIT_DLL',
],
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '<(win_debug_Optimization)',
'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
# We use Release to match the version of chromiumcontent.dll we
# link against.
'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
'conditions': [
# According to MSVS, InlineFunctionExpansion=0 means
# "default inlining", not "/Ob0".
# Thus, we have to handle InlineFunctionExpansion==0 separately.
['win_debug_InlineFunctionExpansion==0', {
'AdditionalOptions': ['/Ob0'],
}],
['win_debug_InlineFunctionExpansion!=""', {
'InlineFunctionExpansion':
'<(win_debug_InlineFunctionExpansion)',
}],
# if win_debug_OmitFramePointers is blank, leave as default
['win_debug_OmitFramePointers==1', {
'OmitFramePointers': 'true',
}],
['win_debug_OmitFramePointers==0', {
'OmitFramePointers': 'false',
# The above is not sufficient (http://crbug.com/106711): it
# simply eliminates an explicit "/Oy", but both /O2 and /Ox
# perform FPO regardless, so we must explicitly disable.
# We still want the false setting above to avoid having
# "/Oy /Oy-" and warnings about overriding.
'AdditionalOptions': ['/Oy-'],
}],
],
'RuntimeLibrary': '2', # /MD (nondebug DLL)
'Optimization': '0', # 0 = /Od
# See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
'BasicRuntimeChecks': '3', # 3 = all checks enabled, 0 = off
},
},
}, # Debug_Base
'Release_Base': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '2', # 2 = /Os
'FavorSizeOrSpeed': '1', # 1 = /Ot
# See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
'InlineFunctionExpansion': '2', # 2 = max
# See http://msdn.microsoft.com/en-us/library/2kxx5t2c(v=vs.80).aspx
'OmitFramePointers': 'false',
# The above is not sufficient (http://crbug.com/106711): it
# simply eliminates an explicit "/Oy", but both /O2 and /Ox
# perform FPO regardless, so we must explicitly disable.
# We still want the false setting above to avoid having
# "/Oy /Oy-" and warnings about overriding.
'AdditionalOptions': ['/Oy-'],
},
},
'conditions': [
['OS=="linux"', {
'cflags': [
'-O2',
# Generate symbols, will be stripped later.
'-g',
# Don't emit the GCC version ident directives, they just end up
# in the .comment section taking up binary size.
'-fno-ident',
# Put data and code in their own sections, so that unused symbols
# can be removed at link time with --gc-sections.
'-fdata-sections',
'-ffunction-sections',
],
'ldflags': [
# Specifically tell the linker to perform optimizations.
# See http://lwn.net/Articles/192624/ .
'-Wl,-O1',
'-Wl,--as-needed',
'-Wl,--gc-sections',
],
}], # OS=="linux"
],
}, # Release_Base
'conditions': [
['libchromiumcontent_component', {
'D': {
'inherit_from': ['Common_Base', 'Debug_Base'],
}, # D (Debug)
}, {
'R': {
'inherit_from': ['Common_Base', 'Release_Base'],
}, # R (Release)
}], # libchromiumcontent_component
['OS=="win"', {
'x64_Base': {
'abstract': 1,
'msvs_configuration_platform': 'x64',
'msvs_settings': {
'VCLinkerTool': {
# Make sure to understand http://crbug.com/361720 if you want to
# increase this.
'MinimumRequiredVersion': '5.02', # Server 2003.
'TargetMachine': '17', # x86 - 64
# Doesn't exist x64 SDK. Should use oleaut32 in any case.
'IgnoreDefaultLibraryNames': [ 'olepro32.lib' ],
},
'VCLibrarianTool': {
'TargetMachine': '17', # x64
},
},
}, # x64_Base
'conditions': [
['libchromiumcontent_component', {
'D_x64': {
'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
}, # D_x64
}, {
'R_x64': {
'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
}, # R_x64
}], # libchromiumcontent_component
],
}], # OS=="win"
],
}, # configurations
'target_conditions': [
# Putting this under "configurations" doesn't work.
['libchromiumcontent_component', {
'xcode_settings': {
'COPY_PHASE_STRIP': 'NO',
'GCC_OPTIMIZATION_LEVEL': '0',
},
},
'Release': {
'inherit_from': [
'Common_Base',
],
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '<(win_release_Optimization)',
'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
'conditions': [
# According to MSVS, InlineFunctionExpansion=0 means
# "default inlining", not "/Ob0".
# Thus, we have to handle InlineFunctionExpansion==0 separately.
['win_release_InlineFunctionExpansion==0', {
'AdditionalOptions': ['/Ob0'],
}],
['win_release_InlineFunctionExpansion!=""', {
'InlineFunctionExpansion':
'<(win_release_InlineFunctionExpansion)',
}],
# if win_release_OmitFramePointers is blank, leave as default
['win_release_OmitFramePointers==1', {
'OmitFramePointers': 'true',
}],
['win_release_OmitFramePointers==0', {
'OmitFramePointers': 'false',
# The above is not sufficient (http://crbug.com/106711): it
# simply eliminates an explicit "/Oy", but both /O2 and /Ox
# perform FPO regardless, so we must explicitly disable.
# We still want the false setting above to avoid having
# "/Oy /Oy-" and warnings about overriding.
'AdditionalOptions': ['/Oy-'],
}],
],
},
}, { # "Debug_Base"
'xcode_settings': {
'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip
'GCC_OPTIMIZATION_LEVEL': '2',
'OTHER_CFLAGS': [
'-fno-inline',
'-fno-omit-frame-pointer',
'-fno-builtin',
'-fno-optimize-sibling-calls',
],
},
},
},
'conditions': [
['OS!="mac"', {
'sources/': [
['exclude', '/mac/'],
['exclude', '_mac\.(mm|h)$'],
],
}, {
'sources/': [
['exclude', '/views/'],
['exclude', '_views\.(cc|h)$'],
}], # "Release_Base"
['OS=="mac" and libchromiumcontent_component==0 and _type in ["executable", "shared_library"]', {
'xcode_settings': {
# Generates symbols and strip the binary.
'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
'DEPLOYMENT_POSTPROCESSING': 'YES',
'STRIP_INSTALLED_PRODUCT': 'YES',
'STRIPFLAGS': '-x',
},
}], # OS=="mac" and libchromiumcontent_component==0 and _type in ["executable", "shared_library"]
['OS=="linux" and target_arch=="ia32" and _toolset=="target"', {
'ldflags': [
# Workaround for linker OOM.
'-Wl,--no-keep-memory',
],
}],
['OS!="win"', {
'sources/': [
['exclude', '/win/'],
['exclude', '_win\.(cc|h)$'],
],
}],
['OS=="linux"', {
'cflags_cc': [
'-D__STRICT_ANSI__',
'-std=gnu++11',
'-fno-rtti',
'<!@(pkg-config --cflags gtk+-2.0)',
],
}, {
'sources/': [
['exclude', '/linux/'],
['exclude', '_linux\.(cc|h)$'],
],
}],
],
},
], # target_conditions
}, # target_defaults
'conditions': [
['OS=="linux" and linux_clang==1', {
['clang', {
'make_global_settings': [
['CC', '/usr/bin/clang'],
['CXX', '/usr/bin/clang++'],
@ -226,63 +318,31 @@
['CXX.host', '$(CXX)'],
['LINK.host', '$(LINK)'],
],
}],
['OS=="win"', {
'target_defaults': {
'include_dirs': [
'<(libchromiumcontent_include_dir)/third_party/wtl/include',
'cflags_cc': [
'-std=c++11',
],
'defines': [
'_WIN32_WINNT=0x0602',
'WINVER=0x0602',
'WIN32',
'_WINDOWS',
'NOMINMAX',
'PSAPI_VERSION=1',
'_CRT_RAND_S',
'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
'WIN32_LEAN_AND_MEAN',
'_ATL_NO_OPENGL',
'_SECURE_ATL',
],
'msvs_system_include_dirs': [
'$(VSInstallDir)/VC/atlmfc/include',
],
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': ['/MP'],
'MinimalRebuild': 'false',
'BufferSecurityCheck': 'true',
'EnableFunctionLevelLinking': 'true',
'RuntimeTypeInfo': 'false',
'WarningLevel': '4',
'WarnAsError': 'true',
'DebugInformationFormat': '3',
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true',
'MapFileName': '$(OutDir)\\$(TargetName).map',
'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
},
'xcode_settings': {
'CC': '/usr/bin/clang',
'LDPLUSPLUS': '/usr/bin/clang++',
'OTHER_CFLAGS': [
'-fcolor-diagnostics',
],
'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99
'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', # -std=c++11
},
'msvs_disabled_warnings': [
4100, # unreferenced formal parameter
4127, # conditional expression is constant
4189, # local variable is initialized but not referenced
4244, # 'initializing' : conversion from 'double' to 'size_t', possible loss of data
4245, # 'initializing' : conversion from 'int' to 'const net::QuicVersionTag', signed/unsigned mismatch
4251, # class 'std::xx' needs to have dll-interface.
4310, # cast truncates constant value
4355, # 'this' : used in base member initializer list
4480, # nonstandard extension used: specifying underlying type for enum
4481, # nonstandard extension used: override specifier 'override'
4510, # default constructor could not be generated
4512, # assignment operator could not be generated
4610, # user defined constructor required
4702, # unreachable code
4819, # The file contains a character that cannot be represented in the current code page
'target_conditions': [
['_type in ["executable", "shared_library"]', {
'xcode_settings': {
# On some machines setting CLANG_CXX_LIBRARY doesn't work for
# linker.
'OTHER_LDFLAGS': [ '-stdlib=libc++' ],
},
}],
],
},
}],
}], # clang
],
}

View file

@ -0,0 +1,77 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This gypi file defines the patterns used for determining whether a
# file is excluded from the build on a given platform. It is
# included by common.gypi for chromium_code.
{
'target_conditions': [
['OS!="win"', {
'sources/': [ ['exclude', '_win(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)win/'],
['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ],
}],
['OS!="mac"', {
'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc|mm?)$'],
['exclude', '(^|/)(cocoa|mac)/'] ],
}],
['OS!="ios"', {
'sources/': [ ['exclude', '_ios(_unittest)?\\.(h|cc|mm?)$'],
['exclude', '(^|/)ios/'] ],
}],
['OS!="mac" and OS!="ios"', {
'sources/': [ ['exclude', '\\.mm?$' ] ],
}],
# Do not exclude the linux files on *BSD since most of them can be
# shared at this point.
# In case a file is not needed, it is going to be excluded later on.
# TODO(evan): the above is not correct; we shouldn't build _linux
# files on non-linux.
['OS!="linux" and OS!="openbsd" and OS!="freebsd"', {
'sources/': [
['exclude', '(^|/)library_loaders/'],
['exclude', '_linux(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)linux_[^/]*\\.(h|cc)$'],
['exclude', '(^|/)linux/'],
['exclude', '_x11(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)x11_[^/]*\\.(h|cc)$'],
['exclude', '(^|/)x11/'],
],
}],
['OS!="android"', {
'sources/': [
['exclude', '_android(_unittest)?\\.cc$'],
['exclude', '(^|/)android/'],
],
}],
['OS=="win"', {
'sources/': [
['exclude', '_posix(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)posix/'],
],
}],
['OS!="linux" and OS!="openbsd" and OS!="freebsd"', {
'sources/': [
['exclude', '_xdg(_unittest)?\\.(h|cc)$'],
],
}],
['OS!="linux" and OS!="openbsd" and OS!="freebsd"', {
'sources/': [
['exclude', '_gtk(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)gtk/'],
['exclude', '(^|/)gtk_[^/]*\\.(h|cc)$'],
['exclude', '(^|/)libgtk2ui/'],
['exclude', '(^|/)x/'],
],
}],
['OS=="mac"', {
'sources/': [ ['exclude', '_aura(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)aura/'],
['exclude', '_views\\.(h|cc)$'],
['exclude', '(^|/)views/'],
],
}],
]
}

70
brightray/filenames.gypi Normal file
View file

@ -0,0 +1,70 @@
{
'variables': {
'brightray_sources': [
'browser/brightray_paths.h',
'browser/browser_client.cc',
'browser/browser_client.h',
'browser/browser_context.cc',
'browser/browser_context.h',
'browser/browser_main_parts.cc',
'browser/browser_main_parts.h',
'browser/browser_main_parts_mac.mm',
'browser/default_web_contents_delegate.cc',
'browser/default_web_contents_delegate.h',
'browser/default_web_contents_delegate_mac.mm',
'browser/devtools_contents_resizing_strategy.cc',
'browser/devtools_contents_resizing_strategy.h',
'browser/devtools_embedder_message_dispatcher.cc',
'browser/devtools_embedder_message_dispatcher.h',
'browser/devtools_manager_delegate.cc',
'browser/devtools_manager_delegate.h',
'browser/devtools_ui.cc',
'browser/devtools_ui.h',
'browser/inspectable_web_contents.cc',
'browser/inspectable_web_contents.h',
'browser/inspectable_web_contents_delegate.cc',
'browser/inspectable_web_contents_delegate.h',
'browser/inspectable_web_contents_impl.cc',
'browser/inspectable_web_contents_impl.h',
'browser/inspectable_web_contents_view.h',
'browser/inspectable_web_contents_view_mac.h',
'browser/inspectable_web_contents_view_mac.mm',
'browser/mac/bry_application.h',
'browser/mac/bry_application.mm',
'browser/mac/bry_inspectable_web_contents_view.h',
'browser/mac/bry_inspectable_web_contents_view.mm',
'browser/media/media_capture_devices_dispatcher.cc',
'browser/media/media_capture_devices_dispatcher.h',
'browser/media/media_stream_devices_controller.cc',
'browser/media/media_stream_devices_controller.h',
'browser/network_delegate.cc',
'browser/network_delegate.h',
'browser/notification_presenter.h',
'browser/notification_presenter_mac.h',
'browser/notification_presenter_mac.mm',
'browser/platform_notification_service_impl.cc',
'browser/platform_notification_service_impl.h',
'browser/linux/notification_presenter_linux.h',
'browser/linux/notification_presenter_linux.cc',
'browser/url_request_context_getter.cc',
'browser/url_request_context_getter.h',
'browser/views/inspectable_web_contents_view_views.h',
'browser/views/inspectable_web_contents_view_views.cc',
'browser/views/views_delegate.cc',
'browser/views/views_delegate.h',
'browser/web_ui_controller_factory.cc',
'browser/web_ui_controller_factory.h',
'common/application_info.h',
'common/application_info_mac.mm',
'common/application_info_win.cc',
'common/content_client.cc',
'common/content_client.h',
'common/mac/foundation_util.h',
'common/mac/main_application_bundle.h',
'common/mac/main_application_bundle.mm',
'common/main_delegate.cc',
'common/main_delegate.h',
'common/main_delegate_mac.mm',
],
},
}

View file

@ -13,42 +13,49 @@ DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download')
def main():
args = parse_args()
return (update_submodules() or
download_libchromiumcontent(args.commit, args.url))
args = parse_args()
return (update_submodules() or
download_libchromiumcontent(args.dev, args.commit, args.url))
def parse_args():
parser = argparse.ArgumentParser(description='Bootstrap this project')
parser.add_argument('-c', '--commit', nargs='?', default='HEAD',
help='The commit of libchromiumcontent to download.')
parser.add_argument('url', help='The base URL from which to download '
'libchromiumcontent (i.e., the URL you passed to '
'libchromiumcontent\'s script/upload script')
return parser.parse_args()
parser = argparse.ArgumentParser(description='Bootstrap this project')
parser.add_argument('-c', '--commit', nargs='?', default='HEAD',
help='The commit of libchromiumcontent to download.')
parser.add_argument('-d', '--dev', action='store_true',
help='Do not download static_library build')
parser.add_argument('url', help='The base URL from which to download '
'libchromiumcontent (i.e., the URL you passed to '
'libchromiumcontent\'s script/upload script')
return parser.parse_args()
def update_submodules():
return (subprocess.call(['git', 'submodule', 'sync', '--quiet']) or
subprocess.call(['git', 'submodule', 'update', '--init',
'--recursive']))
return (subprocess.call(['git', 'submodule', 'sync', '--quiet']) or
subprocess.call(['git', 'submodule', 'update', '--init',
'--recursive']))
def download_libchromiumcontent(commit, url):
mkdir_p(DOWNLOAD_DIR)
download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
'download')
return subprocess.call([sys.executable, download, '-f', '-c', commit, url,
os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')])
def download_libchromiumcontent(is_dev, commit, url):
mkdir_p(DOWNLOAD_DIR)
download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
'download')
target = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')
if is_dev:
subprocess.check_call([sys.executable, download, '-f', '-c', commit, url,
target])
else:
subprocess.check_call([sys.executable, download, '-s', '-f', '-c', commit,
url, target])
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
if __name__ == '__main__':
sys.exit(main())
sys.exit(main())

View file

@ -19,8 +19,9 @@ def run_gyp():
gyp_pylib = os.path.join(os.path.dirname(GYP), 'pylib')
env['PYTHONPATH'] = os.path.pathsep.join([gyp_pylib,
env.get('PYTHONPATH', '')])
env['GYP_DEFINES'] = 'libchromiumcontent_component=static_library'
return subprocess.call([sys.executable, GYP, '--depth', '.',
'brightray.gyp'], env=env)
'-Ibrightray.gypi', 'brightray.gyp'], env=env)
def build():

View file

@ -1,9 +0,0 @@
#!/usr/bin/env python
import os
"""Prints the absolute path of the root of brightray's source tree.
"""
print os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

@ -1 +1 @@
Subproject commit bb327098c5e365f478a66f101044b8fdd4e79aa6
Subproject commit a325ed7b30bf0680881783edd92ca235b5468e11