Add native arch compilation option.

This commit is contained in:
Dan McGoo 2014-10-07 23:12:42 +09:00
parent 09e8560e38
commit e719a8de0f

View file

@ -18,6 +18,9 @@ option(OPENAL
option(FFMPEG
"Use FMPEG to render Bink videos" ON)
option(ONATIVE
"Optimize for the host CPU" OFF)
if(UNIX)
set(OPENAL TRUE)
endif()
@ -68,6 +71,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(my_warn_flags "${my_warn_flags} -Wno-local-type-template-args -Wno-unknown-warning-option -Wno-inline-new-delete")
endif()
if(NOT CMAKE_CROSSCOMPILING AND ONATIVE)
add_definitions(-march=native)
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0 -ggdb -fno-strict-aliasing ${my_warn_flags}")
#set(CMAKE_C_FLAGS_DEBUGALL "${CMAKE_C_FLAGS_DEBUGALL} -g -ggdb -D_DEBUG -fno-strict-aliasing ${my_warn_flags}")
#set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer -fno-strict-aliasing ${my_warn_flags}")