2016-11-18 00:52:42 +01:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2016-11-18 18:31:21 +01:00
|
|
|
# ceftests sources.
|
2016-11-18 00:52:42 +01:00
|
|
|
{{
|
2016-11-18 18:31:21 +01:00
|
|
|
'prefix': 'ceftests',
|
2016-11-18 00:52:42 +01:00
|
|
|
'set': 'UNITTESTS_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'shared_sources_browser',
|
|
|
|
'shared_sources_common',
|
|
|
|
'shared_sources_linux:LINUX',
|
2020-08-29 00:39:23 +02:00
|
|
|
'shared_sources_mac:MAC',
|
2016-11-18 00:52:42 +01:00
|
|
|
'shared_sources_renderer:WINDOWS',
|
|
|
|
'shared_sources_renderer:LINUX',
|
|
|
|
'shared_sources_win:WINDOWS',
|
2016-11-18 18:31:21 +01:00
|
|
|
'ceftests_sources_common',
|
|
|
|
'ceftests_sources_linux:LINUX',
|
2020-08-29 00:39:23 +02:00
|
|
|
'ceftests_sources_mac:MAC',
|
2016-11-18 18:31:21 +01:00
|
|
|
'ceftests_sources_win:WINDOWS',
|
2016-11-18 00:52:42 +01:00
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
2016-11-18 18:31:21 +01:00
|
|
|
# ceftests helper sources.
|
2016-11-18 00:52:42 +01:00
|
|
|
{{
|
2016-11-18 18:31:21 +01:00
|
|
|
'prefix': 'ceftests_helper',
|
2016-11-18 00:52:42 +01:00
|
|
|
'set': 'UNITTESTS_HELPER_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'shared_sources_common',
|
2020-08-29 00:39:23 +02:00
|
|
|
'shared_sources_mac_helper:MAC',
|
2016-11-18 00:52:42 +01:00
|
|
|
'shared_sources_renderer',
|
2020-08-29 00:39:23 +02:00
|
|
|
'ceftests_sources_mac_helper:MAC',
|
2016-11-18 00:52:42 +01:00
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
2016-11-18 18:31:21 +01:00
|
|
|
# ceftests resources.
|
2016-11-18 00:52:42 +01:00
|
|
|
{{
|
2016-11-18 18:31:21 +01:00
|
|
|
'prefix': 'ceftests_resources',
|
2016-11-18 00:52:42 +01:00
|
|
|
'set': 'UNITTESTS_RESOURCES_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'shared_sources_resources',
|
2020-08-29 00:39:23 +02:00
|
|
|
'ceftests_bundle_resources_mac:MAC',
|
2016-11-18 00:52:42 +01:00
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
2022-08-03 02:51:02 +02:00
|
|
|
# ceftests data resources.
|
|
|
|
{{
|
|
|
|
'prefix': 'ceftests_data_resources',
|
|
|
|
'set': 'UNITTESTS_DATA_RESOURCES_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'ceftests_data_resources',
|
|
|
|
],
|
|
|
|
}}
|
2016-11-18 00:52:42 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Shared configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Target executable names.
|
2016-11-18 18:31:21 +01:00
|
|
|
set(CEF_TARGET "ceftests")
|
2020-08-29 00:39:23 +02:00
|
|
|
if(OS_MAC)
|
2018-01-03 21:03:15 +01:00
|
|
|
set(CEF_HELPER_TARGET "ceftests_Helper")
|
|
|
|
set(CEF_HELPER_OUTPUT_NAME "ceftests Helper")
|
2018-07-27 17:39:53 +02:00
|
|
|
else()
|
|
|
|
# Logical target used to link the libcef library.
|
|
|
|
ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
2016-11-18 00:52:42 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Determine the target output directory.
|
|
|
|
SET_CEF_TARGET_OUT_DIR()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Linux configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
if(OS_LINUX)
|
|
|
|
# Find required libraries and update compiler/linker variables.
|
|
|
|
FIND_LINUX_LIBRARIES("glib-2.0")
|
|
|
|
|
|
|
|
# Executable target.
|
|
|
|
add_executable(${CEF_TARGET} ${UNITTESTS_SRCS} ${UNITTESTS_RESOURCES_SRCS})
|
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
|
|
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest)
|
|
|
|
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper cef_gtest ${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})
|
|
|
|
|
|
|
|
# Copy 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}")
|
|
|
|
|
2016-11-18 18:31:21 +01:00
|
|
|
# Copy ceftests resource files to the target output directory.
|
|
|
|
COPY_FILES("${CEF_TARGET}" "${UNITTESTS_RESOURCES_SRCS}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET_OUT_DIR}/ceftests_files")
|
2016-11-18 00:52:42 +01:00
|
|
|
|
2022-08-03 02:51:02 +02:00
|
|
|
# Copy ceftests data resource files to the target output directory.
|
|
|
|
# Remove these prefixes from input file paths.
|
|
|
|
set(PREFIXES
|
|
|
|
"resources/"
|
|
|
|
)
|
|
|
|
COPY_RESOURCES("${CEF_TARGET}" "${UNITTESTS_DATA_RESOURCES_SRCS}" "${PREFIXES}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET_OUT_DIR}/ceftests_files")
|
|
|
|
|
2016-11-18 00:52:42 +01:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2020-08-29 00:39:23 +02:00
|
|
|
if(OS_MAC)
|
2023-08-09 23:17:17 +02:00
|
|
|
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()
|
|
|
|
|
2019-09-04 17:13:32 +02:00
|
|
|
# Output path for the main app bundle.
|
2016-11-18 00:52:42 +01:00
|
|
|
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
|
|
|
|
2019-09-04 17:13:32 +02:00
|
|
|
# Variables referenced from the main Info.plist file.
|
|
|
|
set(EXECUTABLE_NAME "${CEF_TARGET}")
|
2016-11-18 00:52:42 +01:00
|
|
|
set(PRODUCT_NAME "${CEF_TARGET}")
|
|
|
|
|
2018-07-27 23:28:12 +02:00
|
|
|
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()
|
|
|
|
|
2019-09-04 17:13:32 +02:00
|
|
|
# Main app bundle target.
|
2016-11-18 00:52:42 +01:00
|
|
|
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${UNITTESTS_RESOURCES_SRCS} ${UNITTESTS_SRCS})
|
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
2019-09-04 17:13:32 +02:00
|
|
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest)
|
2018-07-27 17:39:53 +02:00
|
|
|
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS})
|
2016-11-18 00:52:42 +01:00
|
|
|
set_target_properties(${CEF_TARGET} PROPERTIES
|
|
|
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
|
|
|
|
)
|
|
|
|
|
2019-09-04 17:13:32 +02:00
|
|
|
# Copy the CEF framework into the Frameworks directory.
|
2016-11-18 00:52:42 +01:00
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2019-09-04 17:13:32 +02:00
|
|
|
# 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}/resources/mac/helper-Info.plist" _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 ${UNITTESTS_HELPER_SRCS})
|
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${_helper_target})
|
|
|
|
add_dependencies(${_helper_target} libcef_dll_wrapper cef_gtest)
|
|
|
|
target_link_libraries(${_helper_target} libcef_dll_wrapper cef_gtest ${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()
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
# 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
|
|
|
|
"resources/mac/"
|
2022-08-03 02:51:02 +02:00
|
|
|
"resources/"
|
2017-08-04 00:55:19 +02:00
|
|
|
"../shared/resources/"
|
|
|
|
)
|
2022-08-03 02:51:02 +02:00
|
|
|
set(RESOURCES ${UNITTESTS_RESOURCES_SRCS} ${UNITTESTS_DATA_RESOURCES_SRCS})
|
|
|
|
COPY_MAC_RESOURCES("${RESOURCES}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}")
|
2016-11-18 00:52:42 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Windows configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
if(OS_WINDOWS)
|
|
|
|
# Executable target.
|
|
|
|
add_executable(${CEF_TARGET} WIN32 ${UNITTESTS_SRCS} ${UNITTESTS_RESOURCES_SRCS})
|
|
|
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest)
|
|
|
|
|
|
|
|
list(APPEND CEF_EXE_LINKER_FLAGS
|
|
|
|
/SUBSYSTEM:CONSOLE # Configure as a console application.
|
|
|
|
)
|
|
|
|
|
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
|
|
|
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS})
|
|
|
|
|
|
|
|
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}/resources/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}")
|
|
|
|
|
2022-08-03 02:51:02 +02:00
|
|
|
# Copy ceftests data resource files to the target output directory.
|
|
|
|
# Remove these prefixes from input file paths.
|
|
|
|
set(PREFIXES
|
|
|
|
"resources/"
|
|
|
|
)
|
|
|
|
COPY_RESOURCES("${CEF_TARGET}" "${UNITTESTS_DATA_RESOURCES_SRCS}" "${PREFIXES}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET_OUT_DIR}/ceftests_files")
|
|
|
|
endif()
|