# 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. # # ceftests sources. {{ 'prefix': 'ceftests', 'set': 'UNITTESTS_SRCS', 'includes': [ 'shared_sources_browser', 'shared_sources_common', 'shared_sources_linux:LINUX', 'shared_sources_mac:MACOSX', 'shared_sources_renderer:WINDOWS', 'shared_sources_renderer:LINUX', 'shared_sources_win:WINDOWS', 'ceftests_sources_common', 'ceftests_sources_linux:LINUX', 'ceftests_sources_mac:MACOSX', 'ceftests_sources_views:WINDOWS', 'ceftests_sources_views:LINUX', 'ceftests_sources_win:WINDOWS', ], }} # ceftests helper sources. {{ 'prefix': 'ceftests_helper', 'set': 'UNITTESTS_HELPER_SRCS', 'includes': [ 'shared_sources_common', 'shared_sources_mac_helper:MACOSX', 'shared_sources_renderer', 'ceftests_sources_mac_helper:MACOSX', ], }} # ceftests resources. {{ 'prefix': 'ceftests_resources', 'set': 'UNITTESTS_RESOURCES_SRCS', 'includes': [ 'shared_sources_resources', 'ceftests_bundle_resources_mac:MACOSX', ], }} # # Shared configuration. # # Target executable names. set(CEF_TARGET "ceftests") if(OS_MACOSX) set(CEF_HELPER_TARGET "ceftests 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) # 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}") # 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") # 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) # 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 ${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_lib 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 ) # Fix the framework rpath in the helper executable. FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET}) # Main executable target. add_executable(${CEF_TARGET} MACOSX_BUNDLE ${UNITTESTS_RESOURCES_SRCS} ${UNITTESTS_SRCS}) SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest "${CEF_HELPER_TARGET}") target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS}) set_target_properties(${CEF_TARGET} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist ) # 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 ) # Fix the framework rpath in the main executable. FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET}) # 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/" "../shared/resources/" ) COPY_MACOSX_RESOURCES("${UNITTESTS_RESOURCES_SRCS}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}") 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}") endif()