Пересобранный и видоизмененный conky для ОСГОС
This commit is contained in:
commit
3a48cf8c86
738 changed files with 217718 additions and 0 deletions
130
3rdparty/Vc/cmake/AddCompilerFlag.cmake
vendored
Normal file
130
3rdparty/Vc/cmake/AddCompilerFlag.cmake
vendored
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
# - Add a given compiler flag to flags variables.
|
||||
# AddCompilerFlag(<flag> [<var>])
|
||||
# or
|
||||
# AddCompilerFlag(<flag> [C_FLAGS <var>] [CXX_FLAGS <var>] [C_RESULT <var>]
|
||||
# [CXX_RESULT <var>])
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010-2015 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of contributing organizations nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
get_filename_component(_currentDir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
include("${_currentDir}/CheckCCompilerFlag.cmake")
|
||||
include("${_currentDir}/CheckCXXCompilerFlag.cmake")
|
||||
|
||||
macro(AddCompilerFlag _flag)
|
||||
string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${_flag}")
|
||||
|
||||
set(_c_flags "CMAKE_C_FLAGS")
|
||||
set(_cxx_flags "CMAKE_CXX_FLAGS")
|
||||
set(_c_result tmp)
|
||||
set(_cxx_result tmp)
|
||||
if(${ARGC} EQUAL 2)
|
||||
message(WARNING "Deprecated use of the AddCompilerFlag macro.")
|
||||
unset(_c_result)
|
||||
set(_cxx_result ${ARGV1})
|
||||
elseif(${ARGC} GREATER 2)
|
||||
set(state 0)
|
||||
unset(_c_flags)
|
||||
unset(_cxx_flags)
|
||||
unset(_c_result)
|
||||
unset(_cxx_result)
|
||||
foreach(_arg ${ARGN})
|
||||
if("x${_arg}" STREQUAL "xC_FLAGS")
|
||||
set(state 1)
|
||||
if(NOT DEFINED _c_result)
|
||||
set(_c_result tmp0)
|
||||
endif()
|
||||
elseif("x${_arg}" STREQUAL "xCXX_FLAGS")
|
||||
set(state 2)
|
||||
if(NOT DEFINED _cxx_result)
|
||||
set(_cxx_result tmp1)
|
||||
endif()
|
||||
elseif("x${_arg}" STREQUAL "xC_RESULT")
|
||||
set(state 3)
|
||||
elseif("x${_arg}" STREQUAL "xCXX_RESULT")
|
||||
set(state 4)
|
||||
elseif(state EQUAL 1)
|
||||
set(_c_flags "${_arg}")
|
||||
elseif(state EQUAL 2)
|
||||
set(_cxx_flags "${_arg}")
|
||||
elseif(state EQUAL 3)
|
||||
set(_c_result "${_arg}")
|
||||
elseif(state EQUAL 4)
|
||||
set(_cxx_result "${_arg}")
|
||||
else()
|
||||
message(FATAL_ERROR "Syntax error for AddCompilerFlag")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(_c_code "int main() { return 0; }")
|
||||
set(_cxx_code "int main() { return 0; }")
|
||||
if("${_flag}" STREQUAL "-mfma")
|
||||
# Compiling with FMA3 support may fail only at the assembler level.
|
||||
# In that case we need to have such an instruction in the test code
|
||||
set(_c_code "#include <immintrin.h>
|
||||
__m128 foo(__m128 x) { return _mm_fmadd_ps(x, x, x); }
|
||||
int main() { return 0; }")
|
||||
set(_cxx_code "${_c_code}")
|
||||
elseif("${_flag}" STREQUAL "-stdlib=libc++")
|
||||
# Compiling with libc++ not only requires a compiler that understands it, but also
|
||||
# the libc++ headers itself
|
||||
set(_cxx_code "#include <iostream>
|
||||
#include <cstdio>
|
||||
int main() { return 0; }")
|
||||
else()
|
||||
set(_cxx_code "#include <cstdio>
|
||||
int main() { return 0; }")
|
||||
endif()
|
||||
|
||||
if(DEFINED _c_result)
|
||||
check_c_compiler_flag("${_flag}" check_c_compiler_flag_${_flag_esc} "${_c_code}")
|
||||
set(${_c_result} ${check_c_compiler_flag_${_flag_esc}})
|
||||
endif()
|
||||
if(DEFINED _cxx_result)
|
||||
check_cxx_compiler_flag("${_flag}" check_cxx_compiler_flag_${_flag_esc} "${_cxx_code}")
|
||||
set(${_cxx_result} ${check_cxx_compiler_flag_${_flag_esc}})
|
||||
endif()
|
||||
|
||||
macro(my_append _list _flag _special)
|
||||
if("x${_list}" STREQUAL "x${_special}")
|
||||
set(${_list} "${${_list}} ${_flag}")
|
||||
else()
|
||||
list(APPEND ${_list} "${_flag}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(check_c_compiler_flag_${_flag_esc} AND DEFINED _c_flags)
|
||||
my_append(${_c_flags} "${_flag}" CMAKE_C_FLAGS)
|
||||
endif()
|
||||
if(check_cxx_compiler_flag_${_flag_esc} AND DEFINED _cxx_flags)
|
||||
my_append(${_cxx_flags} "${_flag}" CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
endmacro(AddCompilerFlag)
|
||||
36
3rdparty/Vc/cmake/AddTargetProperty.cmake
vendored
Normal file
36
3rdparty/Vc/cmake/AddTargetProperty.cmake
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#=============================================================================
|
||||
# Copyright 2010-2015 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the names of contributing organizations nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
macro(add_target_property _target _prop _value)
|
||||
get_target_property(_oldprop "${_target}" ${_prop})
|
||||
if(NOT _oldprop)
|
||||
set_target_properties("${_target}" PROPERTIES ${_prop} "${_value}")
|
||||
else(NOT _oldprop)
|
||||
set_target_properties("${_target}" PROPERTIES ${_prop} "${_oldprop} ${_value}")
|
||||
endif(NOT _oldprop)
|
||||
endmacro(add_target_property)
|
||||
73
3rdparty/Vc/cmake/CheckCCompilerFlag.cmake
vendored
Normal file
73
3rdparty/Vc/cmake/CheckCCompilerFlag.cmake
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# - Check whether the C compiler supports a given flag.
|
||||
# CHECK_C_COMPILER_FLAG(<flag> <var>)
|
||||
# <flag> - the compiler flag
|
||||
# <var> - variable to store the result
|
||||
# This internally calls the check_c_source_compiles macro.
|
||||
# See help for CheckCSourceCompiles for a listing of variables
|
||||
# that can modify the build.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2009 Kitware, Inc.
|
||||
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
|
||||
# Copyright 2011-2013 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of Kitware, Inc., the Insight Consortium, or the names of
|
||||
# any consortium members, or of any contributors, may not be used to
|
||||
# endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
|
||||
MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
|
||||
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
|
||||
if(${ARGC} GREATER 2)
|
||||
SET(TEST_SOURCE "${ARGV2}")
|
||||
else()
|
||||
SET(TEST_SOURCE "int main() { return 0;}")
|
||||
endif()
|
||||
CHECK_C_SOURCE_COMPILES("${TEST_SOURCE}" ${_RESULT}
|
||||
# Some compilers do not fail with a bad flag
|
||||
FAIL_REGEX "error: bad value (.*) for .* switch" # GNU
|
||||
FAIL_REGEX "argument unused during compilation" # clang
|
||||
FAIL_REGEX "is valid for .* but not for C" # GNU
|
||||
FAIL_REGEX "unrecognized .*option" # GNU
|
||||
FAIL_REGEX "ignored for target" # GNU
|
||||
FAIL_REGEX "ignoring unknown option" # MSVC
|
||||
FAIL_REGEX "warning D9002" # MSVC
|
||||
FAIL_REGEX "[Uu]nknown option" # HP
|
||||
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
|
||||
FAIL_REGEX "command option .* is not recognized" # XL
|
||||
FAIL_REGEX "WARNING: unknown flag:" # Open64
|
||||
FAIL_REGEX "command line error" # ICC
|
||||
FAIL_REGEX "command line warning" # ICC
|
||||
FAIL_REGEX "#10236:" # ICC: File not found
|
||||
FAIL_REGEX " #10159: " # ICC
|
||||
FAIL_REGEX " #10353: " # ICC: option '-mfma' ignored, suggest using '-march=core-avx2'
|
||||
)
|
||||
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
|
||||
ENDMACRO (CHECK_C_COMPILER_FLAG)
|
||||
|
||||
73
3rdparty/Vc/cmake/CheckCXXCompilerFlag.cmake
vendored
Normal file
73
3rdparty/Vc/cmake/CheckCXXCompilerFlag.cmake
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# - Check whether the CXX compiler supports a given flag.
|
||||
# CHECK_CXX_COMPILER_FLAG(<flag> <var>)
|
||||
# <flag> - the compiler flag
|
||||
# <var> - variable to store the result
|
||||
# This internally calls the check_cxx_source_compiles macro. See help
|
||||
# for CheckCXXSourceCompiles for a listing of variables that can
|
||||
# modify the build.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2009 Kitware, Inc.
|
||||
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
|
||||
# Copyright 2011-2013 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of Kitware, Inc., the Insight Consortium, or the names of
|
||||
# any consortium members, or of any contributors, may not be used to
|
||||
# endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
|
||||
SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
|
||||
if(${ARGC} GREATER 2)
|
||||
SET(TEST_SOURCE "${ARGV2}")
|
||||
else()
|
||||
SET(TEST_SOURCE "int main() { return 0;}")
|
||||
endif()
|
||||
CHECK_CXX_SOURCE_COMPILES("${TEST_SOURCE}" ${_RESULT}
|
||||
# Some compilers do not fail with a bad flag
|
||||
FAIL_REGEX "error: bad value (.*) for .* switch" # GNU
|
||||
FAIL_REGEX "argument unused during compilation" # clang
|
||||
FAIL_REGEX "is valid for .* but not for C\\\\+\\\\+" # GNU
|
||||
FAIL_REGEX "unrecognized .*option" # GNU
|
||||
FAIL_REGEX "ignored for target" # GNU
|
||||
FAIL_REGEX "ignoring unknown option" # MSVC
|
||||
FAIL_REGEX "warning D9002" # MSVC
|
||||
FAIL_REGEX "[Uu]nknown option" # HP
|
||||
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
|
||||
FAIL_REGEX "command option .* is not recognized" # XL
|
||||
FAIL_REGEX "WARNING: unknown flag:" # Open64
|
||||
FAIL_REGEX "command line error" # ICC
|
||||
FAIL_REGEX "command line warning" # ICC
|
||||
FAIL_REGEX "#10236:" # ICC: File not found
|
||||
FAIL_REGEX " #10159: " # ICC
|
||||
FAIL_REGEX " #10353: " # ICC: option '-mfma' ignored, suggest using '-march=core-avx2'
|
||||
)
|
||||
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
|
||||
ENDMACRO (CHECK_CXX_COMPILER_FLAG)
|
||||
|
||||
61
3rdparty/Vc/cmake/FindVc.cmake
vendored
Normal file
61
3rdparty/Vc/cmake/FindVc.cmake
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# Locate the Vc template library. Vc can be found at https://github.com/VcDevel/Vc
|
||||
#
|
||||
# This file is meant to be copied into projects that want to use Vc. It will
|
||||
# search for VcConfig.cmake, which ships with Vc and will provide up-to-date
|
||||
# buildsystem changes. Thus there should not be any need to update FindVc.cmake
|
||||
# again after you integrated it into your project.
|
||||
#
|
||||
# This module defines the following variables:
|
||||
# Vc_FOUND
|
||||
# Vc_INCLUDE_DIR
|
||||
# Vc_LIBRARIES
|
||||
# Vc_DEFINITIONS
|
||||
# Vc_COMPILE_FLAGS
|
||||
# Vc_ARCHITECTURE_FLAGS
|
||||
# Vc_ALL_FLAGS (the union of the above three variables)
|
||||
# Vc_VERSION_MAJOR
|
||||
# Vc_VERSION_MINOR
|
||||
# Vc_VERSION_PATCH
|
||||
# Vc_VERSION
|
||||
# Vc_VERSION_STRING
|
||||
# Vc_INSTALL_DIR
|
||||
# Vc_LIB_DIR
|
||||
# Vc_CMAKE_MODULES_DIR
|
||||
#
|
||||
# The following two variables are set according to the compiler used. Feel free
|
||||
# to use them to skip whole compilation units.
|
||||
# Vc_SSE_INTRINSICS_BROKEN
|
||||
# Vc_AVX_INTRINSICS_BROKEN
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright 2009-2015 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the names of contributing organizations nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
find_package(Vc ${Vc_FIND_VERSION} QUIET NO_MODULE PATHS $ENV{HOME} /opt/Vc)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Vc CONFIG_MODE)
|
||||
617
3rdparty/Vc/cmake/OptimizeForArchitecture.cmake
vendored
Normal file
617
3rdparty/Vc/cmake/OptimizeForArchitecture.cmake
vendored
Normal file
|
|
@ -0,0 +1,617 @@
|
|||
# Determine the host CPU feature set and determine the best set of compiler
|
||||
# flags to enable all supported SIMD relevant features. Alternatively, the
|
||||
# target CPU can be explicitly selected (for generating more generic binaries
|
||||
# or for targeting a different system).
|
||||
# Compilers provide e.g. the -march=native flag to achieve a similar result.
|
||||
# This fails to address the need for building for a different microarchitecture
|
||||
# than the current host.
|
||||
# The script tries to deduce all settings from the model and family numbers of
|
||||
# the CPU instead of reading the CPUID flags from e.g. /proc/cpuinfo. This makes
|
||||
# the detection more independent from the CPUID code in the kernel (e.g. avx2 is
|
||||
# not listed on older kernels).
|
||||
#
|
||||
# Usage:
|
||||
# OptimizeForArchitecture()
|
||||
# If either of Vc_SSE_INTRINSICS_BROKEN, Vc_AVX_INTRINSICS_BROKEN,
|
||||
# Vc_AVX2_INTRINSICS_BROKEN is defined and set, the OptimizeForArchitecture
|
||||
# macro will consequently disable the relevant features via compiler flags.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010-2016 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the names of contributing organizations nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
get_filename_component(_currentDir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
include("${_currentDir}/AddCompilerFlag.cmake")
|
||||
include(CheckIncludeFileCXX)
|
||||
|
||||
macro(_my_find _list _value _ret)
|
||||
list(FIND ${_list} "${_value}" _found)
|
||||
if(_found EQUAL -1)
|
||||
set(${_ret} FALSE)
|
||||
else(_found EQUAL -1)
|
||||
set(${_ret} TRUE)
|
||||
endif(_found EQUAL -1)
|
||||
endmacro(_my_find)
|
||||
|
||||
macro(AutodetectHostArchitecture)
|
||||
set(TARGET_ARCHITECTURE "generic")
|
||||
set(Vc_ARCHITECTURE_FLAGS)
|
||||
set(_vendor_id)
|
||||
set(_cpu_family)
|
||||
set(_cpu_model)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
file(READ "/proc/cpuinfo" _cpuinfo)
|
||||
string(REGEX REPLACE ".*vendor_id[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _vendor_id "${_cpuinfo}")
|
||||
string(REGEX REPLACE ".*cpu family[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_family "${_cpuinfo}")
|
||||
string(REGEX REPLACE ".*model[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_model "${_cpuinfo}")
|
||||
string(REGEX REPLACE ".*flags[ \t]*:[ \t]+([^\n]+).*" "\\1" _cpu_flags "${_cpuinfo}")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
exec_program("/usr/sbin/sysctl -n machdep.cpu.vendor machdep.cpu.model machdep.cpu.family machdep.cpu.features" OUTPUT_VARIABLE _sysctl_output_string)
|
||||
string(REPLACE "\n" ";" _sysctl_output ${_sysctl_output_string})
|
||||
list(GET _sysctl_output 0 _vendor_id)
|
||||
list(GET _sysctl_output 1 _cpu_model)
|
||||
list(GET _sysctl_output 2 _cpu_family)
|
||||
list(GET _sysctl_output 3 _cpu_flags)
|
||||
|
||||
string(TOLOWER "${_cpu_flags}" _cpu_flags)
|
||||
string(REPLACE "." "_" _cpu_flags "${_cpu_flags}")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
get_filename_component(_vendor_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;VendorIdentifier]" NAME CACHE)
|
||||
get_filename_component(_cpu_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;Identifier]" NAME CACHE)
|
||||
mark_as_advanced(_vendor_id _cpu_id)
|
||||
string(REGEX REPLACE ".* Family ([0-9]+) .*" "\\1" _cpu_family "${_cpu_id}")
|
||||
string(REGEX REPLACE ".* Model ([0-9]+) .*" "\\1" _cpu_model "${_cpu_id}")
|
||||
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if(_vendor_id STREQUAL "GenuineIntel")
|
||||
if(_cpu_family EQUAL 6)
|
||||
# taken from the Intel ORM
|
||||
# http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
|
||||
# CPUID Signature Values of Of Recent Intel Microarchitectures
|
||||
# 4E 5E | Skylake microarchitecture
|
||||
# 3D 47 56 | Broadwell microarchitecture
|
||||
# 3C 45 46 3F | Haswell microarchitecture
|
||||
# 3A 3E | Ivy Bridge microarchitecture
|
||||
# 2A 2D | Sandy Bridge microarchitecture
|
||||
# 25 2C 2F | Intel microarchitecture Westmere
|
||||
# 1A 1E 1F 2E | Intel microarchitecture Nehalem
|
||||
# 17 1D | Enhanced Intel Core microarchitecture
|
||||
# 0F | Intel Core microarchitecture
|
||||
#
|
||||
# Intel SDM Vol. 3C 35-1 / December 2016:
|
||||
# 57 | Xeon Phi 3200, 5200, 7200 [Knights Landing]
|
||||
# 85 | Future Xeon Phi
|
||||
# 8E 9E | 7th gen. Core [Kaby Lake]
|
||||
# 55 | Future Xeon [Skylake w/ AVX512]
|
||||
# 4E 5E | 6th gen. Core / E3 v5 [Skylake w/o AVX512]
|
||||
# 56 | Xeon D-1500 [Broadwell]
|
||||
# 4F | Xeon E5 v4, E7 v4, i7-69xx [Broadwell]
|
||||
# 47 | 5th gen. Core / Xeon E3 v4 [Broadwell]
|
||||
# 3D | M-5xxx / 5th gen. [Broadwell]
|
||||
# 3F | Xeon E5 v3, E7 v3, i7-59xx [Haswell-E]
|
||||
# 3C 45 46 | 4th gen. Core, Xeon E3 v3 [Haswell]
|
||||
# 3E | Xeon E5 v2, E7 v2, i7-49xx [Ivy Bridge-E]
|
||||
# 3A | 3rd gen. Core, Xeon E3 v2 [Ivy Bridge]
|
||||
# 2D | Xeon E5, i7-39xx [Sandy Bridge]
|
||||
# 2F | Xeon E7
|
||||
# 2A | Xeon E3, 2nd gen. Core [Sandy Bridge]
|
||||
# 2E | Xeon 7500, 6500 series
|
||||
# 25 2C | Xeon 3600, 5600 series, Core i7, i5 and i3
|
||||
#
|
||||
# Values from the Intel SDE:
|
||||
# 5C | Goldmont
|
||||
# 5A | Silvermont
|
||||
# 57 | Knights Landing
|
||||
# 66 | Cannonlake
|
||||
# 55 | Skylake Server
|
||||
# 4E | Skylake Client
|
||||
# 3C | Broadwell (likely a bug in the SDE)
|
||||
# 3C | Haswell
|
||||
if(_cpu_model EQUAL 142 OR _cpu_model EQUAL 158) # 8E, 9E
|
||||
set(TARGET_ARCHITECTURE "kaby-lake")
|
||||
elseif(_cpu_model EQUAL 106)
|
||||
set(TARGET_ARCHITECTURE "icelake")
|
||||
elseif(_cpu_model EQUAL 102)
|
||||
set(TARGET_ARCHITECTURE "cannonlake")
|
||||
elseif(_cpu_model EQUAL 87) # 57
|
||||
set(TARGET_ARCHITECTURE "knl") # Knights Landing
|
||||
elseif(_cpu_model EQUAL 92)
|
||||
set(TARGET_ARCHITECTURE "goldmont")
|
||||
elseif(_cpu_model EQUAL 90 OR _cpu_model EQUAL 76)
|
||||
set(TARGET_ARCHITECTURE "silvermont")
|
||||
elseif(_cpu_model EQUAL 85) # 55
|
||||
set(TARGET_ARCHITECTURE "skylake-avx512")
|
||||
elseif(_cpu_model EQUAL 78 OR _cpu_model EQUAL 94) # 4E, 5E
|
||||
set(TARGET_ARCHITECTURE "skylake")
|
||||
elseif(_cpu_model EQUAL 61 OR _cpu_model EQUAL 71 OR _cpu_model EQUAL 79 OR _cpu_model EQUAL 86) # 3D, 47, 4F, 56
|
||||
set(TARGET_ARCHITECTURE "broadwell")
|
||||
elseif(_cpu_model EQUAL 60 OR _cpu_model EQUAL 69 OR _cpu_model EQUAL 70 OR _cpu_model EQUAL 63)
|
||||
set(TARGET_ARCHITECTURE "haswell")
|
||||
elseif(_cpu_model EQUAL 58 OR _cpu_model EQUAL 62)
|
||||
set(TARGET_ARCHITECTURE "ivy-bridge")
|
||||
elseif(_cpu_model EQUAL 42 OR _cpu_model EQUAL 45)
|
||||
set(TARGET_ARCHITECTURE "sandy-bridge")
|
||||
elseif(_cpu_model EQUAL 37 OR _cpu_model EQUAL 44 OR _cpu_model EQUAL 47)
|
||||
set(TARGET_ARCHITECTURE "westmere")
|
||||
elseif(_cpu_model EQUAL 26 OR _cpu_model EQUAL 30 OR _cpu_model EQUAL 31 OR _cpu_model EQUAL 46)
|
||||
set(TARGET_ARCHITECTURE "nehalem")
|
||||
elseif(_cpu_model EQUAL 23 OR _cpu_model EQUAL 29)
|
||||
set(TARGET_ARCHITECTURE "penryn")
|
||||
elseif(_cpu_model EQUAL 15)
|
||||
set(TARGET_ARCHITECTURE "merom")
|
||||
elseif(_cpu_model EQUAL 28)
|
||||
set(TARGET_ARCHITECTURE "atom")
|
||||
elseif(_cpu_model EQUAL 14)
|
||||
set(TARGET_ARCHITECTURE "core")
|
||||
elseif(_cpu_model LESS 14)
|
||||
message(WARNING "Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the generic CPU settings with SSE2.")
|
||||
set(TARGET_ARCHITECTURE "generic")
|
||||
else()
|
||||
message(WARNING "Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the 65nm Core 2 CPU settings.")
|
||||
set(TARGET_ARCHITECTURE "merom")
|
||||
endif()
|
||||
elseif(_cpu_family EQUAL 7) # Itanium (not supported)
|
||||
message(WARNING "Your CPU (Itanium: family ${_cpu_family}, model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.")
|
||||
elseif(_cpu_family EQUAL 15) # NetBurst
|
||||
list(APPEND _available_vector_units_list "sse" "sse2")
|
||||
if(_cpu_model GREATER 2) # Not sure whether this must be 3 or even 4 instead
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3")
|
||||
endif(_cpu_model GREATER 2)
|
||||
else()
|
||||
message(WARNING "Your CPU family ${_cpu_family} (vendor ${_vendor_id} model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.")
|
||||
endif()
|
||||
elseif(_vendor_id STREQUAL "AuthenticAMD")
|
||||
if(_cpu_family EQUAL 25)
|
||||
set(TARGET_ARCHITECTURE "zen3")
|
||||
elseif(_cpu_family EQUAL 23)
|
||||
set(TARGET_ARCHITECTURE "zen")
|
||||
elseif(_cpu_family EQUAL 22) # 16h
|
||||
set(TARGET_ARCHITECTURE "AMD 16h")
|
||||
elseif(_cpu_family EQUAL 21) # 15h
|
||||
if(_cpu_model LESS 2)
|
||||
set(TARGET_ARCHITECTURE "bulldozer")
|
||||
else()
|
||||
set(TARGET_ARCHITECTURE "piledriver")
|
||||
endif()
|
||||
elseif(_cpu_family EQUAL 20) # 14h
|
||||
set(TARGET_ARCHITECTURE "AMD 14h")
|
||||
elseif(_cpu_family EQUAL 18) # 12h
|
||||
elseif(_cpu_family EQUAL 16) # 10h
|
||||
set(TARGET_ARCHITECTURE "barcelona")
|
||||
elseif(_cpu_family EQUAL 15)
|
||||
set(TARGET_ARCHITECTURE "k8")
|
||||
if(_cpu_model GREATER 64) # I don't know the right number to put here. This is just a guess from the hardware I have access to
|
||||
set(TARGET_ARCHITECTURE "k8-sse3")
|
||||
endif(_cpu_model GREATER 64)
|
||||
else()
|
||||
message(WARNING "Your CPU family ${_cpu_family} (vendor ${_vendor_id} model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(OptimizeForArchitecture)
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|AMD64)")
|
||||
OptimizeForArchitectureX86()
|
||||
else()
|
||||
message(STATUS "No support for auto-detection of the target instruction set/extension")
|
||||
set(TARGET_ARCHITECTURE "unused" CACHE STRING "CPU architecture to optimize for. (unused)")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(OptimizeForArchitectureX86)
|
||||
set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. \
|
||||
Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used. \
|
||||
Setting the value to \"auto\" will try to optimize for the architecture where cmake is called. \
|
||||
Other supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Core2), \
|
||||
\"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"ivy-bridge\", \
|
||||
\"haswell\", \"broadwell\", \"skylake\", \"skylake-xeon\", \"kaby-lake\", \"cannonlake\", \"icelake\", \"silvermont\", \
|
||||
\"goldmont\", \"knl\" (Knights Landing), \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \
|
||||
\"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\", \"piledriver\", \
|
||||
\"AMD 14h\", \"AMD 16h\", \"zen\", \"zen3\", \"x86-64\", \"x86-64-v2\", \"x86-64-v3\", \"x86-64-v4\".")
|
||||
set(_force)
|
||||
if(NOT _last_target_arch STREQUAL "${TARGET_ARCHITECTURE}")
|
||||
message(STATUS "target changed from \"${_last_target_arch}\" to \"${TARGET_ARCHITECTURE}\"")
|
||||
set(_force FORCE)
|
||||
endif()
|
||||
set(_last_target_arch "${TARGET_ARCHITECTURE}" CACHE STRING "" FORCE)
|
||||
mark_as_advanced(_last_target_arch)
|
||||
string(TOLOWER "${TARGET_ARCHITECTURE}" TARGET_ARCHITECTURE)
|
||||
|
||||
set(_march_flag_list)
|
||||
set(_available_vector_units_list)
|
||||
|
||||
if(TARGET_ARCHITECTURE STREQUAL "auto")
|
||||
AutodetectHostArchitecture()
|
||||
message(STATUS "Detected CPU: ${TARGET_ARCHITECTURE}")
|
||||
endif(TARGET_ARCHITECTURE STREQUAL "auto")
|
||||
|
||||
macro(_nehalem)
|
||||
list(APPEND _march_flag_list "nehalem")
|
||||
list(APPEND _march_flag_list "corei7")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2")
|
||||
endmacro()
|
||||
macro(_westmere)
|
||||
list(APPEND _march_flag_list "westmere")
|
||||
_nehalem()
|
||||
endmacro()
|
||||
macro(_sandybridge)
|
||||
list(APPEND _march_flag_list "sandybridge")
|
||||
list(APPEND _march_flag_list "corei7-avx")
|
||||
_westmere()
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx")
|
||||
endmacro()
|
||||
macro(_ivybridge)
|
||||
list(APPEND _march_flag_list "ivybridge")
|
||||
list(APPEND _march_flag_list "core-avx-i")
|
||||
_sandybridge()
|
||||
list(APPEND _available_vector_units_list "rdrnd" "f16c")
|
||||
endmacro()
|
||||
macro(_haswell)
|
||||
list(APPEND _march_flag_list "haswell")
|
||||
list(APPEND _march_flag_list "core-avx2")
|
||||
_ivybridge()
|
||||
list(APPEND _available_vector_units_list "avx2" "fma" "bmi" "bmi2")
|
||||
endmacro()
|
||||
macro(_broadwell)
|
||||
list(APPEND _march_flag_list "broadwell")
|
||||
_haswell()
|
||||
endmacro()
|
||||
macro(_skylake)
|
||||
list(APPEND _march_flag_list "skylake")
|
||||
_broadwell()
|
||||
endmacro()
|
||||
macro(_skylake_avx512)
|
||||
list(APPEND _march_flag_list "skylake-avx512")
|
||||
_skylake()
|
||||
list(APPEND _available_vector_units_list "avx512f" "avx512cd" "avx512dq" "avx512bw" "avx512vl")
|
||||
endmacro()
|
||||
macro(_cannonlake)
|
||||
list(APPEND _march_flag_list "cannonlake")
|
||||
_skylake_avx512()
|
||||
list(APPEND _available_vector_units_list "avx512ifma" "avx512vbmi")
|
||||
endmacro()
|
||||
macro(_knightslanding)
|
||||
list(APPEND _march_flag_list "knl")
|
||||
_broadwell()
|
||||
list(APPEND _available_vector_units_list "avx512f" "avx512pf" "avx512er" "avx512cd")
|
||||
endmacro()
|
||||
macro(_silvermont)
|
||||
list(APPEND _march_flag_list "silvermont")
|
||||
_westmere()
|
||||
list(APPEND _available_vector_units_list "rdrnd")
|
||||
endmacro()
|
||||
macro(_goldmont)
|
||||
list(APPEND _march_flag_list "goldmont")
|
||||
_silvermont()
|
||||
endmacro()
|
||||
macro(_x86_64)
|
||||
list(APPEND _march_flag_list "x86-64")
|
||||
list(APPEND _march_flag_list "sse" "sse2")
|
||||
endmacro()
|
||||
macro(_x86_64_v2)
|
||||
list(APPEND _march_flag_list "x86-64-v2")
|
||||
_x86_64()
|
||||
list(APPEND _march_flag_list "sse3" "sse4.1" "sse4.2" "ssse3")
|
||||
endmacro()
|
||||
macro(_x86_64_v3)
|
||||
list(APPEND _march_flag_list "x86-64-v3")
|
||||
_x86_64_v2()
|
||||
list(APPEND _march_flag_list "avx" "avx2" "bmi" "bmi2" "f16c" "fma")
|
||||
endmacro()
|
||||
macro(_x86_64_v4)
|
||||
list(APPEND _march_flag_list "x86-64-v4")
|
||||
_x86_64_v3()
|
||||
list(APPEND _march_flag_list "avx512f" "avx512bw" "avx512cd" "avx512dq" "avx512vl")
|
||||
endmacro()
|
||||
|
||||
if(TARGET_ARCHITECTURE STREQUAL "core")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "merom")
|
||||
list(APPEND _march_flag_list "merom")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "penryn")
|
||||
list(APPEND _march_flag_list "penryn")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3")
|
||||
message(STATUS "Sadly the Penryn architecture exists in variants with SSE4.1 and without SSE4.1.")
|
||||
if(_cpu_flags MATCHES "sse4_1")
|
||||
message(STATUS "SSE4.1: enabled (auto-detected from this computer's CPU flags)")
|
||||
list(APPEND _available_vector_units_list "sse4.1")
|
||||
else()
|
||||
message(STATUS "SSE4.1: disabled (auto-detected from this computer's CPU flags)")
|
||||
endif()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "knl")
|
||||
_knightslanding()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "icelake")
|
||||
_cannonlake()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "cannonlake")
|
||||
_cannonlake()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "kaby-lake")
|
||||
_skylake()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "skylake-xeon" OR TARGET_ARCHITECTURE STREQUAL "skylake-avx512")
|
||||
_skylake_avx512()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "skylake")
|
||||
_skylake()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "broadwell")
|
||||
_broadwell()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "haswell")
|
||||
_haswell()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "ivy-bridge")
|
||||
_ivybridge()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "sandy-bridge")
|
||||
_sandybridge()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "westmere")
|
||||
_westmere()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "nehalem")
|
||||
_nehalem()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "goldmont")
|
||||
_goldmont()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "silvermont")
|
||||
_silvermont()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "atom")
|
||||
list(APPEND _march_flag_list "atom")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "k8")
|
||||
list(APPEND _march_flag_list "k8")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "k8-sse3")
|
||||
list(APPEND _march_flag_list "k8-sse3")
|
||||
list(APPEND _march_flag_list "k8")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "AMD 16h")
|
||||
list(APPEND _march_flag_list "btver2")
|
||||
list(APPEND _march_flag_list "btver1")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a" "sse4.1" "sse4.2" "avx" "f16c")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "AMD 14h")
|
||||
list(APPEND _march_flag_list "btver1")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "zen")
|
||||
list(APPEND _march_flag_list "znver1")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a" "sse4.1" "sse4.2" "avx" "avx2" "fma" "f16c" "bmi" "bmi2")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "zen3")
|
||||
list(APPEND _march_flag_list "znver3")
|
||||
list(APPEND _march_flag_list "znver2")
|
||||
list(APPEND _march_flag_list "znver1")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a" "sse4.1" "sse4.2" "avx" "avx2" "fma" "f16c" "bmi" "bmi2")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "piledriver")
|
||||
list(APPEND _march_flag_list "bdver2")
|
||||
list(APPEND _march_flag_list "bdver1")
|
||||
list(APPEND _march_flag_list "bulldozer")
|
||||
list(APPEND _march_flag_list "barcelona")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a" "sse4.1" "sse4.2" "avx" "xop" "fma4" "fma" "f16c")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "interlagos")
|
||||
list(APPEND _march_flag_list "bdver1")
|
||||
list(APPEND _march_flag_list "bulldozer")
|
||||
list(APPEND _march_flag_list "barcelona")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a" "sse4.1" "sse4.2" "avx" "xop" "fma4")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "bulldozer")
|
||||
list(APPEND _march_flag_list "bdver1")
|
||||
list(APPEND _march_flag_list "bulldozer")
|
||||
list(APPEND _march_flag_list "barcelona")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a" "sse4.1" "sse4.2" "avx" "xop" "fma4")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "barcelona")
|
||||
list(APPEND _march_flag_list "barcelona")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "sse4a")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "istanbul")
|
||||
list(APPEND _march_flag_list "barcelona")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "sse4a")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "magny-cours")
|
||||
list(APPEND _march_flag_list "barcelona")
|
||||
list(APPEND _march_flag_list "core2")
|
||||
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "sse4a")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64")
|
||||
_x86_64()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64-v2")
|
||||
_x86_64_v2()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64-v3")
|
||||
_x86_64_v3()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "x86-64-v4")
|
||||
_x86_64_v4()
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "generic")
|
||||
list(APPEND _march_flag_list "generic")
|
||||
elseif(TARGET_ARCHITECTURE STREQUAL "none")
|
||||
# add this clause to remove it from the else clause
|
||||
else(TARGET_ARCHITECTURE STREQUAL "core")
|
||||
message(FATAL_ERROR "Unknown target architecture: \"${TARGET_ARCHITECTURE}\". Please set TARGET_ARCHITECTURE to a supported value.")
|
||||
endif(TARGET_ARCHITECTURE STREQUAL "core")
|
||||
|
||||
if(NOT TARGET_ARCHITECTURE STREQUAL "none")
|
||||
set(_disable_vector_unit_list)
|
||||
set(_enable_vector_unit_list)
|
||||
if(DEFINED Vc_AVX_INTRINSICS_BROKEN AND Vc_AVX_INTRINSICS_BROKEN)
|
||||
UserWarning("AVX disabled per default because of old/broken toolchain")
|
||||
set(_avx_broken true)
|
||||
set(_avx2_broken true)
|
||||
set(_fma4_broken true)
|
||||
set(_xop_broken true)
|
||||
else()
|
||||
set(_avx_broken false)
|
||||
if(DEFINED Vc_FMA4_INTRINSICS_BROKEN AND Vc_FMA4_INTRINSICS_BROKEN)
|
||||
set(_fma4_broken true)
|
||||
else()
|
||||
set(_fma4_broken false)
|
||||
endif()
|
||||
if(DEFINED Vc_XOP_INTRINSICS_BROKEN AND Vc_XOP_INTRINSICS_BROKEN)
|
||||
set(_xop_broken true)
|
||||
else()
|
||||
set(_xop_broken false)
|
||||
endif()
|
||||
if(DEFINED Vc_AVX2_INTRINSICS_BROKEN AND Vc_AVX2_INTRINSICS_BROKEN)
|
||||
UserWarning("AVX2 disabled per default because of old/broken toolchain")
|
||||
set(_avx2_broken true)
|
||||
else()
|
||||
set(_avx2_broken false)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(_enable_or_disable _name _flag _documentation _broken)
|
||||
if(_broken)
|
||||
set(_found false)
|
||||
else()
|
||||
_my_find(_available_vector_units_list "${_flag}" _found)
|
||||
endif()
|
||||
set(USE_${_name} ${_found} CACHE BOOL "${documentation}" ${_force})
|
||||
mark_as_advanced(USE_${_name})
|
||||
if(USE_${_name})
|
||||
list(APPEND _enable_vector_unit_list "${_flag}")
|
||||
else()
|
||||
list(APPEND _disable_vector_unit_list "${_flag}")
|
||||
endif()
|
||||
endmacro()
|
||||
_enable_or_disable(SSE2 "sse2" "Use SSE2. If SSE2 instructions are not enabled the SSE implementation will be disabled." false)
|
||||
_enable_or_disable(SSE3 "sse3" "Use SSE3. If SSE3 instructions are not enabled they will be emulated." false)
|
||||
_enable_or_disable(SSSE3 "ssse3" "Use SSSE3. If SSSE3 instructions are not enabled they will be emulated." false)
|
||||
_enable_or_disable(SSE4_1 "sse4.1" "Use SSE4.1. If SSE4.1 instructions are not enabled they will be emulated." false)
|
||||
_enable_or_disable(SSE4_2 "sse4.2" "Use SSE4.2. If SSE4.2 instructions are not enabled they will be emulated." false)
|
||||
_enable_or_disable(SSE4a "sse4a" "Use SSE4a. If SSE4a instructions are not enabled they will be emulated." false)
|
||||
_enable_or_disable(AVX "avx" "Use AVX. This will all floating-point vector sizes relative to SSE." _avx_broken)
|
||||
_enable_or_disable(FMA "fma" "Use FMA." _avx_broken)
|
||||
_enable_or_disable(BMI2 "bmi2" "Use BMI2." _avx_broken)
|
||||
_enable_or_disable(AVX2 "avx2" "Use AVX2. This will double all of the vector sizes relative to SSE." _avx2_broken)
|
||||
_enable_or_disable(XOP "xop" "Use XOP." _xop_broken)
|
||||
_enable_or_disable(FMA4 "fma4" "Use FMA4." _fma4_broken)
|
||||
_enable_or_disable(AVX512F "avx512f" "Use AVX512F. This will double all floating-point vector sizes relative to AVX2." false)
|
||||
_enable_or_disable(AVX512VL "avx512vl" "Use AVX512VL. This enables 128- and 256-bit vector length instructions with EVEX coding (improved write-masking & more vector registers)." _avx2_broken)
|
||||
_enable_or_disable(AVX512PF "avx512pf" "Use AVX512PF. This enables prefetch instructions for gathers and scatters." false)
|
||||
_enable_or_disable(AVX512ER "avx512er" "Use AVX512ER. This enables exponential and reciprocal instructions." false)
|
||||
_enable_or_disable(AVX512CD "avx512cd" "Use AVX512CD." false)
|
||||
_enable_or_disable(AVX512DQ "avx512dq" "Use AVX512DQ." false)
|
||||
_enable_or_disable(AVX512BW "avx512bw" "Use AVX512BW." false)
|
||||
_enable_or_disable(AVX512IFMA "avx512ifma" "Use AVX512IFMA." false)
|
||||
_enable_or_disable(AVX512VBMI "avx512vbmi" "Use AVX512VBMI." false)
|
||||
|
||||
if(MSVC)
|
||||
# SSE2 is enabled by default in MSVC
|
||||
|
||||
_my_find(_enable_vector_unit_list "avx2" _found)
|
||||
if(_found)
|
||||
AddCompilerFlag("/arch:AVX2" CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _found)
|
||||
else()
|
||||
_my_find(_enable_vector_unit_list "avx" _found)
|
||||
if(_found)
|
||||
AddCompilerFlag("/arch:AVX" CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _found)
|
||||
endif()
|
||||
endif()
|
||||
foreach(_flag ${_enable_vector_unit_list})
|
||||
string(TOUPPER "${_flag}" _flag)
|
||||
string(REPLACE "." "_" _flag "__${_flag}__")
|
||||
add_definitions("-D${_flag}")
|
||||
endforeach(_flag)
|
||||
elseif(CMAKE_CXX_COMPILER MATCHES "/(icpc|icc)$") # ICC (on Linux)
|
||||
set(OFA_map_knl "-xMIC-AVX512")
|
||||
set(OFA_map_icelake "-xCORE-AVX512")
|
||||
set(OFA_map_cannonlake "-xCORE-AVX512")
|
||||
set(OFA_map_skylake-avx512 "-xCORE-AVX512")
|
||||
set(OFA_map_skylake "-xCORE-AVX2")
|
||||
set(OFA_map_broadwell "-xCORE-AVX2")
|
||||
set(OFA_map_haswell "-xCORE-AVX2")
|
||||
set(OFA_map_ivybridge "-xCORE-AVX-I")
|
||||
set(OFA_map_sandybridge "-xAVX")
|
||||
set(OFA_map_westmere "-xSSE4.2")
|
||||
set(OFA_map_nehalem "-xSSE4.2")
|
||||
set(OFA_map_penryn "-xSSSE3")
|
||||
set(OFA_map_merom "-xSSSE3")
|
||||
set(OFA_map_core2 "-xSSE3")
|
||||
set(OFA_map_znver3 "-mavx2") # -xAVX2 does not work and causes this runtime check to appear:
|
||||
set(OFA_map_znver2 "-mavx2") # Please verify that both the operating system and the processor support Intel(R) X87, CMOV, MMX, FXSAVE, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, MOVBE, POPCNT, AVX, F16C, FMA, BMI, LZCNT and AVX2 instructions.
|
||||
set(OFA_map_znver1 "-mavx2")
|
||||
set(_ok FALSE)
|
||||
foreach(arch ${_march_flag_list})
|
||||
if(DEFINED OFA_map_${arch})
|
||||
AddCompilerFlag(${OFA_map_${arch}} CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _ok)
|
||||
if(_ok)
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
if(NOT _ok)
|
||||
# This is the Intel compiler, so SSE2 is a very reasonable baseline.
|
||||
message(STATUS "Did not recognize the requested architecture flag, falling back to SSE2")
|
||||
AddCompilerFlag("-xSSE2" CXX_FLAGS Vc_ARCHITECTURE_FLAGS)
|
||||
endif()
|
||||
else() # not MSVC and not ICC => GCC, Clang, Open64
|
||||
foreach(_flag ${_march_flag_list})
|
||||
AddCompilerFlag("-march=${_flag}" CXX_RESULT _good CXX_FLAGS Vc_ARCHITECTURE_FLAGS)
|
||||
if(_good)
|
||||
break()
|
||||
endif(_good)
|
||||
endforeach(_flag)
|
||||
foreach(_flag ${_enable_vector_unit_list})
|
||||
AddCompilerFlag("-m${_flag}" CXX_RESULT _result)
|
||||
if(_result)
|
||||
set(_header FALSE)
|
||||
if(_flag STREQUAL "sse3")
|
||||
set(_header "pmmintrin.h")
|
||||
elseif(_flag STREQUAL "ssse3")
|
||||
set(_header "tmmintrin.h")
|
||||
elseif(_flag STREQUAL "sse4.1")
|
||||
set(_header "smmintrin.h")
|
||||
elseif(_flag STREQUAL "sse4.2")
|
||||
set(_header "smmintrin.h")
|
||||
elseif(_flag STREQUAL "sse4a")
|
||||
set(_header "ammintrin.h")
|
||||
elseif(_flag STREQUAL "avx")
|
||||
set(_header "immintrin.h")
|
||||
elseif(_flag STREQUAL "avx2")
|
||||
set(_header "immintrin.h")
|
||||
elseif(_flag STREQUAL "fma4")
|
||||
set(_header "x86intrin.h")
|
||||
elseif(_flag STREQUAL "xop")
|
||||
set(_header "x86intrin.h")
|
||||
endif()
|
||||
set(_resultVar "HAVE_${_header}")
|
||||
string(REPLACE "." "_" _resultVar "${_resultVar}")
|
||||
if(_header)
|
||||
CHECK_INCLUDE_FILE_CXX("${_header}" ${_resultVar} "-m${_flag}")
|
||||
if(NOT ${_resultVar})
|
||||
set(_useVar "USE_${_flag}")
|
||||
string(TOUPPER "${_useVar}" _useVar)
|
||||
string(REPLACE "." "_" _useVar "${_useVar}")
|
||||
message(STATUS "disabling ${_useVar} because ${_header} is missing")
|
||||
set(${_useVar} FALSE)
|
||||
list(APPEND _disable_vector_unit_list "${_flag}")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT _header OR ${_resultVar})
|
||||
list(APPEND Vc_ARCHITECTURE_FLAGS "-m${_flag}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach(_flag)
|
||||
foreach(_flag ${_disable_vector_unit_list})
|
||||
AddCompilerFlag("-mno-${_flag}" CXX_FLAGS Vc_ARCHITECTURE_FLAGS)
|
||||
endforeach(_flag)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
9
3rdparty/Vc/cmake/UserWarning.cmake
vendored
Normal file
9
3rdparty/Vc/cmake/UserWarning.cmake
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
macro(UserWarning _msg)
|
||||
if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
|
||||
# developer (non-dashboard) build
|
||||
message(WARNING "${_msg}")
|
||||
else()
|
||||
# dashboard build
|
||||
message(STATUS "${_msg}")
|
||||
endif()
|
||||
endmacro()
|
||||
30
3rdparty/Vc/cmake/VcConfig.cmake.in
vendored
Normal file
30
3rdparty/Vc/cmake/VcConfig.cmake.in
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
### General variables for project discovery/inspection
|
||||
set_and_check(@PROJECT_NAME@_INSTALL_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@)
|
||||
set_and_check(@PROJECT_NAME@_INCLUDE_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@/include)
|
||||
set_and_check(@PROJECT_NAME@_LIB_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@)
|
||||
set_and_check(@PROJECT_NAME@_CMAKE_MODULES_DIR ${@PROJECT_NAME@_LIB_DIR}/cmake/Vc)
|
||||
set(@PROJECT_NAME@_VERSION_STRING "@PROJECT_VERSION@")
|
||||
|
||||
### Setup @PROJECT_NAME@ defaults
|
||||
list(APPEND CMAKE_MODULE_PATH "${@PROJECT_NAME@_CMAKE_MODULES_DIR}")
|
||||
include("${@PROJECT_NAME@_CMAKE_MODULES_DIR}/VcMacros.cmake")
|
||||
|
||||
set(@PROJECT_NAME@_DEFINITIONS)
|
||||
set(@PROJECT_NAME@_COMPILE_FLAGS)
|
||||
set(@PROJECT_NAME@_ARCHITECTURE_FLAGS)
|
||||
vc_set_preferred_compiler_flags()
|
||||
separate_arguments(@PROJECT_NAME@_ALL_FLAGS UNIX_COMMAND "${@PROJECT_NAME@_DEFINITIONS}")
|
||||
list(APPEND @PROJECT_NAME@_ALL_FLAGS ${@PROJECT_NAME@_COMPILE_FLAGS})
|
||||
list(APPEND @PROJECT_NAME@_ALL_FLAGS ${@PROJECT_NAME@_ARCHITECTURE_FLAGS})
|
||||
|
||||
### Import targets
|
||||
include("@PACKAGE_CMAKE_INSTALL_PREFIX@/@PACKAGE_INSTALL_DESTINATION@/@PROJECT_NAME@Targets.cmake")
|
||||
|
||||
### Define @PROJECT_NAME@_LIBRARIES for backwards compatibility
|
||||
get_target_property(vc_lib_location @PROJECT_NAME@::Vc INTERFACE_LOCATION)
|
||||
set_and_check(@PROJECT_NAME@_LIBRARIES ${vc_lib_location})
|
||||
|
||||
### Handle required components - not used
|
||||
check_required_components(@PROJECT_NAME@)
|
||||
552
3rdparty/Vc/cmake/VcMacros.cmake
vendored
Normal file
552
3rdparty/Vc/cmake/VcMacros.cmake
vendored
Normal file
|
|
@ -0,0 +1,552 @@
|
|||
# Macros for use with the Vc library. Vc can be found at http://code.compeng.uni-frankfurt.de/projects/vc
|
||||
#
|
||||
# The following macros are provided:
|
||||
# vc_determine_compiler
|
||||
# vc_set_preferred_compiler_flags
|
||||
#
|
||||
# =============================================================================
|
||||
# Copyright 2009-2015 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the names of contributing organizations nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# =============================================================================
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3...3.13)
|
||||
|
||||
get_filename_component(_currentDir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
include("${_currentDir}/UserWarning.cmake")
|
||||
include("${_currentDir}/AddCompilerFlag.cmake")
|
||||
include("${_currentDir}/OptimizeForArchitecture.cmake")
|
||||
|
||||
macro(vc_determine_compiler)
|
||||
if(NOT DEFINED Vc_COMPILER_IS_INTEL)
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE _cxx_compiler_version ERROR_VARIABLE _cxx_compiler_version)
|
||||
set(Vc_COMPILER_IS_INTEL false)
|
||||
set(Vc_COMPILER_IS_OPEN64 false)
|
||||
set(Vc_COMPILER_IS_CLANG false)
|
||||
set(Vc_COMPILER_IS_MSVC false)
|
||||
set(Vc_COMPILER_IS_GCC false)
|
||||
|
||||
if(CMAKE_CXX_COMPILER MATCHES "/(icpc|icc)$")
|
||||
set(Vc_COMPILER_IS_INTEL true)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE Vc_ICC_VERSION)
|
||||
message(STATUS "Detected Compiler: Intel ${Vc_ICC_VERSION}")
|
||||
|
||||
# break build with too old clang as early as possible.
|
||||
if(Vc_ICC_VERSION VERSION_LESS 18.0.0)
|
||||
message(FATAL_ERROR "Vc 1.4 requires least ICC 18")
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER MATCHES "(opencc|openCC)$")
|
||||
set(Vc_COMPILER_IS_OPEN64 true)
|
||||
message(STATUS "Detected Compiler: Open64")
|
||||
elseif(CMAKE_CXX_COMPILER MATCHES "clang\\+\\+$" OR "${_cxx_compiler_version}" MATCHES "clang")
|
||||
set(Vc_COMPILER_IS_CLANG true)
|
||||
exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE Vc_CLANG_VERSION)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" Vc_CLANG_VERSION "${Vc_CLANG_VERSION}")
|
||||
message(STATUS "Detected Compiler: Clang ${Vc_CLANG_VERSION}")
|
||||
|
||||
# break build with too old clang as early as possible.
|
||||
if(Vc_CLANG_VERSION VERSION_LESS 3.4)
|
||||
message(FATAL_ERROR "Vc 1.x requires C++11 support. This requires at least clang 3.4")
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
set(Vc_COMPILER_IS_MSVC true)
|
||||
message(STATUS "Detected Compiler: MSVC ${MSVC_VERSION}")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(Vc_COMPILER_IS_GCC true)
|
||||
exec_program(${CMAKE_CXX_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE Vc_GCC_VERSION)
|
||||
message(STATUS "Detected Compiler: GCC ${Vc_GCC_VERSION}")
|
||||
|
||||
# some distributions patch their GCC to return nothing or only major and minor version on -dumpversion.
|
||||
# In that case we must extract the version number from --version.
|
||||
if(NOT Vc_GCC_VERSION OR Vc_GCC_VERSION MATCHES "^[0-9]\\.[0-9]+$")
|
||||
exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE Vc_GCC_VERSION)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" Vc_GCC_VERSION "${Vc_GCC_VERSION}")
|
||||
message(STATUS "GCC Version from --version: ${Vc_GCC_VERSION}")
|
||||
endif()
|
||||
|
||||
# some distributions patch their GCC to be API incompatible to what the FSF released. In
|
||||
# those cases we require a macro to identify the distribution version
|
||||
find_program(Vc_lsb_release lsb_release)
|
||||
mark_as_advanced(Vc_lsb_release)
|
||||
|
||||
if(Vc_lsb_release)
|
||||
if(NOT Vc_distributor_id)
|
||||
execute_process(COMMAND ${Vc_lsb_release} -is OUTPUT_VARIABLE Vc_distributor_id OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(TOUPPER "${Vc_distributor_id}" Vc_distributor_id)
|
||||
set(Vc_distributor_id "${Vc_distributor_id}" CACHE STRING "lsb distribution id")
|
||||
execute_process(COMMAND ${Vc_lsb_release} -rs OUTPUT_VARIABLE Vc_distributor_release OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(Vc_distributor_release "${Vc_distributor_release}" CACHE STRING "lsb release id")
|
||||
endif()
|
||||
|
||||
if(Vc_distributor_id STREQUAL "UBUNTU")
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE _gcc_version)
|
||||
string(REGEX MATCH "\\(.* ${Vc_GCC_VERSION}-([0-9]+).*\\)" _tmp "${_gcc_version}")
|
||||
|
||||
if(_tmp)
|
||||
set(_patch ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _tmp "${Vc_distributor_release}")
|
||||
execute_process(COMMAND printf 0x%x%02x%02x ${CMAKE_MATCH_1} ${CMAKE_MATCH_2} ${_patch} OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE _tmp)
|
||||
set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -D__GNUC_UBUNTU_VERSION__=${_tmp}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# break build with too old GCC as early as possible.
|
||||
if(Vc_GCC_VERSION VERSION_LESS 4.8.1)
|
||||
message(FATAL_ERROR "Vc 1.x requires C++11 support. This requires at least GCC 4.8.1")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Untested/-supported Compiler (${CMAKE_CXX_COMPILER}) for use with Vc.\nPlease fill out the missing parts in the CMake scripts and submit a patch to http://code.compeng.uni-frankfurt.de/projects/vc")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(vc_set_gnu_buildtype_flags)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g3" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING "Flags used by the compiler during release minsize builds." FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files)." FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBUG "-O3" CACHE STRING "Flags used by the compiler during release builds containing runtime checks." FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBUG} -g" CACHE STRING "Flags used by the compiler during Release with Debug Info builds." FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING "Flags used by the compiler during release minsize builds." FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files)." FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBUG "${CMAKE_CXX_FLAGS_RELWITHDEBUG}" CACHE STRING "Flags used by the compiler during release builds containing runtime checks." FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING "Flags used by the compiler during Release with Debug Info builds." FORCE)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebug")
|
||||
set(ENABLE_STRICT_ALIASING true CACHE BOOL "Enables strict aliasing rules for more aggressive optimizations")
|
||||
|
||||
if(NOT ENABLE_STRICT_ALIASING)
|
||||
AddCompilerFlag(-fno-strict-aliasing)
|
||||
endif(NOT ENABLE_STRICT_ALIASING)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CMAKE_CXX_FLAGS_RELWITHDEBUG CMAKE_C_FLAGS_RELWITHDEBUG)
|
||||
endmacro()
|
||||
|
||||
macro(vc_add_compiler_flag VAR _flag)
|
||||
AddCompilerFlag("${_flag}" CXX_FLAGS ${VAR})
|
||||
endmacro()
|
||||
|
||||
macro(vc_check_assembler)
|
||||
exec_program(${CMAKE_CXX_COMPILER} ARGS -print-prog-name=as OUTPUT_VARIABLE _as)
|
||||
mark_as_advanced(_as)
|
||||
|
||||
if(NOT _as)
|
||||
message(WARNING "Could not find 'as', the assembler used by GCC. Hoping everything will work out...")
|
||||
else()
|
||||
exec_program(${_as} ARGS --version OUTPUT_VARIABLE _as_version)
|
||||
string(REGEX REPLACE "\\([^\\)]*\\)" "" _as_version "${_as_version}")
|
||||
string(REGEX MATCH "[1-9]\\.[0-9]+(\\.[0-9]+)?" _as_version "${_as_version}")
|
||||
|
||||
if(_as_version VERSION_LESS "2.18.93")
|
||||
UserWarning("Your binutils is too old (${_as_version}). Some optimizations of Vc will be disabled.")
|
||||
set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_NO_XGETBV") # old assembler doesn't know the xgetbv instruction
|
||||
set(Vc_AVX_INTRINSICS_BROKEN true)
|
||||
set(Vc_XOP_INTRINSICS_BROKEN true)
|
||||
set(Vc_FMA4_INTRINSICS_BROKEN true)
|
||||
elseif(_as_version VERSION_LESS "2.21.0")
|
||||
UserWarning("Your binutils is too old (${_as_version}) for XOP and AVX2 instructions. They will therefore not be provided in libVc.")
|
||||
set(Vc_XOP_INTRINSICS_BROKEN true)
|
||||
set(Vc_AVX2_INTRINSICS_BROKEN true)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(vc_set_preferred_compiler_flags)
|
||||
vc_determine_compiler()
|
||||
|
||||
# Look for libmvec, which provides vectorized implementations of libm
|
||||
find_library(Vc_LIB_MVEC mvec)
|
||||
|
||||
if(Vc_LIB_MVEC)
|
||||
set(SAFE_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${Vc_LIB_MVEC})
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <x86intrin.h>
|
||||
extern \"C\" {
|
||||
__m128 _ZGVbN4v_sinf(__m128);
|
||||
__m128d _ZGVbN2v_sin(__m128d);
|
||||
__m128 _ZGVbN4v_cosf(__m128);
|
||||
__m128d _ZGVbN2v_cos(__m128d);
|
||||
}
|
||||
|
||||
__m128 f0(__m128 x) { return _ZGVbN4v_cosf(_ZGVbN4v_sinf(x)); }
|
||||
__m128d f1(__m128d x) { return _ZGVbN2v_cos(_ZGVbN2v_sin(x)); }
|
||||
int main() { return 0; }
|
||||
" Vc_HAVE_SSE_SINCOS)
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <x86intrin.h>
|
||||
extern \"C\" {
|
||||
__m256 _ZGVdN8v_sinf(__m256);
|
||||
__m256d _ZGVdN4v_sin(__m256d);
|
||||
__m256 _ZGVdN8v_cosf(__m256);
|
||||
__m256d _ZGVdN4v_cos(__m256d);
|
||||
}
|
||||
|
||||
__m256 f0(__m256 x) { return _ZGVdN8v_cosf(_ZGVdN8v_sinf(x)); }
|
||||
__m256d f1(__m256d x) { return _ZGVdN4v_cos(_ZGVdN4v_sin(x)); }
|
||||
int main() { return 0; }
|
||||
" Vc_HAVE_AVX_SINCOS)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}")
|
||||
|
||||
if(Vc_HAVE_SSE_SINCOS AND Vc_HAVE_AVX_SINCOS)
|
||||
option(USE_LIBMVEC "Use GNU's libmvec for vectorized sine and cosine" OFF)
|
||||
|
||||
if(USE_LIBMVEC)
|
||||
set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_HAVE_LIBMVEC=1")
|
||||
endif()
|
||||
endif()
|
||||
endif(Vc_LIB_MVEC)
|
||||
|
||||
set(_add_warning_flags false)
|
||||
set(_add_buildtype_flags false)
|
||||
|
||||
foreach(_arg ${ARGN})
|
||||
if(_arg STREQUAL "WARNING_FLAGS")
|
||||
set(_add_warning_flags true)
|
||||
elseif(_arg STREQUAL "BUILDTYPE_FLAGS")
|
||||
set(_add_buildtype_flags true)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(Vc_SSE_INTRINSICS_BROKEN false)
|
||||
set(Vc_AVX_INTRINSICS_BROKEN false)
|
||||
set(Vc_AVX2_INTRINSICS_BROKEN false)
|
||||
set(Vc_XOP_INTRINSICS_BROKEN false)
|
||||
set(Vc_FMA4_INTRINSICS_BROKEN false)
|
||||
|
||||
if(Vc_COMPILER_IS_OPEN64)
|
||||
# #################################################################################################
|
||||
# Open64 #
|
||||
# #################################################################################################
|
||||
if(_add_warning_flags)
|
||||
AddCompilerFlag("-W")
|
||||
AddCompilerFlag("-Wall")
|
||||
AddCompilerFlag("-Wimplicit")
|
||||
AddCompilerFlag("-Wswitch")
|
||||
AddCompilerFlag("-Wformat")
|
||||
AddCompilerFlag("-Wchar-subscripts")
|
||||
AddCompilerFlag("-Wparentheses")
|
||||
AddCompilerFlag("-Wmultichar")
|
||||
AddCompilerFlag("-Wtrigraphs")
|
||||
AddCompilerFlag("-Wpointer-arith")
|
||||
AddCompilerFlag("-Wcast-align")
|
||||
AddCompilerFlag("-Wreturn-type")
|
||||
AddCompilerFlag("-pedantic")
|
||||
AddCompilerFlag("-Wno-long-long")
|
||||
AddCompilerFlag("-Wshadow")
|
||||
AddCompilerFlag("-Wold-style-cast")
|
||||
AddCompilerFlag("-Wno-variadic-macros")
|
||||
endif()
|
||||
|
||||
if(_add_buildtype_flags)
|
||||
vc_set_gnu_buildtype_flags()
|
||||
endif()
|
||||
|
||||
vc_check_assembler()
|
||||
|
||||
# Open64 4.5.1 still doesn't ship immintrin.h
|
||||
set(Vc_AVX_INTRINSICS_BROKEN true)
|
||||
set(Vc_AVX2_INTRINSICS_BROKEN true)
|
||||
elseif(Vc_COMPILER_IS_GCC)
|
||||
# #################################################################################################
|
||||
# GCC #
|
||||
# #################################################################################################
|
||||
if(_add_warning_flags)
|
||||
foreach(_f -W -Wall -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wmultichar -Wtrigraphs -Wpointer-arith -Wcast-align -Wreturn-type -pedantic -Wshadow -Wundef)
|
||||
AddCompilerFlag("${_f}")
|
||||
endforeach()
|
||||
|
||||
foreach(_f -Wold-style-cast)
|
||||
AddCompilerFlag("${_f}" CXX_FLAGS CMAKE_CXX_FLAGS)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-Wabi")
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-fabi-version=0") # ABI version 4 is required to make __m128 and __m256 appear as different types. 0 should give us the latest version.
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-fabi-compat-version=0") # GCC 5 introduced this switch
|
||||
|
||||
# and defaults it to 2 if -fabi-version is 0. But in that case the bug -fabi-version=0 is
|
||||
# supposed to fix resurfaces. For now just make sure that it compiles and links.
|
||||
# Bug report pending.
|
||||
if(_add_buildtype_flags)
|
||||
vc_set_gnu_buildtype_flags()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# The GNU assembler (as) on Mac OS X is hopelessly outdated. The -q flag
|
||||
# to as tells it to use the clang assembler, though, which is fine.
|
||||
# -Wa,-q tells GCC to pass -q to as.
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-Wa,-q")
|
||||
|
||||
# Apparently the MacOS clang assember doesn't understand XOP instructions.
|
||||
set(Vc_XOP_INTRINSICS_BROKEN true)
|
||||
else()
|
||||
vc_check_assembler()
|
||||
endif()
|
||||
elseif(Vc_COMPILER_IS_INTEL)
|
||||
# #################################################################################################
|
||||
# Intel Compiler #
|
||||
# #################################################################################################
|
||||
if(_add_buildtype_flags)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG -O3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG -O3")
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
set(ENABLE_STRICT_ALIASING true CACHE BOOL "Enables strict aliasing rules for more aggressive optimizations")
|
||||
|
||||
if(ENABLE_STRICT_ALIASING)
|
||||
AddCompilerFlag(-ansi-alias CXX_FLAGS Vc_COMPILE_FLAGS)
|
||||
else()
|
||||
AddCompilerFlag(-no-ansi-alias CXX_FLAGS Vc_COMPILE_FLAGS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT "$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
|
||||
# disable warning #2928: the __GXX_EXPERIMENTAL_CXX0X__ macro is disabled when using GNU version 4.6 with the c++0x option
|
||||
# this warning just adds noise about problems in the compiler - but I'm only interested in seeing problems in Vc
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-diag-disable 2928")
|
||||
endif()
|
||||
|
||||
# Intel doesn't implement the XOP or FMA4 intrinsics
|
||||
set(Vc_XOP_INTRINSICS_BROKEN true)
|
||||
set(Vc_FMA4_INTRINSICS_BROKEN true)
|
||||
elseif(Vc_COMPILER_IS_MSVC)
|
||||
# #################################################################################################
|
||||
# Microsoft Visual Studio #
|
||||
# #################################################################################################
|
||||
if(_add_warning_flags)
|
||||
AddCompilerFlag("/wd4800") # Disable warning "forcing value to bool"
|
||||
AddCompilerFlag("/wd4996") # Disable warning about strdup vs. _strdup
|
||||
AddCompilerFlag("/wd4244") # Disable warning "conversion from 'unsigned int' to 'float', possible loss of data"
|
||||
AddCompilerFlag("/wd4146") # Disable warning "unary minus operator applied to unsigned type, result still unsigned"
|
||||
AddCompilerFlag("/wd4227") # Disable warning "anachronism used : qualifiers on reference are ignored" (this is about 'restrict' usage on references, stupid MSVC)
|
||||
AddCompilerFlag("/wd4722") # Disable warning "destructor never returns, potential memory leak" (warns about ~_UnitTest_Global_Object which we don't care about)
|
||||
AddCompilerFlag("/wd4748") # Disable warning "/GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function" (I don't get it)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "/Gv") # default to __vectorcall
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "/bigobj") # required for building tests with AVX
|
||||
|
||||
if(MSVC_VERSION LESS 1900)
|
||||
UserWarning("MSVC before 2015 does not support enough of C++11")
|
||||
endif()
|
||||
elseif(Vc_COMPILER_IS_CLANG)
|
||||
# #################################################################################################
|
||||
# Clang #
|
||||
# #################################################################################################
|
||||
if(Vc_CLANG_VERSION VERSION_GREATER "3.5.99" AND Vc_CLANG_VERSION VERSION_LESS 3.7.0)
|
||||
UserWarning("Clang 3.6 has serious issues with AVX code generation, frequently losing 50% of the data. AVX is therefore disabled.\nPlease update to a more recent clang version.\n")
|
||||
set(Vc_AVX_INTRINSICS_BROKEN true)
|
||||
set(Vc_AVX2_INTRINSICS_BROKEN true)
|
||||
endif()
|
||||
|
||||
# disable these warnings because clang shows them for function overloads that were discarded via SFINAE
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-Wno-local-type-template-args")
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-Wno-unnamed-type-template-args")
|
||||
endif()
|
||||
|
||||
if(NOT Vc_COMPILER_IS_MSVC)
|
||||
vc_add_compiler_flag(Vc_COMPILE_FLAGS "-ffp-contract=fast")
|
||||
endif()
|
||||
|
||||
OptimizeForArchitecture()
|
||||
set(Vc_IMPL "auto" CACHE STRING "Force the Vc implementation globally to the selected instruction set. \"auto\" lets Vc use the best available instructions.")
|
||||
|
||||
if(NOT Vc_IMPL STREQUAL "auto")
|
||||
set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_IMPL=${Vc_IMPL}")
|
||||
|
||||
if(NOT Vc_IMPL STREQUAL "Scalar")
|
||||
set(_use_var "USE_${Vc_IMPL}")
|
||||
|
||||
if(Vc_IMPL STREQUAL "SSE")
|
||||
set(_use_var "USE_SSE2")
|
||||
endif()
|
||||
|
||||
if(NOT ${_use_var})
|
||||
message(WARNING "The selected value for Vc_IMPL (${Vc_IMPL}) will not work because the relevant instructions are not enabled via compiler flags.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# helper macro for vc_compile_for_all_implementations
|
||||
macro(_vc_compile_one_implementation _srcs _impl)
|
||||
list(FIND _disabled_targets "${_impl}" _disabled_index)
|
||||
list(FIND _only_targets "${_impl}" _only_index)
|
||||
|
||||
if(${_disabled_index} GREATER -1)
|
||||
if(${_only_index} GREATER -1)
|
||||
# disabled and enabled -> error
|
||||
message(FATAL_ERROR "vc_compile_for_all_implementations lists ${_impl} in both the ONLY and EXCLUDE lists. Please remove one.")
|
||||
endif()
|
||||
|
||||
list(REMOVE_AT _disabled_targets ${_disabled_index})
|
||||
|
||||
# skip the rest and return
|
||||
elseif(NOT _only_targets OR ${_only_index} GREATER -1)
|
||||
if(${_only_index} GREATER -1)
|
||||
list(REMOVE_AT _only_targets ${_only_index})
|
||||
endif()
|
||||
|
||||
set(_extra_flags)
|
||||
set(_ok FALSE)
|
||||
|
||||
foreach(_flags_it ${ARGN})
|
||||
if(_flags_it STREQUAL "NO_FLAG")
|
||||
set(_ok TRUE)
|
||||
break()
|
||||
endif()
|
||||
|
||||
string(REPLACE " " ";" _flag_list "${_flags_it}")
|
||||
|
||||
foreach(_f ${_flag_list})
|
||||
AddCompilerFlag(${_f} CXX_RESULT _ok)
|
||||
|
||||
if(NOT _ok)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_ok)
|
||||
set(_extra_flags ${_flags_it})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_ok)
|
||||
get_filename_component(_out "${_vc_compile_src}" NAME_WE)
|
||||
get_filename_component(_ext "${_vc_compile_src}" EXT)
|
||||
set(_out "${CMAKE_CURRENT_BINARY_DIR}/${_out}_${_impl}${_ext}")
|
||||
add_custom_command(OUTPUT "${_out}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${_vc_compile_src}" "${_out}"
|
||||
DEPENDS "${_vc_compile_src}"
|
||||
COMMENT "Copy to ${_out}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
VERBATIM)
|
||||
set_source_files_properties("${_out}" PROPERTIES
|
||||
COMPILE_DEFINITIONS "Vc_IMPL=${_impl}"
|
||||
COMPILE_FLAGS "${_flags} ${_extra_flags}"
|
||||
)
|
||||
list(APPEND ${_srcs} "${_out}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Generate compile rules for the given C++ source file for all available implementations and return
|
||||
# the resulting list of object files in _obj
|
||||
# all remaining arguments are additional flags
|
||||
# Example:
|
||||
# vc_compile_for_all_implementations(_objs src/trigonometric.cpp FLAGS -DCOMPILE_BLAH EXCLUDE Scalar)
|
||||
# add_executable(executable main.cpp ${_objs})
|
||||
macro(vc_compile_for_all_implementations _srcs _src)
|
||||
set(_flags)
|
||||
unset(_disabled_targets)
|
||||
unset(_only_targets)
|
||||
set(_state 0)
|
||||
|
||||
foreach(_arg ${ARGN})
|
||||
if(_arg STREQUAL "FLAGS")
|
||||
set(_state 1)
|
||||
elseif(_arg STREQUAL "EXCLUDE")
|
||||
set(_state 2)
|
||||
elseif(_arg STREQUAL "ONLY")
|
||||
set(_state 3)
|
||||
elseif(_state EQUAL 1)
|
||||
set(_flags "${_flags} ${_arg}")
|
||||
elseif(_state EQUAL 2)
|
||||
list(APPEND _disabled_targets "${_arg}")
|
||||
elseif(_state EQUAL 3)
|
||||
list(APPEND _only_targets "${_arg}")
|
||||
else()
|
||||
message(FATAL_ERROR "incorrect argument to vc_compile_for_all_implementations")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(_vc_compile_src "${_src}")
|
||||
|
||||
_vc_compile_one_implementation(${_srcs} Scalar NO_FLAG)
|
||||
|
||||
if(NOT Vc_SSE_INTRINSICS_BROKEN)
|
||||
if(Vc_COMPILER_IS_MSVC)
|
||||
_vc_compile_one_implementation(${_srcs} SSE2 NO_FLAG)
|
||||
_vc_compile_one_implementation(${_srcs} SSE3 NO_FLAG)
|
||||
_vc_compile_one_implementation(${_srcs} SSSE3 NO_FLAG)
|
||||
_vc_compile_one_implementation(${_srcs} SSE4_1 NO_FLAG)
|
||||
_vc_compile_one_implementation(${_srcs} SSE4_2 NO_FLAG)
|
||||
_vc_compile_one_implementation(${_srcs} SSE3+SSE4a NO_FLAG)
|
||||
else()
|
||||
_vc_compile_one_implementation(${_srcs} SSE2 "-msse2")
|
||||
_vc_compile_one_implementation(${_srcs} SSE3 "-msse3")
|
||||
_vc_compile_one_implementation(${_srcs} SSSE3 "-mssse3")
|
||||
_vc_compile_one_implementation(${_srcs} SSE4_1 "-msse4.1")
|
||||
_vc_compile_one_implementation(${_srcs} SSE4_2 "-msse4.2")
|
||||
_vc_compile_one_implementation(${_srcs} SSE3+SSE4a "-msse4a")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT Vc_AVX_INTRINSICS_BROKEN)
|
||||
_vc_compile_one_implementation(${_srcs} AVX "-mavx" "/arch:AVX")
|
||||
|
||||
if(NOT Vc_XOP_INTRINSICS_BROKEN)
|
||||
if(NOT Vc_FMA4_INTRINSICS_BROKEN)
|
||||
_vc_compile_one_implementation(${_srcs} SSE+XOP+FMA4 "-mxop -mfma4" "" "")
|
||||
_vc_compile_one_implementation(${_srcs} AVX+XOP+FMA4 "-mavx -mxop -mfma4" "" "")
|
||||
endif()
|
||||
|
||||
_vc_compile_one_implementation(${_srcs} SSE+XOP+FMA "-mxop -mfma" "" "")
|
||||
_vc_compile_one_implementation(${_srcs} AVX+XOP+FMA "-mavx -mxop -mfma" "" "")
|
||||
endif()
|
||||
|
||||
_vc_compile_one_implementation(${_srcs} AVX+FMA "-mavx -mfma" "" "")
|
||||
endif()
|
||||
|
||||
if(NOT Vc_AVX2_INTRINSICS_BROKEN)
|
||||
# The necessary list is not clear to me yet. At this point I'll only consider Intel CPUs, in
|
||||
# which case AVX2 implies the availability of FMA and BMI2
|
||||
# _vc_compile_one_implementation(${_srcs} AVX2 "-mavx2")
|
||||
# _vc_compile_one_implementation(${_srcs} AVX2+BMI2 "-mavx2 -mbmi2")
|
||||
_vc_compile_one_implementation(${_srcs} AVX2+FMA+BMI2 "-march=core-avx2" "-mavx2 -mfma -mbmi2" "/arch:AVX2")
|
||||
|
||||
# _vc_compile_one_implementation(${_srcs} AVX2+FMA "-mavx2 -mfma")
|
||||
endif()
|
||||
|
||||
list(LENGTH _only_targets _len)
|
||||
|
||||
if(_len GREATER 0)
|
||||
message(WARNING "The following unknown targets where listed in the ONLY list of vc_compile_for_all_implementations: '${_only_targets}'")
|
||||
endif()
|
||||
|
||||
list(LENGTH _disabled_targets _len)
|
||||
|
||||
if(_len GREATER 0)
|
||||
message(WARNING "The following unknown targets where listed in the EXCLUDE list of vc_compile_for_all_implementations: '${_disabled_targets}'")
|
||||
endif()
|
||||
endmacro()
|
||||
2
3rdparty/Vc/cmake/toolchain-arm-linux-gnueabi-gcc.cmake
vendored
Normal file
2
3rdparty/Vc/cmake/toolchain-arm-linux-gnueabi-gcc.cmake
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
2
3rdparty/Vc/cmake/toolchain-arm-linux.cmake
vendored
Normal file
2
3rdparty/Vc/cmake/toolchain-arm-linux.cmake
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
Loading…
Add table
Add a link
Reference in a new issue