Remove SDL2 from the build systems
- deleted the SDL2 branches and the bundled FindSDL2 modules - made SDL3=0 and USE_SDL3=OFF hard errors
This commit is contained in:
+16
-77
@@ -1,10 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
option(TILES "Build graphical tileset version." "OFF")
|
||||
option(USE_SDL3 "Build against SDL3 instead of SDL2 (requires TILES)." "${TILES}")
|
||||
if (USE_SDL3)
|
||||
set(VCPKG_MANIFEST_FEATURES "sdl3")
|
||||
elseif (TILES)
|
||||
set(VCPKG_MANIFEST_FEATURES "sdl2")
|
||||
# SDL2 support was removed; SDL3 is the only tiles backend. The option is kept
|
||||
# so an old -DUSE_SDL3=OFF command line fails loudly instead of silently
|
||||
# building something else.
|
||||
option(USE_SDL3 "Removed; SDL3 is the only tiles backend." "ON")
|
||||
if (TILES AND NOT USE_SDL3)
|
||||
message(FATAL_ERROR
|
||||
"USE_SDL3=OFF is no longer supported: SDL2 support was removed and \
|
||||
SDL3 is the only tiles backend. Drop the option, or build without \
|
||||
-DTILES=ON for a text-only compilation.")
|
||||
endif()
|
||||
project(CataclysmDDA)
|
||||
|
||||
@@ -93,9 +97,6 @@ endif ()
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
set(_OS_DARWIN_ 1)
|
||||
add_definitions(-DMACOSX)
|
||||
if (TILES)
|
||||
add_definitions(-DOSX_SDL2_LIBS)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
@@ -216,7 +217,6 @@ endif ()
|
||||
message(STATUS "GIT_BINARY : ${GIT_EXECUTABLE}")
|
||||
message(STATUS "DYNAMIC_LINKING : ${DYNAMIC_LINKING}")
|
||||
message(STATUS "TILES : ${TILES}")
|
||||
message(STATUS "USE_SDL3 : ${USE_SDL3}")
|
||||
message(STATUS "CURSES : ${CURSES}")
|
||||
message(STATUS "SOUND : ${SOUND}")
|
||||
message(STATUS "BACKTRACE : ${BACKTRACE}")
|
||||
@@ -287,23 +287,23 @@ find_package(Threads REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
# Check for build types and libraries
|
||||
if (TILES AND USE_SDL3)
|
||||
if (TILES)
|
||||
message(STATUS "Searching for SDL3 library --")
|
||||
# SDL_SetGPURenderState and SDL_GetGPURendererDevice were added in SDL 3.4.0;
|
||||
# the GPU shader path requires that floor.
|
||||
find_package(SDL3 3.4.0 CONFIG)
|
||||
if (NOT (SDL3_FOUND OR TARGET SDL3::SDL3 OR TARGET SDL3::SDL3-static))
|
||||
message(FATAL_ERROR
|
||||
"USE_SDL3=ON requires SDL3 >= 3.4.0 to be installed. \
|
||||
"The tiles build requires SDL3 >= 3.4.0 to be installed. \
|
||||
Install or build a newer SDL3 development library, \
|
||||
or set USE_SDL3=OFF to build against SDL2.")
|
||||
or build without -DTILES=ON for a text-only compilation.")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Searching for SDL3_ttf library --")
|
||||
find_package(SDL3_ttf CONFIG)
|
||||
if (NOT (SDL3_TTF_FOUND OR TARGET SDL3_ttf::SDL3_ttf OR TARGET SDL3_ttf::SDL3_ttf-static))
|
||||
message(FATAL_ERROR
|
||||
"USE_SDL3=ON requires SDL3_ttf to be installed.")
|
||||
"The tiles build requires SDL3_ttf to be installed.")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Searching for SDL3_image library --")
|
||||
@@ -311,53 +311,7 @@ if (TILES AND USE_SDL3)
|
||||
if (NOT (SDL3_IMAGE_FOUND OR TARGET SDL3_image::SDL3_image
|
||||
OR TARGET SDL3_image::SDL3_image-static))
|
||||
message(FATAL_ERROR
|
||||
"USE_SDL3=ON requires SDL3_image to be installed.")
|
||||
endif ()
|
||||
add_definitions(-DTILES -DUSE_SDL3)
|
||||
endif ()
|
||||
|
||||
if (TILES AND NOT USE_SDL3)
|
||||
# Find SDL, SDL_ttf & SDL_image for graphical install
|
||||
message(STATUS "Searching for SDL2 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
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
|
||||
find_package(SDL2)
|
||||
endif()
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
|
||||
endif()
|
||||
if (NOT (SDL2_FOUND OR TARGET SDL2::SDL2 OR TARGET SDL2::SDL2-static))
|
||||
message(FATAL_ERROR
|
||||
"This project requires SDL2 to be installed to compile in graphical mode. \
|
||||
Please install the SDL2 development libraries, \
|
||||
or try compiling without -DTILES=1 for a text-only compilation. \
|
||||
See doc/c++/COMPILING-CMAKE.md 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
|
||||
OR TARGET SDL2_ttf::SDL2_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, \
|
||||
or try compiling without -DTILES=1 for a text-only compilation. \
|
||||
See doc/c++/COMPILING-CMAKE.md 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
|
||||
OR TARGET SDL2_image::SDL2_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, \
|
||||
or try compiling without -DTILES=1 for a text-only compilation. \
|
||||
See doc/c++/COMPILING-CMAKE.md for details and more info.")
|
||||
"The tiles build requires SDL3_image to be installed.")
|
||||
endif ()
|
||||
add_definitions(-DTILES)
|
||||
endif ()
|
||||
@@ -418,28 +372,13 @@ if (CURSES)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (SOUND AND USE_SDL3)
|
||||
if (SOUND)
|
||||
message(STATUS "Searching for SDL3_mixer library --")
|
||||
find_package(SDL3_mixer CONFIG)
|
||||
if (NOT (SDL3_MIXER_FOUND OR TARGET SDL3_mixer::SDL3_mixer
|
||||
OR TARGET SDL3_mixer::SDL3_mixer-static))
|
||||
message(FATAL_ERROR
|
||||
"USE_SDL3 + SOUND requires SDL3_mixer to be installed.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (SOUND AND NOT USE_SDL3)
|
||||
# Sound requires SDL_mixer library
|
||||
message(STATUS "Searching for SDL2_mixer library --")
|
||||
if (VCPKG_MANIFEST_MODE)
|
||||
find_package(Vorbis CONFIG REQUIRED)
|
||||
endif()
|
||||
find_package(SDL2_mixer)
|
||||
if (NOT (SDL2_MIXER_FOUND OR TARGET SDL2_mixer::SDL2_mixer
|
||||
OR TARGET SDL2_mixer::SDL2_mixer-static))
|
||||
message(FATAL_ERROR
|
||||
"You need the SDL2_mixer development library \
|
||||
to be able to compile with sound enabled. \
|
||||
"SOUND requires SDL3_mixer to be installed. \
|
||||
See doc/c++/COMPILING-CMAKE.md for details and more info.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
#.rst:
|
||||
# FindSDL2
|
||||
# -------
|
||||
#
|
||||
# Locate SDL2 library
|
||||
#
|
||||
# This module defines
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2_LIBRARY, the name of the library to link against
|
||||
# SDL2_FOUND, if false, do not try to link to SDL
|
||||
# SDL2_INCLUDE_DIR, where to find SDL.h
|
||||
# SDL2_VERSION_STRING, human-readable string containing the version of SDL
|
||||
#
|
||||
#
|
||||
#
|
||||
# This module responds to the flag:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2_BUILDING_LIBRARY
|
||||
# If this is defined, then no SDL2_main will be linked in because
|
||||
# only applications need main().
|
||||
# Otherwise, it is assumed you are building an application and this
|
||||
# module will attempt to locate and set the proper link flags
|
||||
# as part of the returned SDL2_LIBRARY variable.
|
||||
#
|
||||
#
|
||||
#
|
||||
# Don't forget to include SDLmain.h and SDLmain.m your project for the
|
||||
# OS X framework based version. (Other versions link to -lSDLmain which
|
||||
# this module will try to find on your behalf.) Also for OS X, this
|
||||
# module will automatically add the -framework Cocoa on your behalf.
|
||||
#
|
||||
#
|
||||
#
|
||||
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your
|
||||
# configuration and no SDL2_LIBRARY, it means CMake did not find your SDL
|
||||
# library (SDL.dll, libsdl.so, SDL.framework, etc). Set
|
||||
# SDL2_LIBRARY_TEMP to point to your SDL library, and configure again.
|
||||
# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this
|
||||
# value as appropriate. These values are used to generate the final
|
||||
# SDL2_LIBRARY variable, but when these values are unset, SDL2_LIBRARY
|
||||
# does not get created.
|
||||
#
|
||||
#
|
||||
#
|
||||
# $SDLDIR is an environment variable that would correspond to the
|
||||
# ./configure --prefix=$SDLDIR used in building SDL. l.e.galup 9-20-02
|
||||
#
|
||||
# Modified by Eric Wing. Added code to assist with automated building
|
||||
# by using environmental variables and providing a more
|
||||
# controlled/consistent search behavior. Added new modifications to
|
||||
# recognize OS X frameworks and additional Unix paths (FreeBSD, etc).
|
||||
# Also corrected the header search path to follow "proper" SDL
|
||||
# guidelines. Added a search for SDLmain which is needed by some
|
||||
# platforms. Added a search for threads which is needed by some
|
||||
# platforms. Added needed compile switches for MinGW.
|
||||
#
|
||||
# On OSX, this will prefer the Framework version (if found) over others.
|
||||
# People will have to manually change the cache values of SDL2_LIBRARY to
|
||||
# override this selection or set the CMake environment
|
||||
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||
#
|
||||
# Note that the header path has changed from SDL/SDL.h to just SDL.h
|
||||
# This needed to change because "proper" SDL convention is #include
|
||||
# "SDL.h", not <SDL/SDL.h>. This is done for portability reasons
|
||||
# because not all systems place things in SDL/ (see FreeBSD).
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2003-2009 Kitware, Inc.
|
||||
# Copyright 2012 Benjamin Eikel
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
find_path(SDL2_INCLUDE_DIR SDL.h
|
||||
HINTS
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES SDL2
|
||||
# path suffixes to search inside ENV{SDLDIR}
|
||||
include/SDL2 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(SDL2_LIBRARY_TEMP
|
||||
NAMES SDL2
|
||||
HINTS
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
if(NOT SDL2_BUILDING_LIBRARY)
|
||||
if(NOT SDL2_INCLUDE_DIR MATCHES ".framework")
|
||||
# Non-OS X framework versions expect you to also dynamically link to
|
||||
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
|
||||
# seem to provide SDLmain for compatibility even though they don't
|
||||
# necessarily need it.
|
||||
find_library(SDL2MAIN_LIBRARY
|
||||
NAMES SDL2main
|
||||
HINTS
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
PATHS
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# SDL may require threads on your system.
|
||||
# The Apple build may not need an explicit flag because one of the
|
||||
# frameworks may already provide it.
|
||||
# But for non-OSX systems, I will use the CMake Threads package.
|
||||
if(NOT APPLE)
|
||||
find_package(Threads)
|
||||
endif()
|
||||
|
||||
# MinGW needs an additional library, mwindows
|
||||
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
|
||||
# (Actually on second look, I think it only needs one of the m* libraries.)
|
||||
if(MINGW)
|
||||
set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
|
||||
endif()
|
||||
|
||||
if(SDL2_LIBRARY_TEMP)
|
||||
# For SDLmain
|
||||
if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY)
|
||||
list(FIND SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" _SDL2_MAIN_INDEX)
|
||||
if(_SDL2_MAIN_INDEX EQUAL -1)
|
||||
set(SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" ${SDL2_LIBRARY_TEMP})
|
||||
endif()
|
||||
unset(_SDL2_MAIN_INDEX)
|
||||
endif()
|
||||
|
||||
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
|
||||
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||
# though it actually is there if I modify a pre-used variable.
|
||||
# I think it has something to do with the CACHE STRING.
|
||||
# So I use a temporary variable until the end so I can set the
|
||||
# "real" variable in one-shot.
|
||||
if(APPLE)
|
||||
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
# For threads, as mentioned Apple doesn't need this.
|
||||
# In fact, there seems to be a problem if I used the Threads package
|
||||
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||
if(NOT APPLE)
|
||||
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
# For MinGW library
|
||||
if(MINGW)
|
||||
set(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
endif()
|
||||
|
||||
# Set the final string here so the GUI reflects the final state.
|
||||
set(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
|
||||
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
|
||||
set(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
|
||||
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
|
||||
VERSION_VAR SDL2_VERSION_STRING)
|
||||
@@ -1,190 +0,0 @@
|
||||
#.rst:
|
||||
# FindSDL2_image
|
||||
# -------------
|
||||
#
|
||||
# Locate SDL2_image library
|
||||
#
|
||||
# This module defines:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2_IMAGE_LIBRARIES, the name of the library to link against
|
||||
# SDL2_IMAGE_INCLUDE_DIRS, where to find the headers
|
||||
# SDL2_IMAGE_FOUND, if false, do not try to link against
|
||||
# SDL2_IMAGE_VERSION_STRING - human-readable string containing the
|
||||
# version of SDL2_image
|
||||
#
|
||||
#
|
||||
#
|
||||
# For backward compatibility the following variables are also set:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2IMAGE_LIBRARY (same value as SDL2_IMAGE_LIBRARIES)
|
||||
# SDL2IMAGE_INCLUDE_DIR (same value as SDL2_IMAGE_INCLUDE_DIRS)
|
||||
# SDL2IMAGE_FOUND (same value as SDL2_IMAGE_FOUND)
|
||||
#
|
||||
#
|
||||
#
|
||||
# $SDL2DIR is an environment variable that would correspond to the
|
||||
# ./configure --prefix=$SDL2DIR used in building SDL2.
|
||||
#
|
||||
# Created by Eric Wing. This was influenced by the FindSDL2.cmake
|
||||
# module, but with modifications to recognize OS X frameworks and
|
||||
# additional Unix paths (FreeBSD, etc).
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
# Copyright 2012 Benjamin Eikel
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if(NOT SDL2_IMAGE_INCLUDE_DIR AND SDL2IMAGE_INCLUDE_DIR)
|
||||
set(SDL2_IMAGE_INCLUDE_DIR ${SDL2IMAGE_INCLUDE_DIR} CACHE PATH "directory cache
|
||||
entry initialized from old variable name")
|
||||
endif()
|
||||
find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h
|
||||
HINTS
|
||||
ENV SDL2IMAGEDIR
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES SDL2
|
||||
# path suffixes to search inside ENV{SDL2DIR}
|
||||
include/SDL2 include
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||
else()
|
||||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
if(NOT SDL2_IMAGE_LIBRARY AND SDL2IMAGE_LIBRARY)
|
||||
set(SDL2_IMAGE_LIBRARY ${SDL2IMAGE_LIBRARY} CACHE FILEPATH "file cache entry
|
||||
initialized from old variable name")
|
||||
endif()
|
||||
find_library(SDL2_IMAGE_LIBRARY
|
||||
NAMES SDL2_image
|
||||
HINTS
|
||||
ENV SDL2IMAGEDIR
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY})
|
||||
set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image
|
||||
REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS
|
||||
VERSION_VAR SDL2_IMAGE_VERSION_STRING)
|
||||
|
||||
# for backward compatibility
|
||||
set(SDL2IMAGE_LIBRARY ${SDL2_IMAGE_LIBRARIES})
|
||||
set(SDL2IMAGE_INCLUDE_DIR ${SDL2_IMAGE_INCLUDE_DIRS})
|
||||
set(SDL2IMAGE_FOUND ${SDL2_IMAGE_FOUND})
|
||||
|
||||
mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR)
|
||||
|
||||
if(NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
|
||||
if (NOT TARGET SDL2_image:SDL2_image-static)
|
||||
add_library(SDL2_image::SDL2_image-static STATIC IMPORTED)
|
||||
set_property(TARGET SDL2_image::SDL2_image-static
|
||||
PROPERTY IMPORTED_LOCATION ${SDL2_IMAGE_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
message(STATUS "Searching for SDL_images deps libraries --")
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(TIFF REQUIRED)
|
||||
pkg_check_modules(WEBP REQUIRED IMPORTED_TARGET libwebp)
|
||||
target_link_libraries(TIFF::TIFF INTERFACE
|
||||
PkgConfig::WEBP
|
||||
)
|
||||
find_library(JBIG jbig REQUIRED)
|
||||
find_package(LibLZMA REQUIRED)
|
||||
target_link_libraries(SDL2_image::SDL2_image-static INTERFACE
|
||||
JPEG::JPEG
|
||||
PNG::PNG
|
||||
TIFF::TIFF
|
||||
${JBIG}
|
||||
LibLZMA::LibLZMA
|
||||
${ZSTD}
|
||||
)
|
||||
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(SDL2_image::SDL2_image-static INTERFACE
|
||||
PkgConfig::ZIP
|
||||
PkgConfig::ZSTD
|
||||
PkgConfig::DEFLATE
|
||||
)
|
||||
if(MSYS2)
|
||||
# only SHARED: find_package(libavif REQUIRED)
|
||||
find_library(AVIF avif)
|
||||
add_library(libavif STATIC IMPORTED)
|
||||
set_target_properties(libavif PROPERTIES
|
||||
IMPORTED_LOCATION ${AVIF}
|
||||
)
|
||||
pkg_check_modules(libyuv REQUIRED IMPORTED_TARGET libyuv)
|
||||
pkg_check_modules(dav1d REQUIRED IMPORTED_TARGET dav1d)
|
||||
pkg_check_modules(rav1e REQUIRED IMPORTED_TARGET rav1e)
|
||||
pkg_check_modules(SvtAv1Enc REQUIRED IMPORTED_TARGET SvtAv1Enc)
|
||||
target_link_libraries(PkgConfig::rav1e INTERFACE
|
||||
ntdll
|
||||
)
|
||||
pkg_check_modules(aom REQUIRED IMPORTED_TARGET aom)
|
||||
target_link_libraries(libavif INTERFACE
|
||||
PkgConfig::libyuv
|
||||
PkgConfig::dav1d
|
||||
PkgConfig::rav1e
|
||||
PkgConfig::SvtAv1Enc
|
||||
PkgConfig::aom
|
||||
)
|
||||
pkg_check_modules(JXL REQUIRED IMPORTED_TARGET libjxl libjxl_threads)
|
||||
# only SHARED: find_package(hwy REQUIRED)
|
||||
pkg_check_modules(hwy REQUIRED IMPORTED_TARGET libhwy)
|
||||
target_link_libraries(PkgConfig::JXL INTERFACE
|
||||
PkgConfig::hwy
|
||||
PkgConfig::BROTLI
|
||||
)
|
||||
find_package(libjpeg-turbo REQUIRED)
|
||||
pkg_check_modules(Lerc REQUIRED IMPORTED_TARGET Lerc)
|
||||
target_link_libraries(SDL2_image::SDL2_image-static INTERFACE
|
||||
libavif
|
||||
PkgConfig::JXL
|
||||
PkgConfig::Lerc
|
||||
libjpeg-turbo::turbojpeg
|
||||
)
|
||||
pkg_check_modules(WEBPDEMUX REQUIRED IMPORTED_TARGET libwebpdemux)
|
||||
pkg_check_modules(WEBPDECODER REQUIRED IMPORTED_TARGET libwebpdecoder)
|
||||
target_link_libraries(TIFF::TIFF INTERFACE
|
||||
WEBPDEMUX
|
||||
WEBPDECODER
|
||||
JPEG::JPEG
|
||||
)
|
||||
pkg_check_modules(sharpyuv REQUIRED IMPORTED_TARGET libsharpyuv)
|
||||
target_link_libraries(PkgConfig::WEBP INTERFACE
|
||||
PkgConfig::sharpyuv
|
||||
)
|
||||
endif()
|
||||
elseif(NOT TARGET SDL2_image::SDL2_image)
|
||||
add_library(SDL2_image::SDL2_image UNKNOWN IMPORTED)
|
||||
set_target_properties(SDL2_image::SDL2_image PROPERTIES
|
||||
IMPORTED_LOCATION ${SDL2_IMAGE_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_IMAGE_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(SDL2_image::SDL2_image INTERFACE
|
||||
z
|
||||
)
|
||||
endif()
|
||||
@@ -1,158 +0,0 @@
|
||||
#.rst:
|
||||
# FindSDL2_mixer
|
||||
# -------------
|
||||
#
|
||||
# Locate SDL2_mixer library
|
||||
#
|
||||
# This module defines:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2_MIXER_LIBRARIES, the name of the library to link against
|
||||
# SDL2_MIXER_INCLUDE_DIRS, where to find the headers
|
||||
# SDL2_MIXER_FOUND, if false, do not try to link against
|
||||
# SDL2_MIXER_VERSION_STRING - human-readable string containing the
|
||||
# version of SDL2_mixer
|
||||
#
|
||||
#
|
||||
#
|
||||
# For backward compatibility the following variables are also set:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2MIXER_LIBRARY (same value as SDL2_MIXER_LIBRARIES)
|
||||
# SDL2MIXER_INCLUDE_DIR (same value as SDL2_MIXER_INCLUDE_DIRS)
|
||||
# SDL2MIXER_FOUND (same value as SDL2_MIXER_FOUND)
|
||||
#
|
||||
#
|
||||
#
|
||||
# $SDL2DIR is an environment variable that would correspond to the
|
||||
# ./configure --prefix=$SDL2DIR used in building SDL2.
|
||||
#
|
||||
# Created by Eric Wing. This was influenced by the FindSDL2.cmake
|
||||
# module, but with modifications to recognize OS X frameworks and
|
||||
# additional Unix paths (FreeBSD, etc).
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
# Copyright 2012 Benjamin Eikel
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if(NOT SDL2_MIXER_INCLUDE_DIR AND SDL2MIXER_INCLUDE_DIR)
|
||||
set(SDL2_MIXER_INCLUDE_DIR ${SDL2MIXER_INCLUDE_DIR} CACHE PATH "directory cache
|
||||
entry initialized from old variable name")
|
||||
endif()
|
||||
find_path(SDL2_MIXER_INCLUDE_DIR SDL_mixer.h
|
||||
HINTS
|
||||
ENV SDL2MIXERDIR
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES SDL2
|
||||
# path suffixes to search inside ENV{SDL2DIR}
|
||||
include/SDL2 include
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||
else()
|
||||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
if(NOT SDL2_MIXER_LIBRARY AND SDL2MIXER_LIBRARY)
|
||||
set(SDL2_MIXER_LIBRARY ${SDL2MIXER_LIBRARY} CACHE FILEPATH "file cache entry
|
||||
initialized from old variable name")
|
||||
endif()
|
||||
find_library(SDL2_MIXER_LIBRARY
|
||||
NAMES SDL2_mixer
|
||||
HINTS
|
||||
ENV SDL2MIXERDIR
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})
|
||||
set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_mixer
|
||||
REQUIRED_VARS SDL2_MIXER_LIBRARIES SDL2_MIXER_INCLUDE_DIRS
|
||||
VERSION_VAR SDL2_MIXER_VERSION_STRING)
|
||||
|
||||
# for backward compatibility
|
||||
set(SDL2MIXER_LIBRARY ${SDL2_MIXER_LIBRARIES})
|
||||
set(SDL2MIXER_INCLUDE_DIR ${SDL2_MIXER_INCLUDE_DIRS})
|
||||
set(SDL2MIXER_FOUND ${SDL2_MIXER_FOUND})
|
||||
|
||||
mark_as_advanced(SDL2_MIXER_LIBRARY SDL2_MIXER_INCLUDE_DIR)
|
||||
|
||||
if(NOT DYNAMIC_LINKING)
|
||||
if (NOT TARGET SDL2_mixer::SDL2_mixer-static)
|
||||
add_library(SDL2_mixer::SDL2_mixer-static STATIC IMPORTED)
|
||||
set_target_properties(SDL2_mixer::SDL2_mixer-static PROPERTIES
|
||||
IMPORTED_LOCATION ${SDL2_MIXER_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_MIXER_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
elseif(NOT TARGET SDL2_mixer::SDL2_mixer)
|
||||
add_library(SDL2_mixer::SDL2_mixer STATIC IMPORTED)
|
||||
set_target_properties(SDL2_mixer::SDL2_mixer PROPERTIES
|
||||
IMPORTED_LOCATION ${SDL2_MIXER_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_MIXER_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
message(STATUS "Searching for SDL_mixer deps libraries --")
|
||||
if(TARGET SDL2_mixer::SDL2_mixer-static)
|
||||
pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac)
|
||||
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
|
||||
PkgConfig::FLAC
|
||||
)
|
||||
if(MSYS2)
|
||||
pkg_check_modules(libmpg123 REQUIRED IMPORTED_TARGET libmpg123)
|
||||
pkg_check_modules(opus REQUIRED IMPORTED_TARGET opus)
|
||||
pkg_check_modules(opusfile REQUIRED IMPORTED_TARGET opusfile)
|
||||
# SHARED only: find_package(Ogg REQUIRED)
|
||||
pkg_check_modules(ogg REQUIRED IMPORTED_TARGET ogg)
|
||||
target_link_libraries(PkgConfig::opusfile INTERFACE
|
||||
PkgConfig::ogg
|
||||
PkgConfig::opus
|
||||
)
|
||||
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
|
||||
PkgConfig::libmpg123
|
||||
PkgConfig::opusfile
|
||||
)
|
||||
if (NOT DYNAMIC_LINKING)
|
||||
pkg_check_modules(vorbis REQUIRED IMPORTED_TARGET vorbis)
|
||||
pkg_check_modules(vorbisenc REQUIRED IMPORTED_TARGET vorbisenc)
|
||||
pkg_check_modules(vorbisfile REQUIRED IMPORTED_TARGET vorbisfile)
|
||||
pkg_check_modules(wavpack REQUIRED IMPORTED_TARGET wavpack)
|
||||
pkg_check_modules(libxmp REQUIRED IMPORTED_TARGET libxmp)
|
||||
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
|
||||
PkgConfig::vorbisfile
|
||||
PkgConfig::vorbis
|
||||
PkgConfig::ogg
|
||||
PkgConfig::vorbisenc
|
||||
PkgConfig::wavpack
|
||||
PkgConfig::libxmp
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
elseif(TARGET SDL2_mixer::SDL2_mixer)
|
||||
pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac)
|
||||
target_link_libraries(SDL2_mixer::SDL2_mixer INTERFACE
|
||||
PkgConfig::FLAC
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,150 +0,0 @@
|
||||
#.rst:
|
||||
# FindSDL2_ttf
|
||||
# -----------
|
||||
#
|
||||
# Locate SDL2_ttf library
|
||||
#
|
||||
# This module defines:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2_TTF_LIBRARIES, the name of the library to link against
|
||||
# SDL2_TTF_INCLUDE_DIRS, where to find the headers
|
||||
# SDL2_TTF_FOUND, if false, do not try to link against
|
||||
# SDL2_TTF_VERSION_STRING - human-readable string containing the version of SDL2_ttf
|
||||
#
|
||||
#
|
||||
#
|
||||
# For backward compatibility the following variables are also set:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# SDL2TTF_LIBRARY (same value as SDL2_TTF_LIBRARIES)
|
||||
# SDL2TTF_INCLUDE_DIR (same value as SDL2_TTF_INCLUDE_DIRS)
|
||||
# SDL2TTF_FOUND (same value as SDL2_TTF_FOUND)
|
||||
#
|
||||
#
|
||||
#
|
||||
# $SDL2DIR is an environment variable that would correspond to the
|
||||
# ./configure --prefix=$SDL2DIR used in building SDL2.
|
||||
#
|
||||
# Created by Eric Wing. This was influenced by the FindSDL2.cmake
|
||||
# module, but with modifications to recognize OS X frameworks and
|
||||
# additional Unix paths (FreeBSD, etc).
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
# Copyright 2012 Benjamin Eikel
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if(NOT SDL2_TTF_INCLUDE_DIR AND SDL2TTF_INCLUDE_DIR)
|
||||
set(SDL2_TTF_INCLUDE_DIR ${SDL2TTF_INCLUDE_DIR} CACHE PATH "directory cache
|
||||
entry initialized from old variable name")
|
||||
endif()
|
||||
find_path(SDL2_TTF_INCLUDE_DIR SDL_ttf.h
|
||||
HINTS
|
||||
ENV SDL2TTFDIR
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES SDL2
|
||||
# path suffixes to search inside ENV{SDL2DIR}
|
||||
include/SDL2 include
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||
else()
|
||||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
if(NOT SDL2_TTF_LIBRARY AND SDL2TTF_LIBRARY)
|
||||
set(SDL2_TTF_LIBRARY ${SDL2TTF_LIBRARY} CACHE FILEPATH "file cache entry
|
||||
initialized from old variable name")
|
||||
endif()
|
||||
find_library(SDL2_TTF_LIBRARY
|
||||
NAMES SDL2_ttf
|
||||
HINTS
|
||||
ENV SDL2TTFDIR
|
||||
ENV SDL2DIR
|
||||
${CMAKE_SOURCE_DIR}/dep/
|
||||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
set(SDL2_TTF_LIBRARIES ${SDL2_TTF_LIBRARY})
|
||||
set(SDL2_TTF_INCLUDE_DIRS ${SDL2_TTF_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_ttf
|
||||
REQUIRED_VARS SDL2_TTF_LIBRARIES SDL2_TTF_INCLUDE_DIRS
|
||||
VERSION_VAR SDL2_TTF_VERSION_STRING)
|
||||
|
||||
# for backward compatibility
|
||||
set(SDL2TTF_LIBRARY ${SDL2_TTF_LIBRARIES})
|
||||
set(SDL2TTF_INCLUDE_DIR ${SDL2_TTF_INCLUDE_DIRS})
|
||||
set(SDL2TTF_FOUND ${SDL2_TTF_FOUND})
|
||||
|
||||
mark_as_advanced(SDL2_TTF_LIBRARY SDL2_TTF_INCLUDE_DIR)
|
||||
|
||||
if (NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
|
||||
if (NOT TARGET SDL2_ttf::SDL2_ttf-static)
|
||||
add_library(SDL2_ttf::SDL2_ttf-static STATIC IMPORTED)
|
||||
set_target_properties(SDL2_ttf::SDL2_ttf-static PROPERTIES
|
||||
IMPORTED_LOCATION ${SDL2_TTF_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_TTF_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
message(STATUS "Searching for SDL_ttf deps libraries --")
|
||||
if(MSYS2)
|
||||
pkg_check_modules(Freetype REQUIRED IMPORTED_TARGET freetype2)
|
||||
pkg_check_modules(harfbuzz REQUIRED IMPORTED_TARGET harfbuzz)
|
||||
pkg_check_modules(graphite REQUIRED IMPORTED_TARGET graphite2)
|
||||
target_link_libraries(PkgConfig::harfbuzz INTERFACE
|
||||
PkgConfig::graphite
|
||||
rpcrt4
|
||||
)
|
||||
target_link_libraries(SDL2_ttf::SDL2_ttf-static INTERFACE
|
||||
PkgConfig::Freetype
|
||||
PkgConfig::harfbuzz
|
||||
)
|
||||
else()
|
||||
find_package(Freetype REQUIRED)
|
||||
find_package(Harfbuzz REQUIRED)
|
||||
get_target_property(_loc harfbuzz::harfbuzz IMPORTED_LOCATION)
|
||||
set_target_properties(harfbuzz::harfbuzz PROPERTIES
|
||||
IMPORTED_IMPLIB_RELEASE ${_loc}
|
||||
IMPORTED_IMPLIB_DEBUG ${_loc}
|
||||
IMPORTED_IMPLIB_RELWITHDEBINFO ${_loc}
|
||||
)
|
||||
target_link_libraries(SDL2_ttf::SDL2_ttf-static INTERFACE
|
||||
Freetype::Freetype
|
||||
harfbuzz::harfbuzz
|
||||
)
|
||||
endif()
|
||||
pkg_check_modules(BROTLI REQUIRED IMPORTED_TARGET libbrotlidec libbrotlicommon)
|
||||
if(MSYS2)
|
||||
pkg_check_modules(bzip2 REQUIRED IMPORTED_TARGET bzip2)
|
||||
target_link_libraries(PkgConfig::Freetype INTERFACE
|
||||
PkgConfig::bzip2
|
||||
)
|
||||
else()
|
||||
target_link_libraries(Freetype::Freetype INTERFACE
|
||||
PkgConfig::BROTLI
|
||||
)
|
||||
endif()
|
||||
elseif(NOT TARGET SDL2_ttf::SDL2_ttf)
|
||||
add_library(SDL2_ttf::SDL2_ttf UNKNOWN IMPORTED)
|
||||
set_target_properties(SDL2_ttf::SDL2_ttf PROPERTIES
|
||||
IMPORTED_LOCATION ${SDL2_TTF_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_TTF_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
@@ -640,11 +640,7 @@ ifeq ($(NATIVE), osx)
|
||||
endif
|
||||
endif
|
||||
ifdef FRAMEWORK
|
||||
ifeq ($(SDL3), 1)
|
||||
SDL_FRAMEWORK_GLOB := SDL3.*
|
||||
else
|
||||
SDL_FRAMEWORK_GLOB := SDL2.*
|
||||
endif
|
||||
SDL_FRAMEWORK_GLOB := SDL3.*
|
||||
ifeq ($(FRAMEWORKSDIR),)
|
||||
FRAMEWORKSDIR := $(strip $(if $(shell [ -d $(HOME)/Library/Frameworks ] && echo 1), \
|
||||
$(if $(shell find $(HOME)/Library/Frameworks -name '$(SDL_FRAMEWORK_GLOB)'), \
|
||||
@@ -777,27 +773,30 @@ endif
|
||||
PKG_CONFIG = $(CROSS)pkg-config
|
||||
|
||||
# Utility targets should not require desktop SDL dependencies just because CI
|
||||
# exported SDL3=1 for build jobs.
|
||||
# exported TILES=1 for build jobs.
|
||||
NO_SDL_GOALS = clean clean-lang clean-tests distclean localization lang/mo_built.stamp
|
||||
ifneq ($(MAKECMDGOALS),)
|
||||
ifeq ($(filter-out $(NO_SDL_GOALS),$(MAKECMDGOALS)),)
|
||||
override SDL3 = 0
|
||||
override SDL = 0
|
||||
override TILES = 0
|
||||
override SOUND = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TILES), 1)
|
||||
ifeq ($(origin SDL3), undefined)
|
||||
SDL3 = 1
|
||||
# SDL2 support was removed; SDL3 is the only tiles backend. SDL3=1 stays a
|
||||
# spelling of TILES=1 so old command lines keep working, and SDL3=0 is a hard
|
||||
# error rather than a silent switch to a curses build.
|
||||
ifeq ($(SDL3), 1)
|
||||
TILES = 1
|
||||
endif
|
||||
ifeq ($(SDL3), 0)
|
||||
ifeq ($(TILES), 1)
|
||||
$(error SDL3=0 is no longer supported: SDL2 support was removed and SDL3 is the only tiles backend. Drop the flag, or build without TILES=1 for a text-only compilation)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(SDL3), 1)
|
||||
ifeq ($(TILES), 1)
|
||||
SDL = 1
|
||||
TILES = 1
|
||||
DEFINES += -DUSE_SDL3
|
||||
# SDL_SetGPURenderState and SDL_GetGPURendererDevice were added in SDL 3.4.0.
|
||||
# macOS FRAMEWORK builds resolve SDL3 via Apple framework lookup rather than
|
||||
# pkg-config, so skip the version check there; non-framework macOS still
|
||||
@@ -824,88 +823,43 @@ ifeq ($(TILES), 1)
|
||||
SDL = 1
|
||||
BINDIST_EXTRAS += gfx
|
||||
ifeq ($(NATIVE),osx)
|
||||
ifeq ($(SDL3), 1)
|
||||
ifdef FRAMEWORK
|
||||
OSX_INC = -F$(FRAMEWORKSDIR) \
|
||||
ifdef FRAMEWORK
|
||||
OSX_INC = -F$(FRAMEWORKSDIR) \
|
||||
-I$(FRAMEWORKSDIR)/SDL3.framework/Headers \
|
||||
-I$(FRAMEWORKSDIR)/SDL3_image.framework/Headers \
|
||||
-I$(FRAMEWORKSDIR)/SDL3_ttf.framework/Headers
|
||||
LDFLAGS += -F$(FRAMEWORKSDIR) -rpath $(FRAMEWORKSDIR) \
|
||||
LDFLAGS += -F$(FRAMEWORKSDIR) -rpath $(FRAMEWORKSDIR) \
|
||||
-framework SDL3 -framework SDL3_image -framework SDL3_ttf -framework Cocoa
|
||||
CXXFLAGS += $(OSX_INC)
|
||||
else
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3 sdl3-image sdl3-ttf))
|
||||
LDFLAGS += -framework Cocoa $(shell $(PKG_CONFIG) --libs sdl3 sdl3-image sdl3-ttf)
|
||||
endif
|
||||
CXXFLAGS += $(OSX_INC)
|
||||
else
|
||||
ifdef FRAMEWORK
|
||||
OSX_INC = -F$(FRAMEWORKSDIR) \
|
||||
-I$(FRAMEWORKSDIR)/SDL2.framework/Headers \
|
||||
-I$(FRAMEWORKSDIR)/SDL2_image.framework/Headers \
|
||||
-I$(FRAMEWORKSDIR)/SDL2_ttf.framework/Headers
|
||||
ifeq ($(SOUND), 1)
|
||||
OSX_INC += -I$(FRAMEWORKSDIR)/SDL2_mixer.framework/Headers
|
||||
endif
|
||||
LDFLAGS += -F$(FRAMEWORKSDIR) -rpath $(FRAMEWORKSDIR) \
|
||||
-framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework Cocoa
|
||||
ifeq ($(SOUND), 1)
|
||||
LDFLAGS += -framework SDL2_mixer
|
||||
endif
|
||||
CXXFLAGS += $(OSX_INC)
|
||||
else # libsdl build
|
||||
DEFINES += -DOSX_SDL2_LIBS
|
||||
# handle #include "SDL2/SDL.h" and "SDL.h"
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell sdl2-config --cflags)) \
|
||||
-isystem $(shell dirname $(shell sdl2-config --cflags | sed 's/-I\(.[^ ]*\) .*/\1/'))
|
||||
LDFLAGS += -framework Cocoa $(shell sdl2-config --libs) -lSDL2_ttf
|
||||
LDFLAGS += -lSDL2_image
|
||||
ifeq ($(SOUND), 1)
|
||||
LDFLAGS += -lSDL2_mixer
|
||||
endif
|
||||
endif
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3 sdl3-image sdl3-ttf))
|
||||
LDFLAGS += -framework Cocoa $(shell $(PKG_CONFIG) --libs sdl3 sdl3-image sdl3-ttf)
|
||||
endif
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags freetype2))
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs freetype2)
|
||||
else ifneq ($(NATIVE),emscripten)
|
||||
ifeq ($(SDL3), 1)
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3))
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3-image sdl3-ttf))
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags freetype2))
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3))
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3-image sdl3-ttf))
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags freetype2))
|
||||
|
||||
ifeq ($(STATIC), 1)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) sdl3 --static --libs)
|
||||
else
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) sdl3 --libs)
|
||||
endif
|
||||
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs sdl3-image sdl3-ttf)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs freetype2)
|
||||
ifeq ($(STATIC), 1)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) sdl3 --static --libs)
|
||||
else
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl2))
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags SDL2_image SDL2_ttf))
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags freetype2))
|
||||
|
||||
ifeq ($(STATIC), 1)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) sdl2 --static --libs)
|
||||
else
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) sdl2 --libs)
|
||||
endif
|
||||
|
||||
LDFLAGS += -lSDL2_ttf -lSDL2_image
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs freetype2)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) sdl3 --libs)
|
||||
endif
|
||||
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs sdl3-image sdl3-ttf)
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs freetype2)
|
||||
endif
|
||||
|
||||
DEFINES += -DTILES
|
||||
|
||||
ifeq ($(TARGETSYSTEM),WINDOWS)
|
||||
ifndef DYNAMIC_LINKING
|
||||
# These differ depending on what SDL2 is configured to use.
|
||||
# These differ depending on what SDL is configured to use.
|
||||
ifneq (,$(findstring mingw32,$(CROSS)))
|
||||
# We use pkg-config to find out which libs are needed with MXE
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs SDL2_image SDL2_ttf)
|
||||
# We don't use SDL_main -- we have proper main()/WinMain()
|
||||
LDFLAGS := $(filter-out -lSDL2main,$(LDFLAGS))
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs sdl3-image sdl3-ttf)
|
||||
else
|
||||
ifeq ($(MSYS2),1)
|
||||
LDFLAGS += -Wl,--start-group -lharfbuzz -lfreetype -Wl,--end-group -lgraphite2 -lpng -lz -ltiff -lbz2 -lglib-2.0 -llzma -lws2_32 -lwebp -ljpeg -luuid
|
||||
@@ -914,7 +868,7 @@ ifeq ($(TILES), 1)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
# Currently none needed by the game itself (only used by SDL2 layer).
|
||||
# Currently none needed by the game itself (only used by the SDL layer).
|
||||
# Placeholder for future use (savegame compression, etc).
|
||||
LDFLAGS +=
|
||||
endif
|
||||
@@ -964,32 +918,10 @@ else
|
||||
endif # TILES
|
||||
|
||||
ifeq ($(SOUND), 1)
|
||||
ifeq ($(SDL3), 1)
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3-mixer))
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs sdl3-mixer)
|
||||
ifneq ($(NATIVE),osx)
|
||||
LDFLAGS += -lpthread
|
||||
endif
|
||||
else
|
||||
ifeq ($(NATIVE),osx)
|
||||
ifndef FRAMEWORK # libsdl build
|
||||
ifeq ($(MACPORTS), 1)
|
||||
LDFLAGS += -lSDL2_mixer -lvorbisfile -lvorbis -logg
|
||||
else # homebrew
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags SDL2_mixer))
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs SDL2_mixer)
|
||||
LDFLAGS += -lvorbisfile -lvorbis -logg
|
||||
endif
|
||||
endif
|
||||
else # not osx
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags SDL2_mixer))
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs SDL2_mixer)
|
||||
LDFLAGS += -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(MSYS2),1)
|
||||
LDFLAGS += -lmpg123 -lshlwapi -lvorbisfile -lvorbis -logg -lflac
|
||||
endif
|
||||
CXXFLAGS += $(subst -I,-isystem ,$(shell $(PKG_CONFIG) --cflags sdl3-mixer))
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs sdl3-mixer)
|
||||
ifneq ($(NATIVE),osx)
|
||||
LDFLAGS += -lpthread
|
||||
endif
|
||||
|
||||
CXXFLAGS += -DSDL_SOUND
|
||||
@@ -997,7 +929,6 @@ endif
|
||||
|
||||
# We don't use SDL_main -- we have proper main()/WinMain()
|
||||
CXXFLAGS := $(filter-out -Dmain=SDL_main,$(CXXFLAGS))
|
||||
LDFLAGS := $(filter-out -lSDL2main,$(LDFLAGS))
|
||||
LDFLAGS := $(filter-out -lSDL3main,$(LDFLAGS))
|
||||
|
||||
ifeq ($(BSD), 1)
|
||||
@@ -1049,19 +980,15 @@ ifeq ($(TARGETSYSTEM),LINUX)
|
||||
CXXFLAGS += -mcx16
|
||||
endif
|
||||
BINDIST_EXTRAS += cataclysm-launcher
|
||||
ifeq ($(SDL3),1)
|
||||
ifeq ($(TILES),1)
|
||||
# bundle-sdl3-linux.sh fills bindist/lib/; RUNPATH=$$ORIGIN/lib lets
|
||||
# the binary resolve bundled libs without the launcher.
|
||||
LDFLAGS += -Wl,-rpath,'$$ORIGIN/lib'
|
||||
BUNDLE_SDL3_LINUX = 1
|
||||
endif
|
||||
ifneq ("$(wildcard LICENSE-SDL.txt)","")
|
||||
ifneq ($(SDL3),1)
|
||||
SDL_solibs = $(shell ldd $(TARGET) | grep libSDL2-2\.0 | cut -d ' ' -f 3)
|
||||
INSTALL_EXTRAS += $(SDL_solibs)
|
||||
endif
|
||||
BINDIST_EXTRAS += LICENSE-SDL.txt
|
||||
ifeq ($(SDL3),1)
|
||||
ifeq ($(TILES),1)
|
||||
ifneq ("$(wildcard LICENSE-SDL3_image.txt)","")
|
||||
BINDIST_EXTRAS += LICENSE-SDL3_image.txt
|
||||
endif
|
||||
@@ -1165,7 +1092,7 @@ ifdef LANGUAGES
|
||||
L10N = localization
|
||||
endif
|
||||
|
||||
ifeq ($(SDL3), 1)
|
||||
ifeq ($(TILES), 1)
|
||||
SHADERS_DIR := data/shaders
|
||||
SHADERS_SRC := $(wildcard $(SHADERS_DIR)/*.frag $(SHADERS_DIR)/*.vert)
|
||||
# Default the shader format set to whatever the local GPU backend can
|
||||
@@ -1247,7 +1174,7 @@ LDFLAGS += -lz
|
||||
all: version prefix $(CHECKS) $(TARGET) $(L10N) $(TESTSTARGET) $(ZZIP_BIN) $(SHADERS_STAMP)
|
||||
@
|
||||
|
||||
ifeq ($(SDL3), 1)
|
||||
ifeq ($(TILES), 1)
|
||||
$(SHADERS_STAMP): $(SHADERS_SRC) tools/build_shaders.py
|
||||
python3 tools/build_shaders.py --shader-dir $(SHADERS_DIR) --formats $(BUILD_SHADER_FORMATS) --stamp $@
|
||||
endif
|
||||
@@ -1406,7 +1333,7 @@ endif
|
||||
ifeq ($(SOUND), 1)
|
||||
cp -R --no-preserve=ownership data/sound $(DATA_PREFIX)
|
||||
endif
|
||||
ifeq ($(SDL3), 1)
|
||||
ifeq ($(TILES), 1)
|
||||
cp -R --no-preserve=ownership data/shaders $(DATA_PREFIX)
|
||||
endif
|
||||
install --mode=644 data/changelog.txt data/cataicon.ico data/fontdata.json \
|
||||
@@ -1443,7 +1370,7 @@ endif
|
||||
ifeq ($(SOUND), 1)
|
||||
cp -R --no-preserve=ownership data/sound $(DATA_PREFIX)
|
||||
endif
|
||||
ifeq ($(SDL3), 1)
|
||||
ifeq ($(TILES), 1)
|
||||
cp -R --no-preserve=ownership data/shaders $(DATA_PREFIX)
|
||||
endif
|
||||
install --mode=644 data/changelog.txt data/cataicon.ico data/fontdata.json \
|
||||
@@ -1458,10 +1385,6 @@ ifeq ($(NATIVE), osx)
|
||||
APPTARGETDIR=Cataclysm.app
|
||||
APPRESOURCESDIR=$(APPTARGETDIR)/Contents/Resources
|
||||
APPDATADIR=$(APPRESOURCESDIR)/data
|
||||
ifndef FRAMEWORK
|
||||
SDLLIBSDIR=$(shell sdl2-config --libs | sed -n 's/.*-L\([^ ]*\) .*/\1/p')
|
||||
endif # ifndef FRAMEWORK
|
||||
|
||||
appclean:
|
||||
rm -rf $(APPTARGETDIR)
|
||||
rm -f data/options.txt
|
||||
@@ -1504,23 +1427,14 @@ endif
|
||||
ifeq ($(SOUND), 1)
|
||||
cp -R data/sound $(APPDATADIR)
|
||||
endif # ifeq ($(SOUND), 1)
|
||||
ifeq ($(SDL3), 1)
|
||||
ifeq ($(TILES), 1)
|
||||
cp -R data/shaders $(APPDATADIR)
|
||||
endif # ifeq ($(SDL3), 1)
|
||||
endif # ifeq ($(TILES), 1)
|
||||
cp -R gfx $(APPRESOURCESDIR)/
|
||||
ifdef FRAMEWORK
|
||||
ifeq ($(SDL3), 1)
|
||||
cp -R $(FRAMEWORKSDIR)/SDL3.framework $(APPRESOURCESDIR)/
|
||||
cp -R $(FRAMEWORKSDIR)/SDL3_image.framework $(APPRESOURCESDIR)/
|
||||
cp -R $(FRAMEWORKSDIR)/SDL3_ttf.framework $(APPRESOURCESDIR)/
|
||||
else
|
||||
cp -R $(FRAMEWORKSDIR)/SDL2.framework $(APPRESOURCESDIR)/
|
||||
cp -R $(FRAMEWORKSDIR)/SDL2_image.framework $(APPRESOURCESDIR)/
|
||||
cp -R $(FRAMEWORKSDIR)/SDL2_ttf.framework $(APPRESOURCESDIR)/
|
||||
ifeq ($(SOUND), 1)
|
||||
cp -R $(FRAMEWORKSDIR)/SDL2_mixer.framework $(APPRESOURCESDIR)/
|
||||
endif # ifeq ($(SOUND), 1)
|
||||
endif # ifeq ($(SDL3), 1)
|
||||
endif # ifdef FRAMEWORK
|
||||
dylibbundler -of -b -x $(APPRESOURCESDIR)/$(APPTARGET) -d $(APPRESOURCESDIR)/ -p @executable_path/ $(addprefix -s ,$(DYLIBBUNDLER_SEARCH_PATHS))
|
||||
|
||||
@@ -1541,11 +1455,11 @@ ifdef OSXCROSS
|
||||
rm Cataclysm-uncompressed.dmg
|
||||
else
|
||||
plutil -convert binary1 Cataclysm.app/Contents/Info.plist
|
||||
ifeq ($(SDL3), 1)
|
||||
ifeq ($(TILES), 1)
|
||||
# Sign AFTER plutil rewrites Info.plist; signing earlier would be
|
||||
# invalidated by the plist edit. dmgbuild does not modify the bundle.
|
||||
bash build-scripts/codesign-macos.sh $(APPTARGETDIR)
|
||||
endif # ifeq ($(SDL3), 1)
|
||||
endif # ifeq ($(TILES), 1)
|
||||
dmgbuild -s build-data/osx/dmgsettings.py "Cataclysm DDA" Cataclysm.dmg
|
||||
endif
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
.gradle
|
||||
/.idea/libraries
|
||||
/.idea/workspace.xml
|
||||
/app/jni/SDL2
|
||||
/app/jni/SDL2_image
|
||||
/app/jni/SDL2_mixer
|
||||
/app/jni/SDL2_ttf
|
||||
/app/jni/libhidapi
|
||||
/app/jni/lua
|
||||
/app/jni/mpg-123
|
||||
|
||||
@@ -14,7 +14,6 @@ get_filename_component(CATA_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../.."
|
||||
ABSOLUTE)
|
||||
|
||||
set(TILES ON)
|
||||
set(USE_SDL3 ON)
|
||||
set(DYNAMIC_LINKING ON)
|
||||
|
||||
find_package(SDL3 CONFIG REQUIRED)
|
||||
@@ -57,7 +56,6 @@ target_compile_definitions(
|
||||
main
|
||||
PRIVATE TILES
|
||||
SDL_SOUND
|
||||
USE_SDL3
|
||||
BACKTRACE
|
||||
LOCALIZE
|
||||
ZSTD_STATIC_LINKING_ONLY
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ if (SOUND)
|
||||
list(APPEND CATACLYSM_DATA_DIRS sound)
|
||||
endif ()
|
||||
|
||||
if (USE_SDL3)
|
||||
if (TILES)
|
||||
list(APPEND CATACLYSM_DATA_DIRS shaders)
|
||||
endif ()
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<LinkToolExe>lld-link.exe</LinkToolExe>
|
||||
<!-- vcpkg passes dependecy libs via a glob pattern which lld-link doesn't accept. We have to manually enumerate the deps now. -->
|
||||
<VcpkgAutoLink>false</VcpkgAutoLink>
|
||||
<!-- debug versions of libs often (but not always) use `d` suffix, as a convention. E.g. "SDL2-staticd.lib" -->
|
||||
<!-- debug versions of libs often (but not always) use `d` suffix, as a convention. E.g. "SDL3-staticd.lib" -->
|
||||
<VcpkgLibSuffix></VcpkgLibSuffix>
|
||||
<VcpkgLibSuffix Condition="$(Configuration.StartsWith(Debug))">d</VcpkgLibSuffix>
|
||||
</PropertyGroup>
|
||||
@@ -71,9 +71,6 @@
|
||||
<ClCompile Condition="!$(Configuration.Contains(NoTiles))">
|
||||
<PreprocessorDefinitions>TILES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Condition="!$(Configuration.Contains(NoTiles))">
|
||||
<PreprocessorDefinitions>USE_SDL3;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Condition="$(Configuration.Contains(NoTiles))">
|
||||
<PreprocessorDefinitions>USE_PDCURSES;PDC_NCMOUSE;PDC_WIDE;IMTUI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
|
||||
+78
-108
@@ -117,72 +117,44 @@ if (TILES)
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif ()
|
||||
|
||||
if (USE_SDL3)
|
||||
if (NOT DYNAMIC_LINKING)
|
||||
if (TARGET SDL3::SDL3-static)
|
||||
set(_SDL3 SDL3::SDL3-static)
|
||||
else ()
|
||||
set(_SDL3 SDL3::SDL3)
|
||||
endif ()
|
||||
if (TARGET SDL3_image::SDL3_image-static)
|
||||
set(_SDL3_IMAGE SDL3_image::SDL3_image-static)
|
||||
else ()
|
||||
set(_SDL3_IMAGE SDL3_image::SDL3_image)
|
||||
endif ()
|
||||
if (TARGET SDL3_ttf::SDL3_ttf-static)
|
||||
set(_SDL3_TTF SDL3_ttf::SDL3_ttf-static)
|
||||
else ()
|
||||
set(_SDL3_TTF SDL3_ttf::SDL3_ttf)
|
||||
endif ()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
${_SDL3}
|
||||
${_SDL3_IMAGE}
|
||||
${_SDL3_TTF}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL3::SDL3
|
||||
SDL3_image::SDL3_image
|
||||
SDL3_ttf::SDL3_ttf
|
||||
)
|
||||
if (NOT DYNAMIC_LINKING)
|
||||
if (TARGET SDL3::SDL3-static)
|
||||
set(_SDL3 SDL3::SDL3-static)
|
||||
else ()
|
||||
set(_SDL3 SDL3::SDL3)
|
||||
endif ()
|
||||
else ()
|
||||
if (NOT DYNAMIC_LINKING)
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL2::SDL2-static
|
||||
SDL2_image::SDL2_image-static
|
||||
SDL2_ttf::SDL2_ttf-static
|
||||
)
|
||||
else()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL2::SDL2
|
||||
SDL2_image::SDL2_image
|
||||
SDL2_ttf::SDL2_ttf
|
||||
)
|
||||
if (TARGET SDL3_image::SDL3_image-static)
|
||||
set(_SDL3_IMAGE SDL3_image::SDL3_image-static)
|
||||
else ()
|
||||
set(_SDL3_IMAGE SDL3_image::SDL3_image)
|
||||
endif ()
|
||||
if (TARGET SDL3_ttf::SDL3_ttf-static)
|
||||
set(_SDL3_TTF SDL3_ttf::SDL3_ttf-static)
|
||||
else ()
|
||||
set(_SDL3_TTF SDL3_ttf::SDL3_ttf)
|
||||
endif ()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
${_SDL3}
|
||||
${_SDL3_IMAGE}
|
||||
${_SDL3_TTF}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL3::SDL3
|
||||
SDL3_image::SDL3_image
|
||||
SDL3_ttf::SDL3_ttf
|
||||
)
|
||||
endif ()
|
||||
if (SOUND)
|
||||
if (USE_SDL3)
|
||||
if (NOT DYNAMIC_LINKING AND TARGET SDL3_mixer::SDL3_mixer-static)
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL3_mixer::SDL3_mixer-static
|
||||
)
|
||||
else()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL3_mixer::SDL3_mixer
|
||||
)
|
||||
endif()
|
||||
else ()
|
||||
if (NOT DYNAMIC_LINKING)
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL2_mixer::SDL2_mixer-static
|
||||
)
|
||||
else()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL2_mixer::SDL2_mixer
|
||||
)
|
||||
endif()
|
||||
endif ()
|
||||
if (NOT DYNAMIC_LINKING AND TARGET SDL3_mixer::SDL3_mixer-static)
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL3_mixer::SDL3_mixer-static
|
||||
)
|
||||
else()
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC
|
||||
SDL3_mixer::SDL3_mixer
|
||||
)
|
||||
endif()
|
||||
add_definitions(-DSDL_SOUND)
|
||||
endif ()
|
||||
|
||||
@@ -223,45 +195,43 @@ if (TILES)
|
||||
target_link_libraries(cataclysm-tiles-common PUBLIC ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (USE_SDL3)
|
||||
# Compile GLSL shaders to per-backend artifacts (.spv / .dxil / .msl)
|
||||
# for the GPU shader path. Pattern mirrors lang/CMakeLists.txt locale
|
||||
# build. Default the format set to the local GPU backend so that
|
||||
# builds without shadercross succeed (variant_pass goes inert at
|
||||
# runtime if the expected artifact format is missing). Override
|
||||
# CATA_SHADER_FORMATS when shipping a multi-platform bindist.
|
||||
set(_SHADERS_DIR ${CMAKE_SOURCE_DIR}/data/shaders)
|
||||
if (NOT DEFINED CATA_SHADER_FORMATS)
|
||||
if (APPLE)
|
||||
set(CATA_SHADER_FORMATS "msl")
|
||||
elseif (WIN32)
|
||||
set(CATA_SHADER_FORMATS "dxil")
|
||||
else()
|
||||
set(CATA_SHADER_FORMATS "spv")
|
||||
endif()
|
||||
# Compile GLSL shaders to per-backend artifacts (.spv / .dxil / .msl)
|
||||
# for the GPU shader path. Pattern mirrors lang/CMakeLists.txt locale
|
||||
# build. Default the format set to the local GPU backend so that
|
||||
# builds without shadercross succeed (variant_pass goes inert at
|
||||
# runtime if the expected artifact format is missing). Override
|
||||
# CATA_SHADER_FORMATS when shipping a multi-platform bindist.
|
||||
set(_SHADERS_DIR ${CMAKE_SOURCE_DIR}/data/shaders)
|
||||
if (NOT DEFINED CATA_SHADER_FORMATS)
|
||||
if (APPLE)
|
||||
set(CATA_SHADER_FORMATS "msl")
|
||||
elseif (WIN32)
|
||||
set(CATA_SHADER_FORMATS "dxil")
|
||||
else()
|
||||
set(CATA_SHADER_FORMATS "spv")
|
||||
endif()
|
||||
# Stamp filename encodes the format set so switching CATA_SHADER_FORMATS
|
||||
# invalidates the stamp and triggers a rebuild. Hyphen-separated to
|
||||
# avoid commas in filenames; matches the Makefile and MSVC prebuild.
|
||||
string(REPLACE "," "-" _SHADER_STAMP_TAG "${CATA_SHADER_FORMATS}")
|
||||
set(_SHADERS_STAMP ${_SHADERS_DIR}/build-${_SHADER_STAMP_TAG}.stamp)
|
||||
file(GLOB _SHADER_SOURCES "${_SHADERS_DIR}/*.frag" "${_SHADERS_DIR}/*.vert")
|
||||
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
||||
add_custom_command(
|
||||
OUTPUT ${_SHADERS_STAMP}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/build_shaders.py
|
||||
--shader-dir ${_SHADERS_DIR}
|
||||
--formats ${CATA_SHADER_FORMATS}
|
||||
--stamp ${_SHADERS_STAMP}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
DEPENDS ${_SHADER_SOURCES}
|
||||
${CMAKE_SOURCE_DIR}/tools/build_shaders.py
|
||||
COMMENT "Compiling shader artifacts (${CATA_SHADER_FORMATS})"
|
||||
)
|
||||
add_custom_target(compile_shaders ALL DEPENDS ${_SHADERS_STAMP})
|
||||
add_dependencies(cataclysm-tiles-common compile_shaders)
|
||||
endif()
|
||||
# Stamp filename encodes the format set so switching CATA_SHADER_FORMATS
|
||||
# invalidates the stamp and triggers a rebuild. Hyphen-separated to
|
||||
# avoid commas in filenames; matches the Makefile and MSVC prebuild.
|
||||
string(REPLACE "," "-" _SHADER_STAMP_TAG "${CATA_SHADER_FORMATS}")
|
||||
set(_SHADERS_STAMP ${_SHADERS_DIR}/build-${_SHADER_STAMP_TAG}.stamp)
|
||||
file(GLOB _SHADER_SOURCES "${_SHADERS_DIR}/*.frag" "${_SHADERS_DIR}/*.vert")
|
||||
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
||||
add_custom_command(
|
||||
OUTPUT ${_SHADERS_STAMP}
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/build_shaders.py
|
||||
--shader-dir ${_SHADERS_DIR}
|
||||
--formats ${CATA_SHADER_FORMATS}
|
||||
--stamp ${_SHADERS_STAMP}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
DEPENDS ${_SHADER_SOURCES}
|
||||
${CMAKE_SOURCE_DIR}/tools/build_shaders.py
|
||||
COMMENT "Compiling shader artifacts (${CATA_SHADER_FORMATS})"
|
||||
)
|
||||
add_custom_target(compile_shaders ALL DEPENDS ${_SHADERS_STAMP})
|
||||
add_dependencies(cataclysm-tiles-common compile_shaders)
|
||||
|
||||
endif ()
|
||||
|
||||
@@ -365,9 +335,9 @@ if (MINGW AND NOT RELEASE)
|
||||
${RuntimeLib_WINPTHREAD_1}
|
||||
${RuntimeLib_zlib})
|
||||
if (TILES)
|
||||
# SDL2 can have a varius deps. Here you are the MSYS2 ones...
|
||||
find_library(RuntimeLib_SDL2 "SDL2")
|
||||
find_library(RuntimeLib_SDL2_IMG "SDL2_image")
|
||||
# SDL can have a varius deps. Here you are the MSYS2 ones...
|
||||
find_library(RuntimeLib_SDL3 "SDL3")
|
||||
find_library(RuntimeLib_SDL3_IMG "SDL3_image")
|
||||
find_library(RuntimeLib_png "libpng16-16")
|
||||
find_library(RuntimeLib_jpeg "libjpeg-8")
|
||||
find_library(RuntimeLib_jbig "libjbig-0")
|
||||
@@ -376,12 +346,12 @@ if (MINGW AND NOT RELEASE)
|
||||
find_library(RuntimeLib_lzma "liblzma-5")
|
||||
find_library(RuntimeLib_bz2 "libbz2-1")
|
||||
find_library(RuntimeLib_hb "libharfbuzz-0")
|
||||
find_library(RuntimeLib_SDL2_TTF "SDL2_ttf")
|
||||
find_library(RuntimeLib_SDL3_TTF "SDL3_ttf")
|
||||
find_library(RuntimeLib_ft "libfreetype-6")
|
||||
find_library(RuntimeLib_glib "libglib-2.0-0")
|
||||
set(RuntimeLib_SDL
|
||||
${RuntimeLib_SDL2}
|
||||
${RuntimeLib_SDL2_IMG}
|
||||
${RuntimeLib_SDL3}
|
||||
${RuntimeLib_SDL3_IMG}
|
||||
${RuntimeLib_png}
|
||||
${RuntimeLib_jpeg}
|
||||
${RuntimeLib_jbig}
|
||||
@@ -390,11 +360,11 @@ if (MINGW AND NOT RELEASE)
|
||||
${RuntimeLib_lzma}
|
||||
${RuntimeLib_bz2}
|
||||
${RuntimeLib_hb}
|
||||
${RuntimeLib_SDL2_TTF}
|
||||
${RuntimeLib_SDL3_TTF}
|
||||
${RuntimeLib_ft}
|
||||
${RuntimeLib_glib})
|
||||
if (SOUND AND NOT USE_SDL3)
|
||||
find_library(RuntimeLib_SDL_SND "SDL2_mixer")
|
||||
if (SOUND)
|
||||
find_library(RuntimeLib_SDL_SND "SDL3_mixer")
|
||||
find_library(RuntimeLib_flac "libFLAC-8")
|
||||
find_library(RuntimeLib_ogg "libogg-0")
|
||||
find_library(RuntimeLib_flu "libfluidsynth-1")
|
||||
|
||||
Vendored
+12
-35
@@ -133,47 +133,24 @@ if (TILES)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if (NOT USE_SDL3)
|
||||
target_include_directories(
|
||||
imgui
|
||||
SYSTEM
|
||||
PRIVATE
|
||||
${SDL2_INCLUDE_DIR}/..
|
||||
)
|
||||
endif ()
|
||||
|
||||
target_compile_options(
|
||||
imgui
|
||||
PRIVATE
|
||||
-w
|
||||
)
|
||||
|
||||
if (USE_SDL3)
|
||||
if (ANDROID)
|
||||
target_link_libraries(imgui PUBLIC SDL3::SDL3)
|
||||
elseif (NOT DYNAMIC_LINKING)
|
||||
target_link_libraries(imgui PUBLIC
|
||||
$<IF:$<TARGET_EXISTS:SDL3::SDL3-static>,SDL3::SDL3-static,SDL3::SDL3>
|
||||
${_imgui_freetype_libraries}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(imgui PUBLIC
|
||||
SDL3::SDL3
|
||||
${_imgui_freetype_libraries}
|
||||
)
|
||||
endif ()
|
||||
else ()
|
||||
if (NOT DYNAMIC_LINKING)
|
||||
target_link_libraries(imgui PUBLIC
|
||||
SDL2::SDL2-static
|
||||
${_imgui_freetype_libraries}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(imgui PUBLIC
|
||||
SDL2::SDL2
|
||||
${_imgui_freetype_libraries}
|
||||
)
|
||||
endif ()
|
||||
if (ANDROID)
|
||||
target_link_libraries(imgui PUBLIC SDL3::SDL3)
|
||||
elseif (NOT DYNAMIC_LINKING)
|
||||
target_link_libraries(imgui PUBLIC
|
||||
$<IF:$<TARGET_EXISTS:SDL3::SDL3-static>,SDL3::SDL3-static,SDL3::SDL3>
|
||||
${_imgui_freetype_libraries}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(imgui PUBLIC
|
||||
SDL3::SDL3
|
||||
${_imgui_freetype_libraries}
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Runtime selects the matching artifact via SDL_GetGPUShaderFormats; build-time
|
||||
translation avoids the SPIRV-Cross + DXIL runtime dependency that
|
||||
SDL_shadercross would otherwise require at runtime.
|
||||
|
||||
Invoked by Make/CMake/MSVC build rules under USE_SDL3 only. Skips writing if
|
||||
Invoked by Make/CMake/MSVC build rules for tiles builds. Skips writing if
|
||||
the source is older than the artifact.
|
||||
|
||||
Tools required (override via env vars when not on PATH):
|
||||
|
||||
Reference in New Issue
Block a user