Vc package added (version 0.6.79-dev)
[u/mrichter/AliRoot.git] / Vc / CMakeLists.txt
CommitLineData
f22341db 1macro(vc_add_target_property _target _prop _value)
2 get_target_property(_oldprop "${_target}" ${_prop})
3 if(NOT _oldprop)
4 set_target_properties("${_target}" PROPERTIES ${_prop} "${_value}")
5 else(NOT _oldprop)
6 set_target_properties("${_target}" PROPERTIES ${_prop} "${_oldprop} ${_value}")
7 endif(NOT _oldprop)
8endmacro()
9
10include_directories("${Vc_INCLUDE_DIR}" "${Vc_INCLUDE_DIR}/Vc" "${Vc_INCLUDE_DIR}/Vc/avx")
11
12if(USE_AVX)
13 add_library(Vc STATIC src/vector.cpp src/cpuid.cpp src/support.cpp src/avx/sorthelper.cpp)
14else()
15 set(_srcs src/vector.cpp src/cpuid.cpp src/support.cpp)
16
17 if(NOT Vc_AVX_INTRINSICS_BROKEN)
18 # we'd still like to have avx/sorthelper.cpp built in, but that requires compilation with -mavx (or a comparable flag)
19 foreach(_flag "-xAVX" "-mavx" "-arch:AVX")
20 check_cxx_compiler_flag("${_flag}" check_cxx_compiler_flag_${_flag})
21 if(check_cxx_compiler_flag_${_flag})
22 if(_flag STREQUAL "-xAVX")
23 set(_flag "${_flag} -diag-disable 10121") # disable the warning "overriding -xSSE4.2 with -xAVX"
24 endif()
25 set(_srcs ${_srcs} src/avx/sorthelper.cpp)
26 set_source_files_properties(src/avx/sorthelper.cpp PROPERTIES COMPILE_FLAGS "${_flag}")
27 break()
28 endif()
29 endforeach()
30 endif()
31 add_library(Vc STATIC ${_srcs})
32endif()
33string(REPLACE "-Weffc++" "" CXXFLAGS "${CXXFLAGS}")
34vc_add_target_property(Vc COMPILE_FLAGS "-DVC_COMPILE_LIB ${CXXFLAGS} -O3 ${Vc_DEFINITIONS}")
35vc_add_target_property(Vc LABELS "other")
36
37# vim: ft=cmake sw=3 et