• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
2# reserved. Use of this source code is governed by a BSD-style license that
3# can be found in the LICENSE file.
4
5# OVERVIEW
6#
7# CMake is a cross-platform open-source build system that can generate project
8# files in many different formats. It can be downloaded from
9# http://www.cmake.org or installed via a platform package manager.
10#
11# CMake-generated project formats that have been tested with this CEF binary
12# distribution include:
13#
14# Linux:      Ninja, GCC 7.5.0+, Unix Makefiles
15# MacOS:      Ninja, Xcode 12.2 to 13.0
16# Windows:    Ninja, Visual Studio 2019+
17#
18# Ninja is a cross-platform open-source tool for running fast builds using
19# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
20# downloaded from http://martine.github.io/ninja/ or installed via a platform
21# package manager.
22#
23# CMAKE STRUCTURE
24#
25# This CEF binary distribution includes the following CMake files:
26#
27# CMakeLists.txt              Bootstrap that sets up the CMake environment.
28# cmake/*.cmake               CEF configuration files shared by all targets.
29# libcef_dll/CMakeLists.txt   Defines the libcef_dll_wrapper target.
30# tests/*/CMakeLists.txt      Defines the test application target.
31#
32# See the "TODO:" comments below for guidance on how to integrate this CEF
33# binary distribution into a new or existing CMake project.
34#
35# BUILD REQUIREMENTS
36#
37# The below requirements must be met to build this CEF binary distribution.
38#
39# - CMake version 3.19 or newer.
40#
41# - Linux requirements:
42#   Currently supported distributions include Debian 10 (Buster), Ubuntu 18
43#   (Bionic Beaver), and related. Ubuntu 18.04 64-bit with GCC 7.5.0+ is
44#   recommended. Newer versions will likely also work but may not have been
45#   tested.
46#   Required packages include:
47#     build-essential
48#     libgtk3.0-dev     (required by the cefclient target only)
49#
50# - MacOS requirements:
51#   Xcode 12.2 to 13.0 building on MacOS 10.15.4 (Catalina) or newer. Only
52#   64-bit builds are supported. The Xcode command-line tools must also be
53#   installed. Newer Xcode versions may not have been been tested and are not
54#   recommended.
55#
56# - Windows requirements:
57#   Visual Studio 2019 or newer building on Windows 7 or newer. Windows 10
58#   64-bit is recommended. Newer versions will likely also work but may not have
59#   been tested.
60#
61# BUILD EXAMPLES
62#
63# The below commands will generate project files and create a Debug build of all
64# CEF targets using CMake and the platform toolchain.
65#
66# Start by creating and entering the CMake build output directory:
67# > cd path/to/cef_binary_*
68# > mkdir build && cd build
69#
70# To perform a Linux build using a 32-bit CEF binary distribution on a 32-bit
71# Linux platform or a 64-bit CEF binary distribution on a 64-bit Linux platform:
72#   Using Unix Makefiles:
73#     > cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
74#     > make -j4 cefclient cefsimple
75#
76#   Using Ninja:
77#     > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
78#     > ninja cefclient cefsimple
79#
80# To perform a MacOS build using a 64-bit CEF binary distribution:
81#   Using the Xcode IDE:
82#     > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
83#     Open build\cef.xcodeproj in Xcode and select Product > Build.
84#
85#   Using Ninja:
86#     > cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Debug ..
87#     > ninja cefclient cefsimple
88#
89# To perform a MacOS build using an ARM64 CEF binary distribution:
90#   Using the Xcode IDE:
91#     > cmake -G "Xcode" -DPROJECT_ARCH="arm64" ..
92#     Open build\cef.xcodeproj in Xcode and select Product > Build.
93#
94#   Using Ninja:
95#     > cmake -G "Ninja" -DPROJECT_ARCH="arm64" -DCMAKE_BUILD_TYPE=Debug ..
96#     > ninja cefclient cefsimple
97#
98# To perform a Windows build using a 32-bit CEF binary distribution:
99#   Using the Visual Studio 2019 IDE:
100#     > cmake -G "Visual Studio 16" -A Win32 ..
101#     Open build\cef.sln in Visual Studio and select Build > Build Solution.
102#
103#   Using Ninja with Visual Studio 2019 command-line tools:
104#     (this path may be different depending on your Visual Studio installation)
105#     > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
106#     > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
107#     > ninja cefclient cefsimple
108#
109# To perform a Windows build using a 64-bit CEF binary distribution:
110#   Using the Visual Studio 2019 IDE:
111#     > cmake -G "Visual Studio 16" -A x64 ..
112#     Open build\cef.sln in Visual Studio and select Build > Build Solution.
113#
114#   Using Ninja with Visual Studio 2019 command-line tools:
115#     (this path may be different depending on your Visual Studio installation)
116#     > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
117#     > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
118#     > ninja cefclient cefsimple
119#
120# To perform a Windows build using an ARM64 CEF binary distribution:
121#   Using the Visual Studio 2019 IDE:
122#     > cmake -G "Visual Studio 16" -A arm64 ..
123#     Open build\cef.sln in Visual Studio and select Build > Build Solution.
124#
125#   Using Ninja with Visual Studio 2019 command-line tools:
126#     (this path may be different depending on your Visual Studio installation)
127#     > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
128#     > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
129#     > ninja cefsimple
130
131#
132# Global setup.
133#
134
135# For VS2019 and Xcode 12+ support.
136cmake_minimum_required(VERSION 3.19)
137
138# Only generate Debug and Release configuration types.
139set(CMAKE_CONFIGURATION_TYPES Debug Release)
140
141# Project name.
142# TODO: Change this line to match your project name when you copy this file.
143project(cef)
144
145# Use folders in the resulting project files.
146set_property(GLOBAL PROPERTY OS_FOLDERS ON)
147
148
149#
150# CEF_ROOT setup.
151# This variable must be set to locate the binary distribution.
152# TODO: Choose one of the below examples and comment out the rest.
153#
154
155# Example 1: The current directory contains both the complete binary
156#            distribution and your project.
157# A. Comment in these lines:
158#
159set(CEF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
160set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
161
162# Example 2: The binary distribution is in a separate directory from your
163#            project. Locate the binary distribution using the CEF_ROOT CMake
164#            variable.
165# A. Create a directory structure for your project like the following:
166#    myproject/
167#      CMakeLists.txt    <= top-level CMake configuration
168#      mytarget/
169#        CMakeLists.txt  <= CMake configuration for `mytarget`
170#        ... other `mytarget` source files
171# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
172#    configuration.
173# C. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
174#    your application. See the included cefclient and cefsimple CMakeLists.txt
175#    files as an example.
176# D. Comment in these lines:
177#
178# set(CEF_ROOT "c:/path/to/cef_binary_3.2704.xxxx.gyyyyyyy_windows32")
179# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake")
180
181# Example 3: The binary distribution is in a separate directory from your
182#            project. Locate the binary distribution using the CEF_ROOT
183#            environment variable.
184# A. Create a directory structure for your project like the following:
185#    myproject/
186#      CMakeLists.txt    <= top-level CMake configuration
187#      cmake/
188#        FindCEF.cmake   <= CEF CMake configuration entry point
189#      mytarget/
190#        CMakeLists.txt  <= CMake configuration for `mytarget`
191#        ... other `mytarget` source files
192# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake
193#    configuration.
194# C. Copy the cmake/FindCEF.cmake file to "myproject/cmake/FindCEF.cmake".
195# D. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for
196#    your application. See the included cefclient and cefsimple CMakeLists.txt
197#    files as an example.
198# E. Set the CEF_ROOT environment variable before executing CMake. For example:
199#    > set CEF_ROOT=c:\path\to\cef_binary_3.2704.xxxx.gyyyyyyy_windows32
200# F. Comment in these lines:
201#
202# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
203
204
205#
206# Load the CEF configuration.
207#
208
209# Execute FindCEF.cmake which must exist in CMAKE_MODULE_PATH.
210find_package(CEF REQUIRED)
211
212
213#
214# Define CEF-based targets.
215#
216
217# Include the libcef_dll_wrapper target.
218# Comes from the libcef_dll/CMakeLists.txt file in the binary distribution
219# directory.
220add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
221
222# Include application targets.
223# Comes from the <target>/CMakeLists.txt file in the current directory.
224# TODO: Change these lines to match your project target when you copy this file.
225if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
226  add_subdirectory(tests/cefsimple)
227  add_subdirectory(tests/gtest)
228  add_subdirectory(tests/ceftests)
229endif()
230
231if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/cefclient")
232  add_subdirectory(tests/cefclient)
233endif()
234
235# Display configuration settings.
236PRINT_CEF_CONFIG()
237