Generate CMake configuration for the binary distribution (issue #1404).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1881 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
ff77107e73
commit
a91de6d6db
|
@ -0,0 +1,531 @@
|
|||
# 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.
|
||||
|
||||
# OVERVIEW
|
||||
#
|
||||
# CMake is a cross-platform open-source build system that can generate project
|
||||
# files in many different formats. It can be downloaded from
|
||||
# http://www.cmake.org or installed via a platform package manager.
|
||||
#
|
||||
# CMake-generated project formats that have been tested with this CEF binary
|
||||
# distribution include:
|
||||
#
|
||||
# Linux: Ninja, Unix Makefiles
|
||||
# Mac OS X: Ninja, Xcode 5+
|
||||
# Windows: Ninja, Visual Studio 2010+
|
||||
#
|
||||
# Ninja is a cross-platform open-source tool for running fast builds using
|
||||
# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
|
||||
# downloaded from http://martine.github.io/ninja/ or installed via a platform
|
||||
# package manager.
|
||||
#
|
||||
# CMAKE STRUCTURE
|
||||
#
|
||||
# This CEF binary distribution includes the following CMake files:
|
||||
#
|
||||
# CMakeLists.txt Bootstrap that sets up the CMake environment and
|
||||
# loads the other CMake files.
|
||||
# cmake.macros Helper macros for building a generic CEF-based
|
||||
# application.
|
||||
# libcef_dll/CMakeLists.txt Defines the libcef_dll_wrapper target.
|
||||
# cefclient/CMakeLists.txt Defines the cefclient target.
|
||||
# cefsimple/CMakeLists.txt Defines the cefsimple target.
|
||||
#
|
||||
# Existing CMake projects that use this binary distribution without changing the
|
||||
# directory structure can include the existing "libcef_dll/CMakeLists.txt" file
|
||||
# with minimal or no changes.
|
||||
#
|
||||
# BUILD REQUIREMENTS
|
||||
#
|
||||
# The below requirements must be met to build this CEF binary distribution.
|
||||
#
|
||||
# - CMake version 2.8.12.2 or newer.
|
||||
#
|
||||
# - Linux requirements:
|
||||
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
|
||||
# related. Newer versions will likely also work but may not have been tested.
|
||||
# Required packages include:
|
||||
# build-essential
|
||||
# libgtk2.0-dev (required by the cefclient target only)
|
||||
# libgtkglext1-dev (required by the cefclient target only)
|
||||
#
|
||||
# - Mac OS X requirements:
|
||||
# Xcode 5 or newer building on Mac OS X 10.7 (Lion) or newer. The Xcode
|
||||
# command-line tools must also be installed.
|
||||
#
|
||||
# - Windows requirements:
|
||||
# Visual Studio 2010 or newer building on Windows XP SP3 or newer. 64-bit
|
||||
# version of Windows 7 or newer recommended.
|
||||
#
|
||||
# BUILD EXAMPLES
|
||||
#
|
||||
# The below commands will generate project files and create a Debug build of all
|
||||
# CEF targets using CMake and the platform toolchain.
|
||||
#
|
||||
# Start by creating and entering the CMake build output directory:
|
||||
# > cd path/to/cef_binary_*
|
||||
# > mkdir build && cd build
|
||||
#
|
||||
# To perform a Linux build using a 32-bit CEF binary distribution on a 32-bit
|
||||
# Linux platform or a 64-bit CEF binary distribution on a 64-bit Linux platform:
|
||||
# Using Unix Makefiles:
|
||||
# > cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > make -j4 cefclient cefsimple
|
||||
#
|
||||
# Using Ninja:
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Mac OS X build using a 32-bit CEF binary distribution:
|
||||
# Using the Xcode IDE:
|
||||
# > cmake -G "Xcode" -DPROJECT_ARCH="i386" ..
|
||||
# Open build\cef.xcodeproj in Xcode and select Product > Build.
|
||||
#
|
||||
# Using Ninja:
|
||||
# > cmake -G "Ninja" -DPROJECT_ARCH="i386" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Mac OS X build using a 64-bit CEF binary distribution:
|
||||
# Using the Xcode IDE:
|
||||
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
|
||||
# Open build\cef.xcodeproj in Xcode and select Product > Build.
|
||||
#
|
||||
# Using Ninja:
|
||||
# > cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 32-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2013 IDE:
|
||||
# > cmake -G "Visual Studio 12" ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2013 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 64-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2013 IDE:
|
||||
# > cmake -G "Visual Studio 12 Win64" ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2013 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
|
||||
#
|
||||
# Shared configuration.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12.2)
|
||||
|
||||
# Only generate Debug and Release configuration types.
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release)
|
||||
|
||||
# Project name.
|
||||
project(cef)
|
||||
|
||||
# Use folders in the resulting project files.
|
||||
set_property(GLOBAL PROPERTY OS_FOLDERS ON)
|
||||
|
||||
# Determine the project architecture.
|
||||
# PROJECT_ARCH must be specified via the command-line on Mac OS X.
|
||||
if(NOT DEFINED PROJECT_ARCH)
|
||||
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
set(PROJECT_ARCH "x86_64")
|
||||
else()
|
||||
set(PROJECT_ARCH "x86")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Determine the platform.
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
set(OS_MACOSX 1)
|
||||
set(OS_POSIX 1)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
set(OS_LINUX 1)
|
||||
set(OS_POSIX 1)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
|
||||
set(OS_WINDOWS 1)
|
||||
endif()
|
||||
|
||||
# Include cmake macros.
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
|
||||
include("macros")
|
||||
|
||||
# Source include directory.
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Allow C++ programs to use stdint.h macros specified in the C99 standard that
|
||||
# aren't in the C++ standard (e.g. UINT8_MAX, INT64_MIN, etc).
|
||||
add_definitions(-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
|
||||
|
||||
|
||||
#
|
||||
# Linux configuration.
|
||||
#
|
||||
|
||||
if(OS_LINUX)
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE SHARED)
|
||||
# -fno-strict-aliasing = Avoid assumptions regarding non-aliasing of objects of different types
|
||||
# -fPIC = Generate position-independent code for shared libraries
|
||||
# -fstack-protector = Protect some vulnerable functions from stack-smashing (security feature)
|
||||
# -funwind-tables = Support stack unwinding for backtrace()
|
||||
# -fvisibility=hidden = Give hidden visibility to declarations that are not explicitly marked as visible
|
||||
# --param=ssp-buffer-size=4 = Set the minimum buffer size protected by SSP (security feature, related to stack-protector)
|
||||
# -pipe = Use pipes rather than temporary files for communication between build stages
|
||||
# -pthread = Use the pthread library
|
||||
# -Wall = Enable all warnings
|
||||
# -Werror = Treat warnings as errors
|
||||
# -Wno-missing-field-initializers = Don't warn about missing field initializers
|
||||
# -Wno-unused-local-typedefs = Don't warn about unused local typedefs
|
||||
# -Wno-unused-parameter = Don't warn about unused parameters
|
||||
set(CEF_COMPILER_FLAGS "-fno-strict-aliasing -fPIC -fstack-protector -funwind-tables -fvisibility=hidden --param=ssp-buffer-size=4 -pipe -pthread -Wall -Werror -Wno-missing-field-initializers -Wno-unused-local-typedefs -Wno-unused-parameter")
|
||||
# -std=c99 = Use the C99 language standard
|
||||
set(CEF_C_COMPILER_FLAGS "-std=c99")
|
||||
# -fno-exceptions = Disable exceptions
|
||||
# -fno-rtti = Disable real-time type information
|
||||
# -fno-threadsafe-statics = Don't generate thread-safe statics
|
||||
# -fvisibility-inlines-hidden = Give hidden visibility to inlined class member functions
|
||||
# -std=gnu++11 = Use the C++11 language standard including GNU extensions
|
||||
# -Wno-literal-suffix = Don't warn about invalid suffixes on literals
|
||||
# -Wno-narrowing = Don't warn about type narrowing
|
||||
# -Wsign-compare = Warn about mixed signed/unsigned type comparisons
|
||||
set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wno-literal-suffix -Wno-narrowing -Wsign-compare")
|
||||
# -O0 = Disable optimizations
|
||||
# -g = Generate debug information
|
||||
set(CEF_COMPILER_FLAGS_DEBUG "-O0 -g")
|
||||
# -O2 = Optimize for maximum speed
|
||||
# -fdata-sections = Enable linker optimizations to improve locality of reference for data sections
|
||||
# -ffunction-sections = Enable linker optimizations to improve locality of reference for function sections
|
||||
# -fno-ident = Ignore the #ident directive
|
||||
# -DNDEBUG = Not a debug build
|
||||
# -D_FORTIFY_SOURCE=2 = Add memory and string function protection (security feature, related to stack-protector)
|
||||
set(CEF_COMPILER_FLAGS_RELEASE "-O2 -fdata-sections -ffunction-sections -fno-ident -DNDEBUG -D_FORTIFY_SOURCE=2")
|
||||
# -Wl,--disable-new-dtags = Don't generate new-style dynamic tags in ELF
|
||||
# -Wl,--fatal-warnings = Treat warnings as errors
|
||||
# -Wl,-rpath,. = Set rpath so that libraries can be placed next to the executable
|
||||
# -Wl,-z,noexecstack = Mark the stack as non-executable (security feature)
|
||||
# -Wl,-z,now = Resolve symbols on program start instead of on first use (security feature)
|
||||
# -Wl,-z,relro = Mark relocation sections as read-only (security feature)
|
||||
set(CEF_LINKER_FLAGS "-fPIC -pthread -Wl,--disable-new-dtags -Wl,--fatal-warnings -Wl,-rpath,. -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro")
|
||||
# -Wl,-O1 = Enable linker optimizations
|
||||
# -Wl,--as-needed = Only link libraries that export symbols used by the binary
|
||||
# -Wl,--gc-sections = Remove unused code resulting from -fdata-sections and -function-sections
|
||||
set(CEF_LINKER_FLAGS_RELEASE "-Wl,-O1 -Wl,--as-needed -Wl,--gc-sections")
|
||||
|
||||
if(PROJECT_ARCH STREQUAL "x86_64")
|
||||
# 64-bit architecture.
|
||||
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -m64 -march=x86-64")
|
||||
set(CEF_LINKER_FLAGS "${CEF_LINKER_FLAGS} -m64")
|
||||
elseif(PROJECT_ARCH STREQUAL "x86")
|
||||
# 32-bit architecture.
|
||||
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -msse2 -mfpmath=sse -mmmx -m32")
|
||||
set(CEF_LINKER_FLAGS "${CEF_LINKER_FLAGS} -m32")
|
||||
endif()
|
||||
|
||||
# Allow the Large File Support (LFS) interface to replace the old interface.
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS "X11")
|
||||
|
||||
# CEF directory paths.
|
||||
set(CEF_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources")
|
||||
set(CEF_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}")
|
||||
set(CEF_BINARY_DIR_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Debug")
|
||||
set(CEF_BINARY_DIR_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Release")
|
||||
|
||||
# CEF library paths.
|
||||
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.so")
|
||||
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.so")
|
||||
|
||||
# List of CEF binary files.
|
||||
set(CEF_BINARY_FILES
|
||||
chrome-sandbox
|
||||
libffmpegsumo.so
|
||||
libcef.so
|
||||
libpdf.so
|
||||
)
|
||||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
devtools_resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Mac OS X configuration.
|
||||
#
|
||||
|
||||
if(OS_MACOSX)
|
||||
# Platform-specific compiler/linker flags.
|
||||
# See also SET_XCODE_TARGET_PROPERTIES in macros.cmake.
|
||||
set(CEF_LIBTYPE SHARED)
|
||||
# -fno-strict-aliasing = Avoid assumptions regarding non-aliasing of objects of different types
|
||||
# -fstack-protector = Protect some vulnerable functions from stack-smashing (security feature)
|
||||
# -funwind-tables = Support stack unwinding for backtrace()
|
||||
# -fvisibility=hidden = Give hidden visibility to declarations that are not explicitly marked as visible
|
||||
# -Wall = Enable all warnings
|
||||
# -Wendif-labels = Warn whenever an #else or an #endif is followed by text
|
||||
# -Werror = Treat warnings as errors
|
||||
# -Wextra = Enable additional warnings
|
||||
# -Wnewline-eof = Warn about no newline at end of file
|
||||
# -Wno-missing-field-initializers = Don't warn about missing field initializers
|
||||
# -Wno-unused-parameter = Don't warn about unused parameters
|
||||
set(CEF_COMPILER_FLAGS "-fno-strict-aliasing -fstack-protector -funwind-tables -fvisibility=hidden -Wall -Wendif-labels -Werror -Wextra -Wnewline-eof -Wno-missing-field-initializers -Wno-unused-parameter")
|
||||
# -std=c99 = Use the C99 language standard
|
||||
set(CEF_C_COMPILER_FLAGS "-std=c99")
|
||||
# -fno-exceptions = Disable exceptions
|
||||
# -fno-rtti = Disable real-time type information
|
||||
# -fno-threadsafe-statics = Don't generate thread-safe statics
|
||||
# -fobjc-call-cxx-cdtors = Call the constructor/destructor of C++ instance variables in ObjC objects
|
||||
# -fvisibility-inlines-hidden = Give hidden visibility to inlined class member functions
|
||||
# -std=gnu++11 = Use the C++11 language standard including GNU extensions
|
||||
# -Wno-narrowing = Don't warn about type narrowing
|
||||
# -Wsign-compare = Warn about mixed signed/unsigned type comparisons
|
||||
set(CEF_CXX_COMPILER_FLAGS "-fno-exceptions -fno-rtti -fno-threadsafe-statics -fobjc-call-cxx-cdtors -fvisibility-inlines-hidden -std=gnu++11 -Wno-narrowing -Wsign-compare")
|
||||
# -O0 = Disable optimizations
|
||||
# -g = Generate debug information
|
||||
set(CEF_COMPILER_FLAGS_DEBUG "-O0 -g")
|
||||
# -O3 = Optimize for maximum speed plus a few extras
|
||||
set(CEF_COMPILER_FLAGS_RELEASE "-O3")
|
||||
# -Wl,-search_paths_first = Search for static or shared library versions in the same pass
|
||||
# -Wl,-ObjC = Support creation of creation of ObjC static libraries
|
||||
# -Wl,-pie = Generate position-independent code suitable for executables only
|
||||
set(CEF_LINKER_FLAGS "-Wl,-search_paths_first -Wl,-ObjC -Wl,-pie")
|
||||
# -Wl,-dead_strip = Strip dead code
|
||||
set(CEF_LINKER_FLAGS_RELEASE "-Wl,-dead_strip")
|
||||
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS "-lpthread" "-framework Cocoa" "-framework AppKit")
|
||||
|
||||
# Find the newest available base SDK.
|
||||
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
foreach(OS_VERSION 10.10 10.9 10.8 10.7)
|
||||
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
|
||||
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
|
||||
set(CMAKE_OSX_SYSROOT ${SDK})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Target SDK.
|
||||
set(CEF_TARGET_SDK "10.6")
|
||||
set(CEF_COMPILER_FLAGS "${CEF_COMPILER_FLAGS} -mmacosx-version-min=${CEF_TARGET_SDK}")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_TARGET_SDK})
|
||||
|
||||
# Target architecture.
|
||||
if(PROJECT_ARCH STREQUAL "x86_64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||
else()
|
||||
set(CMAKE_OSX_ARCHITECTURES "i386")
|
||||
endif()
|
||||
|
||||
# CEF directory paths.
|
||||
set(CEF_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/$<CONFIGURATION>")
|
||||
set(CEF_BINARY_DIR_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Debug")
|
||||
set(CEF_BINARY_DIR_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Release")
|
||||
|
||||
# CEF library paths.
|
||||
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
|
||||
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Windows configuration.
|
||||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE STATIC)
|
||||
# /MP = Multiprocess compilation
|
||||
# /Gy = Enable function-level linking
|
||||
# /GR- = Disable run-time type information
|
||||
# /Zi = Enable program database
|
||||
# /W4 = Warning level 4
|
||||
# /WX = Treat warnings as errors
|
||||
# /wd"4100" = Ignore "unreferenced formal parameter" warning
|
||||
# /wd"4127" = Ignore "conditional expression is constant" warning
|
||||
# /wd"4244" = Ignore "conversion possible loss of data" warning
|
||||
# /wd"4512" = Ignore "assignment operator could not be generated" warning
|
||||
# /wd"4701" = Ignore "potentially uninitialized local variable" warning
|
||||
# /wd"4996" = Ignore "function or variable may be unsafe" warning
|
||||
set(CEF_COMPILER_FLAGS "/MP /Gy /GR- /Zi /W4 /WX /wd\"4100\" /wd\"4127\" /wd\"4244\" /wd\"4512\" /wd\"4701\" /wd\"4996\"")
|
||||
# /MTd = Multithreaded debug runtime
|
||||
# /Od = Disable optimizations
|
||||
# /RTC1 = Enable basic run-time checks
|
||||
set(CEF_COMPILER_FLAGS_DEBUG "/MTd /RTC1 /Od")
|
||||
# /MT = Multithreaded release runtime
|
||||
# /O2 = Optimize for maximum speed
|
||||
# /Ob2 = Inline any suitable function
|
||||
# /GF = Enable string pooling
|
||||
# /D NDEBUG /D _NDEBUG = Not a debug build
|
||||
set(CEF_COMPILER_FLAGS_RELEASE "/MT /O2 /Ob2 /GF /D NDEBUG /D _NDEBUG")
|
||||
# /DEBUG = Generate debug information
|
||||
set(CEF_LINKER_FLAGS_DEBUG "/DEBUG")
|
||||
# /MANIFEST:NO = No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
|
||||
set(CEF_EXE_LINKER_FLAGS "/MANIFEST:NO")
|
||||
|
||||
# Standard definitions
|
||||
# -DWIN32 -D_WIN32 -D_WINDOWS = Windows platform
|
||||
# -DUNICODE -D_UNICODE = Unicode build
|
||||
# -DWINVER=0x0602 -D_WIN32_WINNT=0x602 = Targeting Windows 8
|
||||
# -DNOMINMAX = Use the standard's templated min/max
|
||||
# -DWIN32_LEAN_AND_MEAN = Exclude less common API declarations
|
||||
# -D_HAS_EXCEPTIONS=0 = Disable exceptions
|
||||
add_definitions(-DWIN32 -D_WIN32 -D_WINDOWS -DUNICODE -D_UNICODE -DWINVER=0x0602
|
||||
-D_WIN32_WINNT=0x602 -DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0)
|
||||
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS "comctl32.lib" "rpcrt4.lib" "shlwapi.lib")
|
||||
|
||||
# CEF directory paths.
|
||||
set(CEF_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources")
|
||||
set(CEF_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/$<CONFIGURATION>")
|
||||
set(CEF_BINARY_DIR_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Debug")
|
||||
set(CEF_BINARY_DIR_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Release")
|
||||
|
||||
# CEF library paths.
|
||||
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/libcef.lib")
|
||||
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/libcef.lib")
|
||||
|
||||
# List of CEF binary files.
|
||||
set(CEF_BINARY_FILES
|
||||
d3dcompiler_43.dll
|
||||
d3dcompiler_46.dll
|
||||
ffmpegsumo.dll
|
||||
libcef.dll
|
||||
libEGL.dll
|
||||
libGLESv2.dll
|
||||
pdf.dll
|
||||
)
|
||||
if(PROJECT_ARCH STREQUAL "x86")
|
||||
# Only used on 32-bit platforms.
|
||||
set(CEF_BINARY_FILES
|
||||
${CEF_BINARY_FILES}
|
||||
wow_helper.exe
|
||||
)
|
||||
endif()
|
||||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
devtools_resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
|
||||
# Configure use of the sandbox.
|
||||
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
||||
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1800)
|
||||
# The cef_sandbox.lib static library is currently built with VS2013. It will
|
||||
# not link successfully with other VS versions.
|
||||
set(USE_SANDBOX OFF)
|
||||
endif()
|
||||
|
||||
if(USE_SANDBOX)
|
||||
# Definition required by cef_sandbox.lib.
|
||||
add_definitions(-DPSAPI_VERSION=1)
|
||||
# Definition used by apps to test if the sandbox is enabled.
|
||||
add_definitions(-DCEF_USE_SANDBOX)
|
||||
|
||||
# Libraries required by cef_sandbox.lib.
|
||||
set(CEF_SANDBOX_STANDARD_LIBS "dbghelp.lib" "psapi.lib")
|
||||
|
||||
# CEF sandbox library paths.
|
||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
|
||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Post-configuration actions.
|
||||
#
|
||||
|
||||
# Merge compiler/linker flags.
|
||||
set(CMAKE_C_FLAGS "${CEF_COMPILER_FLAGS} ${CEF_C_COMPILER_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CEF_COMPILER_FLAGS_DEBUG} ${CEF_C_COMPILER_FLAGS_DEBUG}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CEF_COMPILER_FLAGS_RELEASE} ${CEF_C_COMPILER_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS "${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CEF_LINKER_FLAGS} ${CEF_EXE_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CEF_LINKER_FLAGS_DEBUG} ${CEF_EXE_LINKER_FLAGS_DEBUG}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CEF_LINKER_FLAGS_RELEASE} ${CEF_EXE_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CEF_LINKER_FLAGS} ${CEF_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CEF_LINKER_FLAGS_DEBUG} ${CEF_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CEF_LINKER_FLAGS_RELEASE} ${CEF_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
|
||||
|
||||
#
|
||||
# Include target subdirectories.
|
||||
#
|
||||
|
||||
add_subdirectory(libcef_dll)
|
||||
add_subdirectory(cefclient)
|
||||
add_subdirectory(cefsimple)
|
||||
|
||||
|
||||
#
|
||||
# Display configuration settings.
|
||||
#
|
||||
|
||||
message(STATUS "*** CONFIGURATION SETTINGS ***")
|
||||
message(STATUS "Generator: ${CMAKE_GENERATOR}")
|
||||
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "Project architecture: ${PROJECT_ARCH}")
|
||||
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
if(OS_MACOSX)
|
||||
message(STATUS "Base SDK: ${CMAKE_OSX_SYSROOT}")
|
||||
message(STATUS "Target SDK: ${CEF_TARGET_SDK}")
|
||||
endif()
|
||||
|
||||
if(OS_WINDOWS)
|
||||
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
|
||||
endif()
|
||||
|
||||
set(LIBRARIES ${CEF_STANDARD_LIBS})
|
||||
if(OS_WINDOWS AND USE_SANDBOX)
|
||||
set(LIBRARIES ${LIBRARIES} ${CEF_SANDBOX_STANDARD_LIBS})
|
||||
endif()
|
||||
message(STATUS "Standard libraries: ${LIBRARIES}")
|
||||
|
||||
get_directory_property(DEFINITIONS COMPILE_DEFINITIONS)
|
||||
message(STATUS "Compiler definitions: ${DEFINITIONS}")
|
||||
|
||||
message(STATUS "C_FLAGS: ${CMAKE_C_FLAGS}")
|
||||
message(STATUS "C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
||||
message(STATUS "C_FLAGS_RELEASE: ${CMAKE_C_FLAGS_RELEASE}")
|
||||
message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
||||
message(STATUS "CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
message(STATUS "CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
message(STATUS "EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
message(STATUS "EXE_LINKER_FLAGS_DEBUG: ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
message(STATUS "EXE_LINKER_FLAGS_RELEASE: ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
message(STATUS "SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
message(STATUS "SHARED_LINKER_FLAGS_DEBUG: ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
message(STATUS "SHARED_LINKER_FLAGS_RELEASE: ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
|
||||
if(OS_LINUX OR OS_WINDOWS)
|
||||
message(STATUS "CEF Binary files: ${CEF_BINARY_FILES}")
|
||||
message(STATUS "CEF Resource files: ${CEF_RESOURCE_FILES}")
|
||||
endif()
|
|
@ -0,0 +1,22 @@
|
|||
# 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.
|
||||
|
||||
add_definitions(-DUSING_CEF_SHARED)
|
||||
|
||||
{{
|
||||
'prefix': 'libcef',
|
||||
'library': 'libcef_dll_wrapper',
|
||||
'includes': [
|
||||
'includes_common',
|
||||
'autogen_cpp_includes',
|
||||
'includes_capi',
|
||||
'autogen_capi_includes',
|
||||
'includes_wrapper',
|
||||
'includes_win:WINDOWS',
|
||||
'includes_mac:MACOSX',
|
||||
'includes_linux:LINUX',
|
||||
'libcef_dll_wrapper_sources_common',
|
||||
'autogen_client_side',
|
||||
],
|
||||
}}
|
|
@ -0,0 +1,271 @@
|
|||
# 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.
|
||||
|
||||
#
|
||||
# Shared macros.
|
||||
#
|
||||
|
||||
# Append platform specific sources to a list of sources.
|
||||
macro(APPEND_PLATFORM_SOURCES name_of_list)
|
||||
if(OS_LINUX AND ${name_of_list}_LINUX)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_LINUX})
|
||||
endif()
|
||||
if(OS_POSIX AND ${name_of_list}_POSIX)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_POSIX})
|
||||
endif()
|
||||
if(OS_WINDOWS AND ${name_of_list}_WINDOWS)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_WINDOWS})
|
||||
endif()
|
||||
if(OS_MACOSX AND ${name_of_list}_MACOSX)
|
||||
list(APPEND ${name_of_list} ${${name_of_list}_MACOSX})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Add a logical target that can be used to link the specified libraries into an
|
||||
# executable target.
|
||||
macro(ADD_LOGICAL_TARGET target debug_lib release_lib)
|
||||
add_library(${target} ${CEF_LIBTYPE} IMPORTED)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
IMPORTED_LOCATION "${release_lib}"
|
||||
IMPORTED_LOCATION_DEBUG "${debug_lib}"
|
||||
IMPORTED_LOCATION_RELEASE "${release_lib}"
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# Determine the target output directory based on platform and generator.
|
||||
macro(SET_CEF_TARGET_OUT_DIR)
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
|
||||
# Ninja does not create a subdirectory named after the configuration.
|
||||
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
elseif(OS_LINUX)
|
||||
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
|
||||
else()
|
||||
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Copy a list of files from one directory to another. Relative files paths are maintained.
|
||||
macro(COPY_FILES target file_list source_dir target_dir)
|
||||
foreach(FILENAME ${file_list})
|
||||
set(source_file ${source_dir}/${FILENAME})
|
||||
set(target_file ${target_dir}/${FILENAME})
|
||||
if(IS_DIRECTORY ${source_file})
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_file}" "${target_file}"
|
||||
VERBATIM
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${source_file}" "${target_file}"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Rename a directory replacing the target if it already exists.
|
||||
macro(RENAME_DIRECTORY target source_dir target_dir)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
# Remove the target directory if it already exists.
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory "${target_dir}"
|
||||
# Rename the source directory to target directory.
|
||||
COMMAND ${CMAKE_COMMAND} -E rename "${source_dir}" "${target_dir}"
|
||||
VERBATIM
|
||||
)
|
||||
endmacro()
|
||||
|
||||
|
||||
#
|
||||
# Linux macros.
|
||||
#
|
||||
|
||||
if(OS_LINUX)
|
||||
|
||||
# Use pkg-config to find Linux libraries and update compiler/linker variables.
|
||||
macro(FIND_LINUX_LIBRARIES libraries)
|
||||
# Read pkg-config info into variables.
|
||||
execute_process(COMMAND pkg-config --cflags ${libraries} OUTPUT_VARIABLE FLL_CFLAGS)
|
||||
execute_process(COMMAND pkg-config --libs-only-L --libs-only-other ${libraries} OUTPUT_VARIABLE FLL_LDFLAGS)
|
||||
execute_process(COMMAND pkg-config --libs-only-l ${libraries} OUTPUT_VARIABLE FLL_LIBS)
|
||||
|
||||
# Strip leading and trailing whitepspace.
|
||||
STRING(STRIP "${FLL_CFLAGS}" FLL_CFLAGS)
|
||||
STRING(STRIP "${FLL_LDFLAGS}" FLL_LDFLAGS)
|
||||
STRING(STRIP "${FLL_LIBS}" FLL_LIBS)
|
||||
|
||||
# Update the variables.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLL_CFLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLL_CFLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLL_LDFLAGS} ${FLL_LIBS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FLL_LDFLAGS} ${FLL_LIBS}")
|
||||
endmacro()
|
||||
|
||||
# Set SUID permissions on the specified executable.
|
||||
macro(SET_LINUX_SUID_PERMISSIONS target executable)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo ""
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "*** Run the following command manually to set SUID permissions ***"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "EXE=\"${executable}\" && sudo -- chown root:root $EXE && sudo -- chmod 4755 $EXE"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo ""
|
||||
VERBATIM
|
||||
)
|
||||
endmacro()
|
||||
|
||||
endif(OS_LINUX)
|
||||
|
||||
|
||||
#
|
||||
# Mac OS X macros.
|
||||
#
|
||||
|
||||
if(OS_MACOSX)
|
||||
|
||||
# Set Xcode target properties.
|
||||
function(SET_XCODE_TARGET_PROPERTIES target)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO
|
||||
XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11
|
||||
XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO # -fno-objc-link-runtime
|
||||
XCODE_ATTRIBUTE_CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS YES # -Wobjc-missing-property-synthesis
|
||||
XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO
|
||||
XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] YES # -Wl,-dead_strip
|
||||
XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99
|
||||
XCODE_ATTRIBUTE_GCC_CW_ASM_SYNTAX NO # No -fasm-blocks
|
||||
XCODE_ATTRIBUTE_GCC_DYNAMIC_NO_PIC NO
|
||||
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS NO # -fno-exceptions
|
||||
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI NO # -fno-rtti
|
||||
XCODE_ATTRIBUTE_GCC_ENABLE_PASCAL_STRINGS NO # No -mpascal-strings
|
||||
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES # -fvisibility-inlines-hidden
|
||||
XCODE_ATTRIBUTE_GCC_OBJC_CALL_CXX_CDTORS YES # -fobjc-call-cxx-cdtors
|
||||
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES # -fvisibility=hidden
|
||||
XCODE_ATTRIBUTE_GCC_THREADSAFE_STATICS NO # -fno-threadsafe-statics
|
||||
XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES # -Werror
|
||||
XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
|
||||
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES # -Wnewline-eof
|
||||
XCODE_ATTRIBUTE_USE_HEADERMAP NO
|
||||
OSX_ARCHITECTURES_DEBUG "${CMAKE_OSX_ARCHITECTURES}"
|
||||
OSX_ARCHITECTURES_RELEASE "${CMAKE_OSX_ARCHITECTURES}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# Override default add_library function.
|
||||
function(add_library name)
|
||||
_add_library(${name} ${ARGN})
|
||||
SET_XCODE_TARGET_PROPERTIES(${name})
|
||||
endfunction()
|
||||
|
||||
# Override default add_executable function.
|
||||
function(add_executable name)
|
||||
_add_executable(${name} ${ARGN})
|
||||
SET_XCODE_TARGET_PROPERTIES(${name})
|
||||
endfunction()
|
||||
|
||||
# Fix the framework link in the helper executable.
|
||||
macro(FIX_MACOSX_HELPER_FRAMEWORK_LINK target app_path)
|
||||
add_custom_command(TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND install_name_tool -change "@executable_path/Chromium Embedded Framework"
|
||||
"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"
|
||||
"${app_path}/Contents/MacOS/${target}"
|
||||
VERBATIM
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# Fix the framework link in the main executable.
|
||||
macro(FIX_MACOSX_MAIN_FRAMEWORK_LINK target app_path)
|
||||
add_custom_command(TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND install_name_tool -change "@executable_path/Chromium Embedded Framework"
|
||||
"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"
|
||||
"${app_path}/Contents/MacOS/${target}"
|
||||
VERBATIM
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# Make the other helper app bundles.
|
||||
macro(MAKE_MACOSX_HELPERS target app_path)
|
||||
add_custom_command(TARGET ${target}
|
||||
POST_BUILD
|
||||
# The exported variables need to be set for generators other than Xcode.
|
||||
COMMAND export BUILT_PRODUCTS_DIR=${app_path} &&
|
||||
export CONTENTS_FOLDER_PATH=/Contents &&
|
||||
tools/make_more_helpers.sh "Frameworks" "${target}"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
VERBATIM
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# Manually process and copy over resource files.
|
||||
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
|
||||
foreach(FILENAME ${resource_list})
|
||||
# Remove one or more prefixes from the source paths.
|
||||
set(TARGET_FILENAME "${FILENAME}")
|
||||
foreach(PREFIX ${prefix_list})
|
||||
string(REGEX REPLACE "^.*${PREFIX}" "" TARGET_FILENAME ${TARGET_FILENAME})
|
||||
endforeach()
|
||||
|
||||
# Determine the absolute source and target paths.
|
||||
set(TARGET_PATH "${app_path}/Contents/Resources/${TARGET_FILENAME}")
|
||||
if(IS_ABSOLUTE ${FILENAME})
|
||||
set(SOURCE_PATH ${FILENAME})
|
||||
else()
|
||||
set(SOURCE_PATH "${source_dir}/${FILENAME}")
|
||||
endif()
|
||||
|
||||
if(${FILENAME} MATCHES ".xib$")
|
||||
# Change the target file extension.
|
||||
string(REGEX REPLACE ".xib$" ".nib" TARGET_PATH ${TARGET_PATH})
|
||||
|
||||
get_filename_component(TARGET_DIRECTORY ${TARGET_PATH} PATH)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
# Create the target directory.
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGET_DIRECTORY}"
|
||||
# Compile the XIB file to a NIB.
|
||||
COMMAND /usr/bin/ibtool --output-format binary1 --compile "${TARGET_PATH}" "${SOURCE_PATH}"
|
||||
VERBATIM
|
||||
)
|
||||
elseif(NOT ${TARGET_FILENAME} STREQUAL "Info.plist")
|
||||
# Copy the file as-is.
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${TARGET_PATH}"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
endif(OS_MACOSX)
|
||||
|
||||
|
||||
#
|
||||
# Windows macros.
|
||||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
|
||||
# Add custom manifest files to an executable target.
|
||||
macro(ADD_WINDOWS_MANIFEST target)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND "mt.exe" -nologo
|
||||
-manifest \"${CMAKE_CURRENT_SOURCE_DIR}/${target}.exe.manifest\" \"${CMAKE_CURRENT_SOURCE_DIR}/compatibility.manifest\"
|
||||
-outputresource:"${CEF_TARGET_OUT_DIR}/${target}.exe"\;\#1
|
||||
COMMENT "Adding manifest..."
|
||||
)
|
||||
endmacro()
|
||||
|
||||
endif(OS_WINDOWS)
|
|
@ -0,0 +1,174 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
# cefclient sources.
|
||||
{{
|
||||
'prefix': 'cefclient',
|
||||
'set': 'CEFCLIENT_SRCS',
|
||||
'includes': [
|
||||
'cefclient_sources_common',
|
||||
'cefclient_bundle_resources_common',
|
||||
'cefclient_sources_win:WINDOWS',
|
||||
'cefclient_sources_mac:MACOSX',
|
||||
'cefclient_sources_linux:LINUX',
|
||||
],
|
||||
}}
|
||||
|
||||
# cefclient helper sources.
|
||||
{{
|
||||
'prefix': 'cefclient_helper',
|
||||
'includes': [
|
||||
'cefclient_sources_mac_helper:MACOSX',
|
||||
],
|
||||
}}
|
||||
|
||||
# cefclient resources.
|
||||
{{
|
||||
'prefix': 'cefclient_resources',
|
||||
'set': 'CEFCLIENT_RESOURCES_SRCS',
|
||||
'includes': [
|
||||
'cefclient_bundle_resources_common',
|
||||
'cefclient_bundle_resources_mac:MACOSX',
|
||||
],
|
||||
}}
|
||||
|
||||
|
||||
#
|
||||
# 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)
|
||||
# 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})
|
||||
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".
|
||||
RENAME_DIRECTORY("${CEF_TARGET}" "${CEF_TARGET_OUT_DIR}/res" "${CEF_TARGET_OUT_DIR}/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 ${CEFCLIENT_HELPER_SRCS})
|
||||
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
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist
|
||||
)
|
||||
|
||||
# Fix the framework link in the helper executable.
|
||||
FIX_MACOSX_HELPER_FRAMEWORK_LINK(${CEF_HELPER_TARGET} ${CEF_HELPER_APP})
|
||||
|
||||
# Main executable target.
|
||||
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS})
|
||||
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}"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/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 link in the main executable.
|
||||
FIX_MACOSX_MAIN_FRAMEWORK_LINK(${CEF_TARGET} ${CEF_APP})
|
||||
|
||||
# Make the other helper app bundles.
|
||||
MAKE_MACOSX_HELPERS(${CEF_TARGET} ${CEF_APP})
|
||||
|
||||
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.
|
||||
set(PREFIXES "mac/" "res/") # Remove these prefixes from input file paths.
|
||||
COPY_MACOSX_RESOURCES("${CEFCLIENT_RESOURCES_SRCS}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Windows configuration.
|
||||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
# Executable target.
|
||||
add_executable(${CEF_TARGET} WIN32 ${CEFCLIENT_SRCS})
|
||||
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
|
||||
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} "glu32.lib" "opengl32.lib")
|
||||
|
||||
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("${CEF_TARGET}")
|
||||
|
||||
# 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()
|
|
@ -25,11 +25,14 @@
|
|||
#include "cefclient/string_util.h"
|
||||
|
||||
|
||||
// Set to 0 to disable sandbox support.
|
||||
#define CEF_ENABLE_SANDBOX 1
|
||||
// When generating projects with CMake the CEF_USE_SANDBOX value will be defined
|
||||
// automatically if using the required compiler version. Pass -DUSE_SANDBOX=OFF
|
||||
// to the CMake command-line to disable use of the sandbox.
|
||||
// Uncomment this line to manually enable sandbox support.
|
||||
// #define CEF_USE_SANDBOX 1
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
// The cef_sandbox.lib static library is currently built with VS2010. It may not
|
||||
#if defined(CEF_USE_SANDBOX)
|
||||
// The cef_sandbox.lib static library is currently built with VS2013. It may not
|
||||
// link successfully with other VS versions.
|
||||
#pragma comment(lib, "cef_sandbox.lib")
|
||||
#endif
|
||||
|
@ -83,7 +86,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
|
||||
void* sandbox_info = NULL;
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
#if defined(CEF_USE_SANDBOX)
|
||||
// Manage the life span of the sandbox information object. This is necessary
|
||||
// for sandbox support on Windows. See cef_sandbox_win.h for complete details.
|
||||
CefScopedSandboxInfo scoped_sandbox;
|
||||
|
@ -107,7 +110,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
|
||||
CefSettings settings;
|
||||
|
||||
#if !CEF_ENABLE_SANDBOX
|
||||
#if !defined(CEF_USE_SANDBOX)
|
||||
settings.no_sandbox = true;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
# cefsimple sources.
|
||||
{{
|
||||
'prefix': 'cefsimple',
|
||||
'set': 'CEFSIMPLE_SRCS',
|
||||
'includes': [
|
||||
'cefsimple_sources_common',
|
||||
'cefsimple_sources_win:WINDOWS',
|
||||
'cefsimple_sources_mac:MACOSX',
|
||||
'cefsimple_sources_linux:LINUX',
|
||||
],
|
||||
}}
|
||||
|
||||
# cefsimple helper sources.
|
||||
{{
|
||||
'prefix': 'cefsimple_helper',
|
||||
'includes': [
|
||||
'cefsimple_sources_mac_helper:MACOSX',
|
||||
],
|
||||
}}
|
||||
|
||||
# cefsimple resources.
|
||||
{{
|
||||
'prefix': 'cefsimple_resources',
|
||||
'set': 'CEFSIMPLE_RESOURCES_SRCS',
|
||||
'includes': [
|
||||
'cefsimple_bundle_resources_mac:MACOSX',
|
||||
],
|
||||
}}
|
||||
|
||||
|
||||
#
|
||||
# Shared configuration.
|
||||
#
|
||||
|
||||
# Target executable names.
|
||||
set(CEF_TARGET "cefsimple")
|
||||
if(OS_MACOSX)
|
||||
set(CEF_HELPER_TARGET "cefsimple 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)
|
||||
# Executable target.
|
||||
add_executable(${CEF_TARGET} ${CEFSIMPLE_SRCS})
|
||||
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 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}")
|
||||
|
||||
# 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 ${CEFSIMPLE_HELPER_SRCS})
|
||||
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
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist
|
||||
)
|
||||
|
||||
# Fix the framework link in the helper executable.
|
||||
FIX_MACOSX_HELPER_FRAMEWORK_LINK(${CEF_HELPER_TARGET} ${CEF_HELPER_APP})
|
||||
|
||||
# Main executable target.
|
||||
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS})
|
||||
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
|
||||
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
||||
set_target_properties(${CEF_TARGET} PROPERTIES
|
||||
RESOURCE "${CEFSIMPLE_RESOURCES_SRCS}"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/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 link in the main executable.
|
||||
FIX_MACOSX_MAIN_FRAMEWORK_LINK(${CEF_TARGET} ${CEF_APP})
|
||||
|
||||
# Make the other helper app bundles.
|
||||
MAKE_MACOSX_HELPERS(${CEF_TARGET} ${CEF_APP})
|
||||
|
||||
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.
|
||||
set(PREFIXES "mac/") # Remove these prefixes from input file paths.
|
||||
COPY_MACOSX_RESOURCES("${CEFSIMPLE_RESOURCES_SRCS}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Windows configuration.
|
||||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
# Executable target.
|
||||
add_executable(${CEF_TARGET} WIN32 ${CEFSIMPLE_SRCS})
|
||||
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
|
||||
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${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("${CEF_TARGET}")
|
||||
|
||||
# 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}")
|
||||
endif()
|
|
@ -8,11 +8,14 @@
|
|||
#include "include/cef_sandbox_win.h"
|
||||
|
||||
|
||||
// Set to 0 to disable sandbox support.
|
||||
#define CEF_ENABLE_SANDBOX 1
|
||||
// When generating projects with CMake the CEF_USE_SANDBOX value will be defined
|
||||
// automatically if using the required compiler version. Pass -DUSE_SANDBOX=OFF
|
||||
// to the CMake command-line to disable use of the sandbox.
|
||||
// Uncomment this line to manually enable sandbox support.
|
||||
// #define CEF_USE_SANDBOX 1
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
// The cef_sandbox.lib static library is currently built with VS2010. It may not
|
||||
#if defined(CEF_USE_SANDBOX)
|
||||
// The cef_sandbox.lib static library is currently built with VS2013. It may not
|
||||
// link successfully with other VS versions.
|
||||
#pragma comment(lib, "cef_sandbox.lib")
|
||||
#endif
|
||||
|
@ -28,7 +31,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
|
||||
void* sandbox_info = NULL;
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
#if defined(CEF_USE_SANDBOX)
|
||||
// Manage the life span of the sandbox information object. This is necessary
|
||||
// for sandbox support on Windows. See cef_sandbox_win.h for complete details.
|
||||
CefScopedSandboxInfo scoped_sandbox;
|
||||
|
@ -54,7 +57,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
// Specify CEF global settings here.
|
||||
CefSettings settings;
|
||||
|
||||
#if !CEF_ENABLE_SANDBOX
|
||||
#if !defined(CEF_USE_SANDBOX)
|
||||
settings.no_sandbox = true;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -32,7 +32,12 @@ Resources Contains resources required by libcef.so. By default these files
|
|||
USAGE
|
||||
-----
|
||||
|
||||
Run 'build.sh Debug' to build the cefclient target in Debug mode.
|
||||
Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using the pre-existing make solution (DEPRECATED):
|
||||
Run 'build.sh Debug' to build the cefclient target in Debug mode.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
|
|
|
@ -28,7 +28,12 @@ tools Scripts that perform post-processing on Mac release targets.
|
|||
USAGE
|
||||
-----
|
||||
|
||||
Xcode 3 and 4: Open the cefclient.xcodeproj project and build.
|
||||
Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using the pre-existing Xcode solution (DEPRECATED):
|
||||
Xcode 3.2 or newer: Open the cefclient.xcodeproj project and build.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
|
|
|
@ -33,18 +33,23 @@ Resources Contains resources required by libcef.dll. By default these files
|
|||
USAGE
|
||||
-----
|
||||
|
||||
Visual Studio 2012 and Visual Studio 2010:
|
||||
Open the cefclient2010.sln solution in Visual Studio and build.
|
||||
Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Visual Studio 2008:
|
||||
Open the cefclient2008.sln solution in Visual Studio and build.
|
||||
Building using the pre-existing Visual Studio solution (DEPRECATED):
|
||||
Visual Studio 2013 and newer:
|
||||
Open the cefclient2010.sln solution in Visual Studio and build.
|
||||
|
||||
Visual Studio 2005:
|
||||
1. Open the cefclient.vcproj and libcef_dll_wrapper.vcproj files in a text
|
||||
editor. Change Version="9.00" to Version="8.00".
|
||||
2. Open the cefclient2005.sln file in a text editor. Change "Version 9.00" to
|
||||
"Version 8.00".
|
||||
3. Open the cefclient2005.sln solution in Visual Studio and build.
|
||||
Visual Studio 2008:
|
||||
Open the cefclient2008.sln solution in Visual Studio and build.
|
||||
|
||||
Visual Studio 2005:
|
||||
1. Open the cefclient.vcproj and libcef_dll_wrapper.vcproj files in a text
|
||||
editor. Change Version="9.00" to Version="8.00".
|
||||
2. Open the cefclient2005.sln file in a text editor. Change "Version 9.00"
|
||||
to "Version 8.00".
|
||||
3. Open the cefclient2005.sln solution in Visual Studio and build.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
|
|
|
@ -129,3 +129,13 @@ def read_version_file(file, args):
|
|||
parts = line.split('=', 1)
|
||||
if len(parts) == 2:
|
||||
args[parts[0]] = parts[1]
|
||||
|
||||
def eval_file(src):
|
||||
""" Loads and evaluates the contents of the specified file. """
|
||||
return eval(read_file(src), {'__builtins__': None}, None)
|
||||
|
||||
def normalize_path(path):
|
||||
""" Normalizes the path separator to match the Unix standard. """
|
||||
if sys.platform == 'win32':
|
||||
return path.replace('\\', '/')
|
||||
return path
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
# 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.
|
||||
|
||||
import os
|
||||
from file_util import *
|
||||
import sys
|
||||
|
||||
# script directory.
|
||||
script_dir = os.path.dirname(__file__)
|
||||
|
||||
# CEF root directory.
|
||||
cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir))
|
||||
|
||||
def get_files_for_variable(cmake_path, variables, variable):
|
||||
""" Returns the path values associated with |variable| and relative to the
|
||||
|cmake_path| directory. """
|
||||
if not variable in variables:
|
||||
raise Exception('Variable %s does not exist' % variable)
|
||||
|
||||
# Cmake file directory.
|
||||
cmake_dirname = os.path.dirname(cmake_path) + '/'
|
||||
|
||||
# Return path values relative to the cmake file directory.
|
||||
# Example 1:
|
||||
# cmake file = "/path/to/libcef_dll/CMakeLists.txt"
|
||||
# include path = "/path/to/libcef_dll/wrapper/cef_browser_info_map.h"
|
||||
# return path = "wrapper/cef_browser_info_map.h"
|
||||
# Example 2:
|
||||
# cmake file = "/path/to/libcef_dll/CMakeLists.txt"
|
||||
# include path = "/path/to/include/internal/cef_export.h"
|
||||
# return path = "../include/internal/cef_export.h"
|
||||
new_paths = []
|
||||
paths = variables[variable]
|
||||
for path in paths:
|
||||
if path[0] == '<':
|
||||
# Skip gyp include variables
|
||||
continue
|
||||
|
||||
abspath = os.path.join(cef_dir, path)
|
||||
newpath = normalize_path(os.path.relpath(abspath, cmake_dirname))
|
||||
new_paths.append(newpath)
|
||||
return new_paths
|
||||
|
||||
def format_cmake_set(name, values):
|
||||
result = 'set(%s\n' % name
|
||||
for value in values:
|
||||
result += ' %s\n' % value
|
||||
return result + ' )\n'
|
||||
|
||||
def format_cmake_group(cmake_path, name, files, platform_sep):
|
||||
platforms = {}
|
||||
common = []
|
||||
|
||||
# Folder will be the cmake parent directory name combined with the path to
|
||||
# first file in the files list.
|
||||
# Example 1:
|
||||
# cmake file = "/path/to/libcef_dll/CMakeLists.txt"
|
||||
# include path = "wrapper/cef_browser_info_map.h"
|
||||
# folder = "libcef_dll\\\\wrapper"
|
||||
# Example 2:
|
||||
# cmake file = "/path/to/libcef_dll/CMakeLists.txt"
|
||||
# include path = "../include/internal/cef_export.h"
|
||||
# folder = "include\\\\internal"
|
||||
folder = os.path.basename(os.path.dirname(cmake_path))
|
||||
folder = os.path.dirname(os.path.normpath(os.path.join(folder, files[0])))
|
||||
folder = normalize_path(folder).replace('/', '\\\\\\\\')
|
||||
|
||||
# Group the files by platform.
|
||||
for file in files:
|
||||
parts = file.split(platform_sep)
|
||||
file = parts[0]
|
||||
if len(parts) > 1:
|
||||
# Add the file under the platform.
|
||||
platform = parts[1]
|
||||
if not platform in platforms:
|
||||
platforms[platform] = []
|
||||
platforms[platform].append(file)
|
||||
else:
|
||||
common.append(file)
|
||||
|
||||
result = ''
|
||||
if len(common) > 0:
|
||||
result += format_cmake_set(name, common)
|
||||
|
||||
if len(platforms) > 0:
|
||||
keys = sorted(platforms.keys())
|
||||
for key in keys:
|
||||
result += format_cmake_set(name + '_' + key, platforms[key])
|
||||
result += 'APPEND_PLATFORM_SOURCES(%s)\n' % name
|
||||
|
||||
result += 'source_group(%s FILES ${%s})\n\n' % (folder, name)
|
||||
return result
|
||||
|
||||
def format_cmake_library(name, group_names):
|
||||
result = 'add_library(%s\n' % name
|
||||
for group in group_names:
|
||||
result += ' ${%s}\n' % group
|
||||
return result + ' )\n\n'
|
||||
|
||||
def process_cmake_template_segment(segment, segment_ct, cmake_path, variables):
|
||||
prefix = None
|
||||
library = None
|
||||
set = None
|
||||
includes = []
|
||||
suffix = '_SRCS' # Appended to each group name before the platform name.
|
||||
platform_sep = ':' # Used to separate value from platform name.
|
||||
|
||||
# Extract values from |segment|. Example |segment| contents:
|
||||
# 'prefix': 'cefsimple',
|
||||
# 'includes': [
|
||||
# 'cefsimple_sources_common',
|
||||
# 'cefsimple_sources_win:WINDOWS',
|
||||
# 'cefsimple_sources_mac:MACOSX',
|
||||
# 'cefsimple_sources_linux:LINUX',
|
||||
# ],
|
||||
values = eval('{' + segment + '}', {'__builtins__': None}, None)
|
||||
if 'prefix' in values:
|
||||
prefix = values['prefix']
|
||||
else:
|
||||
raise Exception('Missing prefix value in segment %d' % segment_ct)
|
||||
|
||||
if 'library' in values:
|
||||
library = values['library']
|
||||
|
||||
if 'set' in values:
|
||||
set = values['set']
|
||||
|
||||
if 'includes' in values and len(values['includes']) > 0:
|
||||
for include in values['includes']:
|
||||
parts = include.strip().split(platform_sep)
|
||||
files = get_files_for_variable(cmake_path, variables, parts[0])
|
||||
if len(parts) == 2:
|
||||
# Append the platform to each file path.
|
||||
files = [file + platform_sep + parts[1] for file in files]
|
||||
includes.extend(files)
|
||||
else:
|
||||
raise Exception('Missing includes value in segment %d' % segment_ct)
|
||||
|
||||
# Sort the file paths alphabetically.
|
||||
includes.sort()
|
||||
|
||||
# Group files by path.
|
||||
# For example, '../include/base/foo.h' and '../include/base/bar.h' will be
|
||||
# grouped as 'PREFIX_INCLUDE_BASE'.
|
||||
groups = {}
|
||||
for include in includes:
|
||||
paths = include.split('/')
|
||||
label = prefix
|
||||
for path in paths[0:-1]:
|
||||
if path == '..':
|
||||
continue
|
||||
label += '_' + path
|
||||
label = label.replace('.', '_').upper()
|
||||
if not label in groups:
|
||||
groups[label] = []
|
||||
groups[label].append(include)
|
||||
|
||||
# Create the output results.
|
||||
result = ''
|
||||
|
||||
keys = sorted(groups.keys())
|
||||
for key in keys:
|
||||
# Add a group of files that share the same path.
|
||||
result += format_cmake_group(cmake_path, key + suffix, groups[key], \
|
||||
platform_sep)
|
||||
|
||||
if not library is None:
|
||||
# Add the library declaration if requested.
|
||||
result += format_cmake_library(library, [key + suffix for key in keys])
|
||||
|
||||
if not set is None:
|
||||
# Add the set declaration if requested.
|
||||
result += format_cmake_set(set, \
|
||||
['${' + key + suffix + '}' for key in keys])
|
||||
|
||||
return result.strip()
|
||||
|
||||
def process_cmake_template(input, output, variables, quiet = False):
|
||||
""" Reads the |input| template, parses variable substitution sections and
|
||||
writes |output|. """
|
||||
if not quiet:
|
||||
sys.stdout.write('Processing "%s" to "%s"...\n' % (input, output))
|
||||
|
||||
if not os.path.exists(input):
|
||||
raise Exception('File %s does not exist' % input)
|
||||
|
||||
cmake_path = normalize_path(os.path.abspath(input))
|
||||
template = read_file(cmake_path)
|
||||
|
||||
delim_start = '{{'
|
||||
delim_end = '}}'
|
||||
|
||||
# Process the template file, replacing segments delimited by |delim_start|
|
||||
# and |delim_end|.
|
||||
result = ''
|
||||
end = 0
|
||||
segment_ct = 0
|
||||
while True:
|
||||
start = template.find(delim_start, end)
|
||||
if start == -1:
|
||||
break
|
||||
result += template[end:start]
|
||||
end = template.find(delim_end, start + len(delim_start))
|
||||
if end == -1:
|
||||
break
|
||||
segment = template[start + len(delim_start):end]
|
||||
segment_ct = segment_ct + 1
|
||||
result += process_cmake_template_segment(segment, segment_ct, \
|
||||
cmake_path, variables)
|
||||
end += len(delim_end)
|
||||
result += template[end:]
|
||||
|
||||
# Only write the output file if the contents have changed.
|
||||
changed = True
|
||||
if os.path.exists(output):
|
||||
existing = read_file(output)
|
||||
changed = result != existing
|
||||
if changed:
|
||||
write_file(output, result)
|
||||
|
||||
def read_gypi_variables(source):
|
||||
""" Read the |source| gypi file and extract the variables section. """
|
||||
path = os.path.join(cef_dir, source + '.gypi')
|
||||
if not os.path.exists(path):
|
||||
raise Exception('File %s does not exist' % path)
|
||||
contents = eval_file(path)
|
||||
if not 'variables' in contents:
|
||||
raise Exception('File %s does not have a variables section' % path)
|
||||
return contents['variables']
|
||||
|
||||
# File entry point.
|
||||
if __name__ == "__main__":
|
||||
# Verify that the correct number of command-line arguments are provided.
|
||||
if len(sys.argv) != 3:
|
||||
sys.stderr.write('Usage: '+sys.argv[0]+' <infile> <outfile>')
|
||||
sys.exit()
|
||||
|
||||
# Read the gypi files and combine into a single dictionary.
|
||||
variables1 = read_gypi_variables('cef_paths')
|
||||
variables2 = read_gypi_variables('cef_paths2')
|
||||
variables = dict(variables1.items() + variables2.items())
|
||||
|
||||
# Process the cmake template.
|
||||
process_cmake_template(sys.argv[1], sys.argv[2], variables)
|
|
@ -5,6 +5,7 @@
|
|||
from date_util import *
|
||||
from file_util import *
|
||||
from gclient_util import *
|
||||
from make_cmake import process_cmake_template
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
import re
|
||||
|
@ -115,10 +116,6 @@ def create_readme():
|
|||
if not options.quiet:
|
||||
sys.stdout.write('Creating README.TXT file.\n')
|
||||
|
||||
def eval_file(src):
|
||||
""" Loads and evaluates the contents of the specified file. """
|
||||
return eval(read_file(src), {'__builtins__': None}, None)
|
||||
|
||||
def transfer_gypi_files(src_dir, gypi_paths, gypi_path_prefix, dst_dir, quiet):
|
||||
""" Transfer files from one location to another. """
|
||||
for path in gypi_paths:
|
||||
|
@ -511,6 +508,24 @@ if mode == 'standard':
|
|||
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/transfer.cfg'), \
|
||||
output_dir, options.quiet)
|
||||
|
||||
# process cmake templates
|
||||
variables = dict(cef_paths.items() + cef_paths2.items())
|
||||
process_cmake_template(os.path.join(cef_dir, 'CMakeLists.txt.in'), \
|
||||
os.path.join(output_dir, 'CMakeLists.txt'), \
|
||||
variables, options.quiet)
|
||||
process_cmake_template(os.path.join(cef_dir, 'macros.cmake.in'), \
|
||||
os.path.join(output_dir, 'macros.cmake'), \
|
||||
variables, options.quiet)
|
||||
process_cmake_template(os.path.join(cef_dir, 'libcef_dll', 'CMakeLists.txt.in'), \
|
||||
os.path.join(output_dir, 'libcef_dll', 'CMakeLists.txt'), \
|
||||
variables, options.quiet)
|
||||
process_cmake_template(os.path.join(cef_dir, 'tests', 'cefclient', 'CMakeLists.txt.in'), \
|
||||
os.path.join(output_dir, 'cefclient', 'CMakeLists.txt'), \
|
||||
variables, options.quiet)
|
||||
process_cmake_template(os.path.join(cef_dir, 'tests', 'cefsimple', 'CMakeLists.txt.in'), \
|
||||
os.path.join(output_dir, 'cefsimple', 'CMakeLists.txt'), \
|
||||
variables, options.quiet)
|
||||
|
||||
if platform == 'windows':
|
||||
binaries = [
|
||||
'd3dcompiler_46.dll',
|
||||
|
|
Loading…
Reference in New Issue