-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes were done to rework most system specific code to be platform independent. This not only gives Linux support but also might open the doors for other operating systems. I do not own an Apple tho so I can not promise anything on that front (especially since Apple kicked out OpenGL iirc). There are also some bug fixes that I ran across while testing and playing the game. Finally I ran valgrind over the tests to check for memory leaks and fixed those. I do not use Windows anymore really so I haven't tested this with Visual Studio but it compiled fine using MinGW (see TC-mingw.cmake for a cross compilation template under linux) and also ran fine with Wine. * Removed Visual Studio files * Removed SDL2 files (CMake handles dependency) * Removed googletest files (CMake handles dependency) * Moved Windows resources (icon) out of src * Reworked Win32 to compatible System * Rework code to use C++17 std::filesystem::path * Rework WinMain to standard main and let SDL2main and GTestmain handle Windows * Add GNU/Linux support * Fixed lightning effect in Catacombs Adventures * Fixed several memory leaks (mostly in test code)
- Loading branch information
Showing
266 changed files
with
3,412 additions
and
73,259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
cmake_minimum_required(VERSION 3.21) | ||
|
||
set(CMAKE_DISABLE_SOURCE_CHANGES ON) | ||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) | ||
|
||
project(CatacombGL LANGUAGES CXX VERSION 0.5.3) | ||
|
||
option(BUILD_TESTS "Build Tests" OFF) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
if(MINGW) | ||
# This might not only be required for mingw | ||
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libstdc++") | ||
endif() | ||
|
||
find_package(OpenGL) | ||
|
||
add_library( CatacombGL_Objects OBJECT | ||
ThirdParty/RefKeen/be_st.h | ||
ThirdParty/RefKeen/be_st_sdl_audio_timer.cpp | ||
ThirdParty/RefKeen/id_sd.cpp | ||
ThirdParty/RefKeen/id_sd.h | ||
ThirdParty/opl/dbopl.cpp | ||
ThirdParty/opl/dbopl.h | ||
) | ||
|
||
add_subdirectory(src/Engine) | ||
add_subdirectory(src/Abyss) | ||
add_subdirectory(src/Apocalypse) | ||
add_subdirectory(src/Armageddon) | ||
add_subdirectory(src/Catacomb3D) | ||
|
||
if(WIN32) | ||
include(FetchContent) | ||
|
||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") | ||
cmake_policy(SET CMP0135 NEW) | ||
endif() | ||
|
||
FetchContent_Declare( | ||
sdldev | ||
URL https://github.com/libsdl-org/SDL/releases/download/release-2.24.1/SDL2-devel-2.24.1-VC.zip | ||
URL_MD5 63dd0eca2c6715c8170b1cd3e84017fc | ||
) | ||
|
||
FetchContent_MakeAvailable(sdldev) | ||
set(SDL2_PATH ${sdldev_SOURCE_DIR}) | ||
find_package(SDL2 REQUIRED CONFIG PATHS ${sdldev_SOURCE_DIR}/cmake NO_DEFAULT_PATH) | ||
|
||
target_link_libraries( CatacombGL_Objects | ||
"shlwapi" | ||
SDL2::SDL2main | ||
) | ||
|
||
else() | ||
find_package(SDL2 REQUIRED) | ||
|
||
endif() | ||
|
||
target_link_libraries( CatacombGL_Objects | ||
SDL2::SDL2 | ||
) | ||
|
||
add_executable(CatacombGL) | ||
add_subdirectory(src/System) | ||
|
||
if(WIN32) | ||
target_sources( CatacombGL | ||
PUBLIC | ||
${CMAKE_SOURCE_DIR}/res/win/CatacombGL.ico | ||
${CMAKE_SOURCE_DIR}/res/win/CatacombGL.rc | ||
${CMAKE_SOURCE_DIR}/res/win/resource.h | ||
) | ||
|
||
set_source_files_properties( | ||
${CMAKE_SOURCE_DIR}/res/win/CatacombGL.rc | ||
PROPERTIES LANGUAGE RC | ||
) | ||
|
||
endif() | ||
|
||
target_link_libraries( CatacombGL | ||
CatacombGL_Objects | ||
OpenGL::GL | ||
OpenGL::GLU | ||
) | ||
|
||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTS) | ||
add_subdirectory(src/Test) | ||
endif() | ||
|
||
include(CPack) | ||
if(WIN32) | ||
set(CMAKE_INSTALL_BINDIR ".") | ||
set(CMAKE_INSTALL_LIBDIR ".") | ||
install(FILES $<TARGET_RUNTIME_DLLS:CatacombGL> TYPE LIB) | ||
endif() | ||
install(TARGETS CatacombGL RUNTIME) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# the name of the target operating system | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
|
||
# which compilers to use for C and C++ | ||
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) | ||
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) | ||
|
||
# where is the target environment located | ||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32/) | ||
|
||
# adjust the default behavior of the FIND_XXX() commands: | ||
# search programs in the host environment | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
|
||
# search headers and libraries in the target environment | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
|
||
# run windows tests in wine | ||
set(CMAKE_CROSSCOMPILING_EMULATOR wine) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.