mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 16:46:16 +00:00
Add avx2 support
This commit is contained in:
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.26.4)
|
|||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
|
option(MOMO_ENABLE_AVX2 "Enable AVX2 support" ON)
|
||||||
option(MOMO_ENABLE_SANITIZER "Enable sanitizer" OFF)
|
option(MOMO_ENABLE_SANITIZER "Enable sanitizer" OFF)
|
||||||
option(MOMO_ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF)
|
option(MOMO_ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF)
|
||||||
option(MOMO_ENABLE_RUST_CODE "Enable code parts written in rust" ON)
|
option(MOMO_ENABLE_RUST_CODE "Enable code parts written in rust" ON)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
include_guard()
|
include_guard()
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# System identification
|
# System identification
|
||||||
@@ -114,6 +115,24 @@ endif()
|
|||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
|
if(MOMO_ENABLE_AVX2)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS -Werror)
|
||||||
|
check_cxx_compiler_flag(-mavx2 COMPILER_SUPPORTS_MAVX2)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "")
|
||||||
|
|
||||||
|
check_cxx_compiler_flag(/arch:AVX2 COMPILER_SUPPORTS_ARCH_AVX2)
|
||||||
|
|
||||||
|
if(COMPILER_SUPPORTS_MAVX2)
|
||||||
|
momo_add_c_and_cxx_compile_options(-mavx2)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (COMPILER_SUPPORTS_ARCH_AVX2)
|
||||||
|
momo_add_c_and_cxx_compile_options(/arch:AVX2)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
|
||||||
if(MOMO_ENABLE_SANITIZER)
|
if(MOMO_ENABLE_SANITIZER)
|
||||||
momo_add_c_and_cxx_compile_options(-fsanitize=address)
|
momo_add_c_and_cxx_compile_options(-fsanitize=address)
|
||||||
add_link_options(-fsanitize=address)
|
add_link_options(-fsanitize=address)
|
||||||
|
|||||||
Reference in New Issue
Block a user