From c7274cb0507f92e233b935de043d98b4a101fa27 Mon Sep 17 00:00:00 2001 From: Richard Jackson Date: Thu, 4 May 2017 11:04:27 +0100 Subject: [PATCH 1/5] Make it build with Visual Studio 15. Assumes cef is already built in libs/CEF/win32 - see readme.md --- example_ofxCEF/bin/win/compatibility.manifest | 17 ++++++++ .../bin/win/example_ofxCEF.exe.manifest | 20 ++++++++++ example_ofxCEF/example_ofxCEF.sln | 19 ++------- example_ofxCEF/example_ofxCEF.vcxproj | 40 +++++++++++++------ 4 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 example_ofxCEF/bin/win/compatibility.manifest create mode 100644 example_ofxCEF/bin/win/example_ofxCEF.exe.manifest diff --git a/example_ofxCEF/bin/win/compatibility.manifest b/example_ofxCEF/bin/win/compatibility.manifest new file mode 100644 index 0000000..10d10da --- /dev/null +++ b/example_ofxCEF/bin/win/compatibility.manifest @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/example_ofxCEF/bin/win/example_ofxCEF.exe.manifest b/example_ofxCEF/bin/win/example_ofxCEF.exe.manifest new file mode 100644 index 0000000..d36f084 --- /dev/null +++ b/example_ofxCEF/bin/win/example_ofxCEF.exe.manifest @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/example_ofxCEF/example_ofxCEF.sln b/example_ofxCEF/example_ofxCEF.sln index 9f655c8..0771f2c 100644 --- a/example_ofxCEF/example_ofxCEF.sln +++ b/example_ofxCEF/example_ofxCEF.sln @@ -1,16 +1,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2012 for Windows Desktop +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_ofxCEF", "example_ofxCEF.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" - ProjectSection(ProjectDependencies) = postProject - {0FD57D83-9065-4DF4-888D-5E6DE5BFB65C} = {0FD57D83-9065-4DF4-888D-5E6DE5BFB65C} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZERO_CHECK", "..\libs\CEF\win32\build\ZERO_CHECK.vcxproj", "{8B2CE83C-9D83-451C-853A-44DFBB7A951E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcef_dll_wrapper", "..\libs\CEF\win32\build\libcef_dll\libcef_dll_wrapper.vcxproj", "{0FD57D83-9065-4DF4-888D-5E6DE5BFB65C}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -25,14 +20,6 @@ Global {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 - {8B2CE83C-9D83-451C-853A-44DFBB7A951E}.Debug|Win32.ActiveCfg = Debug|Win32 - {8B2CE83C-9D83-451C-853A-44DFBB7A951E}.Debug|Win32.Build.0 = Debug|Win32 - {8B2CE83C-9D83-451C-853A-44DFBB7A951E}.Release|Win32.ActiveCfg = Release|Win32 - {8B2CE83C-9D83-451C-853A-44DFBB7A951E}.Release|Win32.Build.0 = Release|Win32 - {0FD57D83-9065-4DF4-888D-5E6DE5BFB65C}.Debug|Win32.ActiveCfg = Debug|Win32 - {0FD57D83-9065-4DF4-888D-5E6DE5BFB65C}.Debug|Win32.Build.0 = Debug|Win32 - {0FD57D83-9065-4DF4-888D-5E6DE5BFB65C}.Release|Win32.ActiveCfg = Release|Win32 - {0FD57D83-9065-4DF4-888D-5E6DE5BFB65C}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/example_ofxCEF/example_ofxCEF.vcxproj b/example_ofxCEF/example_ofxCEF.vcxproj index 94febd2..460bce7 100644 --- a/example_ofxCEF/example_ofxCEF.vcxproj +++ b/example_ofxCEF/example_ofxCEF.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -19,13 +19,13 @@ Application Unicode - v110 + v140 Application Unicode true - v110 + v140 @@ -58,16 +58,27 @@ MultiThreadedDebugDLL Level3 EditAndContinue - %(AdditionalIncludeDirectories);..\..\..\addons\ofxCef\libs\CEF\win32\include;..\..\..\addons\ofxCef\libs\CEF\win32;..\..\..\addons\ofxCef\src;src + %(AdditionalIncludeDirectories);..\libs\CEF\win32\include;..\libs\CEF\win32;..\src;src CompileAsCpp true Console false - ..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration)\libcef.lib;%(AdditionalDependencies) - ..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration);%(AdditionalLibraryDirectories) + ..\libs\CEF\win32\$(Configuration)\libcef.lib;%(AdditionalDependencies) + ..\libs\CEF\win32\$(Configuration);%(AdditionalLibraryDirectories) + + bin\win\compatibility.manifest %(AdditionalManifestFiles) + + + echo on + dir + robocopy "../libs/CEF/win32/$(Configuration)/" "$(ProjectDir)bin/" "*.dll" "*.bin" /njs /njh /np /fp /bytes + robocopy "../libs/CEF/win32/Resources/" "$(ProjectDir)bin/" "*.pak" /E /njs /njh /np /fp /bytes + robocopy "$(OF_ROOT)/export/vs/$(Platform_Actual)/" "$(ProjectDir)bin/" "*.dll" /njs /njh /np /fp /bytes +if errorlevel 1 exit 0 else exit %errorlevel% + @@ -88,6 +99,14 @@ ..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration)\libcef.lib;%(AdditionalDependencies) ..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration);%(AdditionalLibraryDirectories) + + echo on + dir + robocopy "../libs/CEF/win32/$(Configuration)/" "$(ProjectDir)bin/" "*.dll" "*.bin" /njs /njh /np /fp /bytes + robocopy "../libs/CEF/win32/Resources/" "$(ProjectDir)bin/" "*.pak" /E /njs /njh /np /fp /bytes + robocopy "$(OF_ROOT)/export/vs/$(Platform_Actual)/" "$(ProjectDir)bin/" "*.dll" /njs /njh /np /fp /bytes +if errorlevel 1 exit 0 else exit %errorlevel% + @@ -110,13 +129,8 @@ {5837595d-aca9-485c-8e76-729040ce4b0b} - - {0fd57d83-9065-4df4-888d-5e6de5bfb65c} - false - false - false - true - false + + {5a8eb445-dd74-3b3d-b149-8e8e10db0a21} From c4d80764ebc2ebc23c6dcd3f9e4115681ef4cc69 Mon Sep 17 00:00:00 2001 From: Richard Jackson Date: Thu, 4 May 2017 11:10:07 +0100 Subject: [PATCH 2/5] Make it shutdown cleanly --- example_ofxCEF/src/main.cpp | 1 + src/ofxCEF.cpp | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/example_ofxCEF/src/main.cpp b/example_ofxCEF/src/main.cpp index c3b605b..840148a 100644 --- a/example_ofxCEF/src/main.cpp +++ b/example_ofxCEF/src/main.cpp @@ -22,6 +22,7 @@ int main(){ ofApp * p = new ofApp(); p->cefgui = cefgui; ofRunApp( p ); + CefShutdown(); } diff --git a/src/ofxCEF.cpp b/src/ofxCEF.cpp index f6f4bed..99371b4 100644 --- a/src/ofxCEF.cpp +++ b/src/ofxCEF.cpp @@ -129,14 +129,10 @@ ofxCEF::~ofxCEF(){ } void ofxCEF::exit() { - //TODO Check if we need to do some calls to OnBeforeClose disableEvents(); renderHandler->bIsShuttingDown = true; browser->GetHost()->CloseBrowser(false); - - // The following call to CefShutdown make the app crash on OS X. Still not working on Windows neither. - //CefShutdown(); -} + } //-------------------------------------------------------------- From 0c5671660facf9987e075af407ee6d7a0ea60a3b Mon Sep 17 00:00:00 2001 From: Richard Jackson Date: Thu, 4 May 2017 11:12:45 +0100 Subject: [PATCH 3/5] Limit framerate for decent web performance --- example_ofxCEF/src/ofApp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example_ofxCEF/src/ofApp.cpp b/example_ofxCEF/src/ofApp.cpp index 1f0bc43..49f2195 100644 --- a/example_ofxCEF/src/ofApp.cpp +++ b/example_ofxCEF/src/ofApp.cpp @@ -24,6 +24,8 @@ void ofApp::setup(){ ofSetVerticalSync(true); ofDrawBitmapMode mode; ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL ); + + ofSetFrameRate(60); } //-------------------------------------------------------------- From 60cdd9a928dcd58ec8eeaf3cf6c0560f82dbfc66 Mon Sep 17 00:00:00 2001 From: Richard Jackson Date: Thu, 4 May 2017 11:15:39 +0100 Subject: [PATCH 4/5] Make command line switches work. Add --enable-system-flash option --- src/ofxCEFClientApp.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ofxCEFClientApp.h b/src/ofxCEFClientApp.h index 06776b8..7fea792 100755 --- a/src/ofxCEFClientApp.h +++ b/src/ofxCEFClientApp.h @@ -17,7 +17,7 @@ class ofxCEFClientApp : public CefApp, public CefRenderProcessHandler void OnWebKitInitialized() OVERRIDE; - virtual void OnBeforeCommandLineProcessing( const CefString& process_type, CefRefPtr command_line) { + void OnBeforeCommandLineProcessing( const CefString& process_type, CefRefPtr command_line) OVERRIDE { #if defined(TARGET_OSX) @@ -30,6 +30,10 @@ class ofxCEFClientApp : public CefApp, public CefRenderProcessHandler CefString frameScheduling(L"-enable-begin-frame-scheduling"); command_line->AppendSwitch(frameScheduling); + + CefString enableFlash(L"--enable-system-flash"); + command_line->AppendSwitch(enableFlash); + #endif //CefString singleProcess(L"-single-process"); From a19dae2795b72b9042a5243600d6eb1822e1a10b Mon Sep 17 00:00:00 2001 From: Richard Jackson Date: Thu, 4 May 2017 11:17:15 +0100 Subject: [PATCH 5/5] Update Visual Studio / Win32 build procedure --- readme.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/readme.md b/readme.md index eeb46be..2662292 100644 --- a/readme.md +++ b/readme.md @@ -18,13 +18,11 @@ then compile the demo app itself ![image](images/app.png) ### Windows and Visual Studio - -* Copy the content of the Chromium Embedded Framework 3 Build package in the folder libs/CEF/win32. For details, see the ofxCEF-README.txt included in the folder libs/CEF/win32. -* Add libcef_dll_wrapper.vcxproj and the ZERO_CHECK.vcxproj to your existing Visaul Studio solution. -* Link against libcef.lib. -* Make sure the addon files in src/, libs/CEF/win32/include and libs/CEF/win32 are in your include path. -* Ensure libcef_dll_wrapper is a dependency of your own project (Project Name > Project Dependencies). -* Ensure libcef_dll_wrapper is referenced by your project (Project Name > References > Add New Reference). -* You may have to change the Runtime Library of the libcef_dll_wrapper.vcxproj (see screenshot below). - -![image](images/VS-RuntimeLibrary.png) \ No newline at end of file +* Tested with Windows 10, Visual Studio 15 and cef_binary_3.2987.1601.gf035232_windows32 + +* Copy the content of the Chromium Embedded Framework 3 Build package into the folder libs/CEF/win32. +* Create VS project files by running cmake -G "Visual Studio 15" -DUSE_SANDBOX=Off from a Visual Studio command prompt in ofxCEF/libs/CEF/win32. -REQUIRES cmake V3.7.0 +* Open cef.sln and changed the C/C++ Code Generation properties for all projects to /MDd (debug) or /MD (release) +* Build cef.sln - don't worry that ceftests doesn't build because of sandbox issues. +* Check cefsimple and cefclient run OK +* You should now be able to build and run example_ofxCEF \ No newline at end of file