Skip to content

Commit

Permalink
Ask test use AVX2 when run on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
kant2002 committed Jun 8, 2021
1 parent bdc39c9 commit b5bebba
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/tests/Interop/PInvoke/Generics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project (GenericsNative)
include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
project (GenericsNative)
include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
if(CLR_CMAKE_TARGET_ARCH_I386)
add_definitions(-DTARGET_X86)
add_definitions(-DTARGET_XARCH)
Expand All @@ -17,10 +17,15 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# The ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
add_compile_options(-Wno-psabi)
endif()
if (NOT MSVC AND NOT CLR_CMAKE_TARGET_ARCH_ARM64 AND NOT CLR_CMAKE_TARGET_ARCH_ARM)
# We need -march=native so we can detect if AVX2 is present.
# ARM does not like that option too and it make no sense to have this detection there.
add_compile_options(-march=native)
if (MSVC)
# The MSVC require explicitly ask for AVX2 so define would be present.
add_compile_options(/arch:AVX2)
else()
if (NOT CLR_CMAKE_TARGET_ARCH_ARM64 AND NOT CLR_CMAKE_TARGET_ARCH_ARM)
# We need -march=native so we can detect if AVX2 is present.
# ARM does not like that option too and it make no sense to have this detection there.
add_compile_options(-march=native)
endif()
endif()
set(SOURCES
GenericsNative.IUnknown.cpp
Expand Down Expand Up @@ -92,4 +97,4 @@ set(SOURCES
GenericsNative.VectorU.cpp
)
add_library (GenericsNative SHARED ${SOURCES})
install (TARGETS GenericsNative DESTINATION bin)
install (TARGETS GenericsNative DESTINATION bin)

0 comments on commit b5bebba

Please sign in to comment.