Commit cc663239 authored by Callum Linden's avatar Callum Linden
Browse files

Update Dullahan to work with CEF 76.x. Deprecate the batch file that builds...

Update Dullahan to work with CEF 76.x. Deprecate the batch file that builds dullahan via Spotify CEF builds. Create new batch file for building Dullahan against an existing compatible CEF build e.g. a Linden uatobuild one. Scripts to build a compatible CEF package from Spotify downloads will come later
parent 429e5198
......@@ -6,6 +6,10 @@
build/
build64/
# CEF builds folder
./cef/*
!cef/README.md
glob:*.wwdb
# misc files
......
......@@ -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.
......@@ -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,
......
......@@ -37,7 +37,7 @@
// version of this package
#define DULLAHAN_VERSION_MAJOR 1
#define DULLAHAN_VERSION_MINOR 2
#define DULLAHAN_VERSION_MINOR 3
// 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)
......
@rem ####################################################
@rem THIS FILE IS DEPRECATED AND WILL BE REMOVED SOON
@rem ####################################################
@echo This file is deprecated
@exit
@rem This new batch file builds the CEF wrapper and then Dullahan once
@rem you set the variables below: CEF_VERSION, CHROMIUM_VERSION and CEF_SRC_DST_DIR
@rem Eventually, it will replace both make_dullahan_cef_pkg.bat and build_win.bat.
......@@ -5,7 +12,7 @@
@rem have to specify a cef_builds folder, etc.) but this is a good start.
@pushd .
@set VS_CMD=Visual Studio 12 2013
@set VS_CMD=Visual Studio 15 2017
@rem uncomment this line or change one above for VS2015 builds
@rem set VS_CMD=Visual Studio 14 2015
......@@ -13,8 +20,8 @@
@rem Edit these variables to match the version of CEF & Chromium you want to use after
@rem deciding on the version you want to use from the Spotify open source build page
@rem here http://opensource.spotify.com/cefbuilds/index.html
@set CEF_VERSION=75.0.11+gf50b3c2
@set CHROMIUM_VERSION=75.0.3770.100
@set CEF_VERSION=76.1.13+gf19c584
@set CHROMIUM_VERSION=76.0.3809.132
@rem Edit this variable to point to the directory where you stored the download and
@rem where you would like to store the resulting Dullahan compatible CEF build
......@@ -32,6 +39,13 @@
@set SRC_DIR_64=%CEF_SRC_DST_DIR%\%BASE_NAME%windows64
@set DST_DIR_64=%SRC_DIR_64%_dullahan
@set SRC_DIR_64=%CEF_SRC_DST_DIR%\cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_windows64
@set SRC_DIR_64=%CEF_SRC_DST_DIR%\cef_src-76.1.13+gf19c584+chromium-76.0.3809.132-windows64-509660
@set DST_DIR_64=%SRC_DIR_64%_dullahan_new
@if "%1"=="32" goto BitWidth32
@if "%1"=="64" goto BitWidth64
......@@ -94,15 +108,14 @@ mkdir %DST_DIR%
@if exist %BUILD_DIR% del /s /q %BUILD_DIR%
@if exist %BUILD_DIR% rmdir /s /q %BUILD_DIR%
@mkdir %BUILD_DIR%
@cd /d %BUILD_DIR%
@cmake -G %CMAKE_CMD% ..
@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
@rem swap /MT for /MD because that's what we use (cringe - why isn't this an option in CMake)
powershell -Command "(get-content libcef_dll_wrapper.vcxproj) | ForEach-Object { $_ -replace '>MultiThreadedDebug<', '>MultiThreadedDebugDLL<' } | set-content libcef_dll_wrapper.vcxproj"
powershell -Command "(get-content libcef_dll_wrapper.vcxproj) | ForEach-Object { $_ -replace '>MultiThreaded<', '>MultiThreadedDLL<' } | set-content libcef_dll_wrapper.vcxproj"
msbuild libcef_dll_wrapper.vcxproj /property:Configuration="Debug" %PLATFORM_CMD%
msbuild libcef_dll_wrapper.vcxproj /property:Configuration="Release" %PLATFORM_CMD%
......
@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_win.bat <cef_build_dir> <bit width>
@rem
@rem Example: tools\build_win.bat ".\cef\76.1.13+gf19c584" 64
@rem tools\build_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:Platform=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:Platform=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 /p:Configuration=Debug %PLATFORM_CMD%
@if errorlevel 1 goto End
@rem Build the Release configuration of Dullahan
@msbuild dullahan.sln /p: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
set PROPRIETARY_CODEC=1
set BUILD_DEBUG=1
rem make sure this path isn't too long, windows can fail with "path too long" errors!
set DOWNLOAD_DIR=%1
if "%1"=="" set DOWNLOAD_DIR="%USERPROFILE%\Desktop\cef.%BRANCH%.win%BIT_WIDTH%^%/
rem Grab the latest version the Python build script using the Powershell equivalent of curl!
powershell -Command "(New-Object System.Net.WebClient).DownloadString('https://bitbucket.org/chromiumembedded/cef/raw/master/tools/automate/automate-git.py')" > automate-git.py
rem CEF build scripts require these
set CEF_USE_GN=1
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
rem clumsily set up command line variables
if "%PROPRIETARY_CODEC%"=="0" goto :NO_PROPRIETARY_CODEC
set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome
:NO_PROPRIETARY_CODEC
set BUILD_DEBUG_FLAGS=--no-debug-build
if "%BUILD_DEBUG%"=="0" goto :NO_DEBUG_BUILD
set BUILD_DEBUG_FLAGS=
:NO_DEBUG_BUILD
set BUILD_64BIT_FLAGS=
if "%BIT_WIDTH%"=="32" goto :32BIT_BUILD
set BUILD_64BIT_FLAGS=--x64-build
:32BIT_BUILD
rem build it!
python automate-git.py^
--download-dir=%DOWNLOAD_DIR%^
--branch=%BRANCH%^
%BUILD_64BIT_FLAGS%^
%BUILD_DEBUG_FLAGS%
rem rudimentary timing
time /t >> build_duration
Supports Markdown
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