Skip to content

Commit

Permalink
cmake: Add option to select micro-arch, use x86-64-v2 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Jan 10, 2023
1 parent 1f92037 commit 84e74b4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)

if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
# Setup options for x86_64 micro-architecture levels.
# https://clang.llvm.org/docs/UsersManual.html#x86
set(X86_64_ARCH_LEVEL 2 CACHE STRING "The x86_64 micro-architecture level")
if(X86_64_ARCH_LEVEL GREATER 0)
add_compile_options(-march=x86-64-v${X86_64_ARCH_LEVEL})
message(STATUS "x86_64 micro-architecture level: ${X86_64_ARCH_LEVEL}")
endif()
endif()

include(GNUInstallDirs)

if(EVMONE_FUZZING)
Expand Down

0 comments on commit 84e74b4

Please sign in to comment.