mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Windows: Build cef_sandbox.lib with different GN args for official binary distributions (issue #2220)
This commit is contained in:
@ -329,22 +329,13 @@ if(OS_WINDOWS)
|
||||
|
||||
# Configure use of the sandbox.
|
||||
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
||||
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900)
|
||||
# The cef_sandbox.lib static library is currently built with VS2015. It will
|
||||
# not link successfully with other VS versions.
|
||||
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900 AND NOT MSVC_VERSION EQUAL 1910)
|
||||
# The cef_sandbox.lib static library is currently built with VS2015, which
|
||||
# is compatible with VS2015 and VS2017. It will not link successfully with
|
||||
# other VS versions.
|
||||
set(USE_SANDBOX OFF)
|
||||
endif()
|
||||
|
||||
# Configure use of official build compiler settings.
|
||||
# When using an official build the "Debug" build is actually a Release build
|
||||
# with DCHECKs enabled. In order to link the sandbox the Debug build must
|
||||
# be configured with some Release-related compiler settings.
|
||||
option(USE_OFFICIAL_BUILD_SANDBOX "Enable or disable use of an official build sandbox." ON)
|
||||
if(NOT USE_SANDBOX)
|
||||
# Don't need official build settings when the sandbox is off.
|
||||
set(USE_OFFICIAL_BUILD_SANDBOX OFF)
|
||||
endif()
|
||||
|
||||
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
||||
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
||||
|
||||
@ -366,27 +357,11 @@ if(OS_WINDOWS)
|
||||
/wd4996 # Ignore "function or variable may be unsafe" warning
|
||||
${CEF_DEBUG_INFO_FLAG}
|
||||
)
|
||||
if(USE_OFFICIAL_BUILD_SANDBOX)
|
||||
# CMake adds /RTC1, /D"_DEBUG" and a few other values by default for Debug
|
||||
# builds. We can't link the sandbox with those values so clear the CMake
|
||||
# defaults here.
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
|
||||
# These flags are required to successfully link and run applications using
|
||||
# the sandbox library.
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MT # Multithreaded release runtime
|
||||
/O2 # Maximize speed optimization
|
||||
/Zc:inline # Remove unreferenced functions or data
|
||||
/Oy- # Disable frame-pointer omission
|
||||
)
|
||||
else()
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MTd # Multithreaded debug runtime
|
||||
/RTC1 # Disable optimizations
|
||||
/Od # Enable basic run-time checks
|
||||
)
|
||||
endif()
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MTd # Multithreaded debug runtime
|
||||
/RTC1 # Disable optimizations
|
||||
/Od # Enable basic run-time checks
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
||||
/MT # Multithreaded release runtime
|
||||
/O2 # Optimize for maximum speed
|
||||
@ -408,12 +383,6 @@ if(OS_WINDOWS)
|
||||
WIN32_LEAN_AND_MEAN # Exclude less common API declarations
|
||||
_HAS_EXCEPTIONS=0 # Disable exceptions
|
||||
)
|
||||
if(USE_OFFICIAL_BUILD_SANDBOX)
|
||||
list(APPEND CEF_COMPILER_DEFINES_DEBUG
|
||||
NDEBUG _NDEBUG # Not a debug build
|
||||
DCHECK_ALWAYS_ON=1 # DCHECKs are enabled
|
||||
)
|
||||
endif()
|
||||
list(APPEND CEF_COMPILER_DEFINES_RELEASE
|
||||
NDEBUG _NDEBUG # Not a debug build
|
||||
)
|
||||
@ -481,18 +450,25 @@ if(OS_WINDOWS)
|
||||
# Configure use of ATL.
|
||||
option(USE_ATL "Enable or disable use of ATL." ON)
|
||||
if(USE_ATL)
|
||||
# Locate the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER
|
||||
# may be at different directory depths depending on the toolchain version
|
||||
# (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe", etc).
|
||||
# Locate the atlmfc directory if it exists. It may be at any depth inside
|
||||
# the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER may also
|
||||
# be at different depths depending on the toolchain version
|
||||
# (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe",
|
||||
# "VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe", etc).
|
||||
set(HAS_ATLMFC 0)
|
||||
get_filename_component(VC_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||
get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
|
||||
while(NOT ${VC_DIR_NAME} STREQUAL "VC")
|
||||
get_filename_component(VC_DIR ${VC_DIR} DIRECTORY)
|
||||
if(IS_DIRECTORY "${VC_DIR}/atlmfc")
|
||||
set(HAS_ATLMFC 1)
|
||||
break()
|
||||
endif()
|
||||
get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
|
||||
endwhile()
|
||||
|
||||
# Determine if the Visual Studio install supports ATL.
|
||||
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
|
||||
if(NOT HAS_ATLMFC)
|
||||
message(WARNING "ATL is not supported by your VC installation.")
|
||||
set(USE_ATL OFF)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user