CMake configuration improvements (issue #2120)
- Windows: Fix excessive Ninja build warnings. - Windows: Fix ATL detection for different VC toolchain paths. - Windows: Fix Ninja Debug build when official build sandbox is enabled. - Update build tool version recommendations.
This commit is contained in:
parent
eea39b8413
commit
49d1fe3b30
|
@ -48,13 +48,13 @@
|
|||
# libgtkglext1-dev (required by the cefclient target only)
|
||||
#
|
||||
# - Mac OS X requirements:
|
||||
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 7.2
|
||||
# and OS X 10.11 are recommended. The Xcode command-line tools must also be
|
||||
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 8.3
|
||||
# and OS X 10.12 are recommended. The Xcode command-line tools must also be
|
||||
# installed. Only 64-bit builds are supported on OS X.
|
||||
#
|
||||
# - Windows requirements:
|
||||
# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
|
||||
# 2015 Update 2 and Windows 10 64-bit are recommended.
|
||||
# 2015 Update 3 and Windows 10 64-bit are recommended.
|
||||
#
|
||||
# BUILD EXAMPLES
|
||||
#
|
||||
|
|
|
@ -19,7 +19,7 @@ macro(PRINT_CEF_CONFIG)
|
|||
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "Project architecture: ${PROJECT_ARCH}")
|
||||
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
if(GEN_NINJA OR GEN_MAKEFILES)
|
||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
|
@ -81,8 +81,7 @@ endmacro()
|
|||
|
||||
# Determine the target output directory based on platform and generator.
|
||||
macro(SET_CEF_TARGET_OUT_DIR)
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
|
||||
${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
if(GEN_NINJA OR GEN_MAKEFILES)
|
||||
# By default Ninja and Make builds don't create a subdirectory named after
|
||||
# the configuration.
|
||||
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
|
||||
|
|
|
@ -37,9 +37,14 @@ if(NOT DEFINED PROJECT_ARCH)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
|
||||
set(GEN_NINJA 1)
|
||||
elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
set(GEN_MAKEFILES 1)
|
||||
endif()
|
||||
|
||||
# Determine the build type.
|
||||
if(NOT CMAKE_BUILD_TYPE AND
|
||||
(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles"))
|
||||
if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES))
|
||||
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
|
||||
|
@ -314,6 +319,14 @@ endif()
|
|||
#
|
||||
|
||||
if(OS_WINDOWS)
|
||||
if (GEN_NINJA)
|
||||
# When using the Ninja generator clear the CMake defaults to avoid excessive
|
||||
# console warnings (see issue #2120).
|
||||
set(CMAKE_CXX_FLAGS "")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
|
@ -359,8 +372,13 @@ if(OS_WINDOWS)
|
|||
# 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
|
||||
|
@ -463,10 +481,19 @@ 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).
|
||||
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)
|
||||
get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
|
||||
endwhile()
|
||||
|
||||
# Determine if the Visual Studio install supports ATL.
|
||||
get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||
get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY)
|
||||
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
|
||||
message(WARNING "ATL is not supported by your VC installation.")
|
||||
set(USE_ATL OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue