From b998719ff1207615b0aca74e76bab2e01ec4ff70 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Wed, 24 Jul 2019 20:09:27 +0100 Subject: [PATCH] Update CMakeLists.txt, the Makefile, and the readme --- CMakeLists.txt | 11 +++++------ Makefile | 11 ++++++++++- README.md | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cb934a5..ba0f7720 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ option(JAPANESE "Enable the Japanese-language build" OFF) 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 @@ endif() 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") @@ -404,11 +408,6 @@ else() 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) - ## # DoConfig diff --git a/Makefile b/Makefile index c13e163d..0b74b148 100644 --- a/Makefile +++ b/Makefile @@ -208,7 +208,16 @@ ifneq ($(WINDOWS), 1) 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 diff --git a/README.md b/README.md index a273e032..eaa19031 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ You can also add the following flags: * `-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 @@ Run 'make' in this folder, preferably with some of the following settings: * `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