-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathFindCEF.cmake
152 lines (127 loc) · 4.61 KB
/
FindCEF.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
#
# This file is the CEF CMake configuration entry point and should be loaded
# using `find_package(CEF REQUIRED)`. See the top-level CMakeLists.txt file
# included with the CEF binary distribution for usage information.
#
# in order for CEF to be found and usable on macOS, you should
# - download a full (not minimal) binary release of CEF from https://cef-builds.spotifycdn.com/
# - unpack the download, create a symlink to $EXTERNLIBS/cef
# - go to $EXTERNLIBS/cef/Release
# - build libcef_dll_wrapper: execute `cmake .`, followed by make/ninja
# - use ad-hoc code signing: `codesign -s - "Chromium Embedded Framework.framework"`
# - create symlinks to $EXTERNLIBS/ALL: go to $EXTERNLIBS, `stow -t ALL -d cef Release`
# - Find CEF
# Find the CEF includes and library
#
# CEF_INCLUDE_DIR - Where to find CEF includes
# CEF_LIBRARIES - List of libraries when using CEF
# CEF_FOUND - True if CEF was found
IF(CEF_INCLUDE_DIR)
SET(CEF_FIND_QUIETLY TRUE)
ENDIF(CEF_INCLUDE_DIR)
FIND_PATH(CEF_INCLUDE_DIR "include/base/cef_macros.h"
PATHS
$ENV{CEF_HOME}/include
$ENV{EXTERNLIBS}/cef/include
/opt/local/include
/opt/cef/include
/opt/include
PATH_SUFFIXES CEF cef
DOC "CEF - Headers"
)
SET(CEF_NAMES cef libcef "Chromium Embedded Framework")
SET(CEF_DBG_NAMES cefd libcefd libcef cef)
FIND_LIBRARY(CEF_LIBRARY NAMES ${CEF_NAMES}
PATHS
$ENV{CEF_HOME}
$ENV{EXTERNLIBS}/cef
/opt/local
/opt/cef
/opt
PATH_SUFFIXES Release lib/CEF lib64/CEF lib lib64 lib/win_64_VS2015
DOC "CEF - Library"
)
SET(CEF_WRAPPER_NAMES libcef_dll_wrapper.a libcef_dll_wrapper.lib cef_dll_wrapper)
SET(CEF_WRAPPER_DBG_NAMES libcef_dll_wrapperD.a libcef_dll_wrapperD.lib cef_dll_wrapperd)
FIND_LIBRARY(CEF_WRAPPER_LIBRARY NAMES ${CEF_WRAPPER_NAMES}
PATHS
$ENV{CEF_HOME}
$ENV{EXTERNLIBS}/cef
/opt/local
/opt/cef
/opt
PATH_SUFFIXES Release lib/CEF lib64/CEF lib lib64 lib/win_64_VS2015 Release/libcef_dll_wrapper libcef_dll_wrapper
DOC "CEF - Wrapper Library"
)
INCLUDE(FindPackageHandleStandardArgs)
IF(MSVC)
# VisualStudio needs a debug version
FIND_LIBRARY(CEF_LIBRARY_DEBUG NAMES ${CEF_DBG_NAMES}
PATHS
$ENV{CEF_HOME}/lib
$ENV{EXTERNLIBS}/cef
/opt/local
/opt/cef
/opt
PATH_SUFFIXES Debug lib/CEF lib64/CEF lib lib64 lib/win_64_VS2015
DOC "CEF - Library (Debug)"
)
FIND_LIBRARY(CEF_WRAPPER_LIBRARY_DEBUG NAMES ${CEF_WRAPPER_DBG_NAMES}
PATHS
$ENV{CEF_HOME}/lib
$ENV{EXTERNLIBS}/cef
/opt/local
/opt/cef
/opt
PATH_SUFFIXES Debug lib/CEF lib64/CEF lib lib64 lib/win_64_VS2015 Debug/libcef_dll_wrapper libcef_dll_wrapper
DOC "CEF - Wrapper Library (Debug)"
)
IF(CEF_LIBRARY_DEBUG AND CEF_LIBRARY)
SET(CEF_LIBRARIES optimized ${CEF_LIBRARY} debug ${CEF_LIBRARY_DEBUG} optimized ${CEF_WRAPPER_LIBRARY} debug ${CEF_WRAPPER_LIBRARY_DEBUG} )
ENDIF(CEF_LIBRARY_DEBUG AND CEF_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CEF DEFAULT_MSG CEF_LIBRARY CEF_LIBRARY_DEBUG CEF_INCLUDE_DIR CEF_WRAPPER_LIBRARY CEF_WRAPPER_LIBRARY_DEBUG)
MARK_AS_ADVANCED(CEF_LIBRARY CEF_LIBRARY_DEBUG CEF_INCLUDE_DIR CEF_WRAPPER_LIBRARY CEF_WRAPPER_LIBRARY_DEBUG)
ELSE(MSVC)
# rest of the world
SET(CEF_LIBRARIES ${CEF_LIBRARY} ${CEF_WRAPPER_LIBRARY})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CEF DEFAULT_MSG CEF_LIBRARY CEF_WRAPPER_LIBRARY CEF_INCLUDE_DIR)
MARK_AS_ADVANCED(CEF_LIBRARY CEF_INCLUDE_DIR CEF_WRAPPER_LIBRARY)
ENDIF(MSVC)
IF(CEF_FOUND)
SET(CEF_INCLUDE_DIRS ${CEF_INCLUDE_DIR})
ELSE(CEF_FOUND)
# Find the CEF binary distribution root directory.
set(_CEF_ROOT "")
if(CEF_ROOT AND IS_DIRECTORY "${CEF_ROOT}")
set(_CEF_ROOT "${CEF_ROOT}")
set(_CEF_ROOT_EXPLICIT 1)
else()
set(_ENV_CEF_ROOT "")
if(DEFINED ENV{CEF_ROOT})
file(TO_CMAKE_PATH "$ENV{CEF_ROOT}" _ENV_CEF_ROOT)
endif()
if(_ENV_CEF_ROOT AND IS_DIRECTORY "${_ENV_CEF_ROOT}")
set(_CEF_ROOT "${_ENV_CEF_ROOT}")
set(_CEF_ROOT_EXPLICIT 1)
endif()
unset(_ENV_CEF_ROOT)
endif()
set(ERROR FALSE)
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
message(WARNING "Specify a CEF_ROOT value via CMake or environment variable to find CEF")
set(ERROR TRUE)
endif()
if(NOT IS_DIRECTORY "${_CEF_ROOT}/cmake")
message(WARNING "No CMake bootstrap found for CEF binary distribution at: ${CEF_ROOT}.")
set(ERROR TRUE)
endif()
if(NOT ERROR)
# Execute additional cmake files from the CEF binary distribution.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CEF_ROOT}/cmake")
include("cef_variables")
include("cef_macros")
endif()
ENDIF(CEF_FOUND)