Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Cmake AVX2 builds for Windows #2232

Merged
merged 1 commit into from
Aug 22, 2019
Merged
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
23 changes: 14 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ else ()
endif()

if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
if (NANO_SIMD_OPTIMIZATIONS OR RAIBLOCKS_SIMD_OPTIMIZATIONS)
if (NANO_SIMD_OPTIMIZATIONS OR RAIBLOCKS_SIMD_OPTIMIZATIONS OR ENABLE_AVX2)
add_compile_options(-msse4)
if (ENABLE_AES)
add_compile_options(-maes)
Expand All @@ -105,14 +105,6 @@ else ()
-DCRYPTOPP_DISABLE_AESNI)
endif()

if (ENABLE_AVX2)
add_compile_options(-mavx2 -mbmi -mbmi2 -maes)
if (PERMUTE_WITH_GATHER)
add_definitions(-DPERMUTE_WITH_GATHER)
elseif (PERMUTE_WITH_SHUFFLES)
add_definitions(-DPERMUTE_WITH_SHUFFLES)
endif()
endif()
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
if (NANO_SIMD_OPTIMIZATIONS OR RAIBLOCKS_SIMD_OPTIMIZATIONS)
add_compile_options(-march=armv8-a+crc+crypto)
Expand All @@ -123,6 +115,19 @@ else ()
endif()
endif ()

if (ENABLE_AVX2)
if (WIN32)
add_definitions(/arch:AVX2)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
add_compile_options(-mavx2 -mbmi -mbmi2 -maes)
endif()
if (PERMUTE_WITH_GATHER)
add_definitions(-DPERMUTE_WITH_GATHER)
elseif (PERMUTE_WITH_SHUFFLES)
add_definitions(-DPERMUTE_WITH_SHUFFLES)
endif()
endif()

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
#set(CMAKE_C_EXTENSIONS OFF)
Expand Down