Update CMakeLists.txt, the Makefile, and the readme

This commit is contained in:
Clownacy 2019-07-24 20:09:27 +01:00
parent 7bbc0321cd
commit b998719ff1
3 changed files with 17 additions and 7 deletions

View file

@ -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(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(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) 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) project(CSE2 LANGUAGES C CXX)
@ -248,6 +248,10 @@ endif()
if(RENDERER MATCHES "OpenGL2") if(RENDERER MATCHES "OpenGL2")
target_sources(CSE2 PRIVATE "src/Backends/Rendering/OpenGL2.cpp") 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") elseif(RENDERER MATCHES "Texture")
target_sources(CSE2 PRIVATE "src/Backends/Rendering/SDLTexture.cpp") target_sources(CSE2 PRIVATE "src/Backends/Rendering/SDLTexture.cpp")
elseif(RENDERER MATCHES "Surface") elseif(RENDERER MATCHES "Surface")
@ -404,11 +408,6 @@ else()
target_link_libraries(CSE2 freetype) target_link_libraries(CSE2 freetype)
endif() endif()
find_package(GLEW REQUIRED)
target_link_libraries(CSE2 GLEW::GLEW)
find_package(OpenGL REQUIRED)
target_link_libraries(CSE2 OpenGL::GL OpenGL::GLU)
## ##
# DoConfig # DoConfig

View file

@ -208,7 +208,16 @@ ifneq ($(WINDOWS), 1)
RESOURCES += ICON/ICON_MINI.bmp RESOURCES += ICON/ICON_MINI.bmp
endif 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 SOURCES += Backends/Rendering/SDLTexture
else ifeq ($(RENDERER), Surface) else ifeq ($(RENDERER), Surface)
SOURCES += Backends/Rendering/Software SOURCES += Backends/Rendering/Software

View file

@ -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)) * `-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 * `-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 * `-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=Texture` - Use the hardware-accelerated SDL2 Texture API renderer (default)
* `-DRENDERER=Surface` - Use the software-rendered SDL2 Surface API renderer * `-DRENDERER=Surface` - Use the software-rendered SDL2 Surface API renderer
* `-DRENDERER=Software` - Use a handwritten software 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) * `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 * `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 * `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=Texture` - Use the hardware-accelerated SDL2 Texture API renderer (default)
* `RENDERER=Surface` - Use the software-rendered SDL2 Surface API renderer * `RENDERER=Surface` - Use the software-rendered SDL2 Surface API renderer
* `RENDERER=Software` - Use a hand-written software renderer * `RENDERER=Software` - Use a hand-written software renderer