Global replace SDL2->SDL3

This commit is contained in:
Louis Gombert
2024-12-27 13:12:05 +01:00
parent 294a087c50
commit f2ff77ef4f
13 changed files with 22 additions and 22 deletions

View File

@@ -17,7 +17,7 @@ jobs:
- name: Generate git hash and tarball
run: |
sudo apt update
sudo apt install -y ninja-build cmake g++ libsdl2-dev zlib1g-dev
sudo apt install -y ninja-build cmake g++ libsdl3-dev zlib1g-dev
cmake --preset linux
cmake --build --preset linux -t get_git_hash
cmake --build --preset linux -t package_source

View File

@@ -2,7 +2,7 @@
# Building Descent 3 Open Source
## Dependencies
The build process uses [**CMake**](https://cmake.org/) and, by default, [**Ninja**](https://ninja-build.org/). You must install these; the project cannot locate them for you. The source code depends on [**SDL2**](https://github.com/libsdl-org/SDL/tree/SDL2) and [**zlib**](https://github.com/madler/zlib). You can supply these dependencies yourself via your system's library management tools, or the build system can locate the dependencies for you using [vcpkg](https://github.com/microsoft/vcpkg), a cross-platform dependency-management system developed by Microsoft. The official builds source their dependencies from vcpkg.
The build process uses [**CMake**](https://cmake.org/) and, by default, [**Ninja**](https://ninja-build.org/). You must install these; the project cannot locate them for you. The source code depends on [**SDL3**](https://github.com/libsdl-org/SDL/tree/main) and [**zlib**](https://github.com/madler/zlib). You can supply these dependencies yourself via your system's library management tools, or the build system can locate the dependencies for you using [vcpkg](https://github.com/microsoft/vcpkg), a cross-platform dependency-management system developed by Microsoft. The official builds source their dependencies from vcpkg.
## Installing and using vcpkg
* When building for Windows, vcpkg is already installed and configured when using any of the Visual Studio command prompts (either actual Command Prompt, or PowerShell).
@@ -132,11 +132,11 @@ Once CMake finishes, the built files will be put in `builds/mac/build/Debug` or
* If you would like to manage the code dependencies yourself:
* APT users
```sh
sudo apt install -y --no-install-recommends libsdl2-dev zlib1g-dev libcpp-httplib-dev libgtest-dev libglm-dev
sudo apt install -y --no-install-recommends libsdl3-dev zlib1g-dev libcpp-httplib-dev libgtest-dev libglm-dev
```
* DNF users
```sh
sudo dnf install -y SDL2-devel zlib-devel cpp-httplib-devel gtest glm-devel
sudo dnf install -y SDL3-devel zlib-devel cpp-httplib-devel gtest glm-devel
```
3. **Clone the Descent3 source code.**

View File

@@ -161,9 +161,9 @@ endif()
find_package(glm REQUIRED)
find_package(httplib REQUIRED)
find_package(SDL2 REQUIRED)
# Some versions of the SDL2 find_package set SDL2_INCLUDE_DIR and some set a plural SDL2_INCLUDE_DIRS. Check both.
message("SDL2 Include Dir is ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}")
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
# Some versions of the SDL3 find_package set SDL3_INCLUDE_DIR and some set a plural SDL3_INCLUDE_DIRS. Check both.
message("SDL3 Include Dir is ${SDL3_INCLUDE_DIR} ${SDL3_INCLUDE_DIRS}")
if(USE_EXTERNAL_PLOG)
find_package(plog REQUIRED)
endif()
@@ -171,11 +171,11 @@ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
message("Building for Linux")
add_compile_definitions(POSIX __LINUX__ _USE_OGL_ACTIVE_TEXTURES PRIMARY_HOG=\"d3-linux.hog\")
set(PLATFORM_INCLUDES "lib/linux" ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS})
set(PLATFORM_INCLUDES "lib/linux" ${SDL3_INCLUDE_DIR} ${SDL3_INCLUDE_DIRS})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
message("Building for MAC OSX")
add_compile_definitions(POSIX MACOSX=1 _USE_OGL_ACTIVE_TEXTURES PRIMARY_HOG=\"d3-osx.hog\")
set(PLATFORM_INCLUDES "lib/linux" ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS})
set(PLATFORM_INCLUDES "lib/linux" ${SDL3_INCLUDE_DIR} ${SDL3_INCLUDE_DIRS})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Windows.h defines to avoid as many issues as possible.
add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX NODRAWTEXT NOBITMAP NOMCX NOSERVICE PRIMARY_HOG=\"d3-win.hog\"

View File

@@ -312,7 +312,7 @@ file(GLOB_RECURSE INCS "../lib/*.h")
add_executable(Descent3 WIN32 MACOSX_BUNDLE ${D3Icon} ${HEADERS} ${CPPS} ${INCS} ${MANIFEST} ${RC_FILE})
target_link_libraries(Descent3 PRIVATE
SDL2::SDL2
SDL3::SDL3
2dlib
AudioEncode
bitmap

View File

@@ -30,6 +30,6 @@ target_link_libraries(ddebug PRIVATE
misc
>
PUBLIC
SDL2::SDL2
SDL3::SDL3
logger
)

View File

@@ -28,7 +28,7 @@ set(CPPS
)
add_library(ddio STATIC ${HEADERS} ${CPPS})
target_link_libraries(ddio PRIVATE
SDL2::SDL2
SDL3::SDL3
ddebug
logger
mem

View File

@@ -564,7 +564,7 @@ set(SOURCE
set(CMAKE_MFC_FLAG 1)
# Editor only works in Windows, because of MFC and DirectX dependencies
set(PLATFORM_LIBS linux wsock32.lib winmm.lib dd_grwin32 win32 SDL2::SDL2)
set(PLATFORM_LIBS linux wsock32.lib winmm.lib dd_grwin32 win32 SDL3::SDL3)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC")

View File

@@ -16,7 +16,7 @@ set(CPPS
add_library(libmve STATIC ${HEADERS} ${CPPS})
target_link_libraries(libmve PRIVATE
ddio
SDL2::SDL2
SDL3::SDL3
)
target_include_directories(libmve PUBLIC
$<BUILD_INTERFACE:

View File

@@ -23,5 +23,5 @@ target_include_directories(linux PUBLIC
target_link_libraries(linux PRIVATE
ddebug
ddio
SDL2::SDL2
SDL3::SDL3
)

View File

@@ -28,7 +28,7 @@ add_definitions(-DOUTRAGE_VERSION)
add_library(dmfc STATIC ${HEADERS} ${CPPS})
target_link_libraries(dmfc PUBLIC
SDL2::SDL2
SDL3::SDL3
grtext
misc
module

View File

@@ -34,7 +34,7 @@ add_library(renderer STATIC ${HEADERS} ${CPPS})
target_include_directories(renderer PRIVATE ${GENERATED_HEADERS})
target_link_libraries(renderer PRIVATE
glm::glm
SDL2::SDL2
SDL3::SDL3
bitmap
ddebug
ddio

View File

@@ -26,7 +26,7 @@ target_link_libraries(sndlib PRIVATE
mem
stream_audio
physics
SDL2::SDL2
SDL3::SDL3
)
target_include_directories(sndlib PUBLIC
$<BUILD_INTERFACE:

View File

@@ -7,27 +7,27 @@
"plog",
"zlib",
{
"name": "sdl2",
"name": "sdl3",
"version>=": "2.30.8",
"features": ["x11", "wayland", "alsa"],
"default-features": false,
"platform": "linux & !native"
},
{
"name": "sdl2",
"name": "sdl3",
"version>=": "2.30.8",
"features": ["x11","wayland", "alsa"],
"platform": "linux & native"
},
{
"name": "sdl2",
"name": "sdl3",
"version>=": "2.30.8",
"platform": "!linux"
}
],
"overrides": [
{
"name": "sdl2",
"name": "sdl3",
"version": "2.30.8"
}
]