Remove compiler optimizations to avoid strange issues

This commit is contained in:
Alex Spataru 2024-11-10 12:24:33 -05:00
parent 7c9cc7a1e9
commit 580d478f65

View File

@ -58,21 +58,21 @@ add_definitions(-DPROJECT_DISPNAME="${PROJECT_DISPNAME}")
# Compiler flags
#-------------------------------------------------------------------------------
if(CMAKE_BUILD_TYPE STREQUAL "Release")
if(WIN32 AND MINGW)
set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -g0 -funroll-loops")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections")
elseif (WIN32 AND MSVC)
set(CMAKE_CXX_FLAGS "/O2 /W3 /GL /arch:AVX2 /fp:fast /Zi")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/OPT:REF /OPT:ICF /LTCG /DEBUG")
elseif(APPLE)
set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -g0 -flto=full -funroll-loops")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-dead_strip -flto=full")
elseif(UNIX)
set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -g0 -flto -funroll-loops")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections -flto")
endif()
endif()
#if(CMAKE_BUILD_TYPE STREQUAL "Release")
# if(WIN32 AND MINGW)
# set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -g0 -funroll-loops")
# set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections")
# elseif (WIN32 AND MSVC)
# set(CMAKE_CXX_FLAGS "/O2 /W3 /GL /arch:AVX2 /fp:fast /Zi")
# set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/OPT:REF /OPT:ICF /LTCG /DEBUG")
# elseif(APPLE)
# set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -g0 -flto=full -funroll-loops")
# set(CMAKE_EXE_LINKER_FLAGS "-Wl,-dead_strip -flto=full")
# elseif(UNIX)
# set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -g0 -flto -funroll-loops")
# set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections -flto")
# endif()
#endif()
if (UNIX AND NOT APPLE)
set(PROJECT_EXECUTABLE "serial-studio")