CMAKE changes to support AVX instructions. Source files in src/avx are compiled with AVX enabled (VEX encoding) and require runtime dispatch to avoid crashing a machine without AVX hardware.

This commit is contained in:
Ken Cooke 2016-02-06 10:53:56 -08:00
parent 96f1191a97
commit 08e299f724

View file

@ -11,10 +11,20 @@ macro(SETUP_HIFI_LIBRARY)
project(${TARGET_NAME})
# grab the implemenation and header files
file(GLOB_RECURSE LIB_SRCS "src/*.h" "src/*.cpp" "src/*.c")
# grab the implementation and header files
file(GLOB_RECURSE LIB_SRCS "src/*.h" "src/*.cpp" "src/*.c" "src/avx/*.h" "src/avx/*.cpp" "src/avx/*.c")
list(APPEND ${TARGET_NAME}_SRCS ${LIB_SRCS})
# add compiler flags to AVX source files
file(GLOB_RECURSE AVX_SRCS "src/avx/*.cpp" "src/avx/*.c")
foreach(SRC ${AVX_SRCS})
if (WIN32)
set_source_files_properties(${SRC} PROPERTIES COMPILE_FLAGS /arch:AVX)
elseif (APPLE OR UNIX)
set_source_files_properties(${SRC} PROPERTIES COMPILE_FLAGS -mavx)
endif()
endforeach()
setup_memory_debugger()
# create a library and set the property so it can be referenced later