Browse Source

Windows WebView building

JoshEngebretson 10 years ago
parent
commit
c96f0deb08

+ 5 - 0
Build/CMake/Modules/AtomicWebView.cmake

@@ -38,6 +38,11 @@ if(OS_MACOSX)
 
 endif()
 
+if(OS_WINDOWS)
+    set(CEF_BINARY_DIR_RELEASE "${CMAKE_SOURCE_DIR}/Submodules/CEF/Windows/64bit/Release")
+    set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
+endif()
+
 #
 # Shared macros.
 #

+ 8 - 6
CMakeLists.txt

@@ -67,15 +67,17 @@ endif()
 
 find_program(CLDOC cldoc)
 if(CLDOC)
-
-   add_custom_target(docs
-    DEPENDS AtomicEngineDocs
-    )
+   add_custom_target(docs DEPENDS AtomicEngineDocs)
 endif()
 
 if (ATOMIC_WEBVIEW)
-  include_directories (${CMAKE_SOURCE_DIR}/Submodules/CEF/MacOSX/)
-  add_subdirectory(Submodules/CEF/MacOSX/libcef_dll)
+  if(APPLE)
+    include_directories (${CMAKE_SOURCE_DIR}/Submodules/CEF/MacOSX/)
+    add_subdirectory(Submodules/CEF/MacOSX/libcef_dll)
+  else()
+    include_directories (${CMAKE_SOURCE_DIR}/Submodules/CEF/Windows/)
+    add_subdirectory(Submodules/CEF/Windows/libcef_dll)
+  endif()
 endif()
 
 add_subdirectory(Source)

+ 9 - 5
Source/AtomicEditor/CMakeLists.txt

@@ -54,14 +54,18 @@ if(OS_MACOSX)
   set(CEF_HELPER_TARGET "AtomicEditor Helper")
 endif()
 
-# Logical target used to link the libcef library.
-ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
-
-# Determine the target output directory.
-SET_CEF_TARGET_OUT_DIR()
+if (OS_WINDOWS)
+    target_link_libraries(AtomicEditor AtomicWebView libcef_dll_wrapper "${CEF_LIB_RELEASE}")
+endif()
 
 if(OS_MACOSX)
 
+  # Logical target used to link the libcef library.
+  ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
+
+  # Determine the target output directory.
+  SET_CEF_TARGET_OUT_DIR()
+
   # Output paths for the app bundles.
   set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
   set(CEF_HELPER_APP "${CEF_TARGET_OUT_DIR}/${CEF_HELPER_TARGET}.app")

+ 4 - 0
Source/AtomicWebView/WebBrowserHost.cpp

@@ -50,8 +50,12 @@ WebBrowserHost::WebBrowserHost(Context* context) : Object (context)
 {
     const Vector<String>& arguments = GetArguments();
 
+#ifdef ATOMIC_PLATFORM_OSX
     const char* _argv[3] = { "", "--enable-media-stream", "--enable-usermedia-screen-capturing" };
     CefMainArgs args(3, (char**) &_argv);
+#else
+    CefMainArgs args;
+#endif
 
     CefSettings settings;
     settings.windowless_rendering_enabled = true;

+ 6 - 0
Source/AtomicWebView/WebClient.cpp

@@ -87,8 +87,14 @@ public:
 
         if(SDL_GetWindowWMInfo(sdlWindow, &info))
         {
+#ifdef ATOMIC_PLATFORM_OSX
             NSView* view = (NSView*) GetNSWindowContentView(info.info.cocoa.window);
             windowInfo.SetAsWindowless(view, false);
+#endif
+
+#ifdef ATOMIC_PLATFORM_WINDOWS
+         windowInfo.SetAsWindowless(info.info.win.window, false);
+#endif
 
             webClient_->renderHandler_->SetSize(width, height);
             CefRefPtr<CefBrowser> browser = CefBrowserHost::CreateBrowserSync(windowInfo, this,

+ 11 - 1
Source/AtomicWebView/WebTexture2D.cpp

@@ -89,6 +89,7 @@ public:
         return true;
     }
 
+#ifdef ATOMIC_PLATFORM_OSX
     void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects,
                  const void *buffer, int width, int height) OVERRIDE
     {
@@ -181,6 +182,15 @@ public:
         glDisable(GL_TEXTURE_2D);
 
     }
+#else
+
+    void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects,
+                 const void *buffer, int width, int height) OVERRIDE
+    {
+
+    }
+
+#endif
 
 private:
 
@@ -231,7 +241,7 @@ void WebTexture2D::SetSize(int width, int height)
     if (width == texture_->GetWidth() && height == texture_->GetHeight())
         return;
 
-    texture_->SetSize(width, height, Graphics::GetBGRAFormat(), TEXTURE_DYNAMIC);
+    texture_->SetSize(width, height, Graphics::GetRGBAFormat(), TEXTURE_DYNAMIC);
 
 }