Merge pull request #38749 from tchaikov/wip-cmake-check-nasm

cmake: only display the result of checking nasm once

Reviewed-by: Changcheng Liu <changcheng.liu@aliyun.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
Kefu Chai 2021-01-05 10:32:48 +08:00 committed by GitHub
commit 62bac2989d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,10 +14,9 @@ macro(check_nasm_support _object_format _support_x64 _support_x64_and_avx2 _supp
#error x32
#endif
int main() {}
" not_arch_x32)
" ${_support_x64})
set(CMAKE_REQUIRED_QUIET ${save_quiet})
if(not_arch_x32)
set(${_support_x64} TRUE)
if(${_support_x64})
execute_process(COMMAND nasm -f ${object_format} -i
${CMAKE_SOURCE_DIR}/src/isa-l/include/
${CMAKE_SOURCE_DIR}/src/isa-l/erasure_code/gf_vect_dot_prod_avx2.asm
@ -27,7 +26,7 @@ macro(check_nasm_support _object_format _support_x64 _support_x64_and_avx2 _supp
ERROR_QUIET)
if(NOT rc)
set(${_support_x64_and_avx2} TRUE)
endif(NOT rc)
endif()
execute_process(COMMAND nasm -D HAVE_AS_KNOWS_AVX512 -f ${object_format}
-i ${CMAKE_SOURCE_DIR}/src/isa-l/include/
${CMAKE_SOURCE_DIR}/src/isa-l/erasure_code/gf_vect_dot_prod_avx512.asm
@ -37,22 +36,19 @@ macro(check_nasm_support _object_format _support_x64 _support_x64_and_avx2 _supp
ERROR_QUIET)
if(NOT rt)
set(${_support_x64_and_avx512} TRUE)
endif(NOT rt)
endif(not_arch_x32)
endif()
endif(${_support_x64})
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
endif(NOT no_nasm)
if(no_nasm)
message(STATUS "Could NOT find nasm")
elseif(NOT not_arch_x32)
elseif(NOT ${_support_x64})
message(STATUS "Found nasm: but x86_64 with x32 ABI is not supported")
endif()
if(${_support_x64_and_avx512})
elseif(${_support_x64_and_avx512})
message(STATUS "Found nasm: best -- capable of assembling AVX512")
endif()
if(${_support_x64_and_avx2})
elseif(${_support_x64_and_avx2})
message(STATUS "Found nasm: better -- capable of assembling AVX2")
endif()
if(${_support_x64})
elseif(${_support_x64})
message(STATUS "Found nasm: good -- capable of assembling x86_64")
endif()
endmacro()