mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Make CMake scream less
This commit is contained in:
@@ -59,7 +59,7 @@ include(cef_support)
|
||||
set_current_cef_build_platform()
|
||||
|
||||
# Download and extract the CEF binary distribution (executes DownloadCEF.cmake).
|
||||
DownloadCEF("${CEF_PLATFORM}" "${CEF_VERSION}" "${CMAKE_CURRENT_SOURCE_DIR}/ext/cef")
|
||||
download_cef("${CEF_PLATFORM}" "${CEF_VERSION}" "${CMAKE_CURRENT_SOURCE_DIR}/ext/cef")
|
||||
|
||||
##########################################################################################
|
||||
# Apply cmake patch
|
||||
@@ -145,7 +145,7 @@ if(OS_MACOSX)
|
||||
# Helper executable target.
|
||||
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${WEBBROWSER_HELPER_SOURCES})
|
||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
|
||||
ADD_CEF_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
||||
add_cef_logical_target("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
||||
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
|
||||
@@ -158,15 +158,15 @@ endif()
|
||||
|
||||
if (OS_WINDOWS)
|
||||
message(STATUS "Setting up WebBrowser CEF helper executable: ${CEF_HELPER_TARGET}")
|
||||
SET_OPENSPACE_CEF_TARGET_OUT_DIR()
|
||||
set_openspace_cef_target_out_dir()
|
||||
add_executable(${CEF_HELPER_TARGET} ${WEBBROWSER_HELPER_SOURCES})
|
||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
|
||||
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
|
||||
# Logical target used to link the libcef library.
|
||||
ADD_CEF_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
||||
add_cef_logical_target("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
||||
target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
||||
# Add the custom manifest files to the executable.
|
||||
ADD_WINDOWS_CEF_MANIFEST("${CEF_TARGET_OUT_DIR}" "${WEBBROWSER_MODULE_PATH}" "${CEF_HELPER_TARGET}" "exe")
|
||||
add_windows_cef_manifest("${CEF_TARGET_OUT_DIR}" "${WEBBROWSER_MODULE_PATH}" "${CEF_HELPER_TARGET}" "exe")
|
||||
endif (OS_WINDOWS)
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
# This file consists of snippets taken from various CEF projects.
|
||||
|
||||
|
||||
# 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.
|
||||
@@ -56,7 +55,7 @@ endfunction()
|
||||
# Visit http://opensource.spotify.com/cefbuilds/index.html for the list of
|
||||
# supported platforms and versions.
|
||||
|
||||
function(DownloadCEF platform version download_dir)
|
||||
function(download_cef platform version download_dir)
|
||||
# Specify the binary distribution type and download directory.
|
||||
set(CEF_DISTRIBUTION "cef_binary_${version}_${platform}")
|
||||
set(CEF_DOWNLOAD_DIR "${download_dir}")
|
||||
@@ -94,7 +93,7 @@ function(DownloadCEF platform version download_dir)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(SET_OPENSPACE_CEF_TARGET_OUT_DIR)
|
||||
macro(set_openspace_cef_target_out_dir)
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
|
||||
${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
# By default Ninja and Make builds don't create a subdirectory named after
|
||||
@@ -111,25 +110,25 @@ macro(SET_OPENSPACE_CEF_TARGET_OUT_DIR)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ADD_WINDOWS_CEF_MANIFEST target_dir 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:"${target_dir}/${target}.${extension}"\;\#1
|
||||
COMMENT "Adding manifest..."
|
||||
)
|
||||
macro(add_windows_cef_manifest target_dir 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:"${target_dir}/${target}.${extension}"\;\#1
|
||||
COMMENT "Adding manifest..."
|
||||
)
|
||||
endmacro()
|
||||
|
||||
|
||||
# Add a logical target that can be used to link the specified libraries into an
|
||||
# executable target.
|
||||
macro(ADD_CEF_LOGICAL_TARGET target debug_lib release_lib)
|
||||
macro(add_cef_logical_target target debug_lib release_lib)
|
||||
add_library(${target} ${CEF_LIBTYPE} IMPORTED GLOBAL)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
IMPORTED_LOCATION "${release_lib}"
|
||||
IMPORTED_LOCATION_DEBUG "${debug_lib}"
|
||||
IMPORTED_LOCATION_RELEASE "${release_lib}"
|
||||
)
|
||||
endmacro()
|
||||
endmacro()
|
||||
|
||||
@@ -34,7 +34,7 @@ function(set_cef_targets cef_root main_target)
|
||||
find_package(CEF REQUIRED)
|
||||
|
||||
# ensure out target dir is set
|
||||
SET_OPENSPACE_CEF_TARGET_OUT_DIR()
|
||||
set_openspace_cef_target_out_dir()
|
||||
|
||||
# main CEF executable target
|
||||
set(CEF_TARGET ${main_target} PARENT_SCOPE)
|
||||
@@ -125,8 +125,8 @@ function(run_cef_windows_config CEF_TARGET CEF_ROOT MODULE_PATH)
|
||||
endif()
|
||||
|
||||
# Add the custom manifest files to the executable.
|
||||
SET_OPENSPACE_CEF_TARGET_OUT_DIR()
|
||||
ADD_WINDOWS_CEF_MANIFEST("${CEF_TARGET_OUT_DIR}" "${MODULE_PATH}" "${CEF_TARGET}" "exe")
|
||||
set_openspace_cef_target_out_dir()
|
||||
add_windows_cef_manifest("${CEF_TARGET_OUT_DIR}" "${MODULE_PATH}" "${CEF_TARGET}" "exe")
|
||||
|
||||
# Copy binary and resource files to the target output directory.
|
||||
copy_files("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "$<TARGET_FILE_DIR:${CEF_TARGET}>")
|
||||
|
||||
Reference in New Issue
Block a user