2016-05-12 23:41:30 +02:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
# Must be loaded via FindCEF.cmake.
|
|
|
|
if(NOT DEFINED _CEF_ROOT_EXPLICIT)
|
|
|
|
message(FATAL_ERROR "Use find_package(CEF) to load this file.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Shared configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Determine the platform.
|
|
|
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
2020-08-29 00:39:23 +02:00
|
|
|
set(OS_MAC 1)
|
|
|
|
set(OS_MACOSX 1) # For backwards compatibility.
|
2016-05-12 23:41:30 +02:00
|
|
|
set(OS_POSIX 1)
|
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
|
|
|
set(OS_LINUX 1)
|
|
|
|
set(OS_POSIX 1)
|
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
|
|
|
|
set(OS_WINDOWS 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Determine the project architecture.
|
|
|
|
if(NOT DEFINED PROJECT_ARCH)
|
2023-01-12 19:13:12 +01:00
|
|
|
if(("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") OR
|
|
|
|
("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM64"))
|
2020-12-15 20:11:11 +01:00
|
|
|
set(PROJECT_ARCH "arm64")
|
|
|
|
elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
2016-05-12 23:41:30 +02:00
|
|
|
set(PROJECT_ARCH "x86_64")
|
|
|
|
else()
|
|
|
|
set(PROJECT_ARCH "x86")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2017-05-11 19:17:16 +02:00
|
|
|
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
|
|
|
|
set(GEN_NINJA 1)
|
|
|
|
elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
|
|
|
set(GEN_MAKEFILES 1)
|
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# Determine the build type.
|
2017-05-11 19:17:16 +02:00
|
|
|
if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES))
|
2016-05-12 23:41:30 +02:00
|
|
|
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
|
|
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
|
|
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
# Path to the include directory.
|
|
|
|
set(CEF_INCLUDE_PATH "${_CEF_ROOT}")
|
|
|
|
|
|
|
|
# Path to the libcef_dll_wrapper target.
|
|
|
|
set(CEF_LIBCEF_DLL_WRAPPER_PATH "${_CEF_ROOT}/libcef_dll")
|
|
|
|
|
|
|
|
|
|
|
|
# Shared compiler/linker flags.
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES
|
2024-08-26 14:44:25 +02:00
|
|
|
# Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't
|
2016-05-12 23:41:30 +02:00
|
|
|
# in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc)
|
|
|
|
__STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-07-27 23:28:12 +02:00
|
|
|
# Configure use of the sandbox.
|
|
|
|
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
|
|
|
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
#
|
|
|
|
# Linux configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
if(OS_LINUX)
|
|
|
|
# Platform-specific compiler/linker flags.
|
|
|
|
set(CEF_LIBTYPE SHARED)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS
|
|
|
|
-fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
|
|
|
|
-fPIC # Generate position-independent code for shared libraries
|
|
|
|
-fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
|
|
|
|
-funwind-tables # Support stack unwinding for backtrace()
|
|
|
|
-fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
|
|
|
|
--param=ssp-buffer-size=4 # Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
|
|
|
|
-pipe # Use pipes rather than temporary files for communication between build stages
|
|
|
|
-pthread # Use the pthread library
|
|
|
|
-Wall # Enable all warnings
|
|
|
|
-Werror # Treat warnings as errors
|
|
|
|
-Wno-missing-field-initializers # Don't warn about missing field initializers
|
|
|
|
-Wno-unused-parameter # Don't warn about unused parameters
|
2018-06-27 18:47:39 +02:00
|
|
|
-Wno-error=comment # Don't warn about code in comments
|
|
|
|
-Wno-comment # Don't warn about code in comments
|
2021-03-01 20:41:27 +01:00
|
|
|
-Wno-deprecated-declarations # Don't warn about using deprecated methods
|
2016-05-12 23:41:30 +02:00
|
|
|
)
|
|
|
|
list(APPEND CEF_C_COMPILER_FLAGS
|
|
|
|
-std=c99 # Use the C99 language standard
|
|
|
|
)
|
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
-fno-exceptions # Disable exceptions
|
|
|
|
-fno-rtti # Disable real-time type information
|
|
|
|
-fno-threadsafe-statics # Don't generate thread-safe statics
|
|
|
|
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
|
2022-07-15 13:31:11 +02:00
|
|
|
-std=c++17 # Use the C++17 language standard
|
2016-05-12 23:41:30 +02:00
|
|
|
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
|
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
|
|
|
-O0 # Disable optimizations
|
|
|
|
-g # Generate debug information
|
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
|
|
|
-O2 # Optimize for maximum speed
|
|
|
|
-fdata-sections # Enable linker optimizations to improve locality of reference for data sections
|
|
|
|
-ffunction-sections # Enable linker optimizations to improve locality of reference for function sections
|
|
|
|
-fno-ident # Ignore the #ident directive
|
|
|
|
-U_FORTIFY_SOURCE # Undefine _FORTIFY_SOURCE in case it was previously defined
|
|
|
|
-D_FORTIFY_SOURCE=2 # Add memory and string function protection (security feature, related to stack-protector)
|
|
|
|
)
|
|
|
|
list(APPEND CEF_LINKER_FLAGS
|
|
|
|
-fPIC # Generate position-independent code for shared libraries
|
|
|
|
-pthread # Use the pthread library
|
|
|
|
-Wl,--disable-new-dtags # Don't generate new-style dynamic tags in ELF
|
|
|
|
-Wl,--fatal-warnings # Treat warnings as errors
|
|
|
|
-Wl,-rpath,. # Set rpath so that libraries can be placed next to the executable
|
|
|
|
-Wl,-z,noexecstack # Mark the stack as non-executable (security feature)
|
|
|
|
-Wl,-z,now # Resolve symbols on program start instead of on first use (security feature)
|
|
|
|
-Wl,-z,relro # Mark relocation sections as read-only (security feature)
|
|
|
|
)
|
|
|
|
list(APPEND CEF_LINKER_FLAGS_RELEASE
|
|
|
|
-Wl,-O1 # Enable linker optimizations
|
|
|
|
-Wl,--as-needed # Only link libraries that export symbols used by the binary
|
|
|
|
-Wl,--gc-sections # Remove unused code resulting from -fdata-sections and -function-sections
|
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES
|
|
|
|
_FILE_OFFSET_BITS=64 # Allow the Large File Support (LFS) interface to replace the old interface
|
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES_RELEASE
|
|
|
|
NDEBUG # Not a debug build
|
|
|
|
)
|
|
|
|
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
2019-02-01 22:05:52 +01:00
|
|
|
CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
|
|
|
|
if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
|
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
-Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
CHECK_C_COMPILER_FLAG(-Wno-unused-local-typedefs COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
|
|
|
|
if(COMPILER_SUPPORTS_NO_UNUSED_LOCAL_TYPEDEFS)
|
|
|
|
list(APPEND CEF_C_COMPILER_FLAGS
|
|
|
|
-Wno-unused-local-typedefs # Don't warn about unused local typedefs
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
CHECK_CXX_COMPILER_FLAG(-Wno-literal-suffix COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
|
|
|
|
if(COMPILER_SUPPORTS_NO_LITERAL_SUFFIX)
|
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
-Wno-literal-suffix # Don't warn about invalid suffixes on literals
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
CHECK_CXX_COMPILER_FLAG(-Wno-narrowing COMPILER_SUPPORTS_NO_NARROWING)
|
|
|
|
if(COMPILER_SUPPORTS_NO_NARROWING)
|
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
-Wno-narrowing # Don't warn about type narrowing
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-02-06 21:48:09 +01:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
-Wno-attributes # The cfi-icall attribute is not supported by the GNU C++ compiler
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
if(PROJECT_ARCH STREQUAL "x86_64")
|
|
|
|
# 64-bit architecture.
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS
|
|
|
|
-m64
|
|
|
|
-march=x86-64
|
|
|
|
)
|
|
|
|
list(APPEND CEF_LINKER_FLAGS
|
|
|
|
-m64
|
|
|
|
)
|
|
|
|
elseif(PROJECT_ARCH STREQUAL "x86")
|
|
|
|
# 32-bit architecture.
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS
|
|
|
|
-msse2
|
|
|
|
-mfpmath=sse
|
|
|
|
-mmmx
|
|
|
|
-m32
|
|
|
|
)
|
|
|
|
list(APPEND CEF_LINKER_FLAGS
|
|
|
|
-m32
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Standard libraries.
|
|
|
|
set(CEF_STANDARD_LIBS
|
|
|
|
X11
|
|
|
|
)
|
|
|
|
|
|
|
|
# CEF directory paths.
|
|
|
|
set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
|
|
|
|
set(CEF_BINARY_DIR "${_CEF_ROOT}/${CMAKE_BUILD_TYPE}")
|
|
|
|
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
|
|
|
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
|
|
|
|
|
|
|
# CEF library paths.
|
|
|
|
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.so")
|
|
|
|
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
|
|
|
|
|
|
|
|
# List of CEF binary files.
|
|
|
|
set(CEF_BINARY_FILES
|
|
|
|
chrome-sandbox
|
|
|
|
libcef.so
|
2018-02-27 21:37:19 +01:00
|
|
|
libEGL.so
|
|
|
|
libGLESv2.so
|
2021-09-30 20:21:50 +02:00
|
|
|
libvk_swiftshader.so
|
|
|
|
libvulkan.so.1
|
2016-05-12 23:41:30 +02:00
|
|
|
snapshot_blob.bin
|
2017-11-27 18:16:23 +01:00
|
|
|
v8_context_snapshot.bin
|
2021-09-30 20:21:50 +02:00
|
|
|
vk_swiftshader_icd.json
|
2016-05-12 23:41:30 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# List of CEF resource files.
|
|
|
|
set(CEF_RESOURCE_FILES
|
2021-02-28 21:23:42 +01:00
|
|
|
chrome_100_percent.pak
|
|
|
|
chrome_200_percent.pak
|
|
|
|
resources.pak
|
2016-05-12 23:41:30 +02:00
|
|
|
icudtl.dat
|
|
|
|
locales
|
|
|
|
)
|
2018-07-27 23:28:12 +02:00
|
|
|
|
|
|
|
if(USE_SANDBOX)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES
|
|
|
|
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
|
|
|
)
|
|
|
|
endif()
|
2016-05-12 23:41:30 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Mac OS X configuration.
|
|
|
|
#
|
|
|
|
|
2020-08-29 00:39:23 +02:00
|
|
|
if(OS_MAC)
|
2016-05-12 23:41:30 +02:00
|
|
|
# Platform-specific compiler/linker flags.
|
2017-04-05 19:30:18 +02:00
|
|
|
# See also Xcode target properties in cef_macros.cmake.
|
2016-05-12 23:41:30 +02:00
|
|
|
set(CEF_LIBTYPE SHARED)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS
|
|
|
|
-fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
|
|
|
|
-fstack-protector # Protect some vulnerable functions from stack-smashing (security feature)
|
|
|
|
-funwind-tables # Support stack unwinding for backtrace()
|
|
|
|
-fvisibility=hidden # Give hidden visibility to declarations that are not explicitly marked as visible
|
|
|
|
-Wall # Enable all warnings
|
|
|
|
-Werror # Treat warnings as errors
|
|
|
|
-Wextra # Enable additional warnings
|
|
|
|
-Wendif-labels # Warn whenever an #else or an #endif is followed by text
|
|
|
|
-Wnewline-eof # Warn about no newline at end of file
|
|
|
|
-Wno-missing-field-initializers # Don't warn about missing field initializers
|
|
|
|
-Wno-unused-parameter # Don't warn about unused parameters
|
|
|
|
)
|
|
|
|
list(APPEND CEF_C_COMPILER_FLAGS
|
|
|
|
-std=c99 # Use the C99 language standard
|
|
|
|
)
|
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
-fno-exceptions # Disable exceptions
|
|
|
|
-fno-rtti # Disable real-time type information
|
|
|
|
-fno-threadsafe-statics # Don't generate thread-safe statics
|
|
|
|
-fobjc-call-cxx-cdtors # Call the constructor/destructor of C++ instance variables in ObjC objects
|
|
|
|
-fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions
|
2022-07-15 13:31:11 +02:00
|
|
|
-std=c++17 # Use the C++17 language standard
|
2016-05-12 23:41:30 +02:00
|
|
|
-Wno-narrowing # Don't warn about type narrowing
|
|
|
|
-Wsign-compare # Warn about mixed signed/unsigned type comparisons
|
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
|
|
|
-O0 # Disable optimizations
|
|
|
|
-g # Generate debug information
|
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
|
|
|
-O3 # Optimize for maximum speed plus a few extras
|
|
|
|
)
|
|
|
|
list(APPEND CEF_LINKER_FLAGS
|
|
|
|
-Wl,-search_paths_first # Search for static or shared library versions in the same pass
|
|
|
|
-Wl,-ObjC # Support creation of ObjC static libraries
|
|
|
|
-Wl,-pie # Generate position-independent code suitable for executables only
|
|
|
|
)
|
|
|
|
list(APPEND CEF_LINKER_FLAGS_RELEASE
|
|
|
|
-Wl,-dead_strip # Strip dead code
|
|
|
|
)
|
|
|
|
|
2017-04-05 19:30:18 +02:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
|
|
|
|
if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
|
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
-Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# Standard libraries.
|
|
|
|
set(CEF_STANDARD_LIBS
|
|
|
|
-lpthread
|
|
|
|
"-framework AppKit"
|
2024-04-27 18:34:46 +02:00
|
|
|
"-framework Cocoa"
|
|
|
|
"-framework IOSurface"
|
2016-05-12 23:41:30 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Find the newest available base SDK.
|
|
|
|
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2024-08-26 14:44:25 +02:00
|
|
|
foreach(OS_VERSION 14.2 14.0 11.0)
|
2016-05-12 23:41:30 +02:00
|
|
|
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
|
|
|
|
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
|
|
|
|
set(CMAKE_OSX_SYSROOT ${SDK})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Target SDK.
|
2024-08-26 14:44:25 +02:00
|
|
|
set(CEF_TARGET_SDK "11.0")
|
2016-05-12 23:41:30 +02:00
|
|
|
list(APPEND CEF_COMPILER_FLAGS
|
|
|
|
-mmacosx-version-min=${CEF_TARGET_SDK}
|
|
|
|
)
|
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_TARGET_SDK})
|
|
|
|
|
|
|
|
# Target architecture.
|
|
|
|
if(PROJECT_ARCH STREQUAL "x86_64")
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
2020-11-20 22:00:56 +01:00
|
|
|
elseif(PROJECT_ARCH STREQUAL "arm64")
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
2016-05-12 23:41:30 +02:00
|
|
|
else()
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "i386")
|
|
|
|
endif()
|
|
|
|
|
2019-10-03 10:26:55 +02:00
|
|
|
# Prevent Xcode 11 from doing automatic codesigning.
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# CEF directory paths.
|
|
|
|
set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
|
|
|
|
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
|
|
|
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
2018-07-27 23:28:12 +02:00
|
|
|
|
|
|
|
if(USE_SANDBOX)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES
|
|
|
|
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
|
|
|
)
|
|
|
|
|
2023-01-03 00:34:43 +01:00
|
|
|
list(APPEND CEF_STANDARD_LIBS
|
|
|
|
-lsandbox
|
|
|
|
)
|
|
|
|
|
2018-07-27 23:28:12 +02:00
|
|
|
# CEF sandbox library paths.
|
|
|
|
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
|
|
|
|
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
|
|
|
|
endif()
|
2019-09-04 17:13:32 +02:00
|
|
|
|
|
|
|
# CEF Helper app suffixes.
|
|
|
|
# Format is "<name suffix>:<target suffix>:<plist suffix>".
|
|
|
|
set(CEF_HELPER_APP_SUFFIXES
|
|
|
|
"::"
|
2023-04-21 20:39:17 +02:00
|
|
|
" (Alerts):_alerts:.alerts"
|
2019-09-04 17:13:32 +02:00
|
|
|
" (GPU):_gpu:.gpu"
|
|
|
|
" (Plugin):_plugin:.plugin"
|
|
|
|
" (Renderer):_renderer:.renderer"
|
|
|
|
)
|
2016-05-12 23:41:30 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Windows configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
if(OS_WINDOWS)
|
2017-05-11 19:17:16 +02:00
|
|
|
if (GEN_NINJA)
|
|
|
|
# When using the Ninja generator clear the CMake defaults to avoid excessive
|
|
|
|
# console warnings (see issue #2120).
|
|
|
|
set(CMAKE_CXX_FLAGS "")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "")
|
|
|
|
endif()
|
|
|
|
|
2017-11-01 21:24:16 +01:00
|
|
|
if(USE_SANDBOX)
|
|
|
|
# Check if the current MSVC version is compatible with the cef_sandbox.lib
|
2020-07-23 18:28:45 +02:00
|
|
|
# static library. We require VS2015 or newer.
|
|
|
|
if(MSVC_VERSION LESS 1900)
|
2017-11-01 21:24:16 +01:00
|
|
|
message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
|
|
|
|
set(USE_SANDBOX OFF)
|
|
|
|
endif()
|
2016-09-01 15:31:24 +02:00
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
|
|
|
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
|
|
|
|
2018-02-22 21:00:09 +01:00
|
|
|
# Consumers using different runtime types may want to pass different flags
|
|
|
|
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
|
|
|
|
if (CEF_RUNTIME_LIBRARY_FLAG)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
|
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# Platform-specific compiler/linker flags.
|
|
|
|
set(CEF_LIBTYPE STATIC)
|
|
|
|
list(APPEND CEF_COMPILER_FLAGS
|
|
|
|
/MP # Multiprocess compilation
|
|
|
|
/Gy # Enable function-level linking
|
|
|
|
/GR- # Disable run-time type information
|
|
|
|
/W4 # Warning level 4
|
|
|
|
/WX # Treat warnings as errors
|
|
|
|
/wd4100 # Ignore "unreferenced formal parameter" warning
|
|
|
|
/wd4127 # Ignore "conditional expression is constant" warning
|
|
|
|
/wd4244 # Ignore "conversion possible loss of data" warning
|
2021-06-20 18:08:10 +02:00
|
|
|
/wd4324 # Ignore "structure was padded due to alignment specifier" warning
|
2016-05-12 23:41:30 +02:00
|
|
|
/wd4481 # Ignore "nonstandard extension used: override" warning
|
|
|
|
/wd4512 # Ignore "assignment operator could not be generated" warning
|
|
|
|
/wd4701 # Ignore "potentially uninitialized local variable" warning
|
|
|
|
/wd4702 # Ignore "unreachable code" warning
|
|
|
|
/wd4996 # Ignore "function or variable may be unsafe" warning
|
|
|
|
${CEF_DEBUG_INFO_FLAG}
|
|
|
|
)
|
2017-07-18 21:25:11 +02:00
|
|
|
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
|
|
|
/RTC1 # Disable optimizations
|
|
|
|
/Od # Enable basic run-time checks
|
|
|
|
)
|
2016-05-12 23:41:30 +02:00
|
|
|
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
|
|
|
/O2 # Optimize for maximum speed
|
|
|
|
/Ob2 # Inline any suitable function
|
|
|
|
/GF # Enable string pooling
|
|
|
|
)
|
2022-07-15 13:31:11 +02:00
|
|
|
list(APPEND CEF_CXX_COMPILER_FLAGS
|
|
|
|
/std:c++17 # Use the C++17 language standard
|
|
|
|
)
|
2016-05-12 23:41:30 +02:00
|
|
|
list(APPEND CEF_LINKER_FLAGS_DEBUG
|
|
|
|
/DEBUG # Generate debug information
|
|
|
|
)
|
|
|
|
list(APPEND CEF_EXE_LINKER_FLAGS
|
2016-09-08 22:52:04 +02:00
|
|
|
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
|
|
|
|
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
|
2023-08-09 22:40:55 +02:00
|
|
|
|
|
|
|
# Delayload most libraries as the dlls are simply not required at startup (or
|
|
|
|
# at all, depending on the process type). Some dlls open handles when they are
|
|
|
|
# loaded, and we may not want them to be loaded in renderers or other sandboxed
|
|
|
|
# processes. Conversely, some dlls must be loaded before sandbox lockdown. In
|
|
|
|
# unsandboxed processes they will load when first needed. The linker will
|
|
|
|
# automatically ignore anything which is not linked to the binary at all (it is
|
|
|
|
# harmless to have an unmatched /delayload). This list should be kept in sync
|
|
|
|
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
|
|
|
|
/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll
|
|
|
|
/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll
|
|
|
|
/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll
|
|
|
|
/DELAYLOAD:advapi32.dll
|
|
|
|
/DELAYLOAD:comctl32.dll
|
|
|
|
/DELAYLOAD:comdlg32.dll
|
|
|
|
/DELAYLOAD:credui.dll
|
|
|
|
/DELAYLOAD:cryptui.dll
|
|
|
|
/DELAYLOAD:d3d11.dll
|
|
|
|
/DELAYLOAD:d3d9.dll
|
|
|
|
/DELAYLOAD:dwmapi.dll
|
|
|
|
/DELAYLOAD:dxgi.dll
|
|
|
|
/DELAYLOAD:dxva2.dll
|
|
|
|
/DELAYLOAD:esent.dll
|
|
|
|
/DELAYLOAD:gdi32.dll
|
|
|
|
/DELAYLOAD:hid.dll
|
|
|
|
/DELAYLOAD:imagehlp.dll
|
|
|
|
/DELAYLOAD:imm32.dll
|
|
|
|
/DELAYLOAD:msi.dll
|
|
|
|
/DELAYLOAD:netapi32.dll
|
|
|
|
/DELAYLOAD:ncrypt.dll
|
|
|
|
/DELAYLOAD:ole32.dll
|
|
|
|
/DELAYLOAD:oleacc.dll
|
|
|
|
/DELAYLOAD:propsys.dll
|
|
|
|
/DELAYLOAD:psapi.dll
|
|
|
|
/DELAYLOAD:rpcrt4.dll
|
|
|
|
/DELAYLOAD:rstrtmgr.dll
|
|
|
|
/DELAYLOAD:setupapi.dll
|
|
|
|
/DELAYLOAD:shell32.dll
|
|
|
|
/DELAYLOAD:shlwapi.dll
|
|
|
|
/DELAYLOAD:uiautomationcore.dll
|
|
|
|
/DELAYLOAD:urlmon.dll
|
|
|
|
/DELAYLOAD:user32.dll
|
|
|
|
/DELAYLOAD:usp10.dll
|
|
|
|
/DELAYLOAD:uxtheme.dll
|
|
|
|
/DELAYLOAD:wer.dll
|
|
|
|
/DELAYLOAD:wevtapi.dll
|
|
|
|
/DELAYLOAD:wininet.dll
|
|
|
|
/DELAYLOAD:winusb.dll
|
|
|
|
/DELAYLOAD:wsock32.dll
|
|
|
|
/DELAYLOAD:wtsapi32.dll
|
2016-05-12 23:41:30 +02:00
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES
|
|
|
|
WIN32 _WIN32 _WINDOWS # Windows platform
|
|
|
|
UNICODE _UNICODE # Unicode build
|
2023-01-05 18:42:43 +01:00
|
|
|
# Targeting Windows 10. We can't say `=_WIN32_WINNT_WIN10` here because
|
|
|
|
# some files do `#if WINVER < 0x0600` without including windows.h before,
|
|
|
|
# and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
|
|
|
|
WINVER=0x0A00
|
|
|
|
_WIN32_WINNT=0x0A00
|
|
|
|
NTDDI_VERSION=NTDDI_WIN10_FE
|
2016-05-12 23:41:30 +02:00
|
|
|
NOMINMAX # Use the standard's templated min/max
|
|
|
|
WIN32_LEAN_AND_MEAN # Exclude less common API declarations
|
|
|
|
_HAS_EXCEPTIONS=0 # Disable exceptions
|
|
|
|
)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES_RELEASE
|
|
|
|
NDEBUG _NDEBUG # Not a debug build
|
|
|
|
)
|
|
|
|
|
2022-10-21 00:23:32 +02:00
|
|
|
if(PROJECT_ARCH STREQUAL "x86")
|
|
|
|
# Set the initial stack size to 0.5MiB, instead of the 1.5MiB minimum
|
|
|
|
# needed by CEF's main thread. This saves significant memory on threads
|
|
|
|
# (like those in the Windows thread pool, and others) whose stack size we
|
|
|
|
# can only control through this setting. The main thread (in 32-bit builds
|
|
|
|
# only) uses fibers to switch to a 4MiB stack at runtime via
|
|
|
|
# CefRunWinMainWithPreferredStackSize().
|
|
|
|
list(APPEND CEF_EXE_LINKER_FLAGS
|
2023-05-06 14:37:19 +02:00
|
|
|
/STACK:0x80000
|
2022-10-21 00:23:32 +02:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
# Increase the initial stack size to 8MiB from the default 1MiB.
|
|
|
|
list(APPEND CEF_EXE_LINKER_FLAGS
|
|
|
|
/STACK:0x800000
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# Standard libraries.
|
|
|
|
set(CEF_STANDARD_LIBS
|
|
|
|
comctl32.lib
|
2021-06-23 19:25:08 +02:00
|
|
|
gdi32.lib
|
2016-05-12 23:41:30 +02:00
|
|
|
rpcrt4.lib
|
|
|
|
shlwapi.lib
|
|
|
|
ws2_32.lib
|
|
|
|
)
|
|
|
|
|
|
|
|
# CEF directory paths.
|
|
|
|
set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources")
|
|
|
|
set(CEF_BINARY_DIR "${_CEF_ROOT}/$<CONFIGURATION>")
|
|
|
|
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
|
|
|
|
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
|
|
|
|
|
|
|
|
# CEF library paths.
|
|
|
|
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
|
|
|
|
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
|
|
|
|
|
|
|
|
# List of CEF binary files.
|
|
|
|
set(CEF_BINARY_FILES
|
2016-11-18 00:52:42 +01:00
|
|
|
chrome_elf.dll
|
2023-06-01 12:30:42 +02:00
|
|
|
d3dcompiler_47.dll
|
2016-05-12 23:41:30 +02:00
|
|
|
libcef.dll
|
|
|
|
libEGL.dll
|
|
|
|
libGLESv2.dll
|
|
|
|
snapshot_blob.bin
|
2017-11-27 18:16:23 +01:00
|
|
|
v8_context_snapshot.bin
|
2021-09-30 20:21:50 +02:00
|
|
|
vk_swiftshader.dll
|
|
|
|
vk_swiftshader_icd.json
|
|
|
|
vulkan-1.dll
|
2016-05-12 23:41:30 +02:00
|
|
|
)
|
|
|
|
|
2024-02-15 22:59:55 +01:00
|
|
|
if(PROJECT_ARCH STREQUAL "x86_64")
|
|
|
|
list(APPEND CEF_BINARY_FILES
|
|
|
|
dxil.dll
|
|
|
|
dxcompiler.dll
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# List of CEF resource files.
|
|
|
|
set(CEF_RESOURCE_FILES
|
2021-02-28 21:23:42 +01:00
|
|
|
chrome_100_percent.pak
|
|
|
|
chrome_200_percent.pak
|
|
|
|
resources.pak
|
2016-05-12 23:41:30 +02:00
|
|
|
icudtl.dat
|
|
|
|
locales
|
|
|
|
)
|
|
|
|
|
|
|
|
if(USE_SANDBOX)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES
|
|
|
|
PSAPI_VERSION=1 # Required by cef_sandbox.lib
|
|
|
|
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
|
|
|
|
)
|
2021-04-26 22:55:55 +02:00
|
|
|
list(APPEND CEF_COMPILER_DEFINES_DEBUG
|
|
|
|
_HAS_ITERATOR_DEBUGGING=0 # Disable iterator debugging
|
|
|
|
)
|
2016-05-12 23:41:30 +02:00
|
|
|
|
|
|
|
# Libraries required by cef_sandbox.lib.
|
|
|
|
set(CEF_SANDBOX_STANDARD_LIBS
|
2020-12-15 20:11:11 +01:00
|
|
|
Advapi32.lib
|
2016-05-12 23:41:30 +02:00
|
|
|
dbghelp.lib
|
2019-10-29 22:29:29 +01:00
|
|
|
Delayimp.lib
|
2023-01-30 18:43:54 +01:00
|
|
|
ntdll.lib
|
2020-12-15 20:11:11 +01:00
|
|
|
OleAut32.lib
|
2019-08-30 17:36:14 +02:00
|
|
|
PowrProf.lib
|
|
|
|
Propsys.lib
|
2016-05-12 23:41:30 +02:00
|
|
|
psapi.lib
|
2019-08-30 17:36:14 +02:00
|
|
|
SetupAPI.lib
|
2020-12-15 20:11:11 +01:00
|
|
|
Shell32.lib
|
2023-02-27 19:52:38 +01:00
|
|
|
Shcore.lib
|
2023-01-03 00:34:43 +01:00
|
|
|
Userenv.lib
|
2016-05-12 23:41:30 +02:00
|
|
|
version.lib
|
2018-11-13 19:44:09 +01:00
|
|
|
wbemuuid.lib
|
2023-02-27 19:52:38 +01:00
|
|
|
WindowsApp.lib
|
2016-05-12 23:41:30 +02:00
|
|
|
winmm.lib
|
|
|
|
)
|
|
|
|
|
|
|
|
# CEF sandbox library paths.
|
|
|
|
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
|
|
|
|
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Configure use of ATL.
|
|
|
|
option(USE_ATL "Enable or disable use of ATL." ON)
|
|
|
|
if(USE_ATL)
|
2017-07-18 21:25:11 +02:00
|
|
|
# Locate the atlmfc directory if it exists. It may be at any depth inside
|
|
|
|
# the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER may also
|
|
|
|
# be at different depths depending on the toolchain version
|
|
|
|
# (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe",
|
|
|
|
# "VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe", etc).
|
|
|
|
set(HAS_ATLMFC 0)
|
2017-05-11 19:17:16 +02:00
|
|
|
get_filename_component(VC_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
|
|
|
get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
|
|
|
|
while(NOT ${VC_DIR_NAME} STREQUAL "VC")
|
|
|
|
get_filename_component(VC_DIR ${VC_DIR} DIRECTORY)
|
2017-07-18 21:25:11 +02:00
|
|
|
if(IS_DIRECTORY "${VC_DIR}/atlmfc")
|
|
|
|
set(HAS_ATLMFC 1)
|
|
|
|
break()
|
|
|
|
endif()
|
2017-05-11 19:17:16 +02:00
|
|
|
get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
|
|
|
|
endwhile()
|
|
|
|
|
2016-05-12 23:41:30 +02:00
|
|
|
# Determine if the Visual Studio install supports ATL.
|
2017-07-18 21:25:11 +02:00
|
|
|
if(NOT HAS_ATLMFC)
|
2017-05-11 19:17:16 +02:00
|
|
|
message(WARNING "ATL is not supported by your VC installation.")
|
2016-05-12 23:41:30 +02:00
|
|
|
set(USE_ATL OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_ATL)
|
|
|
|
list(APPEND CEF_COMPILER_DEFINES
|
|
|
|
CEF_USE_ATL # Used by apps to test if ATL support is enabled
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|