A block for integrating CEF in Cinder with support for Cinder <-> CEF communication via Javascript. This effort owes much to this branch of ofxCEF for OpenFrameworks
Cinder-CEF depends on a pre-built version of libCEF version which can be created using Git Bash on Windows. Depends on cmake and VS 2015.
For proprietary video codecs (Windows) it is necessary to build CEF from source with specific compiler flags set. Further details are here
- Clone this repository into the
Cinder/blocks/
directory.git clone https://github.com/codeoncanvas/Cinder-CEF/
- Open the Cinder-CEF folder in a terminal (Git Bash on Windows)
- Run
sh build_cef.sh
This script will handle downloading and building CEF, and placing items in the correct folders. One it has successfully completed, the provided sample project should work. For building manually, see the script source, or check the instructions in this repository for Mac and Windows.
To create a new project with Cinder-CEF, simply use TinderBox. On macOS there is an additional manual step needed.
-
In the project settings go to Build Phases. There we need another
Run Script
build phase. Press the+
thenNew Run Script Phase
. In there goes:install_name_tool -change "@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" rsync -aved "$CINDER_PATH/blocks/Cinder-CEF/libs/cef/lib/osx/cef_helper_mac.app" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/" rm -rf "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/$PRODUCT_NAME Helper.app" mv "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/cef_helper_mac.app" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/$PRODUCT_NAME Helper.app" mv "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/$PRODUCT_NAME Helper.app/Contents/MacOS/cef_helper_mac" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/$PRODUCT_NAME Helper.app/Contents/MacOS/$PRODUCT_NAME Helper"
Cinder-CEF is currently setup to run in a single-threaded mode. While some performance benefit may be possible using CEF's multi-threaded-message-loop option, there appears to be some clash with Cinder's message handling that causes CEF to hang until mouse events are received. Efforts continue on a (currently broken) branch here
Mileage varies but there are a number of CEF command-line arguments which may improve performance in some cases. Some of these are included but commented out inside ciCEFClient.cpp
. These allow things like gpu-vsync and begin-frame-scheduling to be enabled/disabled.