diff --git a/QCefView_Build_Fix/CMakeLists.txt b/QCefView_Build_Fix/CMakeLists.txt new file mode 100644 index 0000000..df371b3 --- /dev/null +++ b/QCefView_Build_Fix/CMakeLists.txt @@ -0,0 +1,250 @@ +# +# The main config file for QCefView +# +cmake_minimum_required(VERSION 3.21) +project(QCefView) + +set(CMAKE_FOLDER "QCefView") + +# arguments: +# CEF_SDK_VERSION: +# - specify the CEF version to be used, +# - refer to: cmake\CefViewCoreConfig.cmake +# +# QT_SDK_DIR: +# - specify the Qt SDK path +# - refer to: cmake\QtConfig.cmake +# + +#[Edit:JackLee]mingw build +# options +option(BUILD_DEMO "Build the demo" OFF) +option(BUILD_LIBCEF_DEMO "Build the libcef demo" OFF) +option(BUILD_STATIC "Build QCefView as static library" OFF) +option(STATIC_CRT "Use MultiThreaded linkage for MSVC" OFF) +option(USE_SANDBOX "Enable CEF Sandbox" OFF) +option(USE_WIN_DCOMPOSITION "Enabled Windows direct composition for hardware rendering, _WIN32_WINNT >= 0x602 (Windows 8) is required" OFF) +option(BUILD_COMPILER "Build Tools" MINGW) +# Only works for Windows & Linux, always enabled on macOS +# If enable then: +# CefSettings.multi_threaded_message_loop = false && CefSettings.external_message_pump = true +# else: +# CefSettings.multi_threaded_message_loop = true && CefSettings.external_message_pump = false +option(USE_QT_EVENT_LOOP "Enable the integration of CEF message loop thread into Qt event loop" OFF) + +#[Edit:JackLee]mingw build +if (MINGW) + if (NOT QT_SDK_DIR) + set(QT_SDK_DIR "D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake") + endif() + # add_definitions(-DBUILD_DEMO=ON) + # add_definitions(-DBUILD_LIBCEF_DEMO=OFF) + # add_definitions(-DBUILD_STATIC=ON) + # add_definitions(-DSTATIC_CRT=OFF) + # add_definitions(-DUSE_SANDBOX=OFF) + # add_definitions(-DUSE_WIN_DCOMPOSITION=ON) + # add_definitions(-DUSE_QT_EVENT_LOOP=ON) + # add_definitions(-DCMAKE_BUILD_TYPE=Release) + SET(BUILD_DEMO ON) + SET(BUILD_LIBCEF_DEMO OFF) + SET(BUILD_STATIC ON) + SET(STATIC_CRT OFF) + SET(USE_SANDBOX OFF) + SET(USE_WIN_DCOMPOSITION OFF) + SET(USE_QT_EVENT_LOOP ON) + SET(CMAKE_BUILD_TYPE Release) + SET(BUILD_COMPILER MINGW) + # 禁用弃用警告 + add_compile_options(-Wno-deprecated-declarations) +elseif(MSVC) + add_definitions(-D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING=1) +endif() + +message(STATUS "BUILD_DEMO:" ${BUILD_DEMO}) +message(STATUS "BUILD_LIBCEF_DEMO:" ${BUILD_LIBCEF_DEMO}) +message(STATUS "BUILD_STATIC:" ${BUILD_STATIC}) +message(STATUS "STATIC_CRT:" ${STATIC_CRT}) +message(STATUS "USE_SANDBOX:" ${USE_SANDBOX}) +message(STATUS "USE_WIN_DCOMPOSITION:" ${USE_WIN_DCOMPOSITION}) +message(STATUS "USE_QT_EVENT_LOOP:" ${USE_QT_EVENT_LOOP}) +message(STATUS "CMAKE_BUILD_TYPE:" ${CMAKE_BUILD_TYPE}) + +# append cmake config module path +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# Only generate Debug and Release configuration types. +set(CMAKE_CONFIGURATION_TYPES Debug Release) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug") +endif() + +# Use folders in the resulting project files. +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# C standard +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_STANDARD 11) + +# C++ standard +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD 17) + +# Determine the project architecture. +if(NOT DEFINED PROJECT_ARCH) + if(OS_WINDOWS AND "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm64") + set(PROJECT_ARCH "arm64") + elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) + set(PROJECT_ARCH "x86_64") + else() + set(PROJECT_ARCH "x86") + endif() +endif() + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + set(OS_MACOS 1) + set(OS_POSIX 1) + add_definitions( + -DOS_MACOS=1 + -DOS_POSIX=1 + ) + add_compile_options( + "-g" + "$<$:-O0>" + "$<$:-O3>" + ) + + # Target architecture. + if(PROJECT_ARCH STREQUAL "x86_64") + set(CMAKE_OSX_ARCHITECTURES "x86_64") + elseif(PROJECT_ARCH STREQUAL "arm64") + set(CMAKE_OSX_ARCHITECTURES "arm64") + else() + set(CMAKE_OSX_ARCHITECTURES "i386") + endif() +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(OS_LINUX 1) + set(OS_POSIX 1) + add_definitions(-DOS_LINUX=1 -DOS_POSIX=1) + add_compile_options( + "-g" + "$<$:-O0>" + "$<$:-O3>" + ) + + if(PROJECT_ARCH STREQUAL "x86_64") + # x86 64-bit architecture. + add_compile_options(-m64 -march=x86-64) + add_link_options(-m64) + elseif(PROJECT_ARCH STREQUAL "x86") + # x86 32-bit architecture. + add_compile_options(-m32) + add_link_options(-m32) + endif() +#[Edit:JackLee]mingw build +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + if(MSVC) + set(OS_WINDOWS 1) + # Disable the sandbox on Windows, because the sandbox.lib is MT which is conflict with Qt + set(USE_SANDBOX OFF CACHE BOOL "Disable sandbox on Windows" FORCE) + add_definitions( + -DOS_WINDOWS=1 + -D_WIN32_WINNT=0x601 + ) + + if(USE_WIN_DCOMPOSITION) + add_definitions( + -DENABLE_WINDOWS_DIRECT_COMPOSITION=1 + ) + endif() + + add_compile_options( + /W3 + /WX + /M$,T,D>$<$:d> + ) + add_link_options(/DEBUG) + elseif(MINGW) + set(OS_WINDOWS 1) + add_definitions( + -DOS_WINDOWS=1 + -D_WIN32_WINNT=0x0A00 + ) + if(USE_WIN_DCOMPOSITION) + add_definitions(-DENABLE_WINDOWS_DIRECT_COMPOSITION=1) + endif() + endif() +endif() + +if(BUILD_STATIC) + set(QCEFVIEW_LIB_TYPE STATIC) + add_definitions(-DQCEFVIEW_STATIC=1) +else() + set(QCEFVIEW_LIB_TYPE SHARED) +endif() + +# detect whether we are in sub folder +get_directory_property(QCefView_HAS_PARENT_DIRECTORY PARENT_DIRECTORY) + +if(NOT QCefView_HAS_PARENT_DIRECTORY) + message(STATUS "QCefView is not in subdirectory, put all output together") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$/bin) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$/bin) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$/lib) +endif() + +# Config the QT package +# ############################################################## +set(QT_SDK_DIR "" CACHE PATH "Qt build toolchain path") +include(QtConfig) +set(Qt_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION}) + +# ############################################################## +# thirdparty CefViewCore +add_subdirectory(thirdparty) + +if(OS_MACOS) + # detect minimum deployment target by Qt + if(${Qt_VERSION} VERSION_GREATER_EQUAL 6.5) + set(QT_MIN_DEPLOYMENT_TARGET 11.0) + elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 6.2) + set(QT_MIN_DEPLOYMENT_TARGET 10.14) + elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 5.14) + set(QT_MIN_DEPLOYMENT_TARGET 10.13) + elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 5.13) + set(QT_MIN_DEPLOYMENT_TARGET 10.12) + elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 5.10) + set(QT_MIN_DEPLOYMENT_TARGET 10.11) + else() + set(QT_MIN_DEPLOYMENT_TARGET 10.10) + endif() + + # detect minimum deployment target by CEF + # plese refer to: https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding.md + if(${CEF_VERSION_MAJOR} VERSION_GREATER_EQUAL 117) + set(CEF_MIN_DEPLOYMENT_TARGET 10.15) + elseif(${CEF_VERSION_MAJOR} VERSION_GREATER_EQUAL 104) + set(CEF_MIN_DEPLOYMENT_TARGET 10.13) + else() + set(CEF_MIN_DEPLOYMENT_TARGET 10.11) + endif() + + # use the greater one as the minimum deployment target + if(${QT_MIN_DEPLOYMENT_TARGET} VERSION_LESS ${CEF_MIN_DEPLOYMENT_TARGET}) + set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_MIN_DEPLOYMENT_TARGET}) + else() + set(CMAKE_OSX_DEPLOYMENT_TARGET ${QT_MIN_DEPLOYMENT_TARGET}) + endif() +endif() + +# Config QCefView target +# ############################################################## +add_subdirectory(src) + +# Config the Demo project +# ############################################################## +if(BUILD_DEMO) + add_subdirectory(example/QCefViewTest) +endif() + +# ############################################################## diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/CMakeLists.txt b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/CMakeLists.txt new file mode 100644 index 0000000..9ae8a8d --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/CMakeLists.txt @@ -0,0 +1,201 @@ +# +# The main config file for CefViewCore +# +cmake_minimum_required(VERSION 3.19.1) +project(CefViewCore) + +option(USE_SANDBOX "Enable CEF Sandbox" OFF) +option(STATIC_CRT "Use MultiThreaded linkage for MSVC" OFF) + +#[Edit:JackLee]mingw build +if(MINGW) + add_definitions(-DUSE_SANDBOX=OFF) + add_definitions(-DSTATIC_CRT=OFF) + add_definitions(-DCMAKE_BUILD_TYPE=Release) +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# Determine the project architecture. +if(NOT DEFINED PROJECT_ARCH) + if(OS_WINDOWS AND "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm64") + set(PROJECT_ARCH "arm64") + elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) + set(PROJECT_ARCH "x86_64") + else() + set(PROJECT_ARCH "x86") + endif() +endif() + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + set(OS_MACOS 1) + set(OS_POSIX 1) + add_definitions(-DOS_MACOS=1 -DOS_POSIX=1) + + # Target architecture. + if(PROJECT_ARCH STREQUAL "x86_64") + set(CMAKE_OSX_ARCHITECTURES "x86_64") + elseif(PROJECT_ARCH STREQUAL "arm64") + set(CMAKE_OSX_ARCHITECTURES "arm64") + else() + set(CMAKE_OSX_ARCHITECTURES "i386") + endif() +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(OS_LINUX 1) + set(OS_POSIX 1) + add_definitions(-DOS_LINUX=1 -DOS_POSIX=1) + add_compile_options(-Wno-unknown-pragmas) + + # Target architecture. + if(PROJECT_ARCH STREQUAL "x86_64") + # x86 64-bit architecture. + add_compile_options(-m64 -march=x86-64) + add_link_options(-m64) + elseif(PROJECT_ARCH STREQUAL "x86") + # x86 32-bit architecture. + add_compile_options(-m32) + add_link_options(-m32) + endif() +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + set(OS_WINDOWS 1) + add_definitions(-DOS_WINDOWS=1) +endif() + +# Only generate Debug and Release configuration types. +set(CMAKE_CONFIGURATION_TYPES Debug Release) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug") +endif() + +# Use folders in the resulting project files. +set_property(GLOBAL PROPERTY OS_FOLDERS ON) + +# C standard +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_STANDARD 11) + +# C++ standard +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD 17) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/$/bin) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/$/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/$/lib) + +# set CefView Helper Process Name +if(NOT CEFVIEW_WING_NAME) + set(DEFAULT_CEFVIEW_WING_NAME "CefViewWing") + message(STATUS + "CEFVIEW_WING_NAME is empty, use default version ${DEFAULT_CEFVIEW_WING_NAME}\n" + "You can change the name by adding -DCEFVIEW_WING_NAME=xxx to commandline for generation") + set(CEFVIEW_WING_NAME ${DEFAULT_CEFVIEW_WING_NAME} CACHE STRING "CefViewWing Helper Process Name" FORCE) +endif() + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/src/CefViewCoreProtocol.h.in" + "${CMAKE_CURRENT_SOURCE_DIR}/include/CefViewCoreProtocol.h" + @ONLY +) + +# Config the CEF +# ############################################################## +message(STATUS "Detecting CEF_SDK_VERSION: ${CEF_SDK_VERSION}") + +if(NOT CEF_SDK_VERSION) + # set CEF version to be used + # https://cef-builds.spotifycdn.com/index.html + # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding.md + # set(DEFAULT_CEF_SDK_VERSION "89.0.18+gb36241d+chromium-89.0.4389.114") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "91.1.23+g04c8d56+chromium-91.0.4472.164") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "92.0.27+g274abcf+chromium-92.0.4515.159") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "93.1.14+gf38ce34+chromium-93.0.4577.82") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "94.4.11+gc4d96f0+chromium-94.0.4606.81") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "95.7.18+g0d6005e+chromium-95.0.4638.69") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "96.0.18+gfe551e4+chromium-96.0.4664.110") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "97.1.9+ga00bca5+chromium-97.0.4692.99") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "98.2.1+g29d6e22+chromium-98.0.4758.109") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "99.2.15+g71e9523+chromium-99.0.4844.84") # IME poisition incorrect + # set(DEFAULT_CEF_SDK_VERSION "100.0.24+g0783cf8+chromium-100.0.4896.127") # IME poisition incorrect + # set(DEFAULT_CEF_SDK_VERSION "101.0.18+g367b4a0+chromium-101.0.4951.67") # IME poisition incorrect + # set(DEFAULT_CEF_SDK_VERSION "102.0.10+gf249b2e+chromium-102.0.5005.115") # IME poisition incorrect + # set(DEFAULT_CEF_SDK_VERSION "103.0.12+g8eb56c7+chromium-103.0.5060.134") # IME poisition incorrect + # set(DEFAULT_CEF_SDK_VERSION "104.4.26+g4180781+chromium-104.0.5112.102") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "105.3.39+g2ec21f9+chromium-105.0.5195.127") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "106.1.1+g5891c70+chromium-106.0.5249.119") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "107.1.12+g65b79a6+chromium-107.0.5304.122") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "108.4.13+ga98cd4c+chromium-108.0.5359.125") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "109.1.18+gf1c41e4+chromium-109.0.5414.120") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "110.0.32+g291f1df+chromium-110.0.5481.180") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "111.2.7+gebf5d6a+chromium-111.0.5563.148") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "112.3.0+gb09c4ca+chromium-112.0.5615.165") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "113.3.1+g525fa10+chromium-113.0.5672.128") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "114.2.13+g6792e13+chromium-114.0.5735.200") + # set(DEFAULT_CEF_SDK_VERSION "115.3.15+g21130e0+chromium-115.0.5790.173") + # set(DEFAULT_CEF_SDK_VERSION "116.0.27+gd8c85ac+chromium-116.0.5845.190") + # set(DEFAULT_CEF_SDK_VERSION "117.2.5+gda4c36a+chromium-117.0.5938.152") + # set(DEFAULT_CEF_SDK_VERSION "118.7.1+g99817d2+chromium-118.0.5993.119") + # set(DEFAULT_CEF_SDK_VERSION "119.4.7+g55e15c8+chromium-119.0.6045.199") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "120.1.6+gf08b1fd+chromium-120.0.6099.71") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "121.3.15+g4d3b0b4+chromium-121.0.6167.184") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "122.1.13+gde5b724+chromium-122.0.6261.130") # GOOD + # set(DEFAULT_CEF_SDK_VERSION "123.0.13+gfc703fb+chromium-123.0.6312.124") # NOT TEST + # set(DEFAULT_CEF_SDK_VERSION "124.3.9+g9bd638f+chromium-124.0.6367.207") # NOT TEST + # set(DEFAULT_CEF_SDK_VERSION "125.0.22+gc410c95+chromium-125.0.6422.142") # NOT TEST + # set(DEFAULT_CEF_SDK_VERSION "126.2.18+g3647d39+chromium-126.0.6478.183") # NOT TEST + set(DEFAULT_CEF_SDK_VERSION "127.3.5+g114ea2a+chromium-127.0.6533.120") # GOOD + + # set(DEFAULT_CEF_SDK_VERSION "128.4.9+g9840ad9+chromium-128.0.6613.120") # BAD # debugbreak - debug mode + message(STATUS + "CEF_SDK_VERSION is empty, use default version ${DEFAULT_CEF_SDK_VERSION}\n" + "You can change the version by adding -DCEF_SDK_VERSION=xxx to commandline for generation") + set(CEF_SDK_VERSION ${DEFAULT_CEF_SDK_VERSION} CACHE STRING "Cef binary SDK version" FORCE) +endif() + +# setup CEF +include(SetupCef) + +# ############################################################## +set(CMAKE_SUPPRESS_REGENERATION TRUE) + +# ############################################################## +set(CefViewCore_INCLUDE_PATH + "${CEF_INCLUDE_PATH}" + "${CMAKE_CURRENT_SOURCE_DIR}/include" +) + +add_subdirectory(src) + +if(OS_MACOS) + set(CefViewCore_HELPER_TARGETS "${CEFVIEW_WING_NAME};${CEFVIEW_WING_NAME}_gpu;${CEFVIEW_WING_NAME}_plugin;${CEFVIEW_WING_NAME}_renderer") +else() + set(CefViewCore_HELPER_TARGETS "${CEFVIEW_WING_NAME}") +endif() + +get_directory_property(IS_CURRENT_IN_SUBDIRECTORY PARENT_DIRECTORY) + +if(IS_CURRENT_IN_SUBDIRECTORY) + set(CEFVIEW_WING_NAME ${CEFVIEW_WING_NAME} PARENT_SCOPE) + set(CefViewCore_EXPORT_INCLUDE_PATH ${CefViewCore_INCLUDE_PATH} PARENT_SCOPE) + set(CefViewCore_HELPER_APP_TARGETS ${CefViewCore_HELPER_TARGETS} PARENT_SCOPE) + set(CefViewCore_CEF_BINARY_DIR ${CEF_BINARY_DIR} PARENT_SCOPE) + set(CefViewCore_CEF_RESOURCE_DIR ${CEF_RESOURCE_DIR} PARENT_SCOPE) + set(CefViewCore_CEF_INCLUDE_DIR ${CEF_ROOT}/include PARENT_SCOPE) +endif() + +install( + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/$/lib" + DESTINATION "$" +) +install( + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/$/bin" + DESTINATION "$" +) +install( + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" + DESTINATION "include/CefViewCore" +) +install( + DIRECTORY "${CEF_SDK_DIR}/include" + DESTINATION "include/cef" +) diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/cmake/SetupCef.cmake b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/cmake/SetupCef.cmake new file mode 100644 index 0000000..49705fc --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/cmake/SetupCef.cmake @@ -0,0 +1,239 @@ +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# Generally, there is NO NEED to modify the following config +# +# Download CEF binary package +# https://cef-builds.spotifycdn.com/index.html +# + +# ################################################################################# +# Stage 1. Download CEF binary package +if(NOT CEF_SDK_VERSION) + message(FATAL_ERROR "CEF_SDK_VERSION is missing!") +endif() + +if(OS_WINDOWS) + set(CEF_SDK_PLATFORM "windows") +elseif(OS_LINUX) + set(CEF_SDK_PLATFORM "linux") +elseif(OS_MACOS) + set(CEF_SDK_PLATFORM "macos") +else() + message(FATAL_ERROR "Unsupported Operating System") +endif() + +if(PROJECT_ARCH STREQUAL "x86_64") + set(CEF_SDK_ARCH "64") +elseif(PROJECT_ARCH STREQUAL "x86") + set(CEF_SDK_ARCH "32") +elseif(PROJECT_ARCH STREQUAL "arm64") + set(CEF_SDK_ARCH "arm64") +elseif(PROJECT_ARCH STREQUAL "arm") + set(CEF_SDK_ARCH "arm") +else() + message(FATAL_ERROR "Unsupported Processor Architecture") +endif() + +# set cef sdk package name +set(CEF_SDK_WORKSPACE "${CMAKE_CURRENT_SOURCE_DIR}/dep") + +if(OS_MACOS AND PROJECT_ARCH STREQUAL "x86_64") + # macosx64 + set(CEF_SDK_PACKAGE_NAME "cef_binary_${CEF_SDK_VERSION}_${CEF_SDK_PLATFORM}x${CEF_SDK_ARCH}") +else() + set(CEF_SDK_PACKAGE_NAME "cef_binary_${CEF_SDK_VERSION}_${CEF_SDK_PLATFORM}${CEF_SDK_ARCH}") +endif() + +if(NOT CUSTOM_CEF_SDK_DIR) + # Scan extracted sdk dir + set(CEF_SDK_EXTRACTED_DIR "${CEF_SDK_WORKSPACE}/${CEF_SDK_PACKAGE_NAME}") + file(GLOB CEF_SDK_DIR "${CEF_SDK_EXTRACTED_DIR}") +else() + message(STATUS "CUSTOM_CEF_SDK_DIR set: ${CUSTOM_CEF_SDK_DIR}") + set(CEF_SDK_DIR "${CUSTOM_CEF_SDK_DIR}") +endif() + +# output +message(STATUS "CEF SDK dir: ${CEF_SDK_DIR}") + +# ################################################################################# +# Stage 2. Extract CEF binary package +if(NOT EXISTS ${CEF_SDK_DIR}) + set(CEF_LOCAL_PACKAGE_PATH "${CEF_SDK_WORKSPACE}/${CEF_SDK_PACKAGE_NAME}.tar.bz2") + + # if no local cef sdk package file then download it + if(NOT EXISTS "${CEF_LOCAL_PACKAGE_PATH}") + set(CEF_SDK_DOWNLOAD_URL "https://cef-builds.spotifycdn.com/${CEF_SDK_PACKAGE_NAME}.tar.bz2") + message(STATUS "Downloading CEF binary SDK from ${CEF_SDK_DOWNLOAD_URL}") + file(DOWNLOAD + "${CEF_SDK_DOWNLOAD_URL}" # URL + "${CEF_LOCAL_PACKAGE_PATH}" # Local Path + SHOW_PROGRESS + TLS_VERIFY ON + STATUS DOWNLOAD_RESULT + ) + list(GET DOWNLOAD_RESULT 0 DOWNLOAD_RESULT_CODE) + list(GET DOWNLOAD_RESULT 1 DOWNLOAD_RESULT_MESSAGE) + + if(NOT DOWNLOAD_RESULT_CODE EQUAL 0) + file(REMOVE "${CEF_LOCAL_PACKAGE_PATH}") + message(FATAL_ERROR "Failed to download CEF binary SDK, ERROR:[${DOWNLOAD_RESULT_CODE}]${DOWNLOAD_RESULT_MESSAGE}") + endif() + endif() + + message(STATUS "Extracting CEF binary SDK from ${CEF_LOCAL_PACKAGE_PATH}") + + # Extract + file(ARCHIVE_EXTRACT + INPUT "${CEF_LOCAL_PACKAGE_PATH}" + DESTINATION "${CEF_SDK_WORKSPACE}" + VERBOSE + ) + + # Capture the dir name + file(GLOB CEF_SDK_DIR "${CEF_SDK_EXTRACTED_DIR}") +endif() + +# ################################################################################# +# Stage 3. Config CEF +if(${CMAKE_VERSION} GREATER "3.11") + cmake_policy(SET CMP0074 NEW) +endif() + +if(${CMAKE_VERSION} GREATER "3.12") + cmake_policy(SET CMP0077 NEW) +endif() + +#[Edit:JackLee]mingw build +if(OS_WINDOWS AND MSVC) + add_link_options(/DEBUG) + if(USE_SANDBOX) + # cef_sandbox.lib is MT already, must keep the same with it + set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Use static runtime") + add_compile_options("/MT$<$:d>") + else() + # either MT or MD is supported + set(CEF_RUNTIME_LIBRARY_FLAG "/M$,T,D>" CACHE STRING "Use static runtime" FORCE) + add_compile_options("/M$,T,D>$<$:d>") + endif() +elseif(OS_WINDOWS AND MINGW) + if(CMAKE_BUILD_TYPE STREQUAL Release) + add_compile_options( + "$<$:-O0>" + "$<$:-O3>" + ) + else() + add_compile_options( + "-g" + "$<$:-O0>" + "$<$:-O3>" + ) + endif() +endif() + +# Append CEF root dir to CMAKE_MODULE_PATH +set(CEF_ROOT "${CEF_SDK_DIR}") +list(APPEND CMAKE_MODULE_PATH "${CEF_ROOT}/cmake") +find_package(CEF REQUIRED) + +# Add libcef dll wrapper +add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper) + +if(USE_SANDBOX AND(OS_WINDOWS OR OS_MACOS)) + add_definitions(-DCEF_USE_SANDBOX) + + # message(STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG}," "${CEF_SANDBOX_LIB_RELEASE}" ) + # Logical target used to link the cef_sandbox library. + ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}") +endif() + +PRINT_CEF_CONFIG() + +# ################################################################################# +# Stage 4. Read CEF version and generated CefVersion.h +# set need configure QCefView_global to false +set(Need_Config_CefVersion_File FALSE) + +message(STATUS "${CEF_ROOT}/include/cef_version.h") +file(READ "${CEF_ROOT}/include/cef_version.h" cef_version_content) + +# ------------ check CEF_VERSION +string(REGEX MATCH "#define CEF_VERSION \"([a-z0-9\.\+\-]+)\"" _ ${cef_version_content}) + +if(NOT "${CMAKE_MATCH_1}" STREQUAL "${CEF_VERSION}") + set(CEF_VERSION ${CMAKE_MATCH_1} CACHE STRING "CEF Version" FORCE) + set(Need_Config_CefVersion_File TRUE) + message(STATUS "CEF_VERSION: ${CEF_VERSION} - Updated!") +else() + message(STATUS "CEF_VERSION: ${CEF_VERSION} - No Change!") +endif() + +# ------------ check CEF_VERSION_MAJOR +string(REGEX MATCH "#define CEF_VERSION_MAJOR ([0-9]+)" _ ${cef_version_content}) + +if(NOT "${CMAKE_MATCH_1}" STREQUAL "${CEF_VERSION_MAJOR}") + set(CEF_VERSION_MAJOR ${CMAKE_MATCH_1} CACHE STRING "CEF Major Version" FORCE) + set(Need_Config_CefVersion_File TRUE) + message(STATUS "CEF_VERSION_MAJOR: ${CEF_VERSION_MAJOR} - Updated!") +else() + message(STATUS "CEF_VERSION_MAJOR: ${CEF_VERSION_MAJOR} - No Change!") +endif() + +# ------------ check CEF_VERSION_MINOR +string(REGEX MATCH "#define CEF_VERSION_MINOR ([0-9]+)" _ ${cef_version_content}) + +if(NOT "${CMAKE_MATCH_1}" STREQUAL "${CEF_VERSION_MINOR}") + set(CEF_VERSION_MINOR ${CMAKE_MATCH_1} CACHE STRING "CEF Minor Version" FORCE) + set(Need_Config_CefVersion_File TRUE) + message(STATUS "CEF_VERSION_MINOR: ${CEF_VERSION_MINOR} - Updated!") +else() + message(STATUS "CEF_VERSION_MINOR: ${CEF_VERSION_MINOR} - No Change!") +endif() + +# ------------ check CEF_VERSION_PATCH +string(REGEX MATCH "#define CEF_VERSION_PATCH ([0-9]+)" _ ${cef_version_content}) + +if(NOT "${CMAKE_MATCH_1}" STREQUAL "${CEF_VERSION_PATCH}") + set(CEF_VERSION_PATCH ${CMAKE_MATCH_1} CACHE STRING "CEF Patch Version" FORCE) + set(Need_Config_CefVersion_File TRUE) + message(STATUS "CEF_VERSION_PATCH: ${CEF_VERSION_PATCH} - Updated!") +else() + message(STATUS "CEF_VERSION_PATCH: ${CEF_VERSION_PATCH} - No Change!") +endif() + +# ------------ check CEF_COMMIT_NUMBER +string(REGEX MATCH "#define CEF_COMMIT_NUMBER ([0-9]+)" _ ${cef_version_content}) + +if(NOT "${CMAKE_MATCH_1}" STREQUAL "${CEF_COMMIT_NUMBER}") + set(CEF_COMMIT_NUMBER ${CMAKE_MATCH_1} CACHE STRING "CEF Commit Number" FORCE) + set(Need_Config_CefVersion_File TRUE) + message(STATUS "CEF_COMMIT_NUMBER: ${CEF_COMMIT_NUMBER} - Updated!") +else() + message(STATUS "CEF_COMMIT_NUMBER: ${CEF_COMMIT_NUMBER} - No Change!") +endif() + +# ------------ check CEF_COMMIT_HASH +string(REGEX MATCH "#define CEF_COMMIT_HASH \"([a-z0-9]+)\"" _ ${cef_version_content}) + +if(NOT "${CMAKE_MATCH_1}" STREQUAL "${CEF_COMMIT_HASH}") + set(CEF_COMMIT_HASH ${CMAKE_MATCH_1} CACHE STRING "CEF Commit Hash" FORCE) + set(Need_Config_CefVersion_File TRUE) + message(STATUS "CEF_COMMIT_HASH: ${CEF_COMMIT_HASH} - Updated!") +else() + message(STATUS "CEF_COMMIT_HASH: ${CEF_COMMIT_HASH} - No Change!") +endif() + +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/CefVersion.h") + set(Need_Config_CefVersion_File TRUE) +endif() + +if(${Need_Config_CefVersion_File}) + message(STATUS "Need to configure CefVersion.h file") + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/src/CefVersion.h.in" + "${CMAKE_CURRENT_SOURCE_DIR}/include/CefVersion.h" + @ONLY + NEWLINE_STYLE UNIX + ) +else() + message(STATUS "No need to configure CefVersion.h file") +endif() diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/CMakeLists.txt b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/CMakeLists.txt new file mode 100644 index 0000000..c7e5319 --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/CMakeLists.txt @@ -0,0 +1,262 @@ +# Copyright (c) 2014 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. + +# OVERVIEW +# +# CMake is a cross-platform open-source build system that can generate project +# files in many different formats. It can be downloaded from +# http://www.cmake.org or installed via a platform package manager. +# +# CMake-generated project formats that have been tested with this CEF binary +# distribution include: +# +# Linux: Ninja, GCC 7.5.0+, Unix Makefiles +# MacOS: Ninja, Xcode 12.2 to 15.0 +# Windows: Ninja, Visual Studio 2022 +# +# Ninja is a cross-platform open-source tool for running fast builds using +# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be +# downloaded from http://martine.github.io/ninja/ or installed via a platform +# package manager. +# +# CMAKE STRUCTURE +# +# This CEF binary distribution includes the following CMake files: +# +# CMakeLists.txt Bootstrap that sets up the CMake environment. +# cmake/*.cmake CEF configuration files shared by all targets. +# libcef_dll/CMakeLists.txt Defines the libcef_dll_wrapper target. +# tests/*/CMakeLists.txt Defines the test application target. +# +# See the "TODO:" comments below for guidance on how to integrate this CEF +# binary distribution into a new or existing CMake project. +# +# BUILD REQUIREMENTS +# +# The below requirements must be met to build this CEF binary distribution. +# +# - CMake version 3.21 or newer. +# +# - Linux requirements: +# Currently supported distributions include Debian 10 (Buster), Ubuntu 18 +# (Bionic Beaver), and related. Ubuntu 18.04 64-bit with GCC 7.5.0+ is +# recommended. Newer versions will likely also work but may not have been +# tested. +# Required packages include: +# build-essential +# libgtk3.0-dev (required by the cefclient target only) +# +# - MacOS requirements: +# Xcode 12.2 to 15.0 building on MacOS 10.15.4 (Catalina) or newer. Only +# 64-bit builds are supported. The Xcode command-line tools must also be +# installed. Newer Xcode versions may not have been been tested and are not +# recommended. +# +# - Windows requirements: +# Visual Studio 2022 building on Windows 10 or newer. Windows 10/11 64-bit is +# recommended. Newer versions will likely also work but may not have been +# tested. +# +# BUILD EXAMPLES +# +# The below commands will generate project files and create a Debug build of all +# CEF targets using CMake and the platform toolchain. +# +# Start by creating and entering the CMake build output directory: +# > cd path/to/cef_binary_* +# > mkdir build && cd build +# +# To perform a Linux build using a 32-bit CEF binary distribution on a 32-bit +# Linux platform or a 64-bit CEF binary distribution on a 64-bit Linux platform: +# Using Unix Makefiles: +# > cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. +# > make -j4 cefclient cefsimple +# +# Using Ninja: +# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. +# > ninja cefclient cefsimple +# +# To perform a MacOS build using a 64-bit CEF binary distribution: +# Using the Xcode IDE: +# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" .. +# Open build\cef.xcodeproj in Xcode and select Product > Build. +# +# Using Ninja: +# > cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Debug .. +# > ninja cefclient cefsimple +# +# To perform a MacOS build using an ARM64 CEF binary distribution: +# Using the Xcode IDE: +# > cmake -G "Xcode" -DPROJECT_ARCH="arm64" .. +# Open build\cef.xcodeproj in Xcode and select Product > Build. +# +# Using Ninja: +# > cmake -G "Ninja" -DPROJECT_ARCH="arm64" -DCMAKE_BUILD_TYPE=Debug .. +# > ninja cefclient cefsimple +# +# To perform a Windows build using a 32-bit CEF binary distribution: +# Using the Visual Studio 2022 IDE: +# > cmake -G "Visual Studio 17" -A Win32 .. +# Open build\cef.sln in Visual Studio and select Build > Build Solution. +# +# Using Ninja with Visual Studio 2022 command-line tools: +# (this path may be different depending on your Visual Studio installation) +# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars32.bat" +# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. +# > ninja cefclient cefsimple +# +# To perform a Windows build using a 64-bit CEF binary distribution: +# Using the Visual Studio 2022 IDE: +# > cmake -G "Visual Studio 17" -A x64 .. +# Open build\cef.sln in Visual Studio and select Build > Build Solution. +# +# Using Ninja with Visual Studio 2022 command-line tools: +# (this path may be different depending on your Visual Studio installation) +# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat" +# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. +# > ninja cefclient cefsimple +# +# To perform a Windows build using an ARM64 CEF binary distribution: +# Using the Visual Studio 2022 IDE: +# > cmake -G "Visual Studio 17" -A arm64 .. +# Open build\cef.sln in Visual Studio and select Build > Build Solution. +# +# Using Ninja with Visual Studio 2022 command-line tools: +# (this path may be different depending on your Visual Studio installation) +# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. +# > ninja cefsimple + +# +# Global setup. +# + +# For VS2022 and Xcode 12+ support. +cmake_minimum_required(VERSION 3.21) + +# Only generate Debug and Release configuration types. +set(CMAKE_CONFIGURATION_TYPES Debug Release) + +# Project name. +# TODO: Change this line to match your project name when you copy this file. +project(cef) + +# Use folders in the resulting project files. +set_property(GLOBAL PROPERTY OS_FOLDERS ON) + + +# +# CEF_ROOT setup. +# This variable must be set to locate the binary distribution. +# TODO: Choose one of the below examples and comment out the rest. +# + +# Example 1: The current directory contains both the complete binary +# distribution and your project. +# A. Comment in these lines: +# +set(CEF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake") + +# Example 2: The binary distribution is in a separate directory from your +# project. Locate the binary distribution using the CEF_ROOT CMake +# variable. +# A. Create a directory structure for your project like the following: +# myproject/ +# CMakeLists.txt <= top-level CMake configuration +# mytarget/ +# CMakeLists.txt <= CMake configuration for `mytarget` +# ... other `mytarget` source files +# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake +# configuration. +# C. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for +# your application. See the included cefclient and cefsimple CMakeLists.txt +# files as an example. +# D. Comment in these lines: +# +# set(CEF_ROOT "c:/path/to/cef_binary_3.2704.xxxx.gyyyyyyy_windows32") +# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CEF_ROOT}/cmake") + +# Example 3: The binary distribution is in a separate directory from your +# project. Locate the binary distribution using the CEF_ROOT +# environment variable. +# A. Create a directory structure for your project like the following: +# myproject/ +# CMakeLists.txt <= top-level CMake configuration +# cmake/ +# FindCEF.cmake <= CEF CMake configuration entry point +# mytarget/ +# CMakeLists.txt <= CMake configuration for `mytarget` +# ... other `mytarget` source files +# B. Copy this file to "myproject/CMakeLists.txt" as the top-level CMake +# configuration. +# C. Copy the cmake/FindCEF.cmake file to "myproject/cmake/FindCEF.cmake". +# D. Create the target-specific "myproject/mytarget/CMakeLists.txt" file for +# your application. See the included cefclient and cefsimple CMakeLists.txt +# files as an example. +# E. Set the CEF_ROOT environment variable before executing CMake. For example: +# > set CEF_ROOT=c:\path\to\cef_binary_3.2704.xxxx.gyyyyyyy_windows32 +# F. Comment in these lines: +# +# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + + +# +# Load the CEF configuration. +# + +# Execute FindCEF.cmake which must exist in CMAKE_MODULE_PATH. +find_package(CEF REQUIRED) + +# +# Define CEF-based targets. +# + +# Include the libcef_dll_wrapper target. +# Comes from the libcef_dll/CMakeLists.txt file in the binary distribution +# directory. +add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper) + +# Include application targets. +# Comes from the /CMakeLists.txt file in the current directory. +# TODO: Change these lines to match your project target when you copy this file. +#[Edit:JackLee]mingw build +set(BUILD_LIBCEF_DEMO ON) +set(BUILD_LIBCEF_CEFSIMPL_DEMO OFF) +set(BUILD_LIBCEF_CEFCLIENT_DEMO ON) +if(BUILD_LIBCEF_DEMO) + if(BUILD_LIBCEF_CEFSIMPL_DEMO AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests") + add_subdirectory(tests/cefsimple) + add_subdirectory(tests/gtest) + add_subdirectory(tests/ceftests) + endif() + if(BUILD_LIBCEF_CEFCLIENT_DEMO AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/cefclient") + add_subdirectory(tests/cefclient) + endif() +endif() +# Display configuration settings. +PRINT_CEF_CONFIG() + + +# +# Define the API documentation target. +# +#[Edit:JackLee]mingw build +if(BUILD_LIBCEF_DOXYGEN) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile") + find_package(Doxygen) + if(DOXYGEN_FOUND) + add_custom_target(apidocs ALL + # Generate documentation in the docs/html directory. + COMMAND "${DOXYGEN_EXECUTABLE}" Doxyfile + # Write a docs/index.html file. + COMMAND ${CMAKE_COMMAND} -E echo "" > docs/index.html + WORKING_DIRECTORY "${CEF_ROOT}" + COMMENT "Generating API documentation with Doxygen..." + VERBATIM ) + else() + message(WARNING "Doxygen must be installed to generate API documentation.") + endif() + endif() +endif() \ No newline at end of file diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/FindCEF.cmake b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/FindCEF.cmake new file mode 100644 index 0000000..cd33a7d --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/FindCEF.cmake @@ -0,0 +1,39 @@ +# 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. +# + +# 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() + +if(NOT DEFINED _CEF_ROOT_EXPLICIT) + message(FATAL_ERROR "Must specify a CEF_ROOT value via CMake or environment variable.") +endif() + +if(NOT IS_DIRECTORY "${_CEF_ROOT}/cmake") + message(FATAL_ERROR "No CMake bootstrap found for CEF binary distribution at: ${CEF_ROOT}.") +endif() + +# 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") diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/cef_macros.cmake b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/cef_macros.cmake new file mode 100644 index 0000000..81883da --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/cef_macros.cmake @@ -0,0 +1,387 @@ +# 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 macros. +# + +# Print the current CEF configuration. +macro(PRINT_CEF_CONFIG) + message(STATUS "*** CEF CONFIGURATION SETTINGS ***") + message(STATUS "Generator: ${CMAKE_GENERATOR}") + message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}") + message(STATUS "Project architecture: ${PROJECT_ARCH}") + + if(GEN_NINJA OR GEN_MAKEFILES) + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + endif() + + message(STATUS "Binary distribution root: ${_CEF_ROOT}") + + if(OS_MAC) + message(STATUS "Base SDK: ${CMAKE_OSX_SYSROOT}") + message(STATUS "Target SDK: ${CEF_TARGET_SDK}") + endif() + + if(OS_WINDOWS) + message(STATUS "Visual Studio ATL support: ${USE_ATL}") + endif() + + message(STATUS "CEF sandbox: ${USE_SANDBOX}") + + set(_libraries ${CEF_STANDARD_LIBS}) + if(OS_WINDOWS AND USE_SANDBOX) + list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS}) + endif() + message(STATUS "Standard libraries: ${_libraries}") + + message(STATUS "Compile defines: ${CEF_COMPILER_DEFINES}") + message(STATUS "Compile defines (Debug): ${CEF_COMPILER_DEFINES_DEBUG}") + message(STATUS "Compile defines (Release): ${CEF_COMPILER_DEFINES_RELEASE}") + message(STATUS "C compile flags: ${CEF_COMPILER_FLAGS} ${CEF_C_COMPILER_FLAGS}") + message(STATUS "C compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_C_COMPILER_FLAGS_DEBUG}") + message(STATUS "C compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_C_COMPILER_FLAGS_RELEASE}") + message(STATUS "C++ compile flags: ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS}") + message(STATUS "C++ compile flags (Debug): ${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}") + message(STATUS "C++ compile flags (Release): ${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}") + message(STATUS "Exe link flags: ${CEF_LINKER_FLAGS} ${CEF_EXE_LINKER_FLAGS}") + message(STATUS "Exe link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_EXE_LINKER_FLAGS_DEBUG}") + message(STATUS "Exe link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_EXE_LINKER_FLAGS_RELEASE}") + message(STATUS "Shared link flags: ${CEF_LINKER_FLAGS} ${CEF_SHARED_LINKER_FLAGS}") + message(STATUS "Shared link flags (Debug): ${CEF_LINKER_FLAGS_DEBUG} ${CEF_SHARED_LINKER_FLAGS_DEBUG}") + message(STATUS "Shared link flags (Release): ${CEF_LINKER_FLAGS_RELEASE} ${CEF_SHARED_LINKER_FLAGS_RELEASE}") + + if(OS_LINUX OR OS_WINDOWS) + message(STATUS "CEF Binary files: ${CEF_BINARY_FILES}") + message(STATUS "CEF Resource files: ${CEF_RESOURCE_FILES}") + endif() +endmacro() + +# Append platform specific sources to a list of sources. +macro(APPEND_PLATFORM_SOURCES name_of_list) + if(OS_LINUX AND ${name_of_list}_LINUX) + list(APPEND ${name_of_list} ${${name_of_list}_LINUX}) + endif() + if(OS_POSIX AND ${name_of_list}_POSIX) + list(APPEND ${name_of_list} ${${name_of_list}_POSIX}) + endif() + if(OS_WINDOWS AND ${name_of_list}_WINDOWS) + list(APPEND ${name_of_list} ${${name_of_list}_WINDOWS}) + endif() + if(OS_MAC AND ${name_of_list}_MAC) + list(APPEND ${name_of_list} ${${name_of_list}_MAC}) + endif() +endmacro() + +# Determine the target output directory based on platform and generator. +macro(SET_CEF_TARGET_OUT_DIR) + if(GEN_NINJA OR GEN_MAKEFILES) + # By default Ninja and Make builds don't create a subdirectory named after + # the configuration. + set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}") + + # Output binaries (executables, libraries) to the correct directory. + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR}) + else() + set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$") + endif() +endmacro() + +# Copy a list of files from one directory to another. Relative file paths are maintained. +macro(COPY_FILES target file_list source_dir target_dir) + foreach(FILENAME ${file_list}) + set(source_file ${source_dir}/${FILENAME}) + + # Remove the target file path component. + get_filename_component(target_name ${FILENAME} NAME) + set(target_file ${target_dir}/${target_name}) + + COPY_SINGLE_FILE(${target} ${source_file} ${target_file}) + endforeach() +endmacro() + +# Copy a list of files from one directory to another. Relative file paths are maintained. +macro(COPY_RESOURCES target file_list prefix_list source_dir target_dir) + foreach(FILENAME ${file_list}) + set(source_file ${source_dir}/${FILENAME}) + + # Remove one or more prefixes from the source paths. + set(TARGET_FILENAME "${FILENAME}") + foreach(PREFIX ${prefix_list}) + string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME}) + endforeach() + set(target_file ${target_dir}/${TARGET_FILENAME}) + + COPY_SINGLE_FILE(${target} ${source_file} ${target_file}) + endforeach() +endmacro() + +macro(COPY_SINGLE_FILE target source_file target_file) + string(FIND ${source_file} "$" _pos) + if(NOT ${_pos} EQUAL -1) + # Must test with an actual configuration directory. + string(REPLACE "$" "Release" existing_source_file ${source_file}) + if(NOT EXISTS ${existing_source_file}) + string(REPLACE "$" "Debug" existing_source_file ${source_file}) + endif() + else() + set(existing_source_file ${source_file}) + endif() + + if(IS_DIRECTORY ${existing_source_file}) + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}" + VERBATIM + ) + else() + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}" + VERBATIM + ) + endif() +endmacro() + + +# +# Linux macros. +# + +if(OS_LINUX) + +# Use pkg-config to find Linux libraries and update compiler/linker variables. +macro(FIND_LINUX_LIBRARIES libraries) + # Read pkg-config info into variables. + execute_process(COMMAND pkg-config --cflags ${libraries} OUTPUT_VARIABLE FLL_CFLAGS) + execute_process(COMMAND pkg-config --libs-only-L --libs-only-other ${libraries} OUTPUT_VARIABLE FLL_LDFLAGS) + execute_process(COMMAND pkg-config --libs-only-l ${libraries} OUTPUT_VARIABLE FLL_LIBS) + + # Strip leading and trailing whitepspace. + STRING(STRIP "${FLL_CFLAGS}" FLL_CFLAGS) + STRING(STRIP "${FLL_LDFLAGS}" FLL_LDFLAGS) + STRING(STRIP "${FLL_LIBS}" FLL_LIBS) + + # Convert to a list. + separate_arguments(FLL_CFLAGS) + separate_arguments(FLL_LDFLAGS) + separate_arguments(FLL_LIBS) + + # Update build variables. + list(APPEND CEF_C_COMPILER_FLAGS ${FLL_CFLAGS}) + list(APPEND CEF_CXX_COMPILER_FLAGS ${FLL_CFLAGS}) + list(APPEND CEF_EXE_LINKER_FLAGS ${FLL_LDFLAGS}) + list(APPEND CEF_SHARED_LINKER_FLAGS ${FLL_LDFLAGS}) + list(APPEND CEF_STANDARD_LIBS ${FLL_LIBS}) +endmacro() + +# Set SUID permissions on the specified executable. +macro(SET_LINUX_SUID_PERMISSIONS target executable) + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "" + COMMAND ${CMAKE_COMMAND} -E echo "*** Run the following command manually to set SUID permissions ***" + COMMAND ${CMAKE_COMMAND} -E echo "EXE=\"${executable}\" && sudo -- chown root:root $EXE && sudo -- chmod 4755 $EXE" + COMMAND ${CMAKE_COMMAND} -E echo "" + VERBATIM + ) +endmacro() + +endif(OS_LINUX) + + +# +# Mac OS X macros. +# + +if(OS_MAC) + +# Manually process and copy over resource files. +macro(COPY_MAC_RESOURCES resource_list prefix_list target source_dir app_path) + foreach(FILENAME ${resource_list}) + # Remove one or more prefixes from the source paths. + set(TARGET_FILENAME "${FILENAME}") + foreach(PREFIX ${prefix_list}) + string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME}) + endforeach() + + # Determine the absolute source and target paths. + set(TARGET_PATH "${app_path}/Contents/Resources/${TARGET_FILENAME}") + if(IS_ABSOLUTE ${FILENAME}) + set(SOURCE_PATH ${FILENAME}) + else() + set(SOURCE_PATH "${source_dir}/${FILENAME}") + endif() + + if(${FILENAME} MATCHES ".xib$") + # Change the target file extension. + string(REGEX REPLACE ".xib$" ".nib" TARGET_PATH ${TARGET_PATH}) + + get_filename_component(TARGET_DIRECTORY ${TARGET_PATH} PATH) + add_custom_command( + TARGET ${target} + POST_BUILD + # Create the target directory. + COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGET_DIRECTORY}" + # Compile the XIB file to a NIB. + COMMAND /usr/bin/ibtool --output-format binary1 --compile "${TARGET_PATH}" "${SOURCE_PATH}" + VERBATIM + ) + elseif(NOT ${TARGET_FILENAME} STREQUAL "Info.plist") + # Copy the file as-is. + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${TARGET_PATH}" + VERBATIM + ) + endif() + endforeach() +endmacro() + +endif(OS_MAC) + + +# +# Windows macros. +# +#[Edit:JackLee]mingw build +if(OS_WINDOWS AND MSVC) + +# Add custom manifest files to an executable target. +macro(ADD_WINDOWS_MANIFEST manifest_path target extension) + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND "mt.exe" -nologo + -manifest \"${manifest_path}/${target}.${extension}.manifest\" \"${manifest_path}/compatibility.manifest\" + -outputresource:"${CEF_TARGET_OUT_DIR}/${target}.${extension}"\;\#1 + COMMENT "Adding manifest..." + ) +endmacro() + +endif() + + +# +# Target configuration macros. +# + +# Add a logical target that can be used to link the specified libraries into an +# executable target. +macro(ADD_LOGICAL_TARGET target debug_lib release_lib) + add_library(${target} ${CEF_LIBTYPE} IMPORTED) + set_target_properties(${target} PROPERTIES + IMPORTED_LOCATION "${release_lib}" + IMPORTED_LOCATION_DEBUG "${debug_lib}" + IMPORTED_LOCATION_RELEASE "${release_lib}" + ) +endmacro() + +# Set common target properties. Use SET_LIBRARY_TARGET_PROPERTIES() or +# SET_EXECUTABLE_TARGET_PROPERTIES() instead of calling this macro directly. +macro(SET_COMMON_TARGET_PROPERTIES target) + # Compile flags. + target_compile_options(${target} PRIVATE ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS}) + target_compile_options(${target} PRIVATE $<$:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>) + target_compile_options(${target} PRIVATE $<$:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>) + + # Compile definitions. + target_compile_definitions(${target} PRIVATE ${CEF_COMPILER_DEFINES}) + target_compile_definitions(${target} PRIVATE $<$:${CEF_COMPILER_DEFINES_DEBUG}>) + target_compile_definitions(${target} PRIVATE $<$:${CEF_COMPILER_DEFINES_RELEASE}>) + + # Include directories. + target_include_directories(${target} PRIVATE ${CEF_INCLUDE_PATH}) + + # Linker flags. + if(CEF_LINKER_FLAGS) + string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str}) + endif() + if(CEF_LINKER_FLAGS_DEBUG) + string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_DEBUG}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str}) + endif() + if(CEF_LINKER_FLAGS_RELEASE) + string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_RELEASE}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str}) + endif() + + if(OS_MAC) + # Set Xcode target properties. + set_target_properties(${target} PROPERTIES + XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO + XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11 + XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO # -fno-objc-link-runtime + XCODE_ATTRIBUTE_CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS YES # -Wobjc-missing-property-synthesis + XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO + XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] YES # -Wl,-dead_strip + XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99 + XCODE_ATTRIBUTE_GCC_CW_ASM_SYNTAX NO # No -fasm-blocks + XCODE_ATTRIBUTE_GCC_DYNAMIC_NO_PIC NO + XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS NO # -fno-exceptions + XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI NO # -fno-rtti + XCODE_ATTRIBUTE_GCC_ENABLE_PASCAL_STRINGS NO # No -mpascal-strings + XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES # -fvisibility-inlines-hidden + XCODE_ATTRIBUTE_GCC_OBJC_CALL_CXX_CDTORS YES # -fobjc-call-cxx-cdtors + XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES # -fvisibility=hidden + XCODE_ATTRIBUTE_GCC_THREADSAFE_STATICS NO # -fno-threadsafe-statics + XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES # -Werror + XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0" + XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES # -Wnewline-eof + XCODE_ATTRIBUTE_USE_HEADERMAP NO + OSX_ARCHITECTURES_DEBUG "${CMAKE_OSX_ARCHITECTURES}" + OSX_ARCHITECTURES_RELEASE "${CMAKE_OSX_ARCHITECTURES}" + ) + endif() +endmacro() + +# Set library-specific properties. +macro(SET_LIBRARY_TARGET_PROPERTIES target) + SET_COMMON_TARGET_PROPERTIES(${target}) + + # Shared library linker flags. + if(CEF_SHARED_LINKER_FLAGS) + string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str}) + endif() + if(CEF_SHARED_LINKER_FLAGS_DEBUG) + string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_DEBUG}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str}) + endif() + if(CEF_SHARED_LINKER_FLAGS_RELEASE) + string(REPLACE ";" " " _flags_str "${CEF_SHARED_LINKER_FLAGS_RELEASE}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str}) + endif() +endmacro() + +# Set executable-specific properties. +macro(SET_EXECUTABLE_TARGET_PROPERTIES target) + SET_COMMON_TARGET_PROPERTIES(${target}) + + # Executable linker flags. + if(CEF_EXE_LINKER_FLAGS) + string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str}) + endif() + if(CEF_EXE_LINKER_FLAGS_DEBUG) + string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_DEBUG}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str}) + endif() + if(CEF_EXE_LINKER_FLAGS_RELEASE) + string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_RELEASE}") + set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str}) + endif() +endmacro() diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/cef_variables.cmake b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/cef_variables.cmake new file mode 100644 index 0000000..b1be2d9 --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/cmake/cef_variables.cmake @@ -0,0 +1,892 @@ +# 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") + set(OS_MAC 1) + set(OS_MACOSX 1) # For backwards compatibility. + 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) + if(("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") OR + ("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM64")) + set(PROJECT_ARCH "arm64") + elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) + set(PROJECT_ARCH "x86_64") + else() + set(PROJECT_ARCH "x86") + endif() +endif() + +if(${CMAKE_GENERATOR} STREQUAL "Ninja") + set(GEN_NINJA 1) +elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") + set(GEN_MAKEFILES 1) +endif() + +# Determine the build type. +if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES)) + # 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") + + +#[Edit:JackLee]mingw build +# Shared compiler/linker flags. +if(MSVC) + list(APPEND CEF_COMPILER_DEFINES + # Allow C++ programs to use stdint.h macros specified in the C99 standard that aren't + # in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc) + __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS + ) +endif() + +#[Edit:JackLee]mingw build +# Configure use of the sandbox. +option(USE_SANDBOX "Enable or disable use of the sandbox." ON) +option(USE_ATL "Enable or disable use of ATL." ON) +add_definitions(-DUSE_SANDBOX=OFF) +add_definitions(-DUSE_ATL=OFF) +# +# 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 + -Wno-error=comment # Don't warn about code in comments + -Wno-comment # Don't warn about code in comments + -Wno-deprecated-declarations # Don't warn about using deprecated methods + ) + 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 + -std=c++17 # Use the C++17 language standard + -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) + + 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() + + 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() + + 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() + + 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 + libEGL.so + libGLESv2.so + libvk_swiftshader.so + libvulkan.so.1 + snapshot_blob.bin + v8_context_snapshot.bin + vk_swiftshader_icd.json + ) + + # List of CEF resource files. + set(CEF_RESOURCE_FILES + chrome_100_percent.pak + chrome_200_percent.pak + resources.pak + icudtl.dat + locales + ) + + if(USE_SANDBOX) + list(APPEND CEF_COMPILER_DEFINES + CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled + ) + endif() +endif() + + +# +# Mac OS X configuration. +# + +if(OS_MAC) + # Platform-specific compiler/linker flags. + # See also Xcode target properties in cef_macros.cmake. + 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 + -std=c++17 # Use the C++17 language standard + -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 + ) + + 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() + + # Standard libraries. + set(CEF_STANDARD_LIBS + -lpthread + "-framework AppKit" + "-framework Cocoa" + "-framework IOSurface" + ) + + # Find the newest available base SDK. + execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + foreach(OS_VERSION 14.2 14.0 10.15) + 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. + set(CEF_TARGET_SDK "10.15") + 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") + elseif(PROJECT_ARCH STREQUAL "arm64") + set(CMAKE_OSX_ARCHITECTURES "arm64") + else() + set(CMAKE_OSX_ARCHITECTURES "i386") + endif() + + # Prevent Xcode 11 from doing automatic codesigning. + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + + # CEF directory paths. + set(CEF_BINARY_DIR "${_CEF_ROOT}/$") + set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug") + set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release") + + if(USE_SANDBOX) + list(APPEND CEF_COMPILER_DEFINES + CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled + ) + + list(APPEND CEF_STANDARD_LIBS + -lsandbox + ) + + # 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() + + # CEF Helper app suffixes. + # Format is "::". + set(CEF_HELPER_APP_SUFFIXES + "::" + " (Alerts):_alerts:.alerts" + " (GPU):_gpu:.gpu" + " (Plugin):_plugin:.plugin" + " (Renderer):_renderer:.renderer" + ) +endif() + + +# +# Windows configuration. +# +#[Edit:JackLee]mingw build +if(OS_WINDOWS AND MSVC) + 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() + + if(USE_SANDBOX) + # Check if the current MSVC version is compatible with the cef_sandbox.lib + # static library. We require VS2015 or newer. + if(MSVC_VERSION LESS 1900) + message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})") + set(USE_SANDBOX OFF) + endif() + endif() + + # 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") + + # 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() + + # 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 + /wd4324 # Ignore "structure was padded due to alignment specifier" warning + /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} + ) + list(APPEND CEF_COMPILER_FLAGS_DEBUG + /RTC1 # Disable optimizations + /Od # Enable basic run-time checks + ) + list(APPEND CEF_COMPILER_FLAGS_RELEASE + /O2 # Optimize for maximum speed + /Ob2 # Inline any suitable function + /GF # Enable string pooling + ) + list(APPEND CEF_CXX_COMPILER_FLAGS + /std:c++17 # Use the C++17 language standard + ) + list(APPEND CEF_LINKER_FLAGS_DEBUG + /DEBUG # Generate debug information + ) + list(APPEND CEF_EXE_LINKER_FLAGS + /MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage) + /LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM + + # 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 + ) + list(APPEND CEF_COMPILER_DEFINES + WIN32 _WIN32 _WINDOWS # Windows platform + UNICODE _UNICODE # Unicode build + # 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 + 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 + ) + + 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 + /STACK:0x80000 + ) + else() + # Increase the initial stack size to 8MiB from the default 1MiB. + list(APPEND CEF_EXE_LINKER_FLAGS + /STACK:0x800000 + ) + endif() + + # Standard libraries. + set(CEF_STANDARD_LIBS + comctl32.lib + gdi32.lib + rpcrt4.lib + shlwapi.lib + ws2_32.lib + ) + + # CEF directory paths. + set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources") + set(CEF_BINARY_DIR "${_CEF_ROOT}/$") + 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 + chrome_elf.dll + d3dcompiler_47.dll + libcef.dll + libEGL.dll + libGLESv2.dll + snapshot_blob.bin + v8_context_snapshot.bin + vk_swiftshader.dll + vk_swiftshader_icd.json + vulkan-1.dll + ) + + if(PROJECT_ARCH STREQUAL "x86_64") + list(APPEND CEF_BINARY_FILES + dxil.dll + dxcompiler.dll + ) + endif() + + # List of CEF resource files. + set(CEF_RESOURCE_FILES + chrome_100_percent.pak + chrome_200_percent.pak + resources.pak + 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 + ) + list(APPEND CEF_COMPILER_DEFINES_DEBUG + _HAS_ITERATOR_DEBUGGING=0 # Disable iterator debugging + ) + + # Libraries required by cef_sandbox.lib. + set(CEF_SANDBOX_STANDARD_LIBS + Advapi32.lib + dbghelp.lib + Delayimp.lib + ntdll.lib + OleAut32.lib + PowrProf.lib + Propsys.lib + psapi.lib + SetupAPI.lib + Shell32.lib + Shcore.lib + Userenv.lib + version.lib + wbemuuid.lib + WindowsApp.lib + 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. + if(USE_ATL) + # 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) + 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) + if(IS_DIRECTORY "${VC_DIR}/atlmfc") + set(HAS_ATLMFC 1) + break() + endif() + get_filename_component(VC_DIR_NAME ${VC_DIR} NAME) + endwhile() + + # Determine if the Visual Studio install supports ATL. + if(NOT HAS_ATLMFC) + message(STATUS "ATL is not supported by your VC installation.") + 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() +elseif (OS_WINDOWS AND MINGW) + # Platform-specific compiler/linker flags. + # set(CEF_LIBTYPE SHARED) + set(CEF_LIBTYPE STATIC) + 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 + -Wno-error=comment # Don't warn about code in comments + -Wno-comment # Don't warn about code in comments + -Wno-deprecated-declarations # Don't warn about using deprecated methods + ) + list(APPEND CEF_C_COMPILER_FLAGS + -std=c++17 # 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 + -std=c++17 # Use the C++17 language standard + -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 + WIN32 _WIN32 _WINDOWS # Windows platform + UNICODE _UNICODE # Unicode build + # 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 + NOMINMAX # Use the standard's templated min/max + WIN32_LEAN_AND_MEAN # Exclude less common API declarations + _HAS_EXCEPTIONS=0 # Disable exceptions + _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) + + # 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() + + 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() + + 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() + + 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 + comctl32.lib + gdi32.lib + rpcrt4.lib + shlwapi.lib + ws2_32.lib + ) + + # CEF directory paths. + set(CEF_RESOURCE_DIR "${_CEF_ROOT}/Resources") + set(CEF_BINARY_DIR "${_CEF_ROOT}/$") + 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 + chrome_elf.dll + d3dcompiler_47.dll + libcef.dll + libEGL.dll + libGLESv2.dll + snapshot_blob.bin + v8_context_snapshot.bin + vk_swiftshader.dll + vk_swiftshader_icd.json + vulkan-1.dll + ) + + if(PROJECT_ARCH STREQUAL "x86_64") + list(APPEND CEF_BINARY_FILES + dxil.dll + dxcompiler.dll + ) + endif() + + # List of CEF resource files. + set(CEF_RESOURCE_FILES + chrome_100_percent.pak + chrome_200_percent.pak + resources.pak + 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 + ) + list(APPEND CEF_COMPILER_DEFINES_DEBUG + _HAS_ITERATOR_DEBUGGING=0 # Disable iterator debugging + ) + + # Libraries required by cef_sandbox.lib. + set(CEF_SANDBOX_STANDARD_LIBS + Advapi32.lib + dbghelp.lib + Delayimp.lib + ntdll.lib + OleAut32.lib + PowrProf.lib + Propsys.lib + psapi.lib + SetupAPI.lib + Shell32.lib + Shcore.lib + Userenv.lib + version.lib + wbemuuid.lib + WindowsApp.lib + 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. + if(USE_ATL) + # 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) + 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) + if(IS_DIRECTORY "${VC_DIR}/atlmfc") + set(HAS_ATLMFC 1) + break() + endif() + get_filename_component(VC_DIR_NAME ${VC_DIR} NAME) + endwhile() + + # Determine if the Visual Studio install supports ATL. + if(NOT HAS_ATLMFC) + message(STATUS "ATL is not supported by your VC installation.") + 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() diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/test/cefclient/CMakeLists.txt b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/test/cefclient/CMakeLists.txt new file mode 100644 index 0000000..3e30479 --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/test/cefclient/CMakeLists.txt @@ -0,0 +1,611 @@ +# Copyright (c) 2014 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. + +# +# Source files. +# + +# cefclient browser sources. +set(CEFCLIENT_BROWSER_BROWSER_SRCS + browser/base_client_handler.cc + browser/base_client_handler.h + browser/binary_transfer_test.cc + browser/binary_transfer_test.h + browser/binding_test.cc + browser/binding_test.h + browser/browser_window.cc + browser/browser_window.h + browser/bytes_write_handler.cc + browser/bytes_write_handler.h + browser/client_app_delegates_browser.cc + browser/client_browser.cc + browser/client_browser.h + browser/client_handler.cc + browser/client_handler.h + browser/client_handler_osr.cc + browser/client_handler_osr.h + browser/client_handler_std.cc + browser/client_handler_std.h + browser/client_prefs.cc + browser/client_prefs.h + browser/client_types.h + browser/default_client_handler.cc + browser/default_client_handler.h + browser/dialog_test.cc + browser/dialog_test.h + browser/hang_test.cc + browser/hang_test.h + browser/image_cache.cc + browser/image_cache.h + browser/main_context.cc + browser/main_context.h + browser/main_context_impl.cc + browser/main_context_impl.h + browser/media_router_test.cc + browser/media_router_test.h + browser/osr_dragdrop_events.h + browser/osr_renderer.cc + browser/osr_renderer.h + browser/osr_renderer_settings.h + browser/preferences_test.cc + browser/preferences_test.h + browser/resource.h + browser/response_filter_test.cc + browser/response_filter_test.h + browser/root_window.cc + browser/root_window.h + browser/root_window_create.cc + browser/root_window_manager.cc + browser/root_window_manager.h + browser/root_window_views.cc + browser/root_window_views.h + browser/scheme_test.cc + browser/scheme_test.h + browser/server_test.cc + browser/server_test.h + browser/temp_window.h + browser/test_runner.cc + browser/test_runner.h + browser/urlrequest_test.cc + browser/urlrequest_test.h + browser/views_menu_bar.cc + browser/views_menu_bar.h + browser/views_overlay_controls.cc + browser/views_overlay_controls.h + browser/views_style.cc + browser/views_style.h + browser/views_window.cc + browser/views_window.h + browser/window_test.cc + browser/window_test.h + browser/window_test_runner.cc + browser/window_test_runner.h + browser/window_test_runner_views.cc + browser/window_test_runner_views.h + ) +source_group(cefclient\\\\browser FILES ${CEFCLIENT_BROWSER_BROWSER_SRCS}) + +set(CEFCLIENT_BROWSER_SHARED_BROWSER_SRCS + ../shared/browser/client_app_browser.cc + ../shared/browser/client_app_browser.h + ../shared/browser/file_util.cc + ../shared/browser/file_util.h + ../shared/browser/geometry_util.cc + ../shared/browser/geometry_util.h + ../shared/browser/main_message_loop.cc + ../shared/browser/main_message_loop.h + ../shared/browser/main_message_loop_external_pump.cc + ../shared/browser/main_message_loop_external_pump.h + ../shared/browser/main_message_loop_std.cc + ../shared/browser/main_message_loop_std.h + ../shared/browser/resource_util.h + ) +source_group(shared\\\\browser FILES ${CEFCLIENT_BROWSER_SHARED_BROWSER_SRCS}) + +set(CEFCLIENT_BROWSER_SRCS + ${CEFCLIENT_BROWSER_BROWSER_SRCS} + ${CEFCLIENT_BROWSER_SHARED_BROWSER_SRCS} + ) + +# cefclient common sources. +set(CEFCLIENT_COMMON_COMMON_SRCS + common/client_app_delegates_common.cc + common/scheme_test_common.cc + common/scheme_test_common.h + ) +source_group(cefclient\\\\common FILES ${CEFCLIENT_COMMON_COMMON_SRCS}) + +set(CEFCLIENT_COMMON_SHARED_COMMON_SRCS + ../shared/common/binary_value_utils.cc + ../shared/common/binary_value_utils.h + ../shared/common/client_app.cc + ../shared/common/client_app.h + ../shared/common/client_app_other.cc + ../shared/common/client_app_other.h + ../shared/common/client_switches.cc + ../shared/common/client_switches.h + ../shared/common/string_util.cc + ../shared/common/string_util.h + ) +source_group(shared\\\\common FILES ${CEFCLIENT_COMMON_SHARED_COMMON_SRCS}) + +set(CEFCLIENT_COMMON_SRCS + ${CEFCLIENT_COMMON_COMMON_SRCS} + ${CEFCLIENT_COMMON_SHARED_COMMON_SRCS} + ) + +# cefclient renderer sources. +set(CEFCLIENT_RENDERER_RENDERER_SRCS + renderer/client_app_delegates_renderer.cc + renderer/client_renderer.cc + renderer/client_renderer.h + renderer/ipc_performance_test.cc + renderer/ipc_performance_test.h + renderer/performance_test.cc + renderer/performance_test.h + renderer/performance_test_setup.h + renderer/performance_test_tests.cc + ) +source_group(cefclient\\\\renderer FILES ${CEFCLIENT_RENDERER_RENDERER_SRCS}) + +set(CEFCLIENT_RENDERER_SHARED_RENDERER_SRCS + ../shared/renderer/client_app_renderer.cc + ../shared/renderer/client_app_renderer.h + ) +source_group(shared\\\\renderer FILES ${CEFCLIENT_RENDERER_SHARED_RENDERER_SRCS}) + +set(CEFCLIENT_RENDERER_SRCS + ${CEFCLIENT_RENDERER_RENDERER_SRCS} + ${CEFCLIENT_RENDERER_SHARED_RENDERER_SRCS} + ) + +#cefclient Linux sources +set(CEFCLIENT_LINUX_SRCS + cefclient_gtk.cc + ) +source_group(cefclient FILES ${CEFCLIENT_LINUX_SRCS}) + +set(CEFCLIENT_LINUX_BROWSER_SRCS + browser/browser_window_osr_gtk.cc + browser/browser_window_osr_gtk.h + browser/browser_window_std_gtk.cc + browser/browser_window_std_gtk.h + browser/dialog_handler_gtk.cc + browser/dialog_handler_gtk.h + browser/main_context_impl_posix.cc + browser/main_message_loop_multithreaded_gtk.cc + browser/main_message_loop_multithreaded_gtk.h + browser/print_handler_gtk.cc + browser/print_handler_gtk.h + browser/resource_util_linux.cc + browser/root_window_gtk.cc + browser/root_window_gtk.h + browser/temp_window_x11.cc + browser/temp_window_x11.h + browser/util_gtk.cc + browser/util_gtk.h + browser/window_test_runner_gtk.cc + browser/window_test_runner_gtk.h + ) +source_group(cefclient\\\\browser FILES ${CEFCLIENT_LINUX_BROWSER_SRCS}) + +set(CEFCLIENT_LINUX_SHARED_BROWSER_SRCS + ../shared/browser/main_message_loop_external_pump_linux.cc + ../shared/browser/resource_util_posix.cc + ) +source_group(shared\\\\browser FILES ${CEFCLIENT_LINUX_SHARED_BROWSER_SRCS}) + +set(CEFCLIENT_LINUX_SRCS + ${CEFCLIENT_LINUX_SRCS} + ${CEFCLIENT_LINUX_BROWSER_SRCS} + ${CEFCLIENT_LINUX_SHARED_BROWSER_SRCS} + ) + +#cefclient Mac OS X sources +set(CEFCLIENT_MACOSX_SRCS + cefclient_mac.mm + ) +source_group(cefclient FILES ${CEFCLIENT_MACOSX_SRCS}) + +set(CEFCLIENT_MACOSX_BROWSER_SRCS + browser/browser_window_osr_mac.h + browser/browser_window_osr_mac.mm + browser/browser_window_std_mac.h + browser/browser_window_std_mac.mm + browser/main_context_impl_posix.cc + browser/osr_accessibility_helper.cc + browser/osr_accessibility_helper.h + browser/osr_accessibility_node.cc + browser/osr_accessibility_node.h + browser/osr_accessibility_node_mac.mm + browser/root_window_mac.h + browser/root_window_mac.mm + browser/temp_window_mac.h + browser/temp_window_mac.mm + browser/text_input_client_osr_mac.h + browser/text_input_client_osr_mac.mm + browser/views_window_mac.mm + browser/window_test_runner_mac.h + browser/window_test_runner_mac.mm + ) +source_group(cefclient\\\\browser FILES ${CEFCLIENT_MACOSX_BROWSER_SRCS}) + +set(CEFCLIENT_MACOSX_SHARED_BROWSER_SRCS + ../shared/browser/main_message_loop_external_pump_mac.mm + ../shared/browser/resource_util_mac.mm + ../shared/browser/resource_util_posix.cc + ) +source_group(shared\\\\browser FILES ${CEFCLIENT_MACOSX_SHARED_BROWSER_SRCS}) + +set(CEFCLIENT_MAC_SRCS + ${CEFCLIENT_MACOSX_SRCS} + ${CEFCLIENT_MACOSX_BROWSER_SRCS} + ${CEFCLIENT_MACOSX_SHARED_BROWSER_SRCS} + ) + +# cefclient Mac OS X helper sources. +set(CEFCLIENT_HELPER_SHARED_SRCS + ../shared/process_helper_mac.cc + ) +source_group(shared FILES ${CEFCLIENT_HELPER_SHARED_SRCS}) + +set(CEFCLIENT_MAC_HELPER_SRCS + ${CEFCLIENT_HELPER_SHARED_SRCS} + ) + +#cefclient Windows sources +set(CEFCLIENT_WINDOWS_SRCS + cefclient_win.cc + ) +source_group(cefclient FILES ${CEFCLIENT_WINDOWS_SRCS}) + +set(CEFCLIENT_WINDOWS_BROWSER_SRCS + browser/browser_window_osr_win.cc + browser/browser_window_osr_win.h + browser/browser_window_std_win.cc + browser/browser_window_std_win.h + browser/main_context_impl_win.cc + browser/main_message_loop_multithreaded_win.cc + browser/main_message_loop_multithreaded_win.h + browser/osr_accessibility_helper.cc + browser/osr_accessibility_helper.h + browser/osr_accessibility_node.cc + browser/osr_accessibility_node.h + browser/osr_accessibility_node_win.cc + browser/osr_d3d11_win.cc + browser/osr_d3d11_win.h + browser/osr_dragdrop_win.cc + browser/osr_dragdrop_win.h + browser/osr_ime_handler_win.cc + browser/osr_ime_handler_win.h + browser/osr_render_handler_win.cc + browser/osr_render_handler_win.h + browser/osr_render_handler_win_d3d11.cc + browser/osr_render_handler_win_d3d11.h + browser/osr_render_handler_win_gl.cc + browser/osr_render_handler_win_gl.h + browser/osr_window_win.cc + browser/osr_window_win.h + browser/resource_util_win_idmap.cc + browser/root_window_win.cc + browser/root_window_win.h + browser/temp_window_win.cc + browser/temp_window_win.h + browser/window_test_runner_win.cc + browser/window_test_runner_win.h + ) +source_group(cefclient\\\\browser FILES ${CEFCLIENT_WINDOWS_BROWSER_SRCS}) + +set(CEFCLIENT_WINDOWS_SHARED_BROWSER_SRCS + ../shared/browser/main_message_loop_external_pump_win.cc + ../shared/browser/resource_util_win.cc + ../shared/browser/util_win.cc + ../shared/browser/util_win.h + ) +source_group(shared\\\\browser FILES ${CEFCLIENT_WINDOWS_SHARED_BROWSER_SRCS}) + +set(CEFCLIENT_WINDOWS_WIN_SRCS + win/cefclient.rc + ) +source_group(cefclient\\\\win FILES ${CEFCLIENT_WINDOWS_WIN_SRCS}) + +set(CEFCLIENT_WINDOWS_SRCS + ${CEFCLIENT_WINDOWS_SRCS} + ${CEFCLIENT_WINDOWS_BROWSER_SRCS} + ${CEFCLIENT_WINDOWS_SHARED_BROWSER_SRCS} + ${CEFCLIENT_WINDOWS_WIN_SRCS} + ) + +# cefclient resources. +set(CEFCLIENT_RESOURCES_MAC_SRCS_MAC + mac/Info.plist.in + mac/cefclient.icns + ) +APPEND_PLATFORM_SOURCES(CEFCLIENT_RESOURCES_MAC_SRCS) +source_group(cefclient\\\\mac FILES ${CEFCLIENT_RESOURCES_MAC_SRCS}) + +set(CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS_MAC + mac/English.lproj/InfoPlist.strings + mac/English.lproj/MainMenu.xib + ) +APPEND_PLATFORM_SOURCES(CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS) +source_group(cefclient\\\\mac\\\\English.lproj FILES ${CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS}) + +set(CEFCLIENT_RESOURCES_RESOURCES_SRCS + resources/binary_transfer.html + resources/binding.html + resources/dialogs.html + resources/draggable.html + resources/hang.html + resources/ipc_performance.html + resources/localstorage.html + resources/logo.png + resources/media_router.html + resources/menu_icon.1x.png + resources/menu_icon.2x.png + resources/other_tests.html + resources/performance.html + resources/performance2.html + resources/preferences.html + resources/response_filter.html + resources/server.html + resources/transparency.html + resources/urlrequest.html + resources/websocket.html + resources/window.html + resources/xmlhttprequest.html + ) +source_group(cefclient\\\\resources FILES ${CEFCLIENT_RESOURCES_RESOURCES_SRCS}) + +set(CEFCLIENT_RESOURCES_SHARED_RESOURCES_SRCS + ../shared/resources/osr_test.html + ../shared/resources/pdf.html + ../shared/resources/pdf.pdf + ../shared/resources/window_icon.1x.png + ../shared/resources/window_icon.2x.png + ) +source_group(shared\\\\resources FILES ${CEFCLIENT_RESOURCES_SHARED_RESOURCES_SRCS}) + +set(CEFCLIENT_RESOURCES_SRCS + ${CEFCLIENT_RESOURCES_MAC_SRCS} + ${CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS} + ${CEFCLIENT_RESOURCES_RESOURCES_SRCS} + ${CEFCLIENT_RESOURCES_SHARED_RESOURCES_SRCS} + ) + + +# +# Shared configuration. +# + +# Target executable names. +set(CEF_TARGET "cefclient") +if(OS_MAC) + set(CEF_HELPER_TARGET "cefclient_Helper") + set(CEF_HELPER_OUTPUT_NAME "cefclient Helper") +else() + # Logical target used to link the libcef library. + ADD_LOGICAL_TARGET("libcef" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") +endif() + +# Determine the target output directory. +SET_CEF_TARGET_OUT_DIR() + + +# +# Linux configuration. +# + +if(OS_LINUX) + # All sources required by the "cefclient" target. Generates an executable that + # is used for all processes. + set(CEFCLIENT_SRCS + ${CEFCLIENT_BROWSER_SRCS} + ${CEFCLIENT_COMMON_SRCS} + ${CEFCLIENT_RENDERER_SRCS} + ${CEFCLIENT_RESOURCES_SRCS} + ${CEFCLIENT_LINUX_SRCS} + ) + + # Find required libraries and update compiler/linker variables. + FIND_LINUX_LIBRARIES("gmodule-2.0 gtk+-3.0 gthread-2.0 gtk+-unix-print-3.0 xi") + + # Executable target. + add_executable(${CEF_TARGET} ${CEFCLIENT_SRCS}) + SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) + add_dependencies(${CEF_TARGET} libcef_dll_wrapper) + target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper "GL" ${CEF_STANDARD_LIBS}) + + # Set rpath so that libraries can be placed next to the executable. + set_target_properties(${CEF_TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN") + set_target_properties(${CEF_TARGET} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) + set_target_properties(${CEF_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR}) + + # We don't call deprecated GTK functions, and they can cause build failures, so disable them. + add_definitions("-DGTK_DISABLE_DEPRECATED") + + # Copy CEF binary and resource files to the target output directory. + COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}") + COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}") + + # Copy cefclient resource files to the target output directory. + COPY_FILES("${CEF_TARGET}" "${CEFCLIENT_RESOURCES_SRCS}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET_OUT_DIR}/cefclient_files") + + # Set SUID permissions on the chrome-sandbox target. + SET_LINUX_SUID_PERMISSIONS("${CEF_TARGET}" "${CEF_TARGET_OUT_DIR}/chrome-sandbox") +endif() + + +# +# Mac OS X configuration. +# + +if(OS_MAC) + option(OPTION_USE_ARC "Build with ARC (automatic Reference Counting) on macOS." ON) + if(OPTION_USE_ARC) + list(APPEND CEF_COMPILER_FLAGS + -fobjc-arc + ) + set_target_properties(${target} PROPERTIES + CLANG_ENABLE_OBJC_ARC "YES" + ) + endif() + + # All sources required by the "cefclient" target. Generates an app bundle that + # is used only for the browser process. + set(CEFCLIENT_SRCS + ${CEFCLIENT_BROWSER_SRCS} + ${CEFCLIENT_COMMON_SRCS} + ${CEFCLIENT_RESOURCES_SRCS} + ${CEFCLIENT_MAC_SRCS} + ) + + # All sources required by the "cefclient Helper" target. Generates an app + # bundle that is used only for non-browser processes. + set(CEFCLIENT_HELPER_SRCS + ${CEFCLIENT_COMMON_SRCS} + ${CEFCLIENT_RENDERER_SRCS} + ${CEFCLIENT_MAC_HELPER_SRCS} + ) + + # Output path for the main app bundle. + set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app") + + # Variables referenced from the main Info.plist file. + set(EXECUTABLE_NAME "${CEF_TARGET}") + set(PRODUCT_NAME "${CEF_TARGET}") + + if(USE_SANDBOX) + # Logical target used to link the cef_sandbox library. + ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}") + endif() + + # Main app bundle target. + add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS}) + SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) + add_dependencies(${CEF_TARGET} libcef_dll_wrapper) + target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL") + set_target_properties(${CEF_TARGET} PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist.in + ) + + # Copy the CEF framework into the Frameworks directory. + add_custom_command( + TARGET ${CEF_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CEF_BINARY_DIR}/Chromium Embedded Framework.framework" + "${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework" + VERBATIM + ) + + # Create the multiple Helper app bundle targets. + foreach(_suffix_list ${CEF_HELPER_APP_SUFFIXES}) + # Convert to a list and extract the suffix values. + string(REPLACE ":" ";" _suffix_list ${_suffix_list}) + list(GET _suffix_list 0 _name_suffix) + list(GET _suffix_list 1 _target_suffix) + list(GET _suffix_list 2 _plist_suffix) + + # Define Helper target and output names. + set(_helper_target "${CEF_HELPER_TARGET}${_target_suffix}") + set(_helper_output_name "${CEF_HELPER_OUTPUT_NAME}${_name_suffix}") + + # Create Helper-specific variants of the helper-Info.plist file. Do this + # manually because the configure_file command (which is executed as part of + # MACOSX_BUNDLE_INFO_PLIST) uses global env variables and would insert the + # wrong values with multiple targets. + set(_helper_info_plist "${CMAKE_CURRENT_BINARY_DIR}/helper-Info${_target_suffix}.plist") + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist.in" _plist_contents) + string(REPLACE "\${EXECUTABLE_NAME}" "${_helper_output_name}" _plist_contents ${_plist_contents}) + string(REPLACE "\${PRODUCT_NAME}" "${_helper_output_name}" _plist_contents ${_plist_contents}) + string(REPLACE "\${BUNDLE_ID_SUFFIX}" "${_plist_suffix}" _plist_contents ${_plist_contents}) + file(WRITE ${_helper_info_plist} ${_plist_contents}) + + # Create Helper executable target. + add_executable(${_helper_target} MACOSX_BUNDLE ${CEFCLIENT_HELPER_SRCS}) + SET_EXECUTABLE_TARGET_PROPERTIES(${_helper_target}) + add_dependencies(${_helper_target} libcef_dll_wrapper) + target_link_libraries(${_helper_target} libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + set_target_properties(${_helper_target} PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${_helper_info_plist} + OUTPUT_NAME ${_helper_output_name} + ) + + if(USE_SANDBOX) + target_link_libraries(${_helper_target} cef_sandbox_lib) + endif() + + # Add the Helper as a dependency of the main executable target. + add_dependencies(${CEF_TARGET} "${_helper_target}") + + # Copy the Helper app bundle into the Frameworks directory. + add_custom_command( + TARGET ${CEF_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CEF_TARGET_OUT_DIR}/${_helper_output_name}.app" + "${CEF_APP}/Contents/Frameworks/${_helper_output_name}.app" + VERBATIM + ) + endforeach() + + # Manually process and copy over resource files. + # The Xcode generator can support this via the set_target_properties RESOURCE + # directive but that doesn't properly handle nested resource directories. + # Remove these prefixes from input file paths. + set(PREFIXES + "mac/" + "resources/" + "../shared/resources/" + ) + COPY_MAC_RESOURCES("${CEFCLIENT_RESOURCES_SRCS}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}") +endif() + + +# +# Windows configuration. +# +option(BUILD_COMPILER "Build Tools" MINGW) + +if(OS_WINDOWS) + if (MINGW) + SET(BUILD_COMPILER MINGW) + endif() + # All sources required by the "cefclient" target. Generates an executable that + # is used for all processes. + set(CEFCLIENT_SRCS + ${CEFCLIENT_BROWSER_SRCS} + ${CEFCLIENT_COMMON_SRCS} + ${CEFCLIENT_RENDERER_SRCS} + ${CEFCLIENT_RESOURCES_SRCS} + ${CEFCLIENT_WINDOWS_SRCS} + ) + + # Executable target. + add_executable(${CEF_TARGET} WIN32 ${CEFCLIENT_SRCS}) + SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) + add_dependencies(${CEF_TARGET} libcef_dll_wrapper) + target_link_libraries(${CEF_TARGET} libcef_dll_wrapper libcef ${CEF_STANDARD_LIBS} d3d11.lib glu32.lib imm32.lib opengl32.lib) + # Add additional /DELAYLOADs that are missing from CEF_EXE_LINKER_FLAGS. + #set_property(TARGET ${CEF_TARGET} PROPERTY LINK_FLAGS "/DELAYLOAD:glu32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:opengl32.dll") + + if(USE_ATL) + # Required by VS2013 to link accessibility API functions. + target_link_libraries(${CEF_TARGET} oleacc.lib) + endif() + + if(USE_SANDBOX) + # Logical target used to link the cef_sandbox library. + ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}") + target_link_libraries(${CEF_TARGET} cef_sandbox_lib ${CEF_SANDBOX_STANDARD_LIBS}) + endif() + + # Add the custom manifest files to the executable. + #ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/win" "${CEF_TARGET}" "exe") + + # Copy CEF binary and resource files to the target output directory. + COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}") + COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}") +endif() diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/test/cefclient/cefclient_win.cc b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/test/cefclient/cefclient_win.cc new file mode 100644 index 0000000..c2b3b90 --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/dep/cef_binary/test/cefclient/cefclient_win.cc @@ -0,0 +1,124 @@ +// Copyright (c) 2015 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. + +#include + +#include + +#include "include/cef_command_line.h" +#include "include/cef_sandbox_win.h" +#include "tests/cefclient/browser/main_context_impl.h" +#include "tests/cefclient/browser/main_message_loop_multithreaded_win.h" +#include "tests/cefclient/browser/resource.h" +#include "tests/cefclient/browser/root_window_manager.h" +#include "tests/cefclient/browser/test_runner.h" +#include "tests/shared/browser/client_app_browser.h" +#include "tests/shared/browser/main_message_loop_external_pump.h" +#include "tests/shared/browser/main_message_loop_std.h" +#include "tests/shared/common/client_app_other.h" +#include "tests/shared/common/client_switches.h" +#include "tests/shared/renderer/client_app_renderer.h" + +// When generating projects with CMake the CEF_USE_SANDBOX value will be defined +// automatically if using the required compiler version. Pass -DUSE_SANDBOX=OFF +// to the CMake command-line to disable use of the sandbox. +// Uncomment this line to manually enable sandbox support. +// #define CEF_USE_SANDBOX 1 + +// #if defined(CEF_USE_SANDBOX) +// // The cef_sandbox.lib static library may not link successfully with all VS +// // versions. +// //#pragma comment(lib, "cef_sandbox.lib") +// #endif + +namespace client { +namespace { + +int Wmain(int argc, char *argv[]) +{ + HINSTANCE hInstance = GetModuleHandle(NULL); + CefMainArgs main_args(hInstance); + void* sandbox_info = nullptr; + // Parse command-line arguments. + CefRefPtr command_line = CefCommandLine::CreateCommandLine(); + command_line->InitFromString(::GetCommandLineW()); + command_line->AppendSwitchWithValue("lang","zh-CN"); + command_line->AppendSwitchWithValue("url","https://www.baidu.com"); + // Create a ClientApp of the correct type. + CefRefPtr app; + ClientApp::ProcessType process_type = ClientApp::GetProcessType(command_line); + if (process_type == ClientApp::BrowserProcess) { + app = new ClientAppBrowser(); + } else if (process_type == ClientApp::RendererProcess) { + app = new ClientAppRenderer(); + } else if (process_type == ClientApp::OtherProcess) { + app = new ClientAppOther(); + } + + // Execute the secondary process, if any. + int exit_code = CefExecuteProcess(main_args, app, sandbox_info); + if (exit_code >= 0) { + return exit_code; + } + + // Create the main context object. + auto context = std::make_unique(command_line, true); + + CefSettings settings; + settings.no_sandbox = true; + // Populate the settings based on command line arguments. + context->PopulateSettings(&settings); + + // Set the ID for the ICON resource that will be loaded from the main + // executable and used when creating default Chrome windows such as DevTools + // and Task Manager. Only used with the Chrome runtime. + settings.chrome_app_icon_id = IDR_MAINFRAME; + + // Create the main message loop object. + std::unique_ptr message_loop; + if (settings.multi_threaded_message_loop) { + message_loop = std::make_unique(); + } else if (settings.external_message_pump) { + message_loop = MainMessageLoopExternalPump::Create(); + } else { + message_loop = std::make_unique(); + } + + // Initialize the CEF browser process. May return false if initialization + // fails or if early exit is desired (for example, due to process singleton + // relaunch behavior). + if (!context->Initialize(main_args, settings, app, sandbox_info)) { + return CefGetExitCode(); + } + + // Register scheme handlers. + test_runner::RegisterSchemeHandlers(); + + auto window_config = std::make_unique(); + window_config->always_on_top = + command_line->HasSwitch(switches::kAlwaysOnTop); + window_config->with_osr = + settings.windowless_rendering_enabled ? true : false; + window_config->with_controls=true; + // Create the first window. + context->GetRootWindowManager()->CreateRootWindow(std::move(window_config)); + // Run the message loop. This will block until Quit() is called by the + // RootWindowManager after all windows have been destroyed. + int result = message_loop->Run(); + + // Shut down CEF. + context->Shutdown(); + + // Release objects in reverse order of creation. + message_loop.reset(); + context.reset(); + + return result; +} + +} // namespace +} // namespace client +int main(int argc, char *argv[]){ + return client::Wmain(argc, argv); +} \ No newline at end of file diff --git a/QCefView_Build_Fix/_build/_dep/cefviewcore-src/src/CMakeLists.txt b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/src/CMakeLists.txt new file mode 100644 index 0000000..3d183d6 --- /dev/null +++ b/QCefView_Build_Fix/_build/_dep/cefviewcore-src/src/CMakeLists.txt @@ -0,0 +1,451 @@ +file(GLOB_RECURSE CefViewCore_SHARED_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/Shared/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/Shared/*.h" +) +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/Shared" + PREFIX Shared + FILES ${CefViewCore_SHARED_SRC_FILES} +) + +# ## CefViewCore +# ############################################################################################### +# header files +file(GLOB_RECURSE CefViewCore_INCLUDE_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" +) +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" + PREFIX Include + FILES ${CefViewCore_INCLUDE_FILES} +) + +# soruce code for all platforms +file(GLOB_RECURSE CefViewCore_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/CefView/CefBrowserApp/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/CefView/CefBrowserApp/*.cpp" +) +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/CefView/CefBrowserApp" + PREFIX Source + FILES ${CefViewCore_SRC_FILES} +) + +add_library(CefViewCore STATIC + ${CefViewCore_SHARED_SRC_FILES} + ${CefViewCore_INCLUDE_FILES} + ${CefViewCore_SRC_FILES} +) + +target_include_directories(CefViewCore + PUBLIC + ${CefViewCore_INCLUDE_PATH} + PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Shared" +) + +# ADD_LOGICAL_TARGET(libcef_lib +# "${CEF_LIB_DEBUG}" +# "${CEF_LIB_RELEASE}" +# ) +add_library(libcef_lib ${CEF_LIBTYPE} IMPORTED GLOBAL) +#[Edit:JackLee]mingw build +if(BUILD_STATIC) + set_target_properties(libcef_lib + PROPERTIES + IMPORTED_IMPLIB "${CEF_LIB_RELEASE}" + IMPORTED_IMPLIB_DEBUG "${CEF_LIB_DEBUG}" + IMPORTED_IMPLIB_RELEASE "${CEF_LIB_RELEASE}" + IMPORTED_LOCATION "${CEF_LIB_RELEASE}" + IMPORTED_LOCATION_DEBUG "${CEF_LIB_DEBUG}" + IMPORTED_LOCATION_RELEASE "${CEF_LIB_RELEASE}" + ) +else() + set_target_properties(libcef_lib + PROPERTIES + IMPORTED_LOCATION "${CEF_LIB_RELEASE}" + IMPORTED_LOCATION_DEBUG "${CEF_LIB_DEBUG}" + IMPORTED_LOCATION_RELEASE "${CEF_LIB_RELEASE}" + ) +endif() + + + +if(OS_WINDOWS) + SET_LIBRARY_TARGET_PROPERTIES(CefViewCore) + + add_dependencies(CefViewCore + libcef_dll_wrapper + libcef_lib + ) + + set(CefViewCore_LIBS + libcef_dll_wrapper + libcef_lib + ${CEF_STANDARD_LIBS} + ) + + if(USE_SANDBOX) + list(APPEND CefViewCore_LIBS cef_sandbox_lib) + endif() + + target_link_libraries(CefViewCore + PUBLIC + ${CefViewCore_LIBS} + ) +endif() # OS_WINDOWS + +if(OS_LINUX) + SET_LIBRARY_TARGET_PROPERTIES(CefViewCore) + + add_dependencies(CefViewCore + libcef_dll_wrapper + libcef_lib + ) + + set(CefViewCore_LIBS + libcef_dll_wrapper + libcef_lib + ${CEF_STANDARD_LIBS} + ) + + target_link_libraries(CefViewCore + PUBLIC + ${CefViewCore_LIBS} + ) +endif() # OS_LINUX + +if(OS_MACOS) + file(GLOB_RECURSE CefViewCore_PUBLIC_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" + ) + + target_compile_options(CefViewCore + PRIVATE + "-fobjc-arc" + ) + + SET_LIBRARY_TARGET_PROPERTIES(CefViewCore) + + set_target_properties(CefViewCore + PROPERTIES + FRAMEWORK TRUE + PUBLIC_HEADER "${CefViewCore_PUBLIC_HEADERS}" + CLANG_ENABLE_OBJC_ARC "YES" + APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc" + XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11 + XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME "NO" # -fno-objc-link-runtime + XCODE_ATTRIBUTE_COPY_PHASE_STRIP "NO" + XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] "YES" # -Wl,-dead_strip + XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99 + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.cefview.cefview" + ) + + add_dependencies(CefViewCore + libcef_dll_wrapper + ) + + set(CefViewCore_LIBS + libcef_dll_wrapper + ${CEF_STANDARD_LIBS} + ) + + if(USE_SANDBOX) + list(APPEND CefViewCore_LIBS cef_sandbox_lib) + endif() + + target_link_libraries(CefViewCore + PUBLIC + ${CefViewCore_LIBS} + ) +endif() # OS_MACOS + +add_library(CefViewCore::CefViewCore ALIAS CefViewCore) + +#[Edit:JackLee]mingw build +## CefViewWing +############################################################################################### +#soruce code for all platforms +# file(GLOB_RECURSE CefViewWing_SRC_FILES +# "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/App/*.h" +# "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/App/*.cpp" +# "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/Bridge/*.h" +# "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/Bridge/*.cpp" +# ) +# source_group( +# TREE "${CMAKE_CURRENT_SOURCE_DIR}/CefWing" +# PREFIX Source +# FILES ${CefViewWing_SRC_FILES} +# ) + +# if(OS_WINDOWS) +# file(GLOB_RECURSE CefViewWing_PLATFORM_SRC_FILES +# "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/win/*.h" +# "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/win/*.cpp" +# ) +# source_group( +# TREE "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/win" +# PREFIX Source +# FILES ${CefViewWing_PLATFORM_SRC_FILES} +# ) + +# if(EXISTS ${CEFVIEW_WING_ICON}) +# # Copy icon file to binary dir +# configure_file( +# "${CEFVIEW_WING_ICON}" +# "${CMAKE_CURRENT_BINARY_DIR}/app.ico" +# COPYONLY +# ) + +# # Config resource file +# configure_file( +# "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/win/resource.rc.in" +# "${CMAKE_CURRENT_BINARY_DIR}/resource.rc" +# COPYONLY +# ) +# set(CefViewWing_WIN_RESOURCE_FILE "${CMAKE_CURRENT_BINARY_DIR}/resource.rc") +# else() +# set(CefViewWing_WIN_RESOURCE_FILE "") +# endif() + +# # Create Helper executable target. +# add_executable(${CEFVIEW_WING_NAME} WIN32 +# ${CefViewCore_SHARED_SRC_FILES} +# ${CefViewWing_SRC_FILES} +# ${CefViewWing_PLATFORM_SRC_FILES} +# ${CefViewWing_WIN_RESOURCE_FILE} +# ) + +# SET_EXECUTABLE_TARGET_PROPERTIES(${CEFVIEW_WING_NAME}) + +# target_include_directories(${CEFVIEW_WING_NAME} +# PUBLIC +# ${CefViewCore_INCLUDE_PATH} +# PRIVATE +# "${CMAKE_CURRENT_SOURCE_DIR}/Shared" +# ) + +# add_dependencies(${CEFVIEW_WING_NAME} +# libcef_dll_wrapper +# libcef_lib +# ) + +# set(_helper_libs +# libcef_dll_wrapper +# libcef_lib +# d3d11.lib +# glu32.lib +# imm32.lib +# opengl32.lib +# ${CEF_STANDARD_LIBS} +# ${CEF_SANDBOX_STANDARD_LIBS} +# ) + +# if(USE_SANDBOX) +# list(APPEND _helper_libs cef_sandbox_lib) +# endif() + +# target_link_libraries(${CEFVIEW_WING_NAME} +# ${_helper_libs} +# ) + +# add_dependencies(CefViewCore ${CEFVIEW_WING_NAME}) +# # Add the Helper as a dependency of the main executable target. +# add_dependencies(CefViewCore ${CEFVIEW_WING_NAME}) +# #[Edit:JackLee]mingw build +# if(MSVC) +# target_link_options(${CEFVIEW_WING_NAME} +# PRIVATE +# "/MANIFEST" +# ) +# add_custom_command(TARGET ${CEFVIEW_WING_NAME} +# POST_BUILD + +# # embed the manifest file +# COMMAND mt.exe +# -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\CefWing\\win\\CefViewWing.manifest\" +# -outputresource:\"$\" + +# # copy cef binary files +# # .1 copy the cef resources to output dir +# COMMAND ${CMAKE_COMMAND} -E copy_directory +# "${CEF_RESOURCE_DIR}" +# "$" + +# # copy all cef binary files to output dir +# COMMAND ${CMAKE_COMMAND} -E copy_directory +# "${CEF_BINARY_DIR}" +# "$" + +# # move libcef.lib to lib output +# COMMAND ${CMAKE_COMMAND} -E rename +# "$/libcef.lib" +# "$/libcef.lib" + +# # move cef_sandbox.lib to lib output +# COMMAND ${CMAKE_COMMAND} -E rename +# "$/cef_sandbox.lib" +# "$/cef_sandbox.lib" +# ) +# endif() +#endif() # OS_WINDOWS + +if(OS_LINUX) + file(GLOB_RECURSE CefViewWing_PLATFORM_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/linux/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/linux/*.cpp" + ) + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/linux" + PREFIX Source + FILES ${CefViewWing_PLATFORM_SRC_FILES} + ) + + # Create Helper executable target. + add_executable(${CEFVIEW_WING_NAME} + ${CefViewCore_SHARED_SRC_FILES} + ${CefViewWing_SRC_FILES} + ${CefViewWing_PLATFORM_SRC_FILES} + ) + + SET_EXECUTABLE_TARGET_PROPERTIES(${CEFVIEW_WING_NAME}) + + set_target_properties(${CEFVIEW_WING_NAME} + PROPERTIES + INSTALL_RPATH "$ORIGIN" + BUILD_WITH_INSTALL_RPATH TRUE + ) + + target_include_directories(${CEFVIEW_WING_NAME} + PUBLIC + ${CefViewCore_INCLUDE_PATH} + PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Shared" + ) + + add_dependencies(${CEFVIEW_WING_NAME} + libcef_lib + libcef_dll_wrapper + ) + + set(_helper_libs + libcef_lib + libcef_dll_wrapper + ${CEF_STANDARD_LIBS} + ) + + target_link_libraries(${CEFVIEW_WING_NAME} + ${_helper_libs} + ) + + # Add the Helper as a dependency of the main executable target. + add_dependencies(CefViewCore ${CEFVIEW_WING_NAME}) + + # copy cef binary files + add_custom_command(TARGET ${CEFVIEW_WING_NAME} + POST_BUILD + + # copy cef binary files + # .1 copy the cef resources to output dir + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CEF_RESOURCE_DIR}" + "$" + + # copy all cef binary files to output dir + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CEF_BINARY_DIR}" + "$" + ) + + SET_LINUX_SUID_PERMISSIONS(${CEFVIEW_WING_NAME} "$/chrome-sandbox") +endif() # OS_LINUX + +if(OS_MACOS) + file(GLOB_RECURSE CefViewWing_PLATFORM_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/mac/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/mac/*.m" + "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/mac/*.mm" + "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/mac/*.cpp" + ) + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/mac" + PREFIX Source + FILES ${CefViewWing_PLATFORM_SRC_FILES} + ) + + set(CefViewWing_LIBS + libcef_dll_wrapper + ${CEF_STANDARD_LIBS} + ) + + if(USE_SANDBOX) + list(APPEND CefViewWing_LIBS cef_sandbox_lib) + endif() + + # Create the multiple Helper app bundle targets. + foreach(_suffix_list ${CEF_HELPER_APP_SUFFIXES}) + # Convert to a list and extract the suffix values. + string(REPLACE ":" ";" _suffix_list ${_suffix_list}) + list(GET _suffix_list 0 _name_suffix) + list(GET _suffix_list 1 _target_suffix) + list(GET _suffix_list 2 _plist_suffix) + + # Define Helper target and output names. + set(_helper_target "${CEFVIEW_WING_NAME}${_target_suffix}") + set(_helper_output_name "${CEFVIEW_WING_NAME}${_name_suffix}") + + # Create Helper executable target. + add_executable(${_helper_target} MACOSX_BUNDLE + ${CefViewCore_SHARED_SRC_FILES} + ${CefViewWing_SRC_FILES} + ${CefViewWing_PLATFORM_SRC_FILES} + ) + SET_EXECUTABLE_TARGET_PROPERTIES(${_helper_target}) + + set(_helper_info_plist "${CMAKE_CURRENT_BINARY_DIR}/helper-Info${_target_suffix}.plist") + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/mac/info.plist" _plist_contents) + file(WRITE ${_helper_info_plist} ${_plist_contents}) + + set_target_properties(${_helper_target} + PROPERTIES + CLANG_ENABLE_OBJC_ARC "YES" + OUTPUT_NAME "${_helper_output_name}" + MACOSX_BUNDLE_INFO_PLIST "${_helper_info_plist}" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.cefview.${CEFVIEW_WING_NAME}${_plist_suffix}" + XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES" + XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/CefWing/mac/CefViewWing.entitlements" + ) + + target_include_directories(${_helper_target} + PUBLIC + ${CefViewCore_INCLUDE_PATH} + PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Shared" + ) + + add_dependencies(${_helper_target} + libcef_dll_wrapper + ) + + target_link_libraries(${_helper_target} + ${CefViewWing_LIBS} + ) + + # Add the Helper as a dependency of the main executable target. + add_dependencies(CefViewCore ${_helper_target}) + endforeach() + + # copy cef binary files to the output folder + add_custom_command(TARGET ${CEFVIEW_WING_NAME} + POST_BUILD + + # copy the cef framework to output directory + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CEF_BINARY_DIR}/Chromium Embedded Framework.framework" + "$/../Chromium Embedded Framework.framework" + VERBATIM + ) +endif() # OS_MACOS + +# # add alias for heper process target +#add_executable(CefViewCore::CefViewWing ALIAS ${CEFVIEW_WING_NAME}) diff --git a/QCefView_Build_Fix/cmake/QtConfig.cmake b/QCefView_Build_Fix/cmake/QtConfig.cmake new file mode 100644 index 0000000..754c1be --- /dev/null +++ b/QCefView_Build_Fix/cmake/QtConfig.cmake @@ -0,0 +1,33 @@ +# ################################################################################ +# +# The Qt SDK path +# You can set the environment variable via +# 1. command line +# Windows: SET QTDIR=PATH/TO/QT +# Non-Windows: export QTDIR=PATH/TO/QT +# 2. modifying the value below directly +# + +# Qt build toolchain path not set or doesn't exist +# try to read from environment QTDIR +if(NOT EXISTS ${QT_SDK_DIR}) + message(STATUS "QT_SDK_DIR not found, try to read from environment variable: QTDIR") + set(QT_SDK_DIR "$ENV{QTDIR}" CACHE STRING "QT_SDK_DIR read from environment variable: QTDIR" FORCE) +endif() + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# You must make sure the target platform and architecture +# of QT binaries math the ones of CEF binaries +# Qt linux-x86 + CEF linux-x86 +# Qt linux-x86_64 + CEF linux-x86_64 +# Qt windows-x86 + CEF windows-x86 +# Qt windows-x86_64 + CEF windows-x86_64 +# Qt macos-x86_64 + CEF macos-x86_64 +# Qt macos-arm64 + CEF macos-arm64 +# + +# find required components +message(STATUS "Qt SDK dir: " ${QT_SDK_DIR}) +set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_SDK_DIR}) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED) \ No newline at end of file diff --git a/QCefView_Build_Fix/example/QCefViewTest/CMakeLists.txt b/QCefView_Build_Fix/example/QCefViewTest/CMakeLists.txt new file mode 100644 index 0000000..7a92691 --- /dev/null +++ b/QCefView_Build_Fix/example/QCefViewTest/CMakeLists.txt @@ -0,0 +1,277 @@ +project(QCefViewTest) + +set(CMAKE_FOLDER "Example") + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED) + +get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) +get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) + +if(OS_WINDOWS) + find_program(DEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") +elseif(OS_MACOS) + find_program(DEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") +elseif(OS_LINUX) +elseif(OS_MACOS) +else() +endif() + +# Create an empty source file as the rebuild trigger +# QCefView will update this file every time it gets built +file(WRITE ${CMAKE_BINARY_DIR}/auto_rebuild.cpp "/* Auto Rebuild Trigger */") + +include_directories( + ${CMAKE_SOURCE_DIR}/include +) + +file(GLOB _SRC_FILES + "*.h" + "*.cpp" + ${CMAKE_BINARY_DIR}/auto_rebuild.cpp +) + +file(GLOB_RECURSE _UI_FILES + "*.ui" +) +source_group("Form Files" + FILES ${_UI_FILES}) + +configure_file(websrc/left.in.html webres/left.html COPYONLY) +configure_file(websrc/right.in.html webres/right.html COPYONLY) +configure_file(websrc/iframe.in.html webres/iframe.html COPYONLY) + +file(GLOB_RECURSE _WEB_FILES + "*.html" +) +source_group("Webres Files" + FILES ${_WEB_FILES} +) + +if(OS_WINDOWS) + file(GLOB_RECURSE _PLATFORM_SRC_FILES + "win/*.h" + "win/*.cpp" + ) + + file(GLOB_RECURSE _RES_FILES + "*.qrc" + "*.rc" + ) + source_group("Resource Files" + FILES ${_RES_FILES}) + + add_executable(${PROJECT_NAME} WIN32 + ${_SRC_FILES} + ${_PLATFORM_SRC_FILES} + ${_UI_FILES} + ${_RES_FILES} + ${_WEB_FILES} + ) + + target_link_libraries(${PROJECT_NAME} + PRIVATE + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Widgets + QCefView + ) + + target_compile_definitions(${PROJECT_NAME} PRIVATE + UNICODE + _UNICODE + ) + + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + PROPERTY + VS_STARTUP_PROJECT ${PROJECT_NAME} + ) + + set_target_properties(${PROJECT_NAME} + PROPERTIES + VS_DEBUGGER_WORKING_DIRECTORY "$" + ) + if(MSVC) + add_custom_command(TARGET ${PROJECT_NAME} + POST_BUILD + + # Embed the manifest file into the target + COMMAND mt.exe + -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\${PROJECT_NAME}.manifest\" + -inputresource:\"$\" + -outputresource:\"$\" + + # Copy QCefView binary to output folder + COMMAND ${CMAKE_COMMAND} -E copy_directory + $ + $ + + # Copy the webres directory to output folder + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_BINARY_DIR}/webres + $/webres + + # Deploy the Qt Application + COMMAND ${DEPLOYQT_EXECUTABLE} + --no-svg + --no-translations + --no-compiler-runtime + $ + ) + endif() +endif() # OS_WINDOWS + +if(OS_LINUX) + file(GLOB_RECURSE _PLATFORM_SRC_FILES + "linux/*.h" + "linux/*.cpp" + ) + + file(GLOB_RECURSE _RES_FILES + "*.qrc" + ) + source_group("Resource Files" + FILES ${_RES_FILES}) + + add_executable(${PROJECT_NAME} + ${_SRC_FILES} + ${_PLATFORM_SRC_FILES} + ${_UI_FILES} + ${_RES_FILES} + ${_WEB_FILES} + ) + + set_target_properties(${PROJECT_NAME} + PROPERTIES + INSTALL_RPATH "$ORIGIN" + BUILD_WITH_INSTALL_RPATH TRUE + ) + + target_link_libraries(${PROJECT_NAME} + PRIVATE + + # On linux platform and debug mode, libcef.so MUST be loaded before libc.so. + # Generally we can achieve this by using LD_PRELOAD=libcef.so, but this is not + # convenience for debugging. + # Thus, here we do a trick to make sure the load order + "-Wl,--no-as-needed $/$" + + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Widgets + QCefView + ) + + add_custom_command(TARGET ${PROJECT_NAME} + POST_BUILD + + # Copy QCefView binary to output folder + COMMAND ${CMAKE_COMMAND} -E copy_directory + $ + $ + + # Copy the webres directory to output folder + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_BINARY_DIR}/webres + $/webres + + # Deploy the Qt Application + # COMMAND ${DEPLOYQT_EXECUTABLE} + # --no-svg + # --no-translations + # --no-compiler-runtime + # $ + ) +endif() # OS_LINUX + +if(OS_MACOS) + file(GLOB_RECURSE _PLATFORM_SRC_FILES + "mac/*.h" + "mac/*.cpp" + "mac/*.mm" + ) + + file(GLOB_RECURSE _RES_FILES + "*.qrc" + ) + source_group("Resource Files" + FILES ${_RES_FILES}) + + set(QCefViewTest_INFO_PLIST_FILE + "${CMAKE_CURRENT_LIST_DIR}/mac/Info.plist" + ) + + add_executable(${PROJECT_NAME} MACOSX_BUNDLE + ${_SRC_FILES} + ${_PLATFORM_SRC_FILES} + ${_UI_FILES} + ${_RES_FILES} + ${_WEB_FILES} + ) + + set_target_properties(${PROJECT_NAME} + PROPERTIES + CLANG_ENABLE_OBJC_ARC "YES" + MACOSX_BUNDLE_INFO_PLIST "${QCefViewTest_INFO_PLIST_FILE}" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.cefview.qcefviewtest" + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks" + XCODE_LINK_BUILD_PHASE_MODE "KNOWN_LOCATION" + XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY "YES" + XCODE_EMBED_FRAMEWORKS "${CMAKE_BINARY_DIR}/output/$(CONFIGURATION)/bin/QCefView.framework" + ) + + add_custom_command(TARGET ${PROJECT_NAME} + POST_BUILD + + # remove the old framework from the bundle if exists then copy the new one + # the below tow commands can be removed if you use CMake >= 3.20.0 and set the + # following target propertis XCODE_EMBED_FRAMEWORKS, XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY + # COMMAND rm -fr "$/Frameworks/QCefView.framework" + # COMMAND ${CMAKE_COMMAND} -E copy_directory + # "$" + # "$/Frameworks/QCefView.framework" + + # copy the webres to the bundle + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_CURRENT_BINARY_DIR}/webres" + "$/Resources/webres" + + # deploy the Qt Application, this command line will re-sign the app bundle + COMMAND ${DEPLOYQT_EXECUTABLE} + "$" + "-codesign=-" + + VERBATIM + ) + + find_library(COCOA_FRAMEWORK Cocoa) + find_library(APPKIT_FRAMEWORK Appkit) + target_link_libraries(${PROJECT_NAME} + PRIVATE + ${COCOA_FRAMEWORK} + ${APPKIT_FRAMEWORK} + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Widgets + $ + ) +endif() + +set_target_properties(${PROJECT_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/$/bin + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/$/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/$/lib +) + +if(OS_MACOS) + # Copy the app to a subfoler named QCefViewTest under install dir + install(DIRECTORY "$/" DESTINATION "${PROJECT_NAME}$<$:/Debug>/${PROJECT_NAME}.app") +else() + install(DIRECTORY "$/" DESTINATION "${PROJECT_NAME}$<$:/Debug>") +endif() \ No newline at end of file diff --git a/QCefView_Build_Fix/src/CMakeLists.txt b/QCefView_Build_Fix/src/CMakeLists.txt new file mode 100644 index 0000000..44526ee --- /dev/null +++ b/QCefView_Build_Fix/src/CMakeLists.txt @@ -0,0 +1,295 @@ +# ## QCefView +# ############################################################################################### +set(CMAKE_GLOBAL_AUTOGEN_TARGET OFF) +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED) + +file(GLOB_RECURSE QCefView_INCLUDE_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" +) +source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" + PREFIX Include + FILES ${QCefView_INCLUDE_FILES} +) + +file(GLOB QCefView_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" +) +source_group( + TREE ${CMAKE_CURRENT_SOURCE_DIR} + PREFIX Source + FILES ${QCefView_SRC_FILES} +) + +file(GLOB_RECURSE QCefView_details_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/details/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/details/*.cpp" +) +source_group( + TREE ${CMAKE_CURRENT_SOURCE_DIR} + PREFIX Source + FILES ${QCefView_details_SRC_FILES} +) + +if(USE_SANDBOX AND(OS_WINDOWS OR OS_MACOS)) + add_definitions(-DCEF_USE_SANDBOX) +endif() + +if(USE_QT_EVENT_LOOP) + add_definitions(-DCEF_USE_QT_EVENT_LOOP) +endif() +#[Edit:JackLee]mingw build +if(USE_WIN_DCOMPOSITION) + add_definitions(-DENABLE_WINDOWS_DIRECT_COMPOSITION=1) +endif() + +if(OS_WINDOWS) + file(GLOB_RECURSE QCefView_Windows_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/win/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/win/*.cpp" + ) + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/win" + PREFIX Source + FILES ${QCefView_Windows_SRC_FILES} + ) + + add_library(QCefView ${QCEFVIEW_LIB_TYPE} + ${QCefView_INCLUDE_FILES} + ${QCefView_SRC_FILES} + ${QCefView_details_SRC_FILES} + ${QCefView_Windows_SRC_FILES} + ) + + target_compile_definitions(QCefView PRIVATE + UNICODE + _UNICODE + QCEFVIEW_LIB + ) + #[Edit:JackLee]mingw build + if(BUILD_STATIC) + target_link_options(QCefView + PRIVATE + "/DELAYLOAD:libcef.lib" + ) + + target_link_libraries(QCefView + PRIVATE + d3d11 + d3dcompiler + dcomp + delayimp + ) + else() + target_link_options(QCefView + PUBLIC + "/DELAYLOAD:libcef.dll" + ) + + target_link_libraries(QCefView + PUBLIC + d3d11 + d3dcompiler + dcomp + delayimp + ) + endif() + #[Edit:JackLee]mingw build + if(MSVC) + add_custom_command(TARGET QCefView + PRE_BUILD + + # copy binary files of CefViewCore + COMMAND ${CMAKE_COMMAND} + -E copy_directory + "$" + "$/CefView" + + # gnerate a file contains timestamp + COMMAND ${CMAKE_COMMAND} + -E echo "/* Auto Build Trigger */" > "${CMAKE_BINARY_DIR}/auto_rebuild.cpp" + ) + endif() +endif() # OS_WINDOWS + +if(OS_LINUX) + find_package(Qt${QT_VERSION_MAJOR}Gui ${QT_MIN_VERSION} CONFIG REQUIRED Private) + + file(GLOB_RECURSE QCefView_Linux_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/linux/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/linux/*.cpp" + ) + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/linux" + PREFIX Source + FILES ${QCefView_Linux_SRC_FILES} + ) + + add_library(QCefView ${QCEFVIEW_LIB_TYPE} + ${QCefView_INCLUDE_FILES} + ${QCefView_SRC_FILES} + ${QCefView_details_SRC_FILES} + ${QCefView_Linux_SRC_FILES} + ) + + target_compile_definitions(QCefView + PRIVATE + QCEFVIEW_LIB + ) + + set_target_properties(${PROJECT_NAME} + PROPERTIES + INSTALL_RPATH "$ORIGIN" + BUILD_WITH_INSTALL_RPATH TRUE + ) + + add_custom_command(TARGET QCefView + PRE_BUILD + + # copy binary files of CefViewCore + COMMAND ${CMAKE_COMMAND} + -E copy_directory + "$" + "$" + ) +endif() # OS_LINUX + +if(OS_MACOS) + file(GLOB_RECURSE QCefView_INCLUDE_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" + ) + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" + PREFIX Include + FILES ${QCefView_INCLUDE_HEADERS} + ) + + file(GLOB_RECURSE QCefView_macOS_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.mm" + ) + source_group( + TREE "${CMAKE_CURRENT_SOURCE_DIR}/mac" + PREFIX Source + FILES ${QCefView_macOS_SRC_FILES} + ) + set(QCefView_INFO_PLIST_FILE "${CMAKE_CURRENT_LIST_DIR}/mac/Info.plist") + + add_library(QCefView ${QCEFVIEW_LIB_TYPE} + ${QCefView_INCLUDE_FILES} + ${QCefView_SRC_FILES} + ${QCefView_details_SRC_FILES} + ${QCefView_macOS_SRC_FILES} + ${QCefView_INFO_PLIST_FILE} + ) + + find_library(METAL_FRAMEWORK Metal) + find_library(QUARTZCORE_FRAMEWORK QuartzCore) + if(BUILD_STATIC) + target_link_libraries(QCefView + PUBLIC + ${METAL_FRAMEWORK} + ${QUARTZCORE_FRAMEWORK} + ) + else() + target_link_libraries(QCefView + PRIVATE + ${METAL_FRAMEWORK} + ${QUARTZCORE_FRAMEWORK} + ) + endif() + + + set_target_properties(QCefView + PROPERTIES + FRAMEWORK TRUE + + # compiler settings + COMPILE_FLAGS "-fobjc-arc" + CLANG_ENABLE_OBJC_ARC "YES" + + # xcode settings + PUBLIC_HEADER "${QCefView_INCLUDE_HEADERS}" + MACOSX_FRAMEWORK_INFO_PLIST "${QCefView_INFO_PLIST_FILE}" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.cefview.qcefview" + XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11 + XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME "NO" # -fno-objc-link-runtime + XCODE_ATTRIBUTE_COPY_PHASE_STRIP "NO" + XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] "YES" # -Wl,-dead_strip + XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99 + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @loader_path/Frameworks" + ) + + add_custom_command(TARGET QCefView + POST_BUILD + + # create plugins directory + COMMAND mkdir -p + "$/Resources/PlugIns/" + + # copy the CefViewCore binaries to resource directory + COMMAND cp -a + "$/../" + "$/Resources/PlugIns/" + + # adjust file permission + COMMAND + cd "$/Resources/PlugIns/Chromium Embedded Framework.framework/Resources" && chmod +rw *.bin + + # sign the cef framework + COMMAND codesign + --force + --sign - + "$/Resources/PlugIns/Chromium Embedded Framework.framework" + ) +endif() # OS_MACOS + +target_compile_definitions(QCefView PRIVATE NOMINMAX) + +target_include_directories(QCefView + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/../include" + PRIVATE + ${CefViewCore_EXPORT_INCLUDE_PATH} +) + +add_dependencies(QCefView + CefViewCore::CefViewCore +) + +if(BUILD_STATIC) + target_link_libraries(QCefView + PUBLIC + CefViewCore::CefViewCore + ) +else() + target_link_libraries(QCefView + PRIVATE + CefViewCore::CefViewCore + ) +endif() + +target_link_libraries(QCefView + PUBLIC + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Widgets +) + +# install QCefView files +install( + TARGETS QCefView + ARCHIVE DESTINATION "QCefView/lib$<$:/Debug>" + LIBRARY DESTINATION "QCefView/bin$<$:/Debug>" + FRAMEWORK DESTINATION "QCefView/lib$<$:/Debug>" +) + +if(NOT OS_MACOS) + install(DIRECTORY "${CMAKE_SOURCE_DIR}/include" DESTINATION "QCefView") + install(DIRECTORY "$/" DESTINATION "QCefView/bin$<$:/Debug>") +endif() diff --git a/cef_binary/Resources/chrome_100_percent.pak b/cef_binary/Resources/chrome_100_percent.pak deleted file mode 100644 index a6bd46c..0000000 Binary files a/cef_binary/Resources/chrome_100_percent.pak and /dev/null differ diff --git a/cef_binary/Resources/chrome_200_percent.pak b/cef_binary/Resources/chrome_200_percent.pak deleted file mode 100644 index 34064bb..0000000 Binary files a/cef_binary/Resources/chrome_200_percent.pak and /dev/null differ diff --git a/cef_binary/Resources/icudtl.dat b/cef_binary/Resources/icudtl.dat deleted file mode 100644 index 331d2f3..0000000 Binary files a/cef_binary/Resources/icudtl.dat and /dev/null differ diff --git a/cef_binary/Resources/locales/af.pak b/cef_binary/Resources/locales/af.pak deleted file mode 100644 index 74644bb..0000000 Binary files a/cef_binary/Resources/locales/af.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/am.pak b/cef_binary/Resources/locales/am.pak deleted file mode 100644 index eeeca3d..0000000 Binary files a/cef_binary/Resources/locales/am.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ar.pak b/cef_binary/Resources/locales/ar.pak deleted file mode 100644 index 788d8b1..0000000 Binary files a/cef_binary/Resources/locales/ar.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/bg.pak b/cef_binary/Resources/locales/bg.pak deleted file mode 100644 index 6f9d4b0..0000000 Binary files a/cef_binary/Resources/locales/bg.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/bn.pak b/cef_binary/Resources/locales/bn.pak deleted file mode 100644 index a92bd15..0000000 Binary files a/cef_binary/Resources/locales/bn.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ca.pak b/cef_binary/Resources/locales/ca.pak deleted file mode 100644 index 1d2093e..0000000 Binary files a/cef_binary/Resources/locales/ca.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/cs.pak b/cef_binary/Resources/locales/cs.pak deleted file mode 100644 index 90b991e..0000000 Binary files a/cef_binary/Resources/locales/cs.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/da.pak b/cef_binary/Resources/locales/da.pak deleted file mode 100644 index 06421c2..0000000 Binary files a/cef_binary/Resources/locales/da.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/de.pak b/cef_binary/Resources/locales/de.pak deleted file mode 100644 index ab018dc..0000000 Binary files a/cef_binary/Resources/locales/de.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/el.pak b/cef_binary/Resources/locales/el.pak deleted file mode 100644 index 6ea9f88..0000000 Binary files a/cef_binary/Resources/locales/el.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/en-GB.pak b/cef_binary/Resources/locales/en-GB.pak deleted file mode 100644 index ec42ebf..0000000 Binary files a/cef_binary/Resources/locales/en-GB.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/en-US.pak b/cef_binary/Resources/locales/en-US.pak deleted file mode 100644 index eb68de0..0000000 Binary files a/cef_binary/Resources/locales/en-US.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/es-419.pak b/cef_binary/Resources/locales/es-419.pak deleted file mode 100644 index 27cf73b..0000000 Binary files a/cef_binary/Resources/locales/es-419.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/es.pak b/cef_binary/Resources/locales/es.pak deleted file mode 100644 index 4ae4e27..0000000 Binary files a/cef_binary/Resources/locales/es.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/et.pak b/cef_binary/Resources/locales/et.pak deleted file mode 100644 index 250718d..0000000 Binary files a/cef_binary/Resources/locales/et.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/fa.pak b/cef_binary/Resources/locales/fa.pak deleted file mode 100644 index 8f5d909..0000000 Binary files a/cef_binary/Resources/locales/fa.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/fi.pak b/cef_binary/Resources/locales/fi.pak deleted file mode 100644 index 0d792cf..0000000 Binary files a/cef_binary/Resources/locales/fi.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/fil.pak b/cef_binary/Resources/locales/fil.pak deleted file mode 100644 index 9590beb..0000000 Binary files a/cef_binary/Resources/locales/fil.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/fr.pak b/cef_binary/Resources/locales/fr.pak deleted file mode 100644 index c6960a2..0000000 Binary files a/cef_binary/Resources/locales/fr.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/gu.pak b/cef_binary/Resources/locales/gu.pak deleted file mode 100644 index 1b13501..0000000 Binary files a/cef_binary/Resources/locales/gu.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/he.pak b/cef_binary/Resources/locales/he.pak deleted file mode 100644 index bfd6541..0000000 Binary files a/cef_binary/Resources/locales/he.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/hi.pak b/cef_binary/Resources/locales/hi.pak deleted file mode 100644 index c29e85f..0000000 Binary files a/cef_binary/Resources/locales/hi.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/hr.pak b/cef_binary/Resources/locales/hr.pak deleted file mode 100644 index 90881b0..0000000 Binary files a/cef_binary/Resources/locales/hr.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/hu.pak b/cef_binary/Resources/locales/hu.pak deleted file mode 100644 index 74c0bd6..0000000 Binary files a/cef_binary/Resources/locales/hu.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/id.pak b/cef_binary/Resources/locales/id.pak deleted file mode 100644 index b23c427..0000000 Binary files a/cef_binary/Resources/locales/id.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/it.pak b/cef_binary/Resources/locales/it.pak deleted file mode 100644 index 896a808..0000000 Binary files a/cef_binary/Resources/locales/it.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ja.pak b/cef_binary/Resources/locales/ja.pak deleted file mode 100644 index 7d107d7..0000000 Binary files a/cef_binary/Resources/locales/ja.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/kn.pak b/cef_binary/Resources/locales/kn.pak deleted file mode 100644 index 613930e..0000000 Binary files a/cef_binary/Resources/locales/kn.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ko.pak b/cef_binary/Resources/locales/ko.pak deleted file mode 100644 index 58bc4e4..0000000 Binary files a/cef_binary/Resources/locales/ko.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/lt.pak b/cef_binary/Resources/locales/lt.pak deleted file mode 100644 index a7c987c..0000000 Binary files a/cef_binary/Resources/locales/lt.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/lv.pak b/cef_binary/Resources/locales/lv.pak deleted file mode 100644 index bafde60..0000000 Binary files a/cef_binary/Resources/locales/lv.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ml.pak b/cef_binary/Resources/locales/ml.pak deleted file mode 100644 index b315970..0000000 Binary files a/cef_binary/Resources/locales/ml.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/mr.pak b/cef_binary/Resources/locales/mr.pak deleted file mode 100644 index e209f73..0000000 Binary files a/cef_binary/Resources/locales/mr.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ms.pak b/cef_binary/Resources/locales/ms.pak deleted file mode 100644 index 2e69bf4..0000000 Binary files a/cef_binary/Resources/locales/ms.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/nb.pak b/cef_binary/Resources/locales/nb.pak deleted file mode 100644 index cd1c003..0000000 Binary files a/cef_binary/Resources/locales/nb.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/nl.pak b/cef_binary/Resources/locales/nl.pak deleted file mode 100644 index b576d18..0000000 Binary files a/cef_binary/Resources/locales/nl.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/pl.pak b/cef_binary/Resources/locales/pl.pak deleted file mode 100644 index 0458a39..0000000 Binary files a/cef_binary/Resources/locales/pl.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/pt-BR.pak b/cef_binary/Resources/locales/pt-BR.pak deleted file mode 100644 index 32713a1..0000000 Binary files a/cef_binary/Resources/locales/pt-BR.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/pt-PT.pak b/cef_binary/Resources/locales/pt-PT.pak deleted file mode 100644 index 6bc548d..0000000 Binary files a/cef_binary/Resources/locales/pt-PT.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ro.pak b/cef_binary/Resources/locales/ro.pak deleted file mode 100644 index 776ab0d..0000000 Binary files a/cef_binary/Resources/locales/ro.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ru.pak b/cef_binary/Resources/locales/ru.pak deleted file mode 100644 index e13c32b..0000000 Binary files a/cef_binary/Resources/locales/ru.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/sk.pak b/cef_binary/Resources/locales/sk.pak deleted file mode 100644 index 0465e67..0000000 Binary files a/cef_binary/Resources/locales/sk.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/sl.pak b/cef_binary/Resources/locales/sl.pak deleted file mode 100644 index 7b8c14a..0000000 Binary files a/cef_binary/Resources/locales/sl.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/sr.pak b/cef_binary/Resources/locales/sr.pak deleted file mode 100644 index 91d66ec..0000000 Binary files a/cef_binary/Resources/locales/sr.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/sv.pak b/cef_binary/Resources/locales/sv.pak deleted file mode 100644 index f37d327..0000000 Binary files a/cef_binary/Resources/locales/sv.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/sw.pak b/cef_binary/Resources/locales/sw.pak deleted file mode 100644 index 440b110..0000000 Binary files a/cef_binary/Resources/locales/sw.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ta.pak b/cef_binary/Resources/locales/ta.pak deleted file mode 100644 index 06bd8c3..0000000 Binary files a/cef_binary/Resources/locales/ta.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/te.pak b/cef_binary/Resources/locales/te.pak deleted file mode 100644 index 989ef93..0000000 Binary files a/cef_binary/Resources/locales/te.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/th.pak b/cef_binary/Resources/locales/th.pak deleted file mode 100644 index 8f24337..0000000 Binary files a/cef_binary/Resources/locales/th.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/tr.pak b/cef_binary/Resources/locales/tr.pak deleted file mode 100644 index 5fc6ba1..0000000 Binary files a/cef_binary/Resources/locales/tr.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/uk.pak b/cef_binary/Resources/locales/uk.pak deleted file mode 100644 index 091a47c..0000000 Binary files a/cef_binary/Resources/locales/uk.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/ur.pak b/cef_binary/Resources/locales/ur.pak deleted file mode 100644 index 739147c..0000000 Binary files a/cef_binary/Resources/locales/ur.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/vi.pak b/cef_binary/Resources/locales/vi.pak deleted file mode 100644 index 9fdf7e1..0000000 Binary files a/cef_binary/Resources/locales/vi.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/zh-CN.pak b/cef_binary/Resources/locales/zh-CN.pak deleted file mode 100644 index 183af1f..0000000 Binary files a/cef_binary/Resources/locales/zh-CN.pak and /dev/null differ diff --git a/cef_binary/Resources/locales/zh-TW.pak b/cef_binary/Resources/locales/zh-TW.pak deleted file mode 100644 index 5339e58..0000000 Binary files a/cef_binary/Resources/locales/zh-TW.pak and /dev/null differ diff --git a/cef_binary/Resources/resources.pak b/cef_binary/Resources/resources.pak deleted file mode 100644 index 03463a3..0000000 Binary files a/cef_binary/Resources/resources.pak and /dev/null differ