Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions cmake/DaemonArchitecture.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,28 @@ endif()

# Quotes cannot be part of the define as support for them is not reliable.
add_definitions(-DNACL_ARCH_STRING=${NACL_ARCH})

option(USE_ARCH_INTRINSICS "Enable custom code using intrinsics functions or asm declarations" ON)
mark_as_advanced(USE_ARCH_INTRINSICS)

macro(set_arch_intrinsics name)
if (USE_ARCH_INTRINSICS)
message(STATUS "Enabling ${name} architecture intrinsics")
add_definitions(-DDAEMON_USE_ARCH_INTRINSICS_${name}=1)
else()
message(STATUS "Disabling ${name} architecture intrinsics")
endif()
endmacro()

if (USE_ARCH_INTRINSICS)
add_definitions(-DDAEMON_USE_ARCH_INTRINSICS=1)
endif()

set_arch_intrinsics(${ARCH})

set(amd64_PARENT "i686")
set(arm64_PARENT "armhf")

if (${ARCH}_PARENT)
set_arch_intrinsics(${${ARCH}_PARENT})
endif()
23 changes: 23 additions & 0 deletions cmake/DaemonFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ include(CheckCXXCompilerFlag)

add_definitions(-DDAEMON_BUILD_${CMAKE_BUILD_TYPE})

option(USE_COMPILER_INTRINSICS "Enable usage of compiler intrinsics" ON)
mark_as_advanced(USE_COMPILER_INTRINSICS)

if (USE_COMPILER_INTRINSICS)
add_definitions(-DDAEMON_USE_COMPILER_INTRINSICS=1)
message(STATUS "Enabling compiler intrinsics")
else()
message(STATUS "Disabling compiler intrinsics")
endif()

option(USE_COMPILER_CUSTOMIZATION "Enable usage of compiler custom attributes and operators" ON)
mark_as_advanced(USE_COMPILER_CUSTOMIZATION)

if (USE_COMPILER_CUSTOMIZATION)
add_definitions(-DDAEMON_USE_COMPILER_CUSTOMIZATION=1)
message(STATUS "Enabling compiler custom attributes and operators")
else()
message(STATUS "Disabling compiler custom attributes and operators")
endif()

# Set flag without checking, optional argument specifies build type
macro(set_c_flag FLAG)
if (${ARGC} GREATER 1)
Expand Down Expand Up @@ -133,6 +153,9 @@ if (MSVC)
set_c_cxx_flag("/fp:fast")
set_c_cxx_flag("/d2Zi+" RELWITHDEBINFO)

# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
set_cxx_flag("/Zc:__cplusplus")

# At least Ninja doesn't remove the /W3 flag when we add /W4|/Wall one, which
# leads to compilation warnings. Remove /W3 entirely, as /W4|/Wall be used.
foreach(flag_var
Expand Down
Loading