prepare / kneadium

CEF3 bridge for C#
http://prepare.github.io/kneadium/
Other
8 stars 4 forks source link

WIKI: Building kneadium's cefclient.dll #22

Closed prepare closed 7 years ago

prepare commented 7 years ago

Patching and Building cefclient.dll for kneadium

Our cefclient.dll is a 'special' version of original cefclient.exe, The original source code are patched with our 'special code'. (injected with C/C++ functions that will be used to communicate with .net side, same technique as in our Espresso project)

so, if you build as an exe and run (F5) it will run as original cefclient.exe but when you build as .dll => you get cefclient.dll PLUS 'export C' functions that will be used to 'talk' with .net in kneadium's CefBrowser (C#)


I test this with

cef, chroium 59, cef_binary_3.3071.1647.gc8067b3_windows32.tar.bz2 cef, chroium 61, cef_binary_3.3163.1671.g700dc25_windows32.tar.bz2

see latest pre-built binary at https://github.com/prepare/kneadium_release_tmp


I will show the screen snaps of the described steps above.

This version, I demonstrate with

cef_binary_3.3071.1647.gc8067b3_windows32.tar.bz2 (chromium 59,win32)

from http://opensource.spotify.com/cefbuilds/index.html

prepare commented 7 years ago

1. Configure the solution

I start on d:\projects folder

kn_01 _pic 1: extract source file (1) to the folder (2) and rename (3) it to cef_binary3.3071.1647.win32


kn_02 _pic 2: inside the cef_binary3.3071.1647.win32 folder, this is original source


Apply our 'Patches' to the original source BEFORE do 'cmake' since the patch will modify cmake script too.

kn_03

pic 3: Run kneadium's BridgeBuilder, select patch, check original source location(1), and click LoadPatch and Apply Patch(2)


Run cmake, GUI, I use version 3.10

kn_04

_pic4: specific output folder, set to cef_binary3.3071.1647.win32build (fixed name)


Select proper compiler, we use VS2015 kn05

pic5: this version need VS2015 (1), then click Finish (2)


Configure

kn06

pic 6: configure done(1) , uncheck those 3 boxes (2)


Generate kn07

pic 7: generate (1) done (2)


cef.sln

kn08

_pic 8: cef.sln is generated in cef_binary3.3071.1647.win32build

prepare commented 7 years ago

2. Build cefclient.exe

Open cef.sln project

kn09

pic 9: we use only 2 projects, remove other projects kn10 pic 10: the 2 projects that we will use


Build the cefclient.exe, debug mode.

kn11

_pic 11, debug mode(1), Lets open mycef_buildconfig.h (2), you will see BUILT_TEST value and BUILD_TESTROOTWINDOW (3) value are 0. For cefclient.exe building , set the 2 values to 1.


cefclient's property window

kn12

pic 12: open the cefclient project's property window, ensure that now we are going to build cefclient.exe


Build it! kn13 kn14

pic 13: just build, success, see result in small red box below


kn15 1

_pic 14: in output folder(1), see our result (2)


Run kn15

pic 15: you will get cefclient run as original

prepare commented 7 years ago

3. Build cefclient.dll

change TEST_BUILD, TEST_BUILD_ROOTWINDOW to 0

kn16

pic 16: set both values back, before build in dll mode


Change to dll build

kn17

pic 17: change project property, change values2 (red box) to dll mode


Build it kn18

pic 18: success!


Finish, we get cefclient.dll that is ready to use kn19 1

pic 19: see cefclient.dll in output folder

prepare commented 7 years ago

4. Test it with CefBrowser

open CefBrowser (C#), set native dll folder to load our latest cefclient.dll and run the the project. now, you will have a CefBrowser in your WindowForm app.

kn19

pic 20: 🥇 🥇 🥇


for release mode, repeat the steps similar to debug (as usual)

prepare commented 7 years ago

cef-chromium 61

kn_ch61 pic 21: CefBrowser - Chromium61


Web Assembly!

Loading screen ...

kn_webasm1 pic 22: see http://webassembly.org/demo/


Tank! Demo

kn_webasm2 pic 23: lets play!