cef_variables.cmake 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. # Copyright (c) 2016 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. # Must be loaded via FindCEF.cmake.
  5. if(NOT DEFINED _CEF_ROOT_EXPLICIT)
  6. message(FATAL_ERROR "Use find_package(CEF) to load this file.")
  7. endif()
  8. #
  9. # Shared configuration.
  10. #
  11. # Determine the platform.
  12. if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
  13. set(OS_MAC 1)
  14. set(OS_MACOSX 1) # For backwards compatibility.
  15. set(OS_POSIX 1)
  16. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
  17. set(OS_LINUX 1)
  18. set(OS_POSIX 1)
  19. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
  20. set(OS_WINDOWS 1)
  21. endif()
  22. # Determine the project architecture.
  23. if(NOT DEFINED PROJECT_ARCH)
  24. if(("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") OR
  25. ("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM64"))
  26. set(PROJECT_ARCH "arm64")
  27. elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
  28. set(PROJECT_ARCH "x86_64")
  29. else()
  30. set(PROJECT_ARCH "x86")
  31. endif()
  32. endif()
  33. if(${CMAKE_GENERATOR} STREQUAL "Ninja")
  34. set(GEN_NINJA 1)
  35. elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
  36. set(GEN_MAKEFILES 1)
  37. endif()
  38. # Determine the build type.
  39. if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES))
  40. # CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
  41. set(CMAKE_BUILD_TYPE Release)
  42. message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
  43. endif()
  44. # Path to the include directory.
  45. set(CEF_INCLUDE_PATH "${_CEF_ROOT}")
  46. # Path to the libcef_dll_wrapper target.
  47. set(CEF_LIBCEF_DLL_WRAPPER_PATH "${_CEF_ROOT}/libcef_dll")
  48. # Shared compiler/linker flags.
  49. list(APPEND CEF_COMPILER_DEFINES
  50. # Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
  51. # in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc)
  52. __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS
  53. )
  54. # Configure use of the sandbox.
  55. option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
  56. #
  57. # Linux configuration.
  58. #
  59. if(OS_LINUX)
  60. # Platform-specific compiler/linker flags.
  61. set(CEF_LIBTYPE SHARED)
  62. list(APPEND CEF_COMPILER_FLAGS
  63. -fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
  64. -fPIC # Generate position-independent code for shared libraries
  65. -fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
  66. -funwind-tables # Support stack unwinding for backtrace()
  67. -fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
  68. --param=ssp-buffer-size=4 # Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
  69. -pipe # Use pipes rather than temporary files for communication between build stages
  70. -pthread # Use the pthread library
  71. # -Wall # Enable all warnings
  72. # -Werror # Treat warnings as errors
  73. # -Wno-missing-field-initializers # Don't warn about missing field initializers
  74. # -Wno-unused-parameter # Don't warn about unused parameters
  75. # -Wno-error=comment # Don't warn about code in comments
  76. # -Wno-comment # Don't warn about code in comments
  77. # -Wno-deprecated-declarations # Don't warn about using deprecated methods
  78. )
  79. list(APPEND CEF_C_COMPILER_FLAGS
  80. -std=c99 # Use the C99 language standard
  81. )
  82. list(APPEND CEF_CXX_COMPILER_FLAGS
  83. # -fno-exceptions # Disable exceptions
  84. # -fno-rtti # Disable real-time type information
  85. -fno-threadsafe-statics # Don't generate thread-safe statics
  86. -fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
  87. -std=c++17 # Use the C++17 language standard
  88. -Wsign-compare # Warn about mixed signed/unsigned type comparisons
  89. )
  90. list(APPEND CEF_COMPILER_FLAGS_DEBUG
  91. -O0 # Disable optimizations
  92. -g # Generate debug information
  93. )
  94. list(APPEND CEF_COMPILER_FLAGS_RELEASE
  95. -O2 # Optimize for maximum speed
  96. -fdata-sections # Enable linker optimizations to improve locality of reference for data sections
  97. -ffunction-sections # Enable linker optimizations to improve locality of reference for function sections
  98. -fno-ident # Ignore the #ident directive
  99. -U_FORTIFY_SOURCE # Undefine _FORTIFY_SOURCE in case it was previously defined
  100. -D_FORTIFY_SOURCE=2 # Add memory and string function protection (security feature, related to stack-protector)
  101. )
  102. list(APPEND CEF_LINKER_FLAGS
  103. -fPIC # Generate position-independent code for shared libraries
  104. -pthread # Use the pthread library
  105. -Wl,--disable-new-dtags # Don't generate new-style dynamic tags in ELF
  106. -Wl,--fatal-warnings # Treat warnings as errors
  107. -Wl,-rpath,. # Set rpath so that libraries can be placed next to the executable
  108. -Wl,-z,noexecstack # Mark the stack as non-executable (security feature)
  109. -Wl,-z,now # Resolve symbols on program start instead of on first use (security feature)
  110. -Wl,-z,relro # Mark relocation sections as read-only (security feature)
  111. )
  112. list(APPEND CEF_LINKER_FLAGS_RELEASE
  113. -Wl,-O1 # Enable linker optimizations
  114. -Wl,--as-needed # Only link libraries that export symbols used by the binary
  115. -Wl,--gc-sections # Remove unused code resulting from -fdata-sections and -function-sections
  116. )
  117. list(APPEND CEF_COMPILER_DEFINES
  118. _FILE_OFFSET_BITS=64 # Allow the Large File Support (LFS) interface to replace the old interface
  119. )
  120. list(APPEND CEF_COMPILER_DEFINES_RELEASE
  121. NDEBUG # Not a debug build
  122. )
  123. include(CheckCCompilerFlag)
  124. include(CheckCXXCompilerFlag)
  125. CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
  126. if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
  127. list(APPEND CEF_CXX_COMPILER_FLAGS
  128. -Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
  129. )
  130. endif()
  131. CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
  132. if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
  133. list(APPEND CEF_C_COMPILER_FLAGS
  134. -Wno-unused-local-typedefs # Don't warn about unused local typedefs
  135. )
  136. endif()
  137. CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
  138. if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
  139. list(APPEND CEF_CXX_COMPILER_FLAGS
  140. -Wno-literal-suffix # Don't warn about invalid suffixes on literals
  141. )
  142. endif()
  143. CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
  144. if(COMPILER_SUPPORTS_NO_NARROWING)
  145. list(APPEND CEF_CXX_COMPILER_FLAGS
  146. -Wno-narrowing # Don't warn about type narrowing
  147. )
  148. endif()
  149. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  150. list(APPEND CEF_CXX_COMPILER_FLAGS
  151. -Wno-attributes # The cfi-icall attribute is not supported by the GNU C++ compiler
  152. )
  153. endif()
  154. if(PROJECT_ARCH STREQUAL "x86_64")
  155. # 64-bit architecture.
  156. list(APPEND CEF_COMPILER_FLAGS
  157. -m64
  158. -march=x86-64
  159. )
  160. list(APPEND CEF_LINKER_FLAGS
  161. -m64
  162. )
  163. elseif(PROJECT_ARCH STREQUAL "x86")
  164. # 32-bit architecture.
  165. list(APPEND CEF_COMPILER_FLAGS
  166. -msse2
  167. -mfpmath=sse
  168. -mmmx
  169. -m32
  170. )
  171. list(APPEND CEF_LINKER_FLAGS
  172. -m32
  173. )
  174. endif()
  175. # Standard libraries.
  176. set(CEF_STANDARD_LIBS
  177. X11
  178. )
  179. # CEF directory paths.
  180. set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
  181. set(CEF_BINARY_DIR "${_CEF_ROOT}/${CMAKE_BUILD_TYPE}")
  182. set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
  183. set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
  184. # CEF library paths.
  185. set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.so")
  186. set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
  187. # List of CEF binary files.
  188. set(CEF_BINARY_FILES
  189. chrome-sandbox
  190. libcef.so
  191. libEGL.so
  192. libGLESv2.so
  193. libvk_swiftshader.so
  194. # libvulkan.so.1
  195. snapshot_blob.bin
  196. v8_context_snapshot.bin
  197. vk_swiftshader_icd.json
  198. )
  199. # List of CEF resource files.
  200. set(CEF_RESOURCE_FILES
  201. chrome_100_percent.pak
  202. chrome_200_percent.pak
  203. resources.pak
  204. icudtl.dat
  205. locales
  206. )
  207. if(USE_SANDBOX)
  208. list(APPEND CEF_COMPILER_DEFINES
  209. CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
  210. )
  211. endif()
  212. endif()
  213. #
  214. # Mac OS X configuration.
  215. #
  216. if(OS_MAC)
  217. # Platform-specific compiler/linker flags.
  218. # See also Xcode target properties in cef_macros.cmake.
  219. set(CEF_LIBTYPE SHARED)
  220. list(APPEND CEF_COMPILER_FLAGS
  221. -fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
  222. -fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
  223. -funwind-tables # Support stack unwinding for backtrace()
  224. -fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
  225. -Wall # Enable all warnings
  226. -Werror # Treat warnings as errors
  227. -Wextra # Enable additional warnings
  228. -Wendif-labels # Warn whenever an #else or an #endif is followed by text
  229. -Wnewline-eof # Warn about no newline at end of file
  230. -Wno-missing-field-initializers # Don't warn about missing field initializers
  231. -Wno-unused-parameter # Don't warn about unused parameters
  232. )
  233. list(APPEND CEF_C_COMPILER_FLAGS
  234. -std=c99 # Use the C99 language standard
  235. )
  236. list(APPEND CEF_CXX_COMPILER_FLAGS
  237. # -fno-exceptions # Disable exceptions
  238. # -fno-rtti # Disable real-time type information
  239. -fno-threadsafe-statics # Don't generate thread-safe statics
  240. -fobjc-call-cxx-cdtors # Call the constructor/destructor of C++ instance variables in ObjC objects
  241. -fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
  242. -std=c++17 # Use the C++17 language standard
  243. -Wno-narrowing # Don't warn about type narrowing
  244. -Wsign-compare # Warn about mixed signed/unsigned type comparisons
  245. )
  246. list(APPEND CEF_COMPILER_FLAGS_DEBUG
  247. -O0 # Disable optimizations
  248. -g # Generate debug information
  249. )
  250. list(APPEND CEF_COMPILER_FLAGS_RELEASE
  251. -O3 # Optimize for maximum speed plus a few extras
  252. )
  253. list(APPEND CEF_LINKER_FLAGS
  254. -Wl,-search_paths_first # Search for static or shared library versions in the same pass
  255. -Wl,-ObjC # Support creation of ObjC static libraries
  256. -Wl,-pie # Generate position-independent code suitable for executables only
  257. )
  258. list(APPEND CEF_LINKER_FLAGS_RELEASE
  259. -Wl,-dead_strip # Strip dead code
  260. )
  261. include(CheckCXXCompilerFlag)
  262. CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
  263. if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
  264. list(APPEND CEF_CXX_COMPILER_FLAGS
  265. -Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
  266. )
  267. endif()
  268. # Standard libraries.
  269. set(CEF_STANDARD_LIBS
  270. -lpthread
  271. "-framework Cocoa"
  272. "-framework AppKit"
  273. )
  274. # Find the newest available base SDK.
  275. execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
  276. foreach(OS_VERSION 10.15 10.14 10.13)
  277. set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
  278. if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
  279. set(CMAKE_OSX_SYSROOT ${SDK})
  280. endif()
  281. endforeach()
  282. # Target SDK.
  283. set(CEF_TARGET_SDK "10.13")
  284. list(APPEND CEF_COMPILER_FLAGS
  285. -mmacosx-version-min=${CEF_TARGET_SDK}
  286. )
  287. set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_TARGET_SDK})
  288. # Target architecture.
  289. if(PROJECT_ARCH STREQUAL "x86_64")
  290. set(CMAKE_OSX_ARCHITECTURES "x86_64")
  291. elseif(PROJECT_ARCH STREQUAL "arm64")
  292. set(CMAKE_OSX_ARCHITECTURES "arm64")
  293. else()
  294. set(CMAKE_OSX_ARCHITECTURES "i386")
  295. endif()
  296. # Prevent Xcode 11 from doing automatic codesigning.
  297. set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
  298. # CEF directory paths.
  299. set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
  300. set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
  301. set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
  302. if(USE_SANDBOX)
  303. list(APPEND CEF_COMPILER_DEFINES
  304. CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
  305. )
  306. list(APPEND CEF_STANDARD_LIBS
  307. -lsandbox
  308. )
  309. # CEF sandbox library paths.
  310. set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
  311. set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
  312. endif()
  313. # CEF Helper app suffixes.
  314. # Format is "<name suffix>:<target suffix>:<plist suffix>".
  315. set(CEF_HELPER_APP_SUFFIXES
  316. "::"
  317. " (Alerts):_alerts:.alerts"
  318. " (GPU):_gpu:.gpu"
  319. " (Plugin):_plugin:.plugin"
  320. " (Renderer):_renderer:.renderer"
  321. )
  322. endif()
  323. #
  324. # Windows configuration.
  325. #
  326. if(OS_WINDOWS)
  327. if (GEN_NINJA)
  328. # When using the Ninja generator clear the CMake defaults to avoid excessive
  329. # console warnings (see issue #2120).
  330. set(CMAKE_CXX_FLAGS "")
  331. set(CMAKE_CXX_FLAGS_DEBUG "")
  332. set(CMAKE_CXX_FLAGS_RELEASE "")
  333. endif()
  334. if(USE_SANDBOX)
  335. # Check if the current MSVC version is compatible with the cef_sandbox.lib
  336. # static library. We require VS2015 or newer.
  337. if(MSVC_VERSION LESS 1900)
  338. message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
  339. set(USE_SANDBOX OFF)
  340. endif()
  341. endif()
  342. # Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
  343. set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
  344. # Consumers using different runtime types may want to pass different flags
  345. set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
  346. if (CEF_RUNTIME_LIBRARY_FLAG)
  347. list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
  348. list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
  349. endif()
  350. # Platform-specific compiler/linker flags.
  351. set(CEF_LIBTYPE STATIC)
  352. list(APPEND CEF_COMPILER_FLAGS
  353. /MP # Multiprocess compilation
  354. /Gy # Enable function-level linking
  355. /GR- # Disable run-time type information
  356. /W4 # Warning level 4
  357. /WX # Treat warnings as errors
  358. /wd4100 # Ignore "unreferenced formal parameter" warning
  359. /wd4127 # Ignore "conditional expression is constant" warning
  360. /wd4244 # Ignore "conversion possible loss of data" warning
  361. /wd4324 # Ignore "structure was padded due to alignment specifier" warning
  362. /wd4481 # Ignore "nonstandard extension used: override" warning
  363. /wd4512 # Ignore "assignment operator could not be generated" warning
  364. /wd4701 # Ignore "potentially uninitialized local variable" warning
  365. /wd4702 # Ignore "unreachable code" warning
  366. /wd4996 # Ignore "function or variable may be unsafe" warning
  367. ${CEF_DEBUG_INFO_FLAG}
  368. )
  369. list(APPEND CEF_COMPILER_FLAGS_DEBUG
  370. /RTC1 # Disable optimizations
  371. /Od # Enable basic run-time checks
  372. )
  373. list(APPEND CEF_COMPILER_FLAGS_RELEASE
  374. /O2 # Optimize for maximum speed
  375. /Ob2 # Inline any suitable function
  376. /GF # Enable string pooling
  377. )
  378. list(APPEND CEF_CXX_COMPILER_FLAGS
  379. /std:c++17 # Use the C++17 language standard
  380. )
  381. list(APPEND CEF_LINKER_FLAGS_DEBUG
  382. /DEBUG # Generate debug information
  383. )
  384. list(APPEND CEF_EXE_LINKER_FLAGS
  385. /MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
  386. /LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
  387. )
  388. list(APPEND CEF_COMPILER_DEFINES
  389. WIN32 _WIN32 _WINDOWS # Windows platform
  390. UNICODE _UNICODE # Unicode build
  391. # Targeting Windows 10. We can't say `=_WIN32_WINNT_WIN10` here because
  392. # some files do `#if WINVER < 0x0600` without including windows.h before,
  393. # and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
  394. WINVER=0x0A00
  395. _WIN32_WINNT=0x0A00
  396. NTDDI_VERSION=NTDDI_WIN10_FE
  397. NOMINMAX # Use the standard's templated min/max
  398. WIN32_LEAN_AND_MEAN # Exclude less common API declarations
  399. _HAS_EXCEPTIONS=0 # Disable exceptions
  400. )
  401. list(APPEND CEF_COMPILER_DEFINES_RELEASE
  402. NDEBUG _NDEBUG # Not a debug build
  403. )
  404. if(PROJECT_ARCH STREQUAL "x86")
  405. # Set the initial stack size to 0.5MiB, instead of the 1.5MiB minimum
  406. # needed by CEF's main thread. This saves significant memory on threads
  407. # (like those in the Windows thread pool, and others) whose stack size we
  408. # can only control through this setting. The main thread (in 32-bit builds
  409. # only) uses fibers to switch to a 4MiB stack at runtime via
  410. # CefRunWinMainWithPreferredStackSize().
  411. list(APPEND CEF_EXE_LINKER_FLAGS
  412. /STACK:0x80000
  413. )
  414. else()
  415. # Increase the initial stack size to 8MiB from the default 1MiB.
  416. list(APPEND CEF_EXE_LINKER_FLAGS
  417. /STACK:0x800000
  418. )
  419. endif()
  420. # Standard libraries.
  421. set(CEF_STANDARD_LIBS
  422. comctl32.lib
  423. gdi32.lib
  424. rpcrt4.lib
  425. shlwapi.lib
  426. ws2_32.lib
  427. )
  428. # CEF directory paths.
  429. set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
  430. set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
  431. set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
  432. set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
  433. # CEF library paths.
  434. set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
  435. set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
  436. # List of CEF binary files.
  437. set(CEF_BINARY_FILES
  438. chrome_elf.dll
  439. d3dcompiler_47.dll
  440. libcef.dll
  441. libEGL.dll
  442. libGLESv2.dll
  443. snapshot_blob.bin
  444. v8_context_snapshot.bin
  445. vk_swiftshader.dll
  446. vk_swiftshader_icd.json
  447. vulkan-1.dll
  448. )
  449. # List of CEF resource files.
  450. set(CEF_RESOURCE_FILES
  451. chrome_100_percent.pak
  452. chrome_200_percent.pak
  453. resources.pak
  454. icudtl.dat
  455. locales
  456. )
  457. if(USE_SANDBOX)
  458. list(APPEND CEF_COMPILER_DEFINES
  459. PSAPI_VERSION=1 # Required by cef_sandbox.lib
  460. CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
  461. )
  462. list(APPEND CEF_COMPILER_DEFINES_DEBUG
  463. _HAS_ITERATOR_DEBUGGING=0 # Disable iterator debugging
  464. )
  465. # Libraries required by cef_sandbox.lib.
  466. set(CEF_SANDBOX_STANDARD_LIBS
  467. Advapi32.lib
  468. dbghelp.lib
  469. Delayimp.lib
  470. ntdll.lib
  471. OleAut32.lib
  472. PowrProf.lib
  473. Propsys.lib
  474. psapi.lib
  475. SetupAPI.lib
  476. Shell32.lib
  477. Shcore.lib
  478. Userenv.lib
  479. version.lib
  480. wbemuuid.lib
  481. WindowsApp.lib
  482. winmm.lib
  483. )
  484. # CEF sandbox library paths.
  485. set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
  486. set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
  487. endif()
  488. # Configure use of ATL.
  489. option(USE_ATL "Enable or disable use of ATL." ON)
  490. if(USE_ATL)
  491. # Locate the atlmfc directory if it exists. It may be at any depth inside
  492. # the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER may also
  493. # be at different depths depending on the toolchain version
  494. # (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe",
  495. # "VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe", etc).
  496. set(HAS_ATLMFC 0)
  497. get_filename_component(VC_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
  498. get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
  499. while(NOT ${VC_DIR_NAME} STREQUAL "VC")
  500. get_filename_component(VC_DIR ${VC_DIR} DIRECTORY)
  501. if(IS_DIRECTORY "${VC_DIR}/atlmfc")
  502. set(HAS_ATLMFC 1)
  503. break()
  504. endif()
  505. get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
  506. endwhile()
  507. # Determine if the Visual Studio install supports ATL.
  508. if(NOT HAS_ATLMFC)
  509. message(WARNING "ATL is not supported by your VC installation.")
  510. set(USE_ATL OFF)
  511. endif()
  512. endif()
  513. if(USE_ATL)
  514. list(APPEND CEF_COMPILER_DEFINES
  515. CEF_USE_ATL # Used by apps to test if ATL support is enabled
  516. )
  517. endif()
  518. endif()