mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-18 10:02:12 +00:00
There's no need for the softrenderer to be build conditionally.
We want to build the softrenderer each time and on all platforms. Building it only at user request will lead to code rot.
This commit is contained in:
parent
1ed7762edd
commit
17f289c761
3 changed files with 38 additions and 86 deletions
|
@ -40,7 +40,6 @@ string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||||
option(ZIP_SUPPORT "ZIP support" ON)
|
option(ZIP_SUPPORT "ZIP support" ON)
|
||||||
option(OGG_SUPPORT "OGG Vorbis playback support (Music)" ON)
|
option(OGG_SUPPORT "OGG Vorbis playback support (Music)" ON)
|
||||||
option(OPENAL_SUPPORT "OpenAL support" ON)
|
option(OPENAL_SUPPORT "OpenAL support" ON)
|
||||||
option(SOFTRENDERER_SUPPORT "Enabled the software renderer" ON)
|
|
||||||
option(SYSTEMWIDE_SUPPORT "Enable systemwide installation of game assets" OFF)
|
option(SYSTEMWIDE_SUPPORT "Enable systemwide installation of game assets" OFF)
|
||||||
|
|
||||||
# These variables will act as our list of include folders and linker flags
|
# These variables will act as our list of include folders and linker flags
|
||||||
|
@ -132,10 +131,6 @@ if(${OPENAL_SUPPORT})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${SOFTRENDERER_SUPPORT})
|
|
||||||
add_definitions(-DREFSOFT)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
list(APPEND yquake2LinkerFlags "-lm -static-libgcc")
|
list(APPEND yquake2LinkerFlags "-lm -static-libgcc")
|
||||||
else()
|
else()
|
||||||
|
@ -504,39 +499,37 @@ set(GL3-Header
|
||||||
${COMMON_SRC_DIR}/header/shared.h
|
${COMMON_SRC_DIR}/header/shared.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (${SOFTRENDERER_SUPPORT})
|
set(SOFT-Source
|
||||||
set(SOFT-Source
|
${REF_SRC_DIR}/soft/r_aclip.c
|
||||||
${REF_SRC_DIR}/soft/r_aclip.c
|
${REF_SRC_DIR}/soft/r_alias.c
|
||||||
${REF_SRC_DIR}/soft/r_alias.c
|
${REF_SRC_DIR}/soft/r_bsp.c
|
||||||
${REF_SRC_DIR}/soft/r_bsp.c
|
${REF_SRC_DIR}/soft/r_draw.c
|
||||||
${REF_SRC_DIR}/soft/r_draw.c
|
${REF_SRC_DIR}/soft/r_edge.c
|
||||||
${REF_SRC_DIR}/soft/r_edge.c
|
${REF_SRC_DIR}/soft/r_image.c
|
||||||
${REF_SRC_DIR}/soft/r_image.c
|
${REF_SRC_DIR}/soft/r_light.c
|
||||||
${REF_SRC_DIR}/soft/r_light.c
|
${REF_SRC_DIR}/soft/r_main.c
|
||||||
${REF_SRC_DIR}/soft/r_main.c
|
${REF_SRC_DIR}/soft/r_misc.c
|
||||||
${REF_SRC_DIR}/soft/r_misc.c
|
${REF_SRC_DIR}/soft/r_model.c
|
||||||
${REF_SRC_DIR}/soft/r_model.c
|
${REF_SRC_DIR}/soft/r_part.c
|
||||||
${REF_SRC_DIR}/soft/r_part.c
|
${REF_SRC_DIR}/soft/r_poly.c
|
||||||
${REF_SRC_DIR}/soft/r_poly.c
|
${REF_SRC_DIR}/soft/r_polyse.c
|
||||||
${REF_SRC_DIR}/soft/r_polyse.c
|
${REF_SRC_DIR}/soft/r_rast.c
|
||||||
${REF_SRC_DIR}/soft/r_rast.c
|
${REF_SRC_DIR}/soft/r_scan.c
|
||||||
${REF_SRC_DIR}/soft/r_scan.c
|
${REF_SRC_DIR}/soft/r_sprite.c
|
||||||
${REF_SRC_DIR}/soft/r_sprite.c
|
${REF_SRC_DIR}/soft/r_surf.c
|
||||||
${REF_SRC_DIR}/soft/r_surf.c
|
${REF_SRC_DIR}/files/pcx.c
|
||||||
${REF_SRC_DIR}/files/pcx.c
|
${REF_SRC_DIR}/files/stb.c
|
||||||
${REF_SRC_DIR}/files/stb.c
|
${REF_SRC_DIR}/files/wal.c
|
||||||
${REF_SRC_DIR}/files/wal.c
|
${COMMON_SRC_DIR}/shared/shared.c
|
||||||
${COMMON_SRC_DIR}/shared/shared.c
|
${COMMON_SRC_DIR}/md4.c
|
||||||
${COMMON_SRC_DIR}/md4.c
|
)
|
||||||
)
|
|
||||||
|
|
||||||
set(SOFT-Header
|
set(SOFT-Header
|
||||||
${REF_SRC_DIR}/soft/header/adivtab.h
|
${REF_SRC_DIR}/soft/header/adivtab.h
|
||||||
${REF_SRC_DIR}/soft/header/local.h
|
${REF_SRC_DIR}/soft/header/local.h
|
||||||
${REF_SRC_DIR}/soft/header/model.h
|
${REF_SRC_DIR}/soft/header/model.h
|
||||||
${COMMON_SRC_DIR}/header/shared.h
|
${COMMON_SRC_DIR}/header/shared.h
|
||||||
)
|
)
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Main Quake 2 executable
|
# Main Quake 2 executable
|
||||||
add_executable(quake2 ${Client-Source} ${Client-Header} ${Platform-Specific-Source}
|
add_executable(quake2 ${Client-Source} ${Client-Header} ${Platform-Specific-Source}
|
||||||
|
@ -595,13 +588,11 @@ set_target_properties(ref_gl3 PROPERTIES
|
||||||
target_link_libraries(ref_gl3 ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
target_link_libraries(ref_gl3 ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
||||||
|
|
||||||
# Build the soft renderer dynamic library
|
# Build the soft renderer dynamic library
|
||||||
if (${SOFTRENDERER_SUPPORT})
|
add_library(ref_soft MODULE ${SOFT-Source} ${SOFT-Header} ${REF-Platform-Specific-Source})
|
||||||
add_library(ref_soft MODULE ${SOFT-Source} ${SOFT-Header} ${REF-Platform-Specific-Source})
|
set_target_properties(ref_soft PROPERTIES
|
||||||
set_target_properties(ref_soft PROPERTIES
|
PREFIX ""
|
||||||
PREFIX ""
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
|
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
|
)
|
||||||
)
|
target_link_libraries(ref_soft ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
||||||
target_link_libraries(ref_soft ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
|
|
||||||
endif()
|
|
||||||
|
|
28
Makefile
28
Makefile
|
@ -27,9 +27,6 @@
|
||||||
# User configurable options
|
# User configurable options
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
# Build soft render
|
|
||||||
WITH_REFSOFT:=yes
|
|
||||||
|
|
||||||
# Enables CD audio playback. CD audio playback is used
|
# Enables CD audio playback. CD audio playback is used
|
||||||
# for the background music and doesn't add any further
|
# for the background music and doesn't add any further
|
||||||
# dependencies. It should work on all platforms where
|
# dependencies. It should work on all platforms where
|
||||||
|
@ -349,7 +346,6 @@ config:
|
||||||
@echo "WITH_ZIP = $(WITH_ZIP)"
|
@echo "WITH_ZIP = $(WITH_ZIP)"
|
||||||
@echo "WITH_SYSTEMWIDE = $(WITH_SYSTEMWIDE)"
|
@echo "WITH_SYSTEMWIDE = $(WITH_SYSTEMWIDE)"
|
||||||
@echo "WITH_SYSTEMDIR = $(WITH_SYSTEMDIR)"
|
@echo "WITH_SYSTEMDIR = $(WITH_SYSTEMDIR)"
|
||||||
@echo "WITH_REFSOFT = $(WITH_REFSOFT)"
|
|
||||||
@echo "============================"
|
@echo "============================"
|
||||||
@echo ""
|
@echo ""
|
||||||
ifeq ($(WITH_SDL2),yes)
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
@ -413,10 +409,6 @@ release/quake2.exe : CFLAGS += -DZIP -DNOUNCRYPT
|
||||||
release/quake2.exe : LDFLAGS += -lz
|
release/quake2.exe : LDFLAGS += -lz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(WITH_REFSOFT),yes)
|
|
||||||
release/quake2.exe : CFLAGS += -DREFSOFT
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(WITH_SDL2),yes)
|
ifeq ($(WITH_SDL2),yes)
|
||||||
release/quake2.exe : CFLAGS += -DSDL2
|
release/quake2.exe : CFLAGS += -DSDL2
|
||||||
endif
|
endif
|
||||||
|
@ -482,10 +474,6 @@ ifeq ($(WITH_X11GAMMA),yes)
|
||||||
release/quake2 : CFLAGS += -DX11GAMMA
|
release/quake2 : CFLAGS += -DX11GAMMA
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(WITH_REFSOFT),yes)
|
|
||||||
release/quake2 : CFLAGS += -DREFSOFT
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(WITH_SDL2),yes)
|
ifeq ($(WITH_SDL2),yes)
|
||||||
release/quake2 : CFLAGS += -DSDL2
|
release/quake2 : CFLAGS += -DSDL2
|
||||||
endif
|
endif
|
||||||
|
@ -667,14 +655,9 @@ build/ref_gl3/%.o: %.c
|
||||||
|
|
||||||
ifeq ($(YQ2_OSTYPE), Windows)
|
ifeq ($(YQ2_OSTYPE), Windows)
|
||||||
|
|
||||||
ifeq ($(WITH_REFSOFT),yes)
|
|
||||||
ref_soft:
|
ref_soft:
|
||||||
@echo "===> Building ref_soft.dll"
|
@echo "===> Building ref_soft.dll"
|
||||||
$(MAKE) release/ref_soft.dll
|
$(MAKE) release/ref_soft.dll
|
||||||
else
|
|
||||||
ref_soft:
|
|
||||||
@echo "===> No soft render"
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(WITH_SDL2),yes)
|
ifeq ($(WITH_SDL2),yes)
|
||||||
release/ref_soft.dll : CFLAGS += -DSDL2
|
release/ref_soft.dll : CFLAGS += -DSDL2
|
||||||
|
@ -684,15 +667,9 @@ release/ref_soft.dll : LDFLAGS += -shared
|
||||||
|
|
||||||
else ifeq ($(YQ2_OSTYPE), Darwin)
|
else ifeq ($(YQ2_OSTYPE), Darwin)
|
||||||
|
|
||||||
ifeq ($(WITH_REFSOFT),yes)
|
|
||||||
ref_soft:
|
ref_soft:
|
||||||
@echo "===> Building ref_soft.dylib"
|
@echo "===> Building ref_soft.dylib"
|
||||||
$(MAKE) release/ref_soft.dylib
|
$(MAKE) release/ref_soft.dylib
|
||||||
else
|
|
||||||
ref_soft:
|
|
||||||
@echo "===> No soft render"
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(WITH_SDL2),yes)
|
ifeq ($(WITH_SDL2),yes)
|
||||||
release/ref_soft.dylib : CFLAGS += -DSDL2
|
release/ref_soft.dylib : CFLAGS += -DSDL2
|
||||||
|
@ -702,14 +679,9 @@ release/ref_soft.dylib : LDFLAGS += -shared
|
||||||
|
|
||||||
else # not Windows or Darwin
|
else # not Windows or Darwin
|
||||||
|
|
||||||
ifeq ($(WITH_REFSOFT),yes)
|
|
||||||
ref_soft:
|
ref_soft:
|
||||||
@echo "===> Building ref_soft.so"
|
@echo "===> Building ref_soft.so"
|
||||||
$(MAKE) release/ref_soft.so
|
$(MAKE) release/ref_soft.so
|
||||||
else
|
|
||||||
ref_soft:
|
|
||||||
@echo "===> No soft render"
|
|
||||||
endif
|
|
||||||
|
|
||||||
release/ref_soft.so : CFLAGS += -fPIC
|
release/ref_soft.so : CFLAGS += -fPIC
|
||||||
release/ref_soft.so : LDFLAGS += -shared
|
release/ref_soft.so : LDFLAGS += -shared
|
||||||
|
|
|
@ -73,7 +73,6 @@ GetRenderer(void)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#ifdef REFSOFT
|
|
||||||
else if (Q_stricmp(vid_renderer->string, "soft") == 0)
|
else if (Q_stricmp(vid_renderer->string, "soft") == 0)
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -82,12 +81,6 @@ GetRenderer(void)
|
||||||
{
|
{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -168,13 +161,11 @@ ApplyChanges(void *unused)
|
||||||
Cvar_Set("vid_renderer", "gl3");
|
Cvar_Set("vid_renderer", "gl3");
|
||||||
restart = true;
|
restart = true;
|
||||||
}
|
}
|
||||||
#ifdef REFSOFT
|
|
||||||
else if (s_renderer_list.curvalue == 2)
|
else if (s_renderer_list.curvalue == 2)
|
||||||
{
|
{
|
||||||
Cvar_Set("vid_renderer", "soft");
|
Cvar_Set("vid_renderer", "soft");
|
||||||
restart = true;
|
restart = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* custom mode */
|
/* custom mode */
|
||||||
|
@ -250,9 +241,7 @@ VID_MenuInit(void)
|
||||||
static const char *renderers[] = {
|
static const char *renderers[] = {
|
||||||
"[OpenGL 1.4]",
|
"[OpenGL 1.4]",
|
||||||
"[OpenGL 3.2]",
|
"[OpenGL 3.2]",
|
||||||
#ifdef REFSOFT
|
|
||||||
"[Software ]",
|
"[Software ]",
|
||||||
#endif
|
|
||||||
"[Custom ]",
|
"[Custom ]",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue