Defining cmake project that depends on CEF3 build

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Defining cmake project that depends on CEF3 build

Postby newaira » Mon Apr 20, 2015 9:49 am

Hi there,

After hacking and playing around with the CEF3 build, I would like to put together a proper cmake script that would pull in a specific CEF3 build as a dependency for my own project. I'm a bit new to the cmake toolset and need some of guidance.

I've defined the CEF3 dependency with cmake using ExternalProject_Add.

Code: Select all
cmake_minimum_required(VERSION 3.2.1)
include(ExternalProject)

project(test)

# Include cmake macros.
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
include("macros")

ExternalProject_Add(
    cef
    URL https://cefbuilds.s3.amazonaws.com/2272/win/41.0.2272.76/cef_binary_3.2272.2077_windows32.7z
    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/vendor/cef
    INSTALL_COMMAND ""
)


After this step, I'm not sure what to do. I thought about creating a copy of cefsimple and use that as a starting point for the project, by doing something like add_subdirectory(cefsimple). But this would mean also copying all of CMakeLists.txt into my own CMakeLists.txt file. I would also need to adjust the cefsimple CMakeLists.txt file to somehow depend on the libcef_dll_wrapper from the external project. Does this make sense?

Any push in the right direction would be really helpful...
newaira
Techie
 
Posts: 19
Joined: Sun Apr 19, 2015 7:43 pm

Re: Defining cmake project that depends on CEF3 build

Postby magreenblatt » Mon Apr 20, 2015 1:20 pm

What you're trying to do seems reasonable. You will need something like CEF's root CMakeLists.txt and macros.cmake in your project to properly configure the environment (build flags, etc) and then your own application-specific version of the cefclient or cefsimple configuration. You can then bring in the libcef_dll folder as-is from the binary distribution via add_subdirectory(). I would suggest not downloading directly from cefbuilds.s3.amazonaws.com since those URLs may change or break at any time without notice.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Defining cmake project that depends on CEF3 build

Postby newaira » Tue Apr 21, 2015 1:50 pm

So I managed to get it to work with minimal changes to the original code. Thanks for the help. I'll post the entire sample up when I've polished it a bit.

What would you suggest doing instead of downloading from cefbuilds? You have a point as those builds are probably not being archived.
Last edited by newaira on Tue Apr 21, 2015 1:55 pm, edited 1 time in total.
newaira
Techie
 
Posts: 19
Joined: Sun Apr 19, 2015 7:43 pm

Re: Defining cmake project that depends on CEF3 build

Postby magreenblatt » Tue Apr 21, 2015 1:54 pm

newaira wrote:What would you suggest doing instead of downloading from cefbuilds?

You could copy the binary distribution archive to your own server or network location.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Defining cmake project that depends on CEF3 build

Postby newaira » Tue Apr 21, 2015 4:12 pm

So I posted a sample project on GitHub. I've only made it work on Windows, but now that it works there, it should be easy to make adjustments for other OSs.
https://github.com/andrejpavlovic/cef-c ... ect-sample

Here is a link to the diff to see the changes:
https://github.com/andrejpavlovic/cef-c ... 3e950025d4

Now I'm wondering if there is a way to not have to copy the entire CMakeLists.txt file in order to just make a few changes or automating that somehow...
newaira
Techie
 
Posts: 19
Joined: Sun Apr 19, 2015 7:43 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 59 guests

cron