ref: b998719ff1207615b0aca74e76bab2e01ec4ff70
parent: 7bbc0321cd8680ff911b0bd9346516585b505f2f
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Jul 24 16:09:27 EDT 2019
Update CMakeLists.txt, the Makefile, and the readme
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@
option(FIX_BUGS "Fix certain bugs (see src/Bug Fixes.txt)" OFF)
option(NONPORTABLE "Enable bits of code that aren't portable, but are what the original game used" OFF)
option(FORCE_LOCAL_LIBS "Compile the built-in versions of SDL2, FreeType, and FLTK instead of using the system-provided ones" OFF)
-set(RENDERER "Texture" CACHE STRING "Which renderer the game should use: 'Texture' for SDL2's hardware-accelerated Texture API, 'Surface' for SDL2's software-rendered Surface API, and 'Software' for a handwritten software renderer")
+set(RENDERER "Texture" CACHE STRING "Which renderer the game should use: 'OpenGL2' for an OpenGL 2.1 renderer, 'Texture' for SDL2's hardware-accelerated Texture API, 'Surface' for SDL2's software-rendered Surface API, and 'Software' for a handwritten software renderer")
project(CSE2 LANGUAGES C CXX)
@@ -248,6 +248,10 @@
if(RENDERER MATCHES "OpenGL2")
target_sources(CSE2 PRIVATE "src/Backends/Rendering/OpenGL2.cpp")
+ find_package(GLEW REQUIRED)
+ target_link_libraries(CSE2 GLEW::GLEW)
+ find_package(OpenGL REQUIRED)
+ target_link_libraries(CSE2 OpenGL::GL OpenGL::GLU)
elseif(RENDERER MATCHES "Texture")
target_sources(CSE2 PRIVATE "src/Backends/Rendering/SDLTexture.cpp")
elseif(RENDERER MATCHES "Surface")
@@ -403,11 +407,6 @@
add_subdirectory("external/freetype" EXCLUDE_FROM_ALL)
target_link_libraries(CSE2 freetype)
endif()
-
-find_package(GLEW REQUIRED)
-target_link_libraries(CSE2 GLEW::GLEW)
-find_package(OpenGL REQUIRED)
-target_link_libraries(CSE2 OpenGL::GL OpenGL::GLU)
##
--- a/Makefile
+++ b/Makefile
@@ -208,7 +208,16 @@
RESOURCES += ICON/ICON_MINI.bmp
endif
-ifeq ($(RENDERER), Texture)
+ifeq ($(RENDERER), OpenGL2)
+ SOURCES += Backends/Rendering/OpenGL2
+ CXXFLAGS += `pkg-config glew --cflags`
+
+ ifeq ($(STATIC), 1)
+ LIBS += `pkg-config glew --libs --static`
+ else
+ LIBS += `pkg-config glew --libs`
+ endif
+else ifeq ($(RENDERER), Texture)
SOURCES += Backends/Rendering/SDLTexture
else ifeq ($(RENDERER), Surface)
SOURCES += Backends/Rendering/Software
--- a/README.md
+++ b/README.md
@@ -29,6 +29,7 @@
* `-DFIX_BUGS=ON` - Fix bugs in the game (see [src/Bug Fixes.txt](src/Bug%20Fixes.txt))
* `-DNONPORTABLE=ON` - Enable bits of code that aren't portable, but are what the original game used
* `-DFORCE_LOCAL_LIBS=ON` - Compile the built-in versions of SDL2, FreeType, and FLTK instead of using the system-provided ones
+* `-DRENDERER=OpenGL2` - Use the hardware-accelerated OpenGL 2.1 renderer
* `-DRENDERER=Texture` - Use the hardware-accelerated SDL2 Texture API renderer (default)
* `-DRENDERER=Surface` - Use the software-rendered SDL2 Surface API renderer
* `-DRENDERER=Software` - Use a handwritten software renderer
@@ -56,6 +57,7 @@
* `WINDOWS=1` - Enable Windows-only features like a unique file/taskbar icon, and system font loading (needed for the font setting in Config.dat to do anything)
* `RASPBERRY_PI=1` - Enable tweaks to improve performance on Raspberry Pis
* `NONPORTABLE=1` - Enable bits of code that aren't portable, but are what the original game used
+* `RENDERER=OpenGL2` - Use the hardware-accelerated OpenGL 2.1 renderer
* `RENDERER=Texture` - Use the hardware-accelerated SDL2 Texture API renderer (default)
* `RENDERER=Surface` - Use the software-rendered SDL2 Surface API renderer
* `RENDERER=Software` - Use a hand-written software renderer