mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-21 20:21:09 +00:00
Set -ffloat-store when building with gcc for i386.
This helps the old and crappy x87 FPU to produce correct values. And finally implement compiler detection in the Makefile.
This commit is contained in:
parent
ce2c3292c6
commit
e5c39eeb7f
2 changed files with 41 additions and 0 deletions
|
@ -144,6 +144,21 @@ list(APPEND yquake2LinkerFlags ${CMAKE_DL_LIBS})
|
|||
include_directories(${yquake2IncludeDirectories} ${CMAKE_SOURCE_DIR}/src/client/refresh/gl3/glad/include)
|
||||
link_directories(${yquake2LinkerDirectories})
|
||||
|
||||
# If we're building with gcc for i386 let's define -ffloat-store.
|
||||
# This helps the old and crappy x87 FPU to produce correct values.
|
||||
# Would be nice if Clang had something comparable.
|
||||
if ("${ARCH}" STREQUAL "i386")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffloat-store")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Force SSE math on x86_64. All sane compilers should do this
|
||||
# anyway, just to protect us from broken Linux distros.
|
||||
if ("${ARCH}" STREQUAL "x86_64")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse")
|
||||
endif()
|
||||
|
||||
set(Backends-Generic-Source
|
||||
${BACKENDS_SRC_DIR}/generic/misc.c
|
||||
${BACKENDS_SRC_DIR}/generic/qal.c
|
||||
|
|
26
Makefile
26
Makefile
|
@ -124,6 +124,15 @@ else
|
|||
YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
|
||||
endif
|
||||
|
||||
# Detect the compiler
|
||||
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
|
||||
COMPILER := clang
|
||||
else ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"), 1)
|
||||
COMPILER := gcc
|
||||
else
|
||||
COMPILER := unknown
|
||||
endif
|
||||
|
||||
# Disable CDA for SDL2
|
||||
ifeq ($(WITH_SDL2),yes)
|
||||
ifeq ($(WITH_CDA),yes)
|
||||
|
@ -178,6 +187,23 @@ endif
|
|||
|
||||
# ----------
|
||||
|
||||
# If we're building with gcc for i386 let's define -ffloat-store.
|
||||
# This helps the old and crappy x87 FPU to produce correct values.
|
||||
# Would be nice if Clang had something comparable.
|
||||
ifeq ($(YQ2_ARCH), i386)
|
||||
ifeq ($(COMPILER), gcc)
|
||||
CFLAGS += -ffloat-store
|
||||
endif
|
||||
endif
|
||||
|
||||
# Force SSE math on x86_64. All sane compilers should do this
|
||||
# anyway, just to protect us from broken Linux distros.
|
||||
ifeq ($(YQ2_ARCH), x86_64)
|
||||
CFLAGS += -mfpmath=sse
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
# Systemwide installation
|
||||
ifeq ($(WITH_SYSTEMWIDE),yes)
|
||||
CFLAGS += -DSYSTEMWIDE
|
||||
|
|
Loading…
Reference in a new issue