mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
macOS: Create multiple Helper app bundles (fixes issue #2737)
This commit is contained in:
80
BUILD.gn
80
BUILD.gn
@@ -100,6 +100,7 @@ import("//build/config/sanitizers/sanitizers.gni")
|
|||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//cef/cef_repack_locales.gni")
|
import("//cef/cef_repack_locales.gni")
|
||||||
import("//chrome/common/features.gni")
|
import("//chrome/common/features.gni")
|
||||||
|
import("//content/public/app/mac_helpers.gni")
|
||||||
import("//extensions/buildflags/buildflags.gni")
|
import("//extensions/buildflags/buildflags.gni")
|
||||||
import("//media/media_options.gni")
|
import("//media/media_options.gni")
|
||||||
import("//mojo/public/tools/bindings/mojom.gni")
|
import("//mojo/public/tools/bindings/mojom.gni")
|
||||||
@@ -1703,32 +1704,60 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
mac_app_bundle("${app_name}_helper_app") {
|
template("cef_helper_app") {
|
||||||
testonly = app_testonly
|
mac_app_bundle(target_name) {
|
||||||
output_name = app_helper_name
|
assert(defined(invoker.helper_sources))
|
||||||
|
assert(defined(invoker.helper_name_suffix))
|
||||||
|
assert(defined(invoker.helper_bundle_id_suffix))
|
||||||
|
|
||||||
sources = invoker.helper_sources
|
testonly = app_testonly
|
||||||
|
output_name = app_helper_name + invoker.helper_name_suffix
|
||||||
|
|
||||||
deps = [
|
sources = invoker.helper_sources
|
||||||
":cef_make_headers",
|
|
||||||
":cef_sandbox",
|
extra_substitutions = [
|
||||||
":libcef_dll_wrapper",
|
"BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
|
||||||
]
|
]
|
||||||
if (defined(invoker.helper_deps)) {
|
|
||||||
deps += invoker.helper_deps
|
deps = [
|
||||||
|
":cef_make_headers",
|
||||||
|
":cef_sandbox",
|
||||||
|
":libcef_dll_wrapper",
|
||||||
|
]
|
||||||
|
if (defined(invoker.helper_deps)) {
|
||||||
|
deps += invoker.helper_deps
|
||||||
|
}
|
||||||
|
|
||||||
|
ldflags = [
|
||||||
|
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
||||||
|
# so set rpath up to the base.
|
||||||
|
"-rpath",
|
||||||
|
"@executable_path/../../../../../..",
|
||||||
|
]
|
||||||
|
|
||||||
|
info_plist_target = ":${app_name}_helper_plist"
|
||||||
|
|
||||||
|
if (defined(invoker.helper_defines)) {
|
||||||
|
defines = invoker.helper_defines
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ldflags = [
|
foreach(helper_params, content_mac_helpers) {
|
||||||
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
|
_helper_target = helper_params[0]
|
||||||
# so set rpath up to the base.
|
_helper_bundle_id = helper_params[1]
|
||||||
"-rpath",
|
_helper_suffix = helper_params[2]
|
||||||
"@executable_path/../../../../../..",
|
cef_helper_app("${app_name}_helper_app_${_helper_target}") {
|
||||||
]
|
helper_sources = invoker.helper_sources
|
||||||
|
if (defined(invoker.helper_deps)) {
|
||||||
|
helper_deps = invoker.helper_deps
|
||||||
|
}
|
||||||
|
if (defined(invoker.helper_defines)) {
|
||||||
|
helper_defines = invoker.helper_defines
|
||||||
|
}
|
||||||
|
|
||||||
info_plist_target = ":${app_name}_helper_plist"
|
helper_name_suffix = _helper_suffix
|
||||||
|
helper_bundle_id_suffix = _helper_bundle_id
|
||||||
if (defined(invoker.helper_defines)) {
|
|
||||||
defines = invoker.helper_defines
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1736,14 +1765,19 @@ if (is_mac) {
|
|||||||
testonly = app_testonly
|
testonly = app_testonly
|
||||||
sources = [
|
sources = [
|
||||||
"$root_out_dir/$cef_framework_name.framework",
|
"$root_out_dir/$cef_framework_name.framework",
|
||||||
"$root_out_dir/$app_helper_name.app",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":cef_framework",
|
":cef_framework",
|
||||||
":${app_name}_helper_app",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
foreach(helper_params, content_mac_helpers) {
|
||||||
|
sources += [
|
||||||
|
"$root_out_dir/${app_helper_name}${helper_params[2]}.app",
|
||||||
|
]
|
||||||
|
public_deps += [ ":${app_name}_helper_app_${helper_params[0]}" ]
|
||||||
|
}
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
"{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
|
"{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
|
||||||
]
|
]
|
||||||
|
@@ -346,6 +346,15 @@ if(OS_MACOSX)
|
|||||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
|
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
|
||||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
|
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# CEF Helper app suffixes.
|
||||||
|
# Format is "<name suffix>:<target suffix>:<plist suffix>".
|
||||||
|
set(CEF_HELPER_APP_SUFFIXES
|
||||||
|
"::"
|
||||||
|
" (GPU):_gpu:.gpu"
|
||||||
|
" (Plugin):_plugin:.plugin"
|
||||||
|
" (Renderer):_renderer:.renderer"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -179,53 +179,88 @@ if(OS_MACOSX)
|
|||||||
${CEFCLIENT_MACOSX_HELPER_SRCS}
|
${CEFCLIENT_MACOSX_HELPER_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Output paths for the app bundles.
|
# Output path for the main app bundle.
|
||||||
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
||||||
set(CEF_HELPER_APP "${CEF_TARGET_OUT_DIR}/${CEF_HELPER_OUTPUT_NAME}.app")
|
|
||||||
|
|
||||||
# Variable referenced from Info.plist files.
|
# Variables referenced from the main Info.plist file.
|
||||||
|
set(EXECUTABLE_NAME "${CEF_TARGET}")
|
||||||
set(PRODUCT_NAME "${CEF_TARGET}")
|
set(PRODUCT_NAME "${CEF_TARGET}")
|
||||||
|
|
||||||
# Helper executable target.
|
|
||||||
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFCLIENT_HELPER_SRCS})
|
|
||||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
|
|
||||||
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
|
|
||||||
target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
|
||||||
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
|
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist
|
|
||||||
OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(USE_SANDBOX)
|
if(USE_SANDBOX)
|
||||||
# Logical target used to link the cef_sandbox library.
|
# Logical target used to link the cef_sandbox library.
|
||||||
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
|
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
|
||||||
target_link_libraries(${CEF_HELPER_TARGET} cef_sandbox_lib)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Main executable target.
|
# Main app bundle target.
|
||||||
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS})
|
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS})
|
||||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
||||||
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
|
||||||
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL")
|
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL")
|
||||||
set_target_properties(${CEF_TARGET} PROPERTIES
|
set_target_properties(${CEF_TARGET} PROPERTIES
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
|
||||||
)
|
)
|
||||||
|
|
||||||
# Copy files into the main app bundle.
|
# Copy the CEF framework into the Frameworks directory.
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${CEF_TARGET}
|
TARGET ${CEF_TARGET}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
# Copy the helper app bundle into the Frameworks directory.
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
||||||
"${CEF_HELPER_APP}"
|
|
||||||
"${CEF_APP}/Contents/Frameworks/${CEF_HELPER_OUTPUT_NAME}.app"
|
|
||||||
# Copy the CEF framework into the Frameworks directory.
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
|
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
|
||||||
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
|
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
|
||||||
VERBATIM
|
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}/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 ${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.
|
# Manually process and copy over resource files.
|
||||||
# The Xcode generator can support this via the set_target_properties RESOURCE
|
# The Xcode generator can support this via the set_target_properties RESOURCE
|
||||||
# directive but that doesn't properly handle nested resource directories.
|
# directive but that doesn't properly handle nested resource directories.
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>${EXECUTABLE_NAME}</string>
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>org.cef.cefclient.helper</string>
|
<string>org.cef.cefclient.helper${BUNDLE_ID_SUFFIX}</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
|
@@ -97,53 +97,88 @@ if(OS_MACOSX)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Output paths for the app bundles.
|
# Output path for the main app bundle.
|
||||||
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
||||||
set(CEF_HELPER_APP "${CEF_TARGET_OUT_DIR}/${CEF_HELPER_OUTPUT_NAME}.app")
|
|
||||||
|
|
||||||
# Variable referenced from Info.plist files.
|
# Variables referenced from the main Info.plist file.
|
||||||
|
set(EXECUTABLE_NAME "${CEF_TARGET}")
|
||||||
set(PRODUCT_NAME "${CEF_TARGET}")
|
set(PRODUCT_NAME "${CEF_TARGET}")
|
||||||
|
|
||||||
# Helper executable target.
|
|
||||||
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_HELPER_SRCS})
|
|
||||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
|
|
||||||
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
|
|
||||||
target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
|
||||||
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
|
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist
|
|
||||||
OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(USE_SANDBOX)
|
if(USE_SANDBOX)
|
||||||
# Logical target used to link the cef_sandbox library.
|
# Logical target used to link the cef_sandbox library.
|
||||||
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
|
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
|
||||||
target_link_libraries(${CEF_HELPER_TARGET} cef_sandbox_lib)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Main executable target.
|
# Main app bundle target.
|
||||||
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS})
|
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS})
|
||||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
||||||
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
|
||||||
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
||||||
set_target_properties(${CEF_TARGET} PROPERTIES
|
set_target_properties(${CEF_TARGET} PROPERTIES
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist
|
||||||
)
|
)
|
||||||
|
|
||||||
# Copy files into the main app bundle.
|
# Copy the CEF framework into the Frameworks directory.
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${CEF_TARGET}
|
TARGET ${CEF_TARGET}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
# Copy the helper app bundle into the Frameworks directory.
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
||||||
"${CEF_HELPER_APP}"
|
|
||||||
"${CEF_APP}/Contents/Frameworks/${CEF_HELPER_OUTPUT_NAME}.app"
|
|
||||||
# Copy the CEF framework into the Frameworks directory.
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
|
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
|
||||||
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
|
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
|
||||||
VERBATIM
|
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" _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 ${CEFSIMPLE_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.
|
# Manually process and copy over resource files.
|
||||||
# The Xcode generator can support this via the set_target_properties RESOURCE
|
# The Xcode generator can support this via the set_target_properties RESOURCE
|
||||||
# directive but that doesn't properly handle nested resource directories.
|
# directive but that doesn't properly handle nested resource directories.
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>${EXECUTABLE_NAME}</string>
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>org.cef.cefsimple.helper</string>
|
<string>org.cef.cefsimple.helper${BUNDLE_ID_SUFFIX}</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
|
@@ -104,53 +104,88 @@ endif()
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(OS_MACOSX)
|
if(OS_MACOSX)
|
||||||
# Output paths for the app bundles.
|
# Output path for the main app bundle.
|
||||||
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
||||||
set(CEF_HELPER_APP "${CEF_TARGET_OUT_DIR}/${CEF_HELPER_OUTPUT_NAME}.app")
|
|
||||||
|
|
||||||
# Variable referenced from Info.plist files.
|
# Variables referenced from the main Info.plist file.
|
||||||
|
set(EXECUTABLE_NAME "${CEF_TARGET}")
|
||||||
set(PRODUCT_NAME "${CEF_TARGET}")
|
set(PRODUCT_NAME "${CEF_TARGET}")
|
||||||
|
|
||||||
# Helper executable target.
|
|
||||||
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${UNITTESTS_HELPER_SRCS})
|
|
||||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
|
|
||||||
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper cef_gtest)
|
|
||||||
target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS})
|
|
||||||
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
|
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist
|
|
||||||
OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(USE_SANDBOX)
|
if(USE_SANDBOX)
|
||||||
# Logical target used to link the cef_sandbox library.
|
# Logical target used to link the cef_sandbox library.
|
||||||
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
|
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
|
||||||
target_link_libraries(${CEF_HELPER_TARGET} cef_sandbox_lib)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Main executable target.
|
# Main app bundle target.
|
||||||
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${UNITTESTS_RESOURCES_SRCS} ${UNITTESTS_SRCS})
|
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${UNITTESTS_RESOURCES_SRCS} ${UNITTESTS_SRCS})
|
||||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
||||||
add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest "${CEF_HELPER_TARGET}")
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest)
|
||||||
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS})
|
target_link_libraries(${CEF_TARGET} libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS})
|
||||||
set_target_properties(${CEF_TARGET} PROPERTIES
|
set_target_properties(${CEF_TARGET} PROPERTIES
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
|
||||||
)
|
)
|
||||||
|
|
||||||
# Copy files into the main app bundle.
|
# Copy the CEF framework into the Frameworks directory.
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${CEF_TARGET}
|
TARGET ${CEF_TARGET}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
# Copy the helper app bundle into the Frameworks directory.
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
||||||
"${CEF_HELPER_APP}"
|
|
||||||
"${CEF_APP}/Contents/Frameworks/${CEF_HELPER_OUTPUT_NAME}.app"
|
|
||||||
# Copy the CEF framework into the Frameworks directory.
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
|
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
|
||||||
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
|
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
|
||||||
VERBATIM
|
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}/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()
|
||||||
|
|
||||||
# Manually process and copy over resource files.
|
# Manually process and copy over resource files.
|
||||||
# The Xcode generator can support this via the set_target_properties RESOURCE
|
# The Xcode generator can support this via the set_target_properties RESOURCE
|
||||||
# directive but that doesn't properly handle nested resource directories.
|
# directive but that doesn't properly handle nested resource directories.
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>${EXECUTABLE_NAME}</string>
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>org.cef.ceftests.helper</string>
|
<string>org.cef.ceftests.helper${BUNDLE_ID_SUFFIX}</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
|
Reference in New Issue
Block a user