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