2014-12-13 21:18:31 +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.
|
|
|
|
#
|
|
|
|
|
2015-02-02 23:29:50 +01:00
|
|
|
# cefclient browser sources.
|
2014-12-13 21:18:31 +01:00
|
|
|
{{
|
2015-02-02 23:29:50 +01:00
|
|
|
'prefix': 'cefclient_browser',
|
|
|
|
'set': 'CEFCLIENT_BROWSER_SRCS',
|
2014-12-13 21:18:31 +01:00
|
|
|
'includes': [
|
2015-01-31 01:55:56 +01:00
|
|
|
'cefclient_sources_browser',
|
2015-02-02 23:29:50 +01:00
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
|
|
|
# cefclient common sources.
|
|
|
|
{{
|
|
|
|
'prefix': 'cefclient_common',
|
|
|
|
'set': 'CEFCLIENT_COMMON_SRCS',
|
|
|
|
'includes': [
|
2014-12-13 21:18:31 +01:00
|
|
|
'cefclient_sources_common',
|
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
2015-02-02 23:29:50 +01:00
|
|
|
# cefclient renderer sources.
|
|
|
|
{{
|
|
|
|
'prefix': 'cefclient_renderer',
|
|
|
|
'set': 'CEFCLIENT_RENDERER_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'cefclient_sources_renderer',
|
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
|
|
|
#cefclient Linux sources
|
|
|
|
{{
|
|
|
|
'prefix': 'cefclient_linux',
|
|
|
|
'set': 'CEFCLIENT_LINUX_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'cefclient_sources_linux',
|
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
|
|
|
#cefclient Mac OS X sources
|
|
|
|
{{
|
|
|
|
'prefix': 'cefclient_macosx',
|
|
|
|
'set': 'CEFCLIENT_MACOSX_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'cefclient_sources_mac',
|
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
|
|
|
# cefclient Mac OS X helper sources.
|
2014-12-13 21:18:31 +01:00
|
|
|
{{
|
|
|
|
'prefix': 'cefclient_helper',
|
2015-02-02 23:29:50 +01:00
|
|
|
'set': 'CEFCLIENT_MACOSX_HELPER_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'cefclient_sources_mac_helper',
|
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
|
|
|
#cefclient Windows sources
|
|
|
|
{{
|
|
|
|
'prefix': 'cefclient_windows',
|
|
|
|
'set': 'CEFCLIENT_WINDOWS_SRCS',
|
2014-12-13 21:18:31 +01:00
|
|
|
'includes': [
|
2015-02-02 23:29:50 +01:00
|
|
|
'cefclient_sources_win',
|
2014-12-13 21:18:31 +01:00
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
|
|
|
# cefclient resources.
|
|
|
|
{{
|
|
|
|
'prefix': 'cefclient_resources',
|
|
|
|
'set': 'CEFCLIENT_RESOURCES_SRCS',
|
|
|
|
'includes': [
|
|
|
|
'cefclient_bundle_resources_mac:MACOSX',
|
2015-01-31 01:55:56 +01:00
|
|
|
'cefclient_sources_resources',
|
2014-12-13 21:18:31 +01:00
|
|
|
],
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Shared configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Target executable names.
|
|
|
|
set(CEF_TARGET "cefclient")
|
|
|
|
if(OS_MACOSX)
|
|
|
|
set(CEF_HELPER_TARGET "cefclient Helper")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Logical target used to link the libcef library.
|
|
|
|
ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
|
|
|
|
|
|
|
# Determine the target output directory.
|
|
|
|
SET_CEF_TARGET_OUT_DIR()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Linux configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
if(OS_LINUX)
|
2015-02-02 23:29:50 +01:00
|
|
|
# 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}
|
|
|
|
)
|
|
|
|
|
2014-12-13 21:18:31 +01:00
|
|
|
# Find required libraries and update compiler/linker variables.
|
|
|
|
FIND_LINUX_LIBRARIES("gmodule-2.0 gtk+-2.0 gthread-2.0 gtk+-unix-print-2.0 gtkglext-1.0")
|
|
|
|
|
|
|
|
# Executable target.
|
|
|
|
add_executable(${CEF_TARGET} ${CEFCLIENT_SRCS})
|
2016-05-12 23:41:30 +02:00
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
2014-12-13 21:18:31 +01:00
|
|
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
|
|
|
|
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${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 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}")
|
|
|
|
# Rename the "res" directory to "files".
|
2015-01-30 21:22:46 +01:00
|
|
|
RENAME_DIRECTORY("${CEF_TARGET}" "${CEF_TARGET_OUT_DIR}/resources" "${CEF_TARGET_OUT_DIR}/files")
|
2014-12-13 21:18:31 +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.
|
|
|
|
#
|
|
|
|
|
|
|
|
if(OS_MACOSX)
|
2015-02-02 23:29:50 +01:00
|
|
|
# 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_MACOSX_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_MACOSX_HELPER_SRCS}
|
|
|
|
)
|
|
|
|
|
2014-12-13 21:18:31 +01:00
|
|
|
# Output paths for the app bundles.
|
|
|
|
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
|
|
|
|
set(CEF_HELPER_APP "${CEF_TARGET_OUT_DIR}/${CEF_HELPER_TARGET}.app")
|
|
|
|
|
|
|
|
# Variable referenced from Info.plist files.
|
|
|
|
set(PRODUCT_NAME "${CEF_TARGET}")
|
|
|
|
|
|
|
|
# Helper executable target.
|
|
|
|
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFCLIENT_HELPER_SRCS})
|
2016-05-12 23:41:30 +02:00
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
|
2014-12-13 21:18:31 +01:00
|
|
|
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
|
|
|
|
target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
|
|
|
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
|
2015-01-30 21:55:28 +01:00
|
|
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist
|
2014-12-13 21:18:31 +01:00
|
|
|
)
|
|
|
|
|
2016-09-02 15:59:39 +02:00
|
|
|
# Fix the framework rpath in the helper executable.
|
|
|
|
FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET})
|
2014-12-13 21:18:31 +01:00
|
|
|
|
|
|
|
# Main executable target.
|
|
|
|
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS})
|
2016-05-12 23:41:30 +02:00
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
2014-12-13 21:18:31 +01:00
|
|
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
|
|
|
|
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL")
|
|
|
|
set_target_properties(${CEF_TARGET} PROPERTIES
|
|
|
|
RESOURCE "${CEFCLIENT_RESOURCES_SRCS}"
|
2015-01-30 21:55:28 +01:00
|
|
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
|
2014-12-13 21:18:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
# Copy files into the main app bundle.
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${CEF_TARGET}
|
|
|
|
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_TARGET}.app"
|
|
|
|
# Copy the CEF framework into the Frameworks directory.
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
|
|
|
|
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
|
2016-09-02 15:59:39 +02:00
|
|
|
# Fix the framework rpath in the main executable.
|
|
|
|
FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET})
|
2014-12-13 21:18:31 +01:00
|
|
|
|
|
|
|
if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode")
|
|
|
|
# Manually process and copy over resource files.
|
|
|
|
# The Xcode generator handles this via the set_target_properties RESOURCE directive.
|
2015-01-30 21:55:28 +01:00
|
|
|
set(PREFIXES "resources/mac/" "resources/") # Remove these prefixes from input file paths.
|
2014-12-13 21:18:31 +01:00
|
|
|
COPY_MACOSX_RESOURCES("${CEFCLIENT_RESOURCES_SRCS}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Windows configuration.
|
|
|
|
#
|
|
|
|
|
|
|
|
if(OS_WINDOWS)
|
2015-02-02 23:29:50 +01:00
|
|
|
# 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}
|
|
|
|
)
|
|
|
|
|
2014-12-13 21:18:31 +01:00
|
|
|
# Executable target.
|
|
|
|
add_executable(${CEF_TARGET} WIN32 ${CEFCLIENT_SRCS})
|
2016-05-12 23:41:30 +02:00
|
|
|
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
|
2014-12-13 21:18:31 +01:00
|
|
|
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
|
2016-05-12 23:41:30 +02:00
|
|
|
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} glu32.lib opengl32.lib)
|
2014-12-13 21:18:31 +01: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}")
|
|
|
|
target_link_libraries(${CEF_TARGET} cef_sandbox_lib ${CEF_SANDBOX_STANDARD_LIBS})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Add the custom manifest files to the executable.
|
2016-06-15 00:28:00 +02:00
|
|
|
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}" "exe")
|
2014-12-13 21:18:31 +01:00
|
|
|
|
|
|
|
# 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()
|