Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to build and run with Visual Studio / Win32 #35

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions example_ofxCEF/bin/win/compatibility.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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>
20 changes: 20 additions & 0 deletions example_ofxCEF/bin/win/example_ofxCEF.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<!--The compatibility section will be merged from build/win/compatibility.manifest -->

<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" />
</requestedPrivileges>
</security>
</trustInfo>

</assembly>
19 changes: 3 additions & 16 deletions example_ofxCEF/example_ofxCEF.sln
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
40 changes: 27 additions & 13 deletions example_ofxCEF/example_ofxCEF.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -19,13 +19,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
Expand Down Expand Up @@ -58,16 +58,27 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\addons\ofxCef\libs\CEF\win32\include;..\..\..\addons\ofxCef\libs\CEF\win32;..\..\..\addons\ofxCef\src;src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\libs\CEF\win32\include;..\libs\CEF\win32;..\src;src</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration)\libcef.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>..\libs\CEF\win32\$(Configuration)\libcef.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\libs\CEF\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<Manifest>
<AdditionalManifestFiles>bin\win\compatibility.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
<PostBuildEvent>
<Command>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%</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand All @@ -88,6 +99,14 @@
<AdditionalDependencies>..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration)\libcef.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\addons\ofxCef\libs\CEF\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>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%</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\src\ofxCEF.cpp" />
Expand All @@ -110,13 +129,8 @@
<ProjectReference Include="..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\libs\CEF\win32\build\libcef_dll\libcef_dll_wrapper.vcxproj">
<Project>{0fd57d83-9065-4df4-888d-5e6de5bfb65c}</Project>
<Private>false</Private>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
<ProjectReference Include="..\libs\CEF\win32\libcef_dll_wrapper\libcef_dll_wrapper.vcxproj">
<Project>{5a8eb445-dd74-3b3d-b149-8e8e10db0a21}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions example_ofxCEF/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ int main(){
ofApp * p = new ofApp();
p->cefgui = cefgui;
ofRunApp( p );
CefShutdown();

}

Expand Down
2 changes: 2 additions & 0 deletions example_ofxCEF/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void ofApp::setup(){
ofSetVerticalSync(true);
ofDrawBitmapMode mode;
ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL );

ofSetFrameRate(60);
}

//--------------------------------------------------------------
Expand Down
18 changes: 8 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
* 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
6 changes: 1 addition & 5 deletions src/ofxCEF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}


//--------------------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion src/ofxCEFClientApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ofxCEFClientApp : public CefApp, public CefRenderProcessHandler

void OnWebKitInitialized() OVERRIDE;

virtual void OnBeforeCommandLineProcessing( const CefString& process_type, CefRefPtr<CefCommandLine> command_line) {
void OnBeforeCommandLineProcessing( const CefString& process_type, CefRefPtr<CefCommandLine> command_line) OVERRIDE {
#if defined(TARGET_OSX)


Expand All @@ -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");
Expand Down