Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
sudo apt-get update
sudo apt-get install \
cmake gettext ninja-build mold jq \
libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev libflac-dev \
libsdl3-dev libsdl3-ttf-dev libsdl3-image-dev libsdl3-mixer-dev \
sqlite3 libsqlite3-dev zlib1g-dev

VERSION=20
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ jobs:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
g++ --version

- name: install SDL2 dependencies (ubuntu)
- name: install SDL3 dependencies (ubuntu)
if: ${{ env.SKIP == 'false' && matrix.tiles == 1 }}
run: |
sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev libflac-dev
sudo apt-get install libsdl3-dev libsdl3-ttf-dev libsdl3-image-dev libsdl3-mixer-dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libsdl3-mixer-dev does not exist as an ubuntu package, the rest of the sdl3 packages are only available currently on ubuntu 25.04 or newer (and this workflow uses ubuntu 24.04)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is known, unfortunately we're gonna have to wait for a number of reasons.
I'm marking this as a draft for now. MacOS is similarly effected. We'd have to compile ourselves to skip the wait.
Hopefully won't be too long.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if SDL3 requires a newer version of Ubuntu, I assume we'll have to change the required Ubuntu version.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stable SDL3_Mixer came out last week, so its not available on stable distro packages yet.

I don't think the runner is going to support it until 26.04 LTS (ubuntu-latest runner image is still on 24.04)
Alternatively, we'll have to CMake FetchContent / Git Submodule SDL, as to not depend on distro packaging


# problem matchers are only ran on GCC to reduce error spam
- name: add problem matcher
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/msvc-full-features-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ env:
CMAKE_PRESET: windows-tiles-sounds-x64-msvc

jobs:
build_catatclysm:
build_cataclysm:
name: Build
runs-on: windows-latest
if: github.event.pull_request.draft == false
Expand Down Expand Up @@ -93,6 +93,7 @@ jobs:
id: runvcpkg
with:
vcpkgDirectory: "${{ runner.workspace }}/b/vcpkg"
vcpkgGitCommitId: "a8f78d257ade3c2e7999c1129a6d29971ae32006"

- name: Integrate vcpkg
run: |
Expand Down Expand Up @@ -125,6 +126,15 @@ jobs:

- name: Configure and Build
uses: lukka/run-cmake@v10
env:
# lukka/run-cmake@v10 builds cmake's env from `vcpkg env set` output and only reads the
# first line of each NAME=VALUE pair. X_VCPKG_RECURSIVE_DATA is a multi-line JSON block,
# so it gets truncated to just "{", causing cmake to fail with "Unexpected EOF". Override
# it to empty so cmake never sees the mangled value.
X_VCPKG_RECURSIVE_DATA: ""
# `vcpkg env set` output does not include VCPKG_ROOT, so cmake inherits it from the
# runner image's system env (C:\vcpkg) instead of our pinned install. Set it explicitly.
VCPKG_ROOT: "${{ runner.workspace }}/b/vcpkg"
with:
configurePreset: ${{ env.CMAKE_PRESET }}
buildPreset: windows-msvc-build
Expand All @@ -133,9 +143,9 @@ jobs:
- name: Dump logs if build failed
if: failure()
run: |
echo =================================================
echo ============================================================
Get-ChildItem "${{ runner.workspace }}/Cataclysm-BN/out/build/$env:CMAKE_PRESET" -Recurse
echo =================================================
echo ============================================================

- name: Compile .mo files for localization
run: |
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,12 @@ jobs:
with:
fetch-depth: 1

- name: Install runtime dependencies
uses: BrettDong/setup-sdl2-frameworks@v1
with:
sdl2: 2.30.11
sdl2-ttf: 2.24.0
sdl2-image: 2.8.4
sdl2-mixer: 2.8.0

- name: Install build dependencies
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext parallel llvm@20 astyle sqlite3 zlib
# NOTE (macOS maintainer): sdl3_mixer is not yet available as a Homebrew formula (as of
# March 2026). Once `brew install sdl3_mixer` works, add it back here and restore
# SOUND=${{ matrix.tiles }} in the make command below.
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl3 sdl3_image sdl3_ttf gettext parallel llvm@20 astyle sqlite3 zlib
python3 -m venv ./venv
source ./venv/bin/activate
pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist polib luaparser
Expand All @@ -102,4 +97,6 @@ jobs:
- name: Build
run: |
source ./venv/bin/activate
make -j3 CCACHE=1 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LANGUAGES=all USE_HOME_DIR=1 OSX_MIN=11 PCH=0 COMPILER=$(brew --prefix llvm@20)/bin/clang++ dmgdist
# SOUND=0: sdl3_mixer is not yet in Homebrew — see the brew install step above.
# Restore SOUND=${{ matrix.tiles }} once sdl3_mixer becomes available.
make -j3 CCACHE=1 TILES=${{ matrix.tiles }} SOUND=0 RELEASE=1 LANGUAGES=all USE_HOME_DIR=1 OSX_MIN=11 PCH=0 COMPILER=$(brew --prefix llvm@20)/bin/clang++ dmgdist
50 changes: 25 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(_OS_DARWIN_ 1)
add_definitions(-DMACOSX)
if (TILES)
add_definitions(-DOSX_SDL2_LIBS)
add_definitions(-DOSX_SDL3_LIBS)
endif ()
endif ()

Expand Down Expand Up @@ -330,42 +330,42 @@ endif ()
# Check for build types and libraries
if (TILES)
# Find SDL, SDL_ttf & SDL_image for graphical install
message(STATUS "Searching for SDL2 library --")
message(STATUS "Searching for SDL3 library --")
if (NOT CMAKE_FIND_PACKAGE_PREFER_CONFIG)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
# ^^ Use sdl2-config.cmake provided by the system or VCPKG
find_package(SDL2)
if(NOT SDL2_FOUND)
# Use our CMakeModules/Find/FindSDL2.cmake
# ^^ Use sdl3-config.cmake provided by the system or VCPKG
find_package(SDL3 CONFIG REQUIRED)
if(NOT SDL3_FOUND)
# Use our CMakeModules/Find/FindSDL3.cmake
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
find_package(SDL2)
find_package(SDL3)
endif()
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
endif()
if (NOT (SDL2_FOUND OR TARGET SDL2::SDL2 OR TARGET SDL2::SDL2-static))
if (NOT (SDL3_FOUND OR TARGET SDL3::SDL3 OR TARGET SDL3::SDL3-static))
message(FATAL_ERROR
"This project requires SDL2 to be installed to compile in graphical mode. \
Please install the SDL2 development libraries, \
"This project requires SDL3 to be installed to compile in graphical mode. \
Please install the SDL3 development libraries, \
or try compiling without -DTILES=1 for a text-only compilation. \
See CMake compiling guide for details and more info.")
endif ()

message(STATUS "Searching for SDL2_TTF library --")
find_package(SDL2_ttf)
if (NOT (SDL2_TTF_FOUND OR TARGET SDL2::SDL2_ttf OR TARGET SDL2_ttf::SDL2_ttf-static))
message(STATUS "Searching for SDL3_ttf library --")
find_package(SDL3_ttf CONFIG REQUIRED)
if (NOT (SDL3_TTF_FOUND OR TARGET SDL3_ttf::SDL3_ttf OR TARGET SDL3_ttf::SDL3_ttf-static))
message(FATAL_ERROR
"This project requires SDL2_ttf to be installed to compile in graphical mode. \
Please install the SDL2_ttf development libraries, \
"This project requires SDL3_ttf to be installed to compile in graphical mode. \
Please install the SDL3_ttf development libraries, \
or try compiling without -DTILES=1 for a text-only compilation. \
See CMake compiling guide for details and more info.")
endif ()

message(STATUS "Searching for SDL2_image library --")
find_package(SDL2_image)
if (NOT (SDL2_IMAGE_FOUND OR TARGET SDL2::SDL2_image OR TARGET SDL2_image::SDL2_image-static))
message(STATUS "Searching for SDL3_image library --")
find_package(SDL3_image CONFIG REQUIRED)
if (NOT (SDL3_IMAGE_FOUND OR TARGET SDL3_image::SDL3_image OR TARGET SDL3_image::SDL3_image-static))
message(FATAL_ERROR
"This project requires SDL2_image to be installed to compile in graphical mode. \
Please install the SDL2_image development libraries, \
"This project requires SDL3_image to be installed to compile in graphical mode. \
Please install the SDL3_image development libraries, \
or try compiling without -DTILES=1 for a text-only compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
Expand Down Expand Up @@ -400,12 +400,12 @@ if (SOUND)
endif ()

# Sound requires SDL_mixer library
message(STATUS "Searching for SDL2_mixer library --")
find_package(SDL2_mixer)
if (NOT (SDL2_MIXER_FOUND OR TARGET SDL2_mixer::SDL2_mixer
OR TARGET SDL2_mixer::SDL2_mixer-static))
message(STATUS "Searching for SDL3_mixer library --")
find_package(SDL3_mixer CONFIG REQUIRED)
if (NOT (SDL3_MIXER_FOUND OR TARGET SDL3_mixer::SDL3_mixer
OR TARGET SDL3_mixer::SDL3_mixer-static))
message(FATAL_ERROR
"You need the SDL2_mixer development library \
"You need the SDL3_mixer development library \
to be able to compile with sound enabled. \
See CMake compiling guide for details and more info.")
endif()
Expand Down
93 changes: 93 additions & 0 deletions CMakeModules/Find/FindSDL3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#.rst:
# FindSDL3
# -------
#
# Locate SDL3 library (fallback module — SDL3Config.cmake is preferred)
#
# This module defines:
#
# SDL3_LIBRARY, the name of the library to link against
# SDL3_FOUND, if false, do not try to link to SDL3
# SDL3_INCLUDE_DIR, where to find SDL3/SDL.h
# SDL3_VERSION_STRING, human-readable string containing the version of SDL3

find_path(SDL3_INCLUDE_DIR SDL3/SDL.h
HINTS
ENV SDL3DIR
${CMAKE_SOURCE_DIR}/dep/
PATH_SUFFIXES SDL3
include/SDL3 include
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()

find_library(SDL3_LIBRARY_TEMP
NAMES SDL3
HINTS
ENV SDL3DIR
${CMAKE_SOURCE_DIR}/dep/
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)

if(NOT SDL3_BUILDING_LIBRARY)
if(NOT SDL3_INCLUDE_DIR MATCHES ".framework")
find_library(SDL3MAIN_LIBRARY
NAMES SDL3main
HINTS
ENV SDL3DIR
${CMAKE_SOURCE_DIR}/dep/
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
endif()
endif()

if(NOT APPLE)
find_package(Threads)
endif()

if(SDL3_LIBRARY_TEMP)
if(SDL3MAIN_LIBRARY AND NOT SDL3_BUILDING_LIBRARY)
list(FIND SDL3_LIBRARY_TEMP "${SDL3MAIN_LIBRARY}" _SDL3_MAIN_INDEX)
if(_SDL3_MAIN_INDEX EQUAL -1)
set(SDL3_LIBRARY_TEMP "${SDL3MAIN_LIBRARY}" ${SDL3_LIBRARY_TEMP})
endif()
unset(_SDL3_MAIN_INDEX)
endif()

if(APPLE)
set(SDL3_LIBRARY_TEMP ${SDL3_LIBRARY_TEMP} "-framework Cocoa")
endif()

if(NOT APPLE)
set(SDL3_LIBRARY_TEMP ${SDL3_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
endif()

set(SDL3_LIBRARY ${SDL3_LIBRARY_TEMP} CACHE STRING "Where the SDL3 Library can be found")
set(SDL3_LIBRARY_TEMP "${SDL3_LIBRARY_TEMP}" CACHE INTERNAL "")
endif()

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL3
REQUIRED_VARS SDL3_LIBRARY SDL3_INCLUDE_DIR
VERSION_VAR SDL3_VERSION_STRING)

if(SDL3_FOUND AND NOT TARGET SDL3::SDL3)
if(NOT DYNAMIC_LINKING)
add_library(SDL3::SDL3-static STATIC IMPORTED)
set_target_properties(SDL3::SDL3-static PROPERTIES
IMPORTED_LOCATION ${SDL3_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${SDL3_INCLUDE_DIR}
)
else()
add_library(SDL3::SDL3 UNKNOWN IMPORTED)
set_target_properties(SDL3::SDL3 PROPERTIES
IMPORTED_LOCATION ${SDL3_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${SDL3_INCLUDE_DIR}
)
endif()
endif()
89 changes: 89 additions & 0 deletions CMakeModules/Find/FindSDL3_image.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#.rst:
# FindSDL3_image
# -------------
#
# Locate SDL3_image library (fallback module — SDL3_imageConfig.cmake is preferred)
#
# This module defines:
#
# SDL3_IMAGE_LIBRARIES, the name of the library to link against
# SDL3_IMAGE_INCLUDE_DIRS, where to find the headers
# SDL3_IMAGE_FOUND, if false, do not try to link against
# SDL3_IMAGE_VERSION_STRING - human-readable string containing the version of SDL3_image

find_path(SDL3_IMAGE_INCLUDE_DIR SDL3/SDL_image.h
HINTS
ENV SDL3IMAGEDIR
ENV SDL3DIR
${CMAKE_SOURCE_DIR}/dep/
PATH_SUFFIXES SDL3
include/SDL3 include
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()

find_library(SDL3_IMAGE_LIBRARY
NAMES SDL3_image
HINTS
ENV SDL3IMAGEDIR
ENV SDL3DIR
${CMAKE_SOURCE_DIR}/dep/
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)

set(SDL3_IMAGE_LIBRARIES ${SDL3_IMAGE_LIBRARY})
set(SDL3_IMAGE_INCLUDE_DIRS ${SDL3_IMAGE_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL3_image
REQUIRED_VARS SDL3_IMAGE_LIBRARIES SDL3_IMAGE_INCLUDE_DIRS
VERSION_VAR SDL3_IMAGE_VERSION_STRING)

mark_as_advanced(SDL3_IMAGE_LIBRARY SDL3_IMAGE_INCLUDE_DIR)

if(NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
if (NOT TARGET SDL3_image::SDL3_image-static)
add_library(SDL3_image::SDL3_image-static STATIC IMPORTED)
set_property(TARGET SDL3_image::SDL3_image-static
PROPERTY IMPORTED_LOCATION ${SDL3_IMAGE_LIBRARY}
)
endif()
message(STATUS "Searching for SDL3_image deps libraries --")
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
find_package(TIFF REQUIRED)
find_library(JBIG jbig REQUIRED)
find_package(LibLZMA REQUIRED)
target_link_libraries(SDL3_image::SDL3_image-static INTERFACE
JPEG::JPEG
PNG::PNG
TIFF::TIFF
${JBIG}
LibLZMA::LibLZMA
${ZSTD}
)
pkg_check_modules(WEBP REQUIRED IMPORTED_TARGET libwebp)
pkg_check_modules(ZIP REQUIRED IMPORTED_TARGET libzip)
pkg_check_modules(ZSTD REQUIRED IMPORTED_TARGET libzstd)
pkg_check_modules(DEFLATE REQUIRED IMPORTED_TARGET libdeflate)
target_link_libraries(SDL3_image::SDL3_image-static INTERFACE
PkgConfig::WEBP
PkgConfig::ZIP
PkgConfig::ZSTD
PkgConfig::DEFLATE
)
elseif(NOT TARGET SDL3_image::SDL3_image)
add_library(SDL3_image::SDL3_image UNKNOWN IMPORTED)
set_target_properties(SDL3_image::SDL3_image PROPERTIES
IMPORTED_LOCATION ${SDL3_IMAGE_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${SDL3_IMAGE_INCLUDE_DIRS}
)
target_link_libraries(SDL3_image::SDL3_image INTERFACE
z
)
endif()
Loading