Commit 7fc7f6ac authored by callum_linden's avatar callum_linden

Automated merge with vendor branch for: Vendor drop for Dullahan support for...

Automated merge with vendor branch for: Vendor drop for Dullahan support for new version of CEF (Chrome 74) and improved scroll wheel support that came in via https://bitbucket.org/lindenlab/dullahan/pull-requests/2/sl-11346-fix-nested-scrolls-not-working/diff
parents 76caa083 97e85dec
# OS files
.DS_Store
.DS_Store?
# Build/output folders
build/
build64/
glob:*.wwdb
# misc files
dullahan.sdf
dullahan.v12.suo
dullahan.opensdf
# dullahan header - autogenerated from dullahan.h.in
src/dullahan_version.h
# test apps crud
examples/console/cookies/Cookies-journal
examples/console/cookies/Cookies
examples/console/output.bmp
examples/webcube/cookies/Cookies-journal
examples/webcube/cookies/Cookies
examples/webcube/cache/*
examples/webcube/dullahan_test_urls.html
examples/webcube/*.pdf
examples/simplegl/cookies/Cookies-journal
examples/simplegl/cookies/Cookies
examples/simplegl/cache/*
examples/simplegl/dullahan_test_urls.html
# Astyle crud
glob:*.orig
# Windows RC crud
glob:*.aps
......@@ -191,6 +191,12 @@ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(dullahan_host PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
set_target_properties(dullahan_host PROPERTIES LINK_FLAGS "/ignore:4099")
add_custom_command(
TARGET dullahan_host POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Windows commands to copy CEF 'bin', 'resources' folders to executable dir (needed at runtime)
......@@ -262,6 +268,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()
add_custom_command(
TARGET webcube POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
################################################################################
## simplegl example application using FreeGLUT
......@@ -310,6 +321,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(simplegl PROPERTIES LINK_FLAGS "/ignore:4099")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
TARGET simplegl POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
################################################################################
## console example application
......@@ -339,6 +355,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(console PROPERTIES LINK_FLAGS "/ignore:4099")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
TARGET console POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
################################################################################
## minimal CEF console example (doesn't use Dullahan)
......@@ -371,6 +392,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_target_properties(cef_minimal PROPERTIES LINK_FLAGS "/ignore:4099")
endif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
TARGET cef_minimal POST_BUILD
COMMAND "mt.exe" -manifest \"$(ProjectDir)..\\src\\win\\compatibility.manifest\" -outputresource:"$(TargetDir)$(TargetFileName)"\;\#1
COMMENT "Adding custom manifest...")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
################################################################################
......@@ -418,7 +444,6 @@ endif()
################################################################################
# generic commands that have to go after everything else
###### set only a Release configuration
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES "Release")
endif()
......@@ -69,6 +69,7 @@ app::app()
mTextureWidth = 1024;
mTextureHeight = 1024;
mAllFinished = false;
// empty string means go load the page of test URLs
// may be overridden by command line arg --homepage="URL"
......@@ -113,6 +114,7 @@ void app::init_dullahan()
mDullahan->setOnRequestExitCallback(std::bind(&app::onRequestExitCallback, this));
mDullahan->setOnStatusMessageCallback(std::bind(&app::onStatusMessage, this, std::placeholders::_1));
mDullahan->setOnTitleChangeCallback(std::bind(&app::onTitleChange, this, std::placeholders::_1));
mDullahan->setOnJSDialogCallback(std::bind(&app::onJSDialogCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
std::vector<std::string> custom_schemes(1, "secondlife");
mDullahan->setCustomSchemes(custom_schemes);
......@@ -752,6 +754,19 @@ void app::onPageChangedCallback(const unsigned char* pixels, int x, int y,
}
}
/////////////////////////////////////////////////////////////////////////////////
//
bool app::onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)
{
std::cout << "JavaScript dialog triggered:" << std::endl;
std::cout << " URL: " << origin_url << std::endl;
std::cout << " message: " << message_text << std::endl;
std::cout << " prompt: " << default_prompt_text << std::endl;
// cancel the dialog automatically
return true;
}
/////////////////////////////////////////////////////////////////////////////////
//
void app::onPdfPrintFinished(const std::string path, bool ok)
......@@ -771,6 +786,11 @@ void app::onPdfPrintFinished(const std::string path, bool ok)
//
void app::onRequestExitCallback()
{
mAllFinished = true;
// posted a quit message no longer works as of CEF 74. Not sure why - I
// think it swallows the message before the app (like this one) gets to
// see it. Now we need to use an explicit flag
PostQuitMessage(0);
}
......@@ -812,9 +832,9 @@ void app::on_mouse_move(int x, int y, int face, bool left_button_down)
/////////////////////////////////////////////////////////////////////////////////
//
void app::on_mouse_wheel(int delta_x, int delta_y)
void app::on_mouse_wheel(int x, int y, int delta_x, int delta_y)
{
mDullahan->mouseWheel(delta_x, delta_y);
mDullahan->mouseWheel(x, y, delta_x, delta_y);
}
/////////////////////////////////////////////////////////////////////////////////
......@@ -1060,9 +1080,18 @@ LRESULT CALLBACK window_proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
else
{
// location of mouse cursor when wheel was moved
int mouse_x = LOWORD(lParam);
int mouse_y = HIWORD(lParam);
// use the mouse position to get the position on a face in texture
int texture_x, texture_y, texture_face;
gApp->windowPosToTexturePos(mouse_x, mouse_y, texture_x, texture_y, texture_face);
// synthesize a virtual mouse wheel event (clamp X delta for now)
int delta_x = 0;
int delta_y = GET_WHEEL_DELTA_WPARAM(wParam);
gApp->on_mouse_wheel(delta_x, delta_y);
gApp->on_mouse_wheel(texture_x, texture_y, delta_x, delta_y);
}
return 0;
};
......@@ -1120,6 +1149,13 @@ void app::closeConsole()
FreeConsole();
}
/////////////////////////////////////////////////////////////////////////////////
//
bool app::isAllFinished()
{
return mAllFinished;
}
/////////////////////////////////////////////////////////////////////////////////
//
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
......@@ -1222,7 +1258,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
SwapBuffers(hDC);
}
}
while (msg.message != WM_QUIT);
while (gApp->isAllFinished() == false);
wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hRC);
......
......@@ -78,7 +78,7 @@ class app
void on_left_mouse_down(int x, int y, int face);
void on_left_mouse_up(int x, int y, int face);
void on_mouse_move(int x, int y, int face, bool left_button_down);
void on_mouse_wheel(int delta_x, int delta_y);
void on_mouse_wheel(int x, int y, int delta_x, int delta_y);
void native_keyboard_event(uint32_t msg, uint64_t wparam, uint64_t lparam);
public:
......@@ -106,6 +106,7 @@ class app
const std::string get_title();
void set_homepage_url(std::string url);
bool isAllFinished();
private:
FILE* mConsole;
......@@ -122,6 +123,7 @@ class app
std::string mHomePageURL;
dullahan* mDullahan;
const std::string getHomePageURL();
bool mAllFinished;
void init_dullahan();
......@@ -132,6 +134,7 @@ class app
const std::vector<std::string> onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default);
void onFileDownloadProgress(int percent, bool complete);
bool onHTTPAuth(const std::string host, const std::string realm, std::string& username, std::string& password);
bool onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text);
void onLoadEnd(int status, const std::string url);
void onLoadError(int status, const std::string error_text);
void onLoadStart();
......@@ -141,6 +144,8 @@ class app
void onRequestExitCallback();
void onStatusMessage(const std::string message);
void onTitleChange(const std::string title);
};
#endif // _WEBCUBE_EXAMPLE
......@@ -152,9 +152,9 @@ void dullahan::mouseButton(EMouseButton mouse_button,
mImpl->mouseButton(mouse_button, mouse_event, x, y);
}
void dullahan::mouseWheel(int delta_x, int delta_y)
void dullahan::mouseWheel(int x, int y, int delta_x, int delta_y)
{
mImpl->mouseWheel(delta_x, delta_y);
mImpl->mouseWheel(x, y, delta_x, delta_y);
}
void dullahan::nativeKeyboardEventWin(uint32_t msg,
......@@ -373,3 +373,9 @@ void dullahan::setOnFileDialogCallback(std::function<const std::vector<std::stri
{
mImpl->getCallbackManager()->setOnFileDialogCallback(callback);
}
void dullahan::setOnJSDialogCallback(std::function<bool(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)> callback)
{
mImpl->getCallbackManager()->setOnJSDialogCallback(callback);
}
......@@ -244,7 +244,7 @@ class dullahan
EMouseEvent mouse_event,
int x, int y);
void mouseMove(int x, int y);
void mouseWheel(int delta_x, int delta_y);
void mouseWheel(int x, int y, int delta_x, int delta_y);
// keyboard input
void nativeKeyboardEventWin(uint32_t msg, uint32_t wparam, uint64_t lparam);
......@@ -355,6 +355,11 @@ class dullahan
// file picker shown
void setOnFileDialogCallback(std::function<const std::vector<std::string>(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default)> callback);
// JS dialog shown (alert)
void setOnJSDialogCallback(std::function<bool(const std::string origin_url,
const std::string message_text,
const std::string default_prompt_text)> callback);
private:
std::unique_ptr <dullahan_impl> mImpl;
};
......
......@@ -415,3 +415,19 @@ bool dullahan_browser_client::OnFileDialog(CefRefPtr<CefBrowser> browser,
return true;
}
// CefJSDialogHandler overrides
bool dullahan_browser_client::OnJSDialog(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
JSDialogType dialog_type,
const CefString& message_text,
const CefString& default_prompt_text,
CefRefPtr<CefJSDialogCallback> callback,
bool& suppress_message)
{
suppress_message = mParent->getCallbackManager()->onJSDialogCallback(std::string(origin_url),
std::string(message_text),
std::string(default_prompt_text));
return false;
}
......@@ -41,7 +41,8 @@ class dullahan_browser_client :
public CefLoadHandler,
public CefRequestHandler,
public CefDownloadHandler,
public CefDialogHandler
public CefDialogHandler,
public CefJSDialogHandler
{
public:
dullahan_browser_client(dullahan_impl* parent,
......@@ -138,6 +139,19 @@ class dullahan_browser_client :
const CefString& default_file_path, const std::vector<CefString>& accept_filters, int selected_accept_filter,
CefRefPtr<CefFileDialogCallback> callback) override;
// CefJSDialogHandler overrides
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() override
{
return this;
}
bool OnJSDialog(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
JSDialogType dialog_type,
const CefString& message_text,
const CefString& default_prompt_text,
CefRefPtr<CefJSDialogCallback> callback,
bool& suppress_message) override;
private:
dullahan_impl* mParent;
CefRefPtr<CefRenderHandler> mRenderHandler;
......
......@@ -244,3 +244,21 @@ const std::vector<std::string> dullahan_callback_manager::onFileDialog(dullahan:
return std::vector<std::string>();
}
void dullahan_callback_manager::setOnJSDialogCallback(
std::function<bool(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)> callback)
{
mOnJSDialogCallbackFunc = callback;
}
bool dullahan_callback_manager::onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)
{
if (mOnJSDialogCallbackFunc)
{
return mOnJSDialogCallbackFunc(origin_url, message_text, default_prompt_text);
}
// default to cancel request if no callback set up
return false;
}
......@@ -82,6 +82,9 @@ class dullahan_callback_manager
void setOnFileDialogCallback(std::function<const std::vector<std::string>(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default)> callback);
const std::vector<std::string> onFileDialog(dullahan::EFileDialogType dialog_type, const std::string dialog_title, const std::string default_file, const std::string dialog_accept_filter, bool& use_default);
void setOnJSDialogCallback(std::function<bool(const std::string origin_url, const std::string message_text, const std::string default_prompt_text)> callback);
bool onJSDialogCallback(const std::string origin_url, const std::string message_text, const std::string default_prompt_text);
private:
std::function<void(const std::string)> mOnAddressChangeCallbackFunc;
std::function<void(const std::string, const std::string, int)> mOnConsoleMessageCallbackFunc;
......@@ -99,6 +102,7 @@ class dullahan_callback_manager
std::function<void(const std::string, bool)> mOnPdfPrintFinishedCallbackFunc;
std::function<void(int percent, bool complete)> mOnFileDownloadProgressCallbackFunc;
std::function<const std::vector<std::string>(dullahan::EFileDialogType, const std::string, const std::string, const std::string, bool&)> mOnFileDialogCallbackFunc;
std::function<bool(const std::string, const std::string, const std::string)> mOnJSDialogCallbackFunc;
};
#endif //_DULLAHAN_CALLBACK_MANAGER
......@@ -40,6 +40,8 @@
#include "include/wrapper/cef_library_loader.h"
#endif
dullahan_impl::dullahan_impl() :
mInitialized(false),
mBrowser(0),
......@@ -139,9 +141,15 @@ bool dullahan_impl::init(dullahan::dullahan_settings& user_settings)
@"%@/Contents/Frameworks/DullahanHelper.app/Contents/MacOS/DullahanHelper", appBundlePath] UTF8String];
#endif
// required for CEF 72+ to indicate headless
settings.windowless_rendering_enabled = true;
// explicitly disable sandbox
settings.no_sandbox = true;
// CEF header file suggest that we need this now
settings.external_message_pump = true;
// use a single thread for the message loop
settings.multi_threaded_message_loop = false;
......@@ -158,14 +166,12 @@ bool dullahan_impl::init(dullahan::dullahan_settings& user_settings)
if (user_settings.user_agent_substring.length())
{
std::string user_agent(user_settings.user_agent_substring);
cef_string_utf8_to_utf16(user_agent.c_str(), user_agent.size(),
&settings.product_version);
cef_string_utf8_to_utf16(user_agent.c_str(), user_agent.size(), &settings.product_version);
}
else
{
std::string user_agent = makeCompatibleUserAgentString("");
cef_string_utf8_to_utf16(user_agent.c_str(), user_agent.size(),
&settings.product_version);
cef_string_utf8_to_utf16(user_agent.c_str(), user_agent.size(), &settings.product_version);
}
// list of language locale codes used to configure the Accept-Language HTTP header value
......@@ -767,8 +773,7 @@ void dullahan_impl::postData(const std::string url, const std::string data,
// TODO - get this from the headers parameter
CefRequest::HeaderMap headerMap;
headerMap.insert(std::make_pair("Accept", "*/*"));
headerMap.insert(std::make_pair("Content-Type",
"application/x-www-form-urlencoded"));
headerMap.insert(std::make_pair("Content-Type", "application/x-www-form-urlencoded"));
request->SetHeaderMap(headerMap);
// set up data
......
......@@ -76,7 +76,7 @@ class dullahan_impl :
void mouseButton(dullahan::EMouseButton mouse_button,
dullahan::EMouseEvent mouse_event, int x, int y);
void mouseMove(int x, int y);
void mouseWheel(int deltaX, int deltaY);
void mouseWheel(int x, int y, int deltaX, int deltaY);
void nativeKeyboardEventWin(uint32_t msg, uint32_t wparam, uint64_t lparam);
void nativeKeyboardEventOSX(void* event);
......
......@@ -80,12 +80,14 @@ void dullahan_impl::mouseMove(int x, int y)
}
};
void dullahan_impl::mouseWheel(int deltaX, int deltaY)
void dullahan_impl::mouseWheel(int x, int y, int deltaX, int deltaY)
{
if (mBrowser && mBrowser->GetHost())
{
CefMouseEvent mouse_event;
mouse_event.modifiers = 0;
mBrowser->GetHost()->SendMouseWheelEvent(mouse_event, 0, deltaY);
mouse_event.x = x;
mouse_event.y = getFlipMouseY() ? (mViewHeight - y) : y;
mouse_event.modifiers = EVENTFLAG_LEFT_MOUSE_BUTTON;
mBrowser->GetHost()->SendMouseWheelEvent(mouse_event, deltaX, deltaY);
}
}
......@@ -39,7 +39,7 @@
// TODO: find a way to set build number directly from hg
#define DULLAHAN_VERSION_MAJOR 1
#define DULLAHAN_VERSION_MINOR 1
#define DULLAHAN_VERSION_BUILD 1320
#define DULLAHAN_VERSION_BUILD 2200
// version numbers pulled from CEF build via Cmake
@CEF_VERSION_STR@
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--The ID below indicates application support for Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--The ID below indicates application support for Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
# Tools that are useful for working with CEF and Dullahan
`build_win.bat`
`build_dullahan.bat`
Simple batch file to build Dullahan as well as an example application. Pass in 32 or 64 for 32/64bit versions.
Simple batch file to build CEF then Dullahan as well as an example applications. Pass in 32 or 64 for 32/64bit versions.
`build_mac.sh`
Simple shell script to build 64 bit macOS version of Dullahan.
`cef_download_build.bat`
Batch file that grabs the latest version of automate-git.py and uses it to build CEF from source. You might want to do this if you want to enable the embedded support of media including MPEG-4 files. Since the Chromium dependency on Visual Studio 2015 was introduced, this batch file no longer works but is left here in case parts of it are useful.
`dullahan_test_urls.html`
Simple HTML page that contains links to various sites that test Dullahan functionality.
`make_dullahan_cef_pkg.bat`
A simple Windows batch file that uses a CEF build from the [Spotify](http://opensource.spotify.com/cefbuilds/index.html) CEF site and extracts files (dlls, lib, Resource files etc.) that Dullahan needs.
`make_dullahan_cef_pkg.sh`
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.
......
@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.
@rem There is still some work to do: (automated download of src, drop into local dir vs
@rem have to specify a cef_builds folder, etc.) but this is a good start.
@pushd .
@set VS_CMD=Visual Studio 12 2013
@rem uncomment this line or change one above for VS2015 builds
@rem set VS_CMD=Visual Studio 14 2015
@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=74.1.19+gb62bacf
@set CHROMIUM_VERSION=74.0.3729.157
@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
@set CEF_SRC_DST_DIR=c:\work\cef_builds
@rem This base name is common to both 32 and 64 bit versions.
@rem Do not edit unless Spotify change their naming scheme
@set BASE_NAME=cef_binary_%CEF_VERSION%+chromium-%CHROMIUM_VERSION%_
@rem Edit these variables to point to the uncompressed CEF source directory and
@rem the required destination directory for both 32 and 64 bit versions
@rem @remembering to express the locations in terms of the CEF_VERSION above
@set SRC_DIR_32=%CEF_SRC_DST_DIR%\%BASE_NAME%windows32
@set DST_DIR_32=%SRC_DIR_32%_dullahan
@set SRC_DIR_64=%CEF_SRC_DST_DIR%\%BASE_NAME%windows64
@set DST_DIR_64=%SRC_DIR_64%_dullahan
@if "%1"=="32" goto BitWidth32
@if "%1"=="64" goto BitWidth64
:NoBitWidth
@echo.
@echo You must specify a bit width of 32 or 64
@goto End
:BitWidth32
@set SRC_DIR=%SRC_DIR_32%
@set DST_DIR=%DST_DIR_32%
@set BUILD_DIR="build"
@set CMAKE_CMD="%VS_CMD%"
@set PLATFORM_CMD="/property:Platform=x86"
@goto skip_1
:BitWidth64
@set SRC_DIR=%SRC_DIR_64%
@set DST_DIR=%DST_DIR_64%
@set BUILD_DIR="build64"
@set CMAKE_CMD="%VS_CMD% Win64"
@set PLATFORM_CMD="/property:Platform=x64"
@goto skip_1
:skip_1
@if not exist %SRC_DIR% (
@echo.
@echo *** ERROR: %SRC_DIR% does not exist - check your settings ****
@goto end
)
@if exist %DST_DIR% (
@echo.
@echo *** ERROR: %DST_DIR% exists - remove this directory before running this script ****
@goto end
)
mkdir %DST_DIR%
@if not exist %DST_DIR% (
@echo.
@echo *** ERROR: %DST_DIR% cannot be created - check your settings ****
@goto end
)
@mkdir "%DST_DIR%\bin\debug"
@mkdir "%DST_DIR%\bin\debug\swiftshader"
@mkdir "%DST_DIR%\bin\release"
@mkdir "%DST_DIR%\bin\release\swiftshader"
@mkdir "%DST_DIR%\include"
@mkdir "%DST_DIR%\lib\debug"
@mkdir "%DST_DIR%\lib\release"
@mkdir "%DST_DIR%\resources"
@pushd .
@cd /d %SRC_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% ..
@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%
@copy "Debug\libcef_dll_wrapper.lib" "%DST_DIR%\lib\debug"
@copy "Release\libcef_dll_wrapper.lib" "%DST_DIR%\lib\release"
@popd
@rem ******** bin folder ********
@copy "%SRC_DIR%\Release\d3dcompiler_47.dll" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\chrome_elf.dll" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\libcef.dll" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\libEGL.dll" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\libGLESv2.dll" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\natives_blob.bin" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\snapshot_blob.bin" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\v8_context_snapshot.bin" "%DST_DIR%\bin\release"
@copy "%SRC_DIR%\Release\swiftshader\libEGL.dll" "%DST_DIR%\bin\release\swiftshader"
@copy "%SRC_DIR%\Release\swiftshader\libGLESv2.dll" "%DST_DIR%\bin\release\swiftshader"
@copy "%SRC_DIR%\Debug\d3dcompiler_47.dll" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\chrome_elf.dll" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\libcef.dll" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\libEGL.dll" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\libGLESv2.dll" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\natives_blob.bin" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\snapshot_blob.bin" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\v8_context_snapshot.bin" "%DST_DIR%\bin\debug"
@copy "%SRC_DIR%\Debug\swiftshader\libEGL.dll" "%DST_DIR%\bin\debug\swiftshader"
@copy "%SRC_DIR%\Debug\swiftshader\libGLESv2.dll" "%DST_DIR%\bin\debug\swiftshader"
@rem ******** include folder ********
@xcopy "%SRC_DIR%\include\*" "%DST_DIR%\include\" /S
@rem ******** lib folder ********
@copy "%SRC_DIR%\Debug\libcef.lib" "%DST_DIR%\lib\debug"
@copy "%SRC_DIR%\Release\libcef.lib" "%DST_DIR%\lib\release"
@rem ******** resources folder ********
@xcopy "%SRC_DIR%\resources\*" "%DST_DIR%\resources\" /S
@popd
@if exist .\src\dullahan_version.h del .\src\dullahan_version.h
@if exist .\%BUILD_DIR%\* rmdir /s /q .\%BUILD_DIR%
@mkdir %BUILD_DIR%