Merge pull request #17 from brightray/windows-brightray_example
Changes needed for building brightray_example on Windows
This commit is contained in:
commit
f2ff1fb406
10 changed files with 169 additions and 14 deletions
3
brightray/.gitignore
vendored
3
brightray/.gitignore
vendored
|
@ -4,3 +4,6 @@
|
|||
/brightray.vcxproj*
|
||||
/brightray.xcodeproj/
|
||||
/build/
|
||||
|
||||
# Vim
|
||||
*.swp
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'..',
|
||||
'<(libchromiumcontent_include_dir)',
|
||||
'<(libchromiumcontent_include_dir)/third_party/skia/include/config',
|
||||
],
|
||||
|
@ -51,6 +52,7 @@
|
|||
'browser/url_request_context_getter.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',
|
||||
|
@ -68,6 +70,25 @@
|
|||
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
|
||||
],
|
||||
},
|
||||
}, {
|
||||
'sources/': [
|
||||
['exclude', '/mac/'],
|
||||
['exclude', '_mac\.(mm|h)$'],
|
||||
],
|
||||
}],
|
||||
['OS=="win"', {
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'<(libchromiumcontent_library_dir)/base_static.lib',
|
||||
'<(libchromiumcontent_library_dir)/chromiumcontent.dll.lib',
|
||||
'<(libchromiumcontent_library_dir)/sandbox_static.lib',
|
||||
],
|
||||
},
|
||||
}, {
|
||||
'sources/': [
|
||||
['exclude', '/win/'],
|
||||
['exclude', '_win\.(cc|h)$'],
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
|
|
|
@ -2,15 +2,33 @@
|
|||
'variables': {
|
||||
'libchromiumcontent_dir': 'vendor/download/libchromiumcontent',
|
||||
'libchromiumcontent_library_dir': '<(libchromiumcontent_dir)/Release',
|
||||
'libchromiumcontent_include_dir': '<(libchromiumcontent_dir)/include',
|
||||
'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',
|
||||
|
||||
'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
|
||||
},
|
||||
'target_defaults': {
|
||||
'defines': [
|
||||
'NDEBUG',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'ALWAYS_SEARCH_USER_PATHS': 'NO',
|
||||
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++11',
|
||||
|
@ -33,16 +51,67 @@
|
|||
'configurations': {
|
||||
'Common_Base': {
|
||||
'abstract': 1,
|
||||
'defines': [
|
||||
'COMPONENT_BUILD',
|
||||
'GURL_DLL',
|
||||
'SKIA_DLL',
|
||||
'NDEBUG',
|
||||
'USING_V8_SHARED',
|
||||
'WEBKIT_DLL',
|
||||
],
|
||||
'msvs_configuration_attributes': {
|
||||
'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
|
||||
'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
|
||||
'CharacterSet': '1',
|
||||
},
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'AdditionalDependencies': [
|
||||
'advapi32.lib',
|
||||
'user32.lib',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
'Debug': {
|
||||
'inherit_from': [
|
||||
'Common_Base',
|
||||
],
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'Optimization': '<(win_debug_Optimization)',
|
||||
'PreprocessorDefinitions': ['_DEBUG'],
|
||||
'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-'],
|
||||
}],
|
||||
],
|
||||
},
|
||||
},
|
||||
'xcode_settings': {
|
||||
'COPY_PHASE_STRIP': 'NO',
|
||||
'GCC_OPTIMIZATION_LEVEL': '0',
|
||||
|
@ -52,6 +121,37 @@
|
|||
'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-'],
|
||||
}],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -34,8 +34,10 @@ BrowserContext* BrowserClient::browser_context() {
|
|||
}
|
||||
|
||||
NotificationPresenter* BrowserClient::notification_presenter() {
|
||||
#if defined(OS_MACOSX)
|
||||
if (!notification_presenter_)
|
||||
notification_presenter_.reset(NotificationPresenter::Create());
|
||||
#endif
|
||||
return notification_presenter_.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,9 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(content::WebContents* web
|
|||
auto context = static_cast<BrowserContext*>(web_contents_->GetBrowserContext());
|
||||
dock_side_ = context->prefs()->GetString(kDockSidePref);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
view_.reset(CreateInspectableContentsView(this));
|
||||
#endif
|
||||
}
|
||||
|
||||
InspectableWebContentsImpl::~InspectableWebContentsImpl() {
|
||||
|
|
13
brightray/common/application_info_win.cc
Normal file
13
brightray/common/application_info_win.cc
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include "common/application_info.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
std::string GetApplicationName() {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string GetApplicationVersion() {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,9 @@
|
|||
#include "common/content_client.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/path_service.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
@ -36,4 +38,22 @@ void MainDelegate::PreSandboxStartup() {
|
|||
InitializeResourceBundle();
|
||||
}
|
||||
|
||||
void MainDelegate::InitializeResourceBundle() {
|
||||
base::FilePath path;
|
||||
#if defined(OS_MACOSX)
|
||||
path = GetResourcesPakFilePath();
|
||||
#else
|
||||
base::FilePath pak_dir;
|
||||
PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||
path = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak"));
|
||||
#endif
|
||||
|
||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(path);
|
||||
|
||||
std::vector<base::FilePath> pak_paths;
|
||||
AddPakPaths(&pak_paths);
|
||||
for (auto it = pak_paths.begin(), end = pak_paths.end(); it != end; ++it)
|
||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(*it, ui::SCALE_FACTOR_NONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ protected:
|
|||
private:
|
||||
void InitializeResourceBundle();
|
||||
#if defined(OS_MACOSX)
|
||||
static base::FilePath GetResourcesPakFilePath();
|
||||
static void OverrideChildProcessPath();
|
||||
static void OverrideFrameworkBundlePath();
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/path_service.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
@ -24,15 +23,9 @@ base::FilePath GetFrameworksPath() {
|
|||
|
||||
}
|
||||
|
||||
void MainDelegate::InitializeResourceBundle() {
|
||||
base::FilePath MainDelegate::GetResourcesPakFilePath() {
|
||||
auto path = [base::mac::FrameworkBundle() pathForResource:@"content_shell" ofType:@"pak"];
|
||||
|
||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(base::mac::NSStringToFilePath(path));
|
||||
|
||||
std::vector<base::FilePath> pak_paths;
|
||||
AddPakPaths(&pak_paths);
|
||||
for (const auto& path : pak_paths)
|
||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(path, ui::SCALE_FACTOR_NONE);
|
||||
return base::mac::NSStringToFilePath(path);
|
||||
}
|
||||
|
||||
void MainDelegate::OverrideFrameworkBundlePath() {
|
||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
|||
Subproject commit ad588f54dc342716e55fd23ce69d6e2c176a1df7
|
||||
Subproject commit e436974fc1a470311879056b93f9bf0c3e2408fc
|
Loading…
Reference in a new issue