have avx enabled by default

This commit is contained in:
veclav talica 2024-07-28 21:47:57 +03:00
parent bf65f83806
commit c9f4f85fce

View File

@ -85,9 +85,18 @@ if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE
/W4
$<$<CONFIG:Release>:/GL>)
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:/LTCG>)
else()
set(WARNING_FLAGS_CLANG
-Weverything
-Wno-padded
-Wno-declaration-after-statement
-Wno-unsafe-buffer-usage
-Wno-unused-command-line-argument)
set(WARNING_FLAGS
-Wall
-Wextra
@ -95,7 +104,9 @@ else()
-Wshadow
-Wdouble-promotion
-Wconversion -Wno-sign-conversion
-Werror=vla)
-Werror=vla
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>:${WARNING_FLAGS_CLANG}>)
set(BUILD_FLAGS
# these SHOULDN'T break anything...
-fno-math-errno
@ -103,15 +114,18 @@ else()
-fno-signed-zeros
-fno-trapping-math
-freciprocal-math)
set(BUILD_FLAGS_RELEASE
-O3
-flto
-Wl,-gc-sections
-mavx -mavx2
-Wl,--gc-sections
-fdata-sections
-ffunction-sections
-funroll-loops
-fomit-frame-pointer
-fallow-store-data-races)
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Gnu>:-fallow-store-data-races>)
set(BUILD_FLAGS_DEBUG
-O0
-g3
@ -120,11 +134,13 @@ else()
-fstack-protector-all
-fsanitize=undefined
-fsanitize=address)
target_compile_options(${PROJECT_NAME} PRIVATE
${WARNING_FLAGS}
${BUILD_FLAGS}
$<$<CONFIG:Release>:${BUILD_FLAGS_RELEASE}>
$<$<CONFIG:Debug>:${BUILD_FLAGS_DEBUG}>)
target_link_options(${PROJECT_NAME} PRIVATE
${BUILD_FLAGS}
$<$<CONFIG:Release>:${BUILD_FLAGS_RELEASE}>
@ -137,19 +153,15 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
APP_NAME="${APP_NAME}"
PACKAGE_EXTENSION="${PACKAGE_EXTENSION}")
target_include_directories(${PROJECT_NAME}
PRIVATE
third-party/physfs/src
third-party/physfs/extras
third-party/libxm/include
third-party/glad/include
)
# header-only libraries should be marked as "system includes"
# to suppress compiler warnings in their code (it's not my problem after all)
target_include_directories(${PROJECT_NAME}
SYSTEM
PRIVATE
third-party/physfs/src
third-party/physfs/extras
third-party/libxm/include
third-party/glad/include
third-party/stb
)