Commit 87f9a127 authored by Rye Mutt's avatar Rye Mutt 🍞

Merge

--HG--
branch : vendor
parents 5542efa9 f00a9df9
203e4b3490e49b8f078a9e262a02193d254c9e4d current
203e4b3490e49b8f078a9e262a02193d254c9e4d current
bb71943e6a280eb3a635883525b34c6deb103cf3 current
bb71943e6a280eb3a635883525b34c6deb103cf3 current
6bbfb8b75dd1ea683f2fa55c3e922e517141e8fa current
6bbfb8b75dd1ea683f2fa55c3e922e517141e8fa current
236f352f5fb42baf4a451d26adfbd2ec4b58f4cb current
236f352f5fb42baf4a451d26adfbd2ec4b58f4cb current
b944f8b7e88cd67808271376ba6564cc362ce4db current
b944f8b7e88cd67808271376ba6564cc362ce4db current
5653305d85c35d8416091c1e0569fb74493cd400 current
5653305d85c35d8416091c1e0569fb74493cd400 current
7fd6a09634fc1b80817f91eb781d3cc85d1d320e current
7fd6a09634fc1b80817f91eb781d3cc85d1d320e current
2d8c9bb7d243ed17ab8c8529dec20e9377146c4d current
2d8c9bb7d243ed17ab8c8529dec20e9377146c4d current
8ce9b68539f32896b0d71abf92ff7917fe7d5d8a current
8ce9b68539f32896b0d71abf92ff7917fe7d5d8a current
6c42adbb410e8070ab7fe1363da6230cf09a60f0 current
6c42adbb410e8070ab7fe1363da6230cf09a60f0 current
e8e89f808315f0cfb292379cc4a54e2cb5fcc91c current
e8e89f808315f0cfb292379cc4a54e2cb5fcc91c current
044cd709e41f1a338cf8f9da62b8fdcf9a174ba2 current
044cd709e41f1a338cf8f9da62b8fdcf9a174ba2 current
4aa18e2937f5f76d26d5aaa95248f5a619ba8cfd current
4aa18e2937f5f76d26d5aaa95248f5a619ba8cfd current
d9e5eb62716473eb3bd14d6428c93b227e02e50b current
d9e5eb62716473eb3bd14d6428c93b227e02e50b current
18fa657925aa41ab96d8e6d6291d2dad1a36021e current
18fa657925aa41ab96d8e6d6291d2dad1a36021e current
269c17a770f654518387adca01e440c80b7d0dd3 current
269c17a770f654518387adca01e440c80b7d0dd3 current
b64c26fe5580e5d89100c534fbca593a8fb49662 current
b64c26fe5580e5d89100c534fbca593a8fb49662 current
bb0dd08923133b7c4eb1f67888acbca82a55bdf1 current
bb0dd08923133b7c4eb1f67888acbca82a55bdf1 current
81ee29775a8271a5610199a2e140008fb415b8e7 current
81ee29775a8271a5610199a2e140008fb415b8e7 current
9c7c9df8ef3268f2026d2a2bc8fa4767ff408cd5 current
9c7c9df8ef3268f2026d2a2bc8fa4767ff408cd5 current
3b17bba82c536c1189ac07dd482bb14784a287d7 current
3b17bba82c536c1189ac07dd482bb14784a287d7 current
eb2414ac57c4af6bff46c9f7b44afd5a66104ac5 current
eb2414ac57c4af6bff46c9f7b44afd5a66104ac5 current
2753baf09608aa6800fcd8a634ba9aa654c4cdd6 current
2753baf09608aa6800fcd8a634ba9aa654c4cdd6 current
eb75bff4afb472c5bdbac3db95880f1748a537ec current
......@@ -7,6 +7,9 @@ A headless browser SDK that uses the [Chromium Embedded Framework](https://en.wi
#### **Important note**:
This is a __very__ early release - more than alpha quality but less than beta. I have high hopes this will develop into something useful but there is still a lot of work to do first.
#### **Documentation needs updating**:
The parts of this document that relate to building CEF are outdated as of 2019-09-11 and need to be updated. Once I have all the scripts working again on both Windows and macOS, I will update this document accordingly.
## What could I use it for?
It might be useful in a number of situations - for example:
......
This is a good place to put your CEF builds and refer to them here when using tools\build_win.bat.
This folder (except this file) is ignored by Mercurial (via .hgignore) so it makes commands like `hg status` less confusing when checking which files you have added or modified.
......@@ -107,8 +107,8 @@ static void onRequestExitCallback() {
settings.javascript_enabled = true;
settings.cache_enabled = true;
settings.cache_path = "/tmp/cef_cachez";
settings.disable_network_service = true;
settings.cookies_enabled = true;
settings.cookie_store_path = "/tmp/cef_cookiez";
settings.user_agent_substring = "osxgl";
settings.accept_language_list = "en-us";
settings.autoplay_without_gesture = true;
......@@ -255,7 +255,7 @@ static void onRequestExitCallback() {
if (self.mDullahan) {
const int dx = 3 * theEvent.deltaX;
const int dy = 3 * theEvent.deltaY;
self.mDullahan->mouseWheel(dx, dy);
self.mDullahan->mouseWheel(dx, dy, 10, 0);
}
}
......
......@@ -124,9 +124,11 @@ void app::init_dullahan()
settings.accept_language_list = "en-US";
settings.background_color = 0xff666666;
settings.cache_enabled = true;
settings.locales_dir_path = "";
settings.cache_path = ".\\webcube_cache";
settings.cookies_enabled = true;
settings.disable_gpu = false;
settings.disable_network_service = false;
settings.disable_web_security = false;
settings.file_access_from_file_urls = false;
settings.flash_enabled = false;
......
......@@ -152,6 +152,7 @@ class dullahan
bool disable_gpu = true; // disable GPU and GPU compositing
bool file_access_from_file_urls = false; // allow access files from local file system
bool disable_web_security = false; // like adding --disable-web-security to Chrome command line
bool disable_network_service = false; // like adding --disable-features=NetworkService to Chrome command line
bool autoplay_without_gesture = false; // like adding --autoplay-policy=???? to Chrome command line
bool flash_enabled = true; // system flash plugin
bool force_wave_audio = false; // forces Windows WaveOut/In audio
......@@ -162,9 +163,11 @@ class dullahan
bool plugins_enabled = true; // all plugins
bool webgl_enabled = true; // webgl
// explicitly set the path to the locales folder since defaults no longer work on some systems
std::string locales_dir_path = "";
// path to browser cache - cookies (if enabled) are also stored here as of Chrome 75
std::string cache_path = "";
// list of language locale codes used to configure the Accept-Language HTTP header value
// and change the default language of the browser
std::string accept_language_list = "en-us";
......
......@@ -260,7 +260,10 @@ bool dullahan_browser_client::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
std::string url = request->GetURL();
// for conmparison
std::transform(url.begin(), url.end(), url.begin(), ::tolower);
std::transform(url.begin(), url.end(), url.begin(), [](char c)
{
return static_cast<char>(tolower(c));
});
std::vector<std::string>::iterator iter = mParent->getCustomSchemes().begin();
while (iter != mParent->getCustomSchemes().end())
......@@ -282,9 +285,8 @@ bool dullahan_browser_client::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
}
// CefRequestHandler override
bool dullahan_browser_client::GetAuthCredentials(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
bool isProxy, const CefString& host, int port, const CefString& realm,
bool dullahan_browser_client::GetAuthCredentials(CefRefPtr<CefBrowser> browser, const CefString& origin_url, bool isProxy,
const CefString& host, int port, const CefString& realm,
const CefString& scheme, CefRefPtr<CefAuthCallback> callback)
{
CEF_REQUIRE_IO_THREAD();
......
......@@ -112,10 +112,10 @@ class dullahan_browser_client :
}
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request, bool user_gesture, bool isRedirect) override;
bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
bool isProxy, const CefString& host, int port, const CefString& realm,
bool GetAuthCredentials(CefRefPtr<CefBrowser> browser, const CefString& origin_url, bool isProxy,
const CefString& host, int port, const CefString& realm,
const CefString& scheme, CefRefPtr<CefAuthCallback> callback) override;
bool OnQuotaRequest(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
int64 new_size,
......
......@@ -53,6 +53,7 @@ dullahan_impl::dullahan_impl() :
mForceWaveAudio(false),
mDisableGPU(true),
mDisableWebSecurity(false),
mDisableNetworkService(false),
mAutoPlayWithoutGesture(false),
mFlipPixelsY(false),
mFlipMouseY(false),
......@@ -105,6 +106,11 @@ void dullahan_impl::OnBeforeCommandLineProcessing(const CefString& process_type,
command_line->AppendSwitch("--disable-web-security");
}
if (mDisableNetworkService)
{
command_line->AppendSwitchWithValue("disable-features", "NetworkService");
}
if (mAutoPlayWithoutGesture)
{
command_line->AppendSwitchWithValue("autoplay-policy", "no-user-gesture-required");
......@@ -158,6 +164,9 @@ bool dullahan_impl::init(dullahan::dullahan_settings& user_settings)
// turn on only for Windows 7+
CefEnableHighDPISupport();
// explicitly set the path to the locales folder since defaults no longer work on some systems
CefString(&settings.locales_dir_path) = user_settings.locales_dir_path;
// set path to cache if enabled and set
if (user_settings.cache_enabled && user_settings.cache_path.length())
{
......@@ -209,6 +218,12 @@ bool dullahan_impl::init(dullahan::dullahan_settings& user_settings)
// needing a web server.
mDisableWebSecurity = user_settings.disable_web_security;
// this flag if set, adds a command line parameter that disables "network service" and
// is like adding --disable-features=NetworkService. This appears to be required after
// Chrome 75 to disable the "Chrome wants access to passwords" dialog on macOS that
// started to appear. May change later.
mDisableNetworkService = user_settings.disable_network_service;
// this flag, if set, allows video/audio to autoplay if the URL parameters are configured
// correctly to do so. (by default as of Chrome 70, audio/video does not autoplay)
mAutoPlayWithoutGesture = user_settings.autoplay_without_gesture;
......@@ -876,6 +891,8 @@ const std::string dullahan_impl::dullahan_version(bool show_bitwidth)
s << ".";
s << DULLAHAN_VERSION_MINOR;
s << ".";
s << DULLAHAN_VERSION_POINT;
s << ".";
s << DULLAHAN_VERSION_BUILD;
return append_bitwidth_string(s, show_bitwidth);
......
......@@ -148,6 +148,7 @@ class dullahan_impl :
bool mForceWaveAudio;
bool mDisableGPU;
bool mDisableWebSecurity;
bool mDisableNetworkService;
bool mAutoPlayWithoutGesture;
bool mFlipPixelsY;
bool mFlipMouseY;
......
......@@ -37,7 +37,8 @@
// version of this package
#define DULLAHAN_VERSION_MAJOR 1
#define DULLAHAN_VERSION_MINOR 2
#define DULLAHAN_VERSION_MINOR 3
#define DULLAHAN_VERSION_POINT 4
// The build version number as of v1.2 is now the date/time the build was made
// It is only regenerated if the constructed version header (dullahan_version.h)
......
# Tools that are useful for working with CEF and Dullahan
`build_dullahan.bat`
`build_cef_wrapper_win.bat`
Simple batch file to build CEF then Dullahan as well as an example applications. Pass in 32 or 64 for 32/64bit versions.
Batch file that builds the Windows 32/64 version of Dullahan as well as some example applications. See the notes at the top of the file for usage etc.
`build_mac.sh`
`build_dullahan_mac.sh`
Simple shell script to build 64 bit macOS version of Dullahan.
Shell script that builds the macOS 64 version of Dullahan as well as some example applications. See the notes at the top of the file for usage etc.
`make_dullahan_cef_pkg.sh`
`build_dullahan_win.bat`
A simple macOS shell script that uses a CEF build from the [Spotify](http://opensource.spotify.com/cefbuilds/index.html) CEF site and extracts files (headers, libs, frameworks etc.) that Dullahan needs.
Batch file that builds a version of the CEF wrapper which is compatible with Dullahan given a Spotify open source CEF build or a local build of Chromium/CEF you have completed yourself. See the notes at the top of the file for usage etc.
`astyle.bat`
`build_dullahan_mac.sh`
I find it useful to use [Artistic Style](http://astyle.sourceforge.net/) to reformat the code occasionally and maintain control of tabs/space and line endings. This batch file assumes astyle is installed on your system and runs it with selected command line options.
Shell script that builds a version of the CEF wrapper which is compatible with Dullahan given a Spotify open source CEF build or a local build of Chromium/CEF you have completed yourself. See the notes at the top of the file for usage etc.
`generate_build_version_number.bat`
`astyle.bat`
I wanted a way to version small changes over time and everything else I looked at didn't do the trick.
I am going to try using the "integer number of 10 minutes's since 2000-01-01" and see how that goes.
Each time I want to increase the build version number, I run this script and paste the output into
the DULLAHAN_VERSION_BUILD value in src/dullahan_version.h.in. We will see if this is a good idea...
I find it useful to use [Artistic Style](http://astyle.sourceforge.net/) to reformat the code occasionally and maintain control of tabs/space and line endings. This batch file assumes astyle is installed on your system and runs it with selected command line options.
@rem Chromium/CEF build script
@rem
@rem This batch file worked up using instructions from this CEF page:
@rem https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart.md
@rem
@rem It builds Chromium/CEF and creates a CEF package much like what can
@rem be downloaded from the Spotify CEF site. If everything works [and it takes
@rem a long time to build - 10-12 hours at least] then a CEF package will appear
@rem in the %ROOT_CODE_DIRECTORY%\chromium_git\chromium\src\cef\binary_distrib dir
@rem
@rem Parse command line: for example:
@rem build_cef_src_win.bat c:\cef build in C:\cef - defaults for other settings
@rem build_cef_src_win.bat - - 0 3500 to turn off codecs and build branch 3500
@rem build_cef_src_win.bat - 32 - 3807 to enable 32 bit build of branch 3807
@rem default values - change via command line parameters - see below
@set DEFAULT_ROOT_CODE_DIRECTORY=\code
@set DEFAULT_BIT_WIDTH=64
@set DEFAULT_PROPRIETARY_CODEC=1
@set DEFAULT_BRANCH=3809
@rem Pass in the name of the directory where the build happens as param 1 or '-' to use default
@set ROOT_CODE_DIRECTORY=%DEFAULT_ROOT_CODE_DIRECTORY%
@if not [%1]==[] ( if not [%1]==[-] (set ROOT_CODE_DIRECTORY=%~f1))
@rem Pass in bit width [32/64] of the build as param 2 or '-' to use default
@set BIT_WIDTH=%DEFAULT_BIT_WIDTH%
@if not [%2]==[] ( if not [%2]==[-] (set BIT_WIDTH=%2))
@rem Pass in 1/0 to enable/disable proprietary codecs as param 3 or '-' to use default
@set PROPRIETARY_CODEC=%DEFAULT_PROPRIETARY_CODEC%
@if not [%3]==[] ( if not [%3]==[-] (set PROPRIETARY_CODEC=%3))
@rem Pass in the branch number to build as param 4 or '-' to use default
@set BRANCH=%DEFAULT_BRANCH%
@if not [%4]==[] ( if not [%4]==[-] (set BRANCH=%4))
@mkdir %ROOT_CODE_DIRECTORY%\automate
@mkdir %ROOT_CODE_DIRECTORY%\chromium_git
@mkdir %ROOT_CODE_DIRECTORY%\depot_tools
@cd %ROOT_CODE_DIRECTORY%
@rem Chromium/CEF build scripts need this directory in the path
@set PATH=%ROOT_CODE_DIRECTORY%\depot_tools;%PATH%
@rem initialize build_details file
@echo Build details: > %ROOT_CODE_DIRECTORY%\build_details
@rem record build settings
@echo ROOT_CODE_DIRECTORY: %ROOT_CODE_DIRECTORY% >> %ROOT_CODE_DIRECTORY%\build_details
@echo BIT_WIDTH: %BIT_WIDTH% >> %ROOT_CODE_DIRECTORY%\build_details
@echo PROPRIETARY_CODEC: %PROPRIETARY_CODEC% >> %ROOT_CODE_DIRECTORY%\build_details
@echo BRANCH: %BRANCH% >> %ROOT_CODE_DIRECTORY%\build_details
@echo. >> %ROOT_CODE_DIRECTORY%\build_details
@rem rudimentary timing
@echo Start build: >> %ROOT_CODE_DIRECTORY%\build_details
@time /t >> %ROOT_CODE_DIRECTORY%\build_details
@echo. >> %ROOT_CODE_DIRECTORY%\build_details
@rem grab a recent version of the depot tools using built in curl [.exe extension is important]
@powershell.exe -NoP -NonI -Command "curl.exe -O https://storage.googleapis.com/chrome-infra/depot_tools.zip"
@rem uncompress the zip file using a Powershell command
@powershell.exe -NoP -NonI -Command "Expand-Archive 'depot_tools.zip' '.\depot_tools\'"
@rem Rudimentary timing
@echo Downloaded and unzipped depot tools build: >> %ROOT_CODE_DIRECTORY%\build_details
@time /t >> %ROOT_CODE_DIRECTORY%\build_details
@echo. >> %ROOT_CODE_DIRECTORY%\build_details
@rem run the Google batch file to update it to latest version via git pull
@cd %ROOT_CODE_DIRECTORY%\depot_tools
@call update_depot_tools.bat
@rem Rudimentary timing
@echo Ran update_depot_tools.bat: >> %ROOT_CODE_DIRECTORY%\build_details
@time /t >> %ROOT_CODE_DIRECTORY%\build_details
@echo. >> %ROOT_CODE_DIRECTORY%\build_details
@rem grab latest version of the main python script
@cd %ROOT_CODE_DIRECTORY%\automate
@powershell.exe -NoP -NonI -Command "curl.exe -O https://bitbucket.org/chromiumembedded/cef/raw/master/tools/automate/automate-git.py"
@rem Starting point for automate-git.py step
@cd %ROOT_CODE_DIRECTORY%\chromium_git
@rem Settings taking from the Chromium/CEF Master Build Page.
@set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
@rem Not everyone wants the official media codec support
@set GN_DEFINES=is_official_build=true
@if "%PROPRIETARY_CODEC%"=="1" (set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome)
@rem Allow building of both 32 and 64 bit versions
@set BUILD_64BIT_FLAGS=
@if "%BIT_WIDTH%"=="64" (set BUILD_64BIT_FLAGS=--x64-build)
@rem Rudimentary timing
@echo About to run automate-git.py: >> %ROOT_CODE_DIRECTORY%\build_details
@time /t >> %ROOT_CODE_DIRECTORY%\build_details
@echo. >> %ROOT_CODE_DIRECTORY%\build_details
@rem This is the maion build step and does everything we need
cd %ROOT_CODE_DIRECTORY%\chromium_git\chromium\src\cef
@python ..\automate\automate-git.py^
--download-dir=%ROOT_CODE_DIRECTORY%\chromium_git^
--depot-tools-dir=%ROOT_CODE_DIRECTORY%\depot_tools^
--branch=%BRANCH%^
--client-distrib^
--force-clean^
%BUILD_64BIT_FLAGS%
@rem Rudimentary timing
@echo Ran automate-git.py: >> %ROOT_CODE_DIRECTORY%\build_details
@time /t >> %ROOT_CODE_DIRECTORY%\build_details
@echo. >> %ROOT_CODE_DIRECTORY%\build_details
@rem Rudimentary timing
@cd %ROOT_CODE_DIRECTORY%
@echo End build: >> %ROOT_CODE_DIRECTORY%\build_details
@time /t >> %ROOT_CODE_DIRECTORY%\build_details
@echo. >> %ROOT_CODE_DIRECTORY%\build_details
@echo Build details:
@type %ROOT_CODE_DIRECTORY%\build_details
@echo.
@echo If all went well, zipped builds will be in %ROOT_CODE_DIRECTORY%\chromium_git\chromium\src\cef\binary_distrib
@echo.
:end
@rem This batch file helps you build a CEF wrapper that is compatible
@rem with Dullahan from a CEF source package that you:
@rem
@rem 1/ Downloaded from the Spotify open source site here:
@rem http://opensource.spotify.com/cefbuilds/index.html
@rem 2/ Built yourself from the Chromium/CEF sources - look in
@rem %BUILD_DIR%\chromium_git\chromium\src\cef\binary_distrib
@rem 3/ Somewhere else entirely but is compatible with 1/ or 2/
@rem
@rem Usage: tools\build_cef_wrapper_win.bat <CEF source dir> <CEF out dir> [32|64]
@rem
@rem <CEF source dir> is the name of the directory containing the CEF
@rem package you downloaded or built
@rem
@rem <CEF out dir> is the name of the directory where you want to store
@rem the Dullahan compatible CEF wrapper package
@rem
@rem [32|64] the script will try to guess whether to do 32 or 64 builds
@rem based on source directory name but this lets you override
@rem
@rem Example:
@rem tools\build_cef_wrapper_win.bat C:\download\spotify_cef_76_1_3_windows64 .\cef_76.64
@rem tools\build_cef_wrapper_win.bat C:\code\build\cef_latest C:\cef\builds\cef77.1 32
@rem Set the source and dest directories using the clever batch feature that
@rem converts a relative or absolute path into an absolute one
@set CEF_SRC_DIR=%~f1
@set CEF_DST_DIR=%~f2
@rem Check if the source dir exists and bail if it doesn't
@if not exist %CEF_SRC_DIR% (
@echo.
@echo *** ERROR: %CEF_SRC_DIR% does not exist - check your settings ****
@goto end
)
@rem Check if the destination dir exists and bail if it does - we want to start clean
@if exist %CEF_DST_DIR% (
@echo.
@echo *** ERROR: %CEF_DST_DIR% exists - remove this directory before running this script ****
@goto end
)
@rem Check if the destination dir cannot be created and bail if not
@mkdir %CEF_DST_DIR%
@if not exist %CEF_DST_DIR% (
@echo.
@echo *** ERROR: %CEF_DST_DIR% cannot be created - check your settings ****
@goto end
)
@rem The CMake generator string to use
@set VS_CMD=Visual Studio 15 2017
@rem Get the bit width paramter from command line and if it's empty, try to guess the
@rem value based on the source directory name - Spotify CEF builds have windows32 or
@rem windows64 in the name for example
@set BIT_WIDTH=%3
@if [%BIT_WIDTH%]==[] (
@rem Determine if we are building 32 or 64 bit based on the folder name of the source CEF bundle
@echo %CEF_SRC_DIR%|find "windows64" >nul
@if errorlevel 1 (
set BIT_WIDTH=32
) else (
set BIT_WIDTH=64
)
)
@rem Set up build parameters for 32 bit builds
@if "%BIT_WIDTH%"=="32" (
@set BUILD_DIR=build
@set CMAKE_CMD="%VS_CMD%"
@set PLATFORM_CMD="/property:PlatformTarget=x86"
)
@rem Set up build parameters for 64 bit builds
@if "%BIT_WIDTH%"=="64" (
@set BUILD_DIR=build64
@set CMAKE_CMD="%VS_CMD% Win64"
@set PLATFORM_CMD="/property:PlatformTarget=x64"
)
@rem Helpful, reassuring description of what we are doing....
@echo.
@echo Building CEF in .\%BUILD_DIR% for %BIT_WIDTH% bit using CEF from %CEF_SRC_DIR% and writing compatible CEF package to %CEF_DST_DIR%
@echo.
@mkdir "%CEF_DST_DIR%\bin\debug"
@mkdir "%CEF_DST_DIR%\bin\debug\swiftshader"
@mkdir "%CEF_DST_DIR%\bin\release"
@mkdir "%CEF_DST_DIR%\bin\release\swiftshader"
@mkdir "%CEF_DST_DIR%\include\cef\include"
@mkdir "%CEF_DST_DIR%\lib\debug"
@mkdir "%CEF_DST_DIR%\lib\release"
@mkdir "%CEF_DST_DIR%\resources"
@pushd .
@cd /d %CEF_SRC_DIR%
@if exist %BUILD_DIR% rmdir /s /q %BUILD_DIR%
@mkdir %BUILD_DIR%
@cd /d %BUILD_DIR%
@rem Note that we invoke the option to use the dynamic runtime library for the CEF wrapper
@rem since that is what we use everywhere else - remove the -D flag to revert to /MT
@cmake -G %CMAKE_CMD% .. -DCEF_RUNTIME_LIBRARY_FLAG=/MD
@cd libcef_dll_wrapper
@msbuild libcef_dll_wrapper.vcxproj /property:Configuration="Debug" %PLATFORM_CMD%
@msbuild libcef_dll_wrapper.vcxproj /property:Configuration="Release" %PLATFORM_CMD%
copy "Debug\libcef_dll_wrapper.lib" "%CEF_DST_DIR%\lib\debug"
copy "Release\libcef_dll_wrapper.lib" "%CEF_DST_DIR%\lib\release"
@popd
@rem ******** bin folder ********
copy "%CEF_SRC_DIR%\Release\d3dcompiler_47.dll" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\chrome_elf.dll" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\libcef.dll" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\libEGL.dll" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\libGLESv2.dll" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\natives_blob.bin" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\snapshot_blob.bin" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\v8_context_snapshot.bin" "%CEF_DST_DIR%\bin\release"
copy "%CEF_SRC_DIR%\Release\swiftshader\libEGL.dll" "%CEF_DST_DIR%\bin\release\swiftshader"
copy "%CEF_SRC_DIR%\Release\swiftshader\libGLESv2.dll" "%CEF_DST_DIR%\bin\release\swiftshader"
copy "%CEF_SRC_DIR%\Debug\d3dcompiler_47.dll" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\chrome_elf.dll" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\libcef.dll" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\libEGL.dll" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\libGLESv2.dll" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\natives_blob.bin" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\snapshot_blob.bin" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\v8_context_snapshot.bin" "%CEF_DST_DIR%\bin\debug"
copy "%CEF_SRC_DIR%\Debug\swiftshader\libEGL.dll" "%CEF_DST_DIR%\bin\debug\swiftshader"
copy "%CEF_SRC_DIR%\Debug\swiftshader\libGLESv2.dll" "%CEF_DST_DIR%\bin\debug\swiftshader"
@rem ******** include folder ********
@xcopy "%CEF_SRC_DIR%\include\*" "%CEF_DST_DIR%\include\cef\include\" /s
@rem ******** lib folder ********
copy "%CEF_SRC_DIR%\Debug\libcef.lib" "%CEF_DST_DIR%\lib\debug"
copy "%CEF_SRC_DIR%\Release\libcef.lib" "%CEF_DST_DIR%\lib\release"
@rem ******** resources folder ********
xcopy "%CEF_SRC_DIR%\resources\*" "%CEF_DST_DIR%\resources\" /s
:End
@rem This batch file helps you build Dullahan given a compatible build of CEF.
@rem See the README.md file in this directory for how to download or build
@rem a compatible version.
@rem
@rem Usage: tools\build_dullahan_win.bat <cef_build_dir> <bit width>
@rem
@rem Example: tools\build_dullahan_win.bat ".\cef\76.1.13+gf19c584" 64
@rem tools\build_dullahan_win.bat "c:\cef_builds\sandbox\cef77.4" 32
@rem
@rem Note: There is a .\cef directory present in this repo - that's a good
@rem location to put CEF builds since it's ignored by Mercurial.
@rem The CMake generator string to use
@set VS_CMD=Visual Studio 15 2017
@pushd .
@rem Rudimentary test to see if we are in the Dullahan root directory where
@rem we demand that this script is started from.
@if not exist "tools" (
@echo.
@echo *** ERROR: Run this script from Dullahan root directory ***
@goto End
)
@rem Make use of a batch feature that expands %~f1 to the full path so that
@rem relative or absolute values work as a parameter for the CEF Build directory
@set CEF_DIR=%~f1
@rem Record the bit width we have been asked to build [32 or 64]
@set BIT_WIDTH=%2
@rem Test if a CEF directory has been specified and bail if not
@if [%CEF_DIR%]==[] (
@echo.
@echo *** ERROR: You must specify a compatible CEF build directory ***
@goto End
)
@rem Test if the CEF directory exists and bail if not
@if not exist %CEF_DIR% (
@echo.
@echo *** ERROR: CEF directory '%CEF_DIR%' does not exist ***
@goto End
)
@rem Test if 32 or 64 is specified as a bit width and bail if not
@if not "%BIT_WIDTH%"=="32" (
if not "%BIT_WIDTH%"=="64" (
@echo.
@echo *** ERROR: You must specify a bit width of 32 or 64 ***
@goto End
)
)
@rem Set up build parameters for 32 bit builds
@if "%BIT_WIDTH%"=="32" (
@set BUILD_DIR=build
@set CMAKE_CMD="%VS_CMD%"
@set PLATFORM_CMD="/property:PlatformTarget=x86"
)
@rem Set up build parameters for 64 bit builds
@if "%BIT_WIDTH%"=="64" (
@set BUILD_DIR=build64
@set CMAKE_CMD="%VS_CMD% Win64"
@set PLATFORM_CMD="/property:PlatformTarget=x64"
)
@rem Helpful, reassuring description of what we are doing....
@echo.
@echo Building Dullahan in .\%BUILD_DIR% for %BIT_WIDTH% bit using CEF from %CEF_DIR%
@echo.
@rem The header file dullahan_version.h is auto-generated via
@rem dullahan_version.h.in if the former does not exist. We
@rem usually want this so delete the transient version to start
@if exist .\src\dullahan_version.h del .\src\dullahan_version.h
@rem Start fresh with a clean build directory
@if exist .\%BUILD_DIR%\* rmdir /s /q .\%BUILD_DIR%
@mkdir %BUILD_DIR%
@cd /d %BUILD_DIR%
@rem Generate Dullahan project files, passing in paths to
@rem various CEF folders that are consumed by CMake
@cmake -G %CMAKE_CMD% ^
-DCEF_INCLUDE_DIR="%CEF_DIR%\include\cef\include" ^
-DCEF_LIB_DIR="%CEF_DIR%\lib" ^
-DCEF_BIN_DIR="%CEF_DIR%\bin" ^
-DCEF_RESOURCE_DIR="%CEF_DIR%\resources" ^
..
@if errorlevel 1 goto End
@rem Build the Debug configuration of Dullahan
@msbuild dullahan.sln /property:Configuration="Debug" %PLATFORM_CMD%
@if errorlevel 1 goto End
@rem Build the Release configuration of Dullahan
@msbuild dullahan.sln /property:Configuration="Release" %PLATFORM_CMD%
@if errorlevel 1 goto End
@rem Looks like everything worked - open our Visual Studio solution
@start dullahan.sln
:End
@popd
rem Builds CEF from source with VS 2015 and optionally enables the proprietary
rem codec support that enables playback of media such as MPEG4 inline
rem It takes a long time to build - 5+ hours on my aging MacBook Pro/BootCamp.
rem rudimentary timing
time /t > build_duration
rem user variables for the build - change these to configure builds
set BIT_WIDTH=64
set BRANCH=3202