1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Make SDL2 default on macOS (#16039)

This commit is contained in:
sfence 2025-05-02 21:28:13 +02:00 committed by GitHub
parent d795c28af8
commit 0bdd5f294e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 22 additions and 14 deletions

View file

@ -45,7 +45,7 @@ jobs:
mkdir build mkdir build
cd build cd build
cmake .. \ cmake .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \ -DCMAKE_OSX_DEPLOYMENT_TARGET=13 \
-DCMAKE_FIND_FRAMEWORK=LAST \ -DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_INSTALL_PREFIX=../build/macos/ \ -DCMAKE_INSTALL_PREFIX=../build/macos/ \
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \ -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \

View file

@ -23,6 +23,7 @@ General options and their default values:
PRECOMPILE_HEADERS=FALSE - Precompile some headers (experimental; requires CMake 3.16 or later) PRECOMPILE_HEADERS=FALSE - Precompile some headers (experimental; requires CMake 3.16 or later)
PRECOMPILED_HEADERS_PATH= - Path to a file listing all headers to precompile (default points to src/precompiled_headers.txt) PRECOMPILED_HEADERS_PATH= - Path to a file listing all headers to precompile (default points to src/precompiled_headers.txt)
USE_SDL2=TRUE - Build with SDL2; Enables IrrlichtMt device SDL2 USE_SDL2=TRUE - Build with SDL2; Enables IrrlichtMt device SDL2
USE_SDL2_STATIC=TRUE - Links with SDL2::SDL2-static instead of SDL2::SDL2
ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal) ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations

View file

@ -1,11 +1,9 @@
# When enabling SDL2 by default on macOS, don't forget to change set(DEFAULT_SDL2 ON)
# "NSHighResolutionCapable" to true in "Info.plist".
if(NOT APPLE)
set(DEFAULT_SDL2 ON)
endif()
option(USE_SDL2 "Use the SDL2 backend" ${DEFAULT_SDL2}) option(USE_SDL2 "Use the SDL2 backend" ${DEFAULT_SDL2})
option(USE_SDL2_STATIC "Link with SDL2 static libraries" FALSE)
# Compiler flags # Compiler flags
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
@ -228,7 +226,11 @@ endif()
if(ENABLE_OPENGL) if(ENABLE_OPENGL)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
endif() endif()
set(USE_SDL2_SHARED FALSE)
if(USE_SDL2) if(USE_SDL2)
if(NOT USE_SDL2_STATIC)
set(USE_SDL2_SHARED TRUE)
endif()
if(NOT ANDROID) if(NOT ANDROID)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
else() else()
@ -364,14 +366,14 @@ endif()
if(ENABLE_OPENGL3) if(ENABLE_OPENGL3)
set(IRRDRVROBJ set(IRRDRVROBJ
${IRRDRVROBJ} ${IRRDRVROBJ}
OpenGL3/Driver.cpp OpenGL3/DriverGL3.cpp
) )
endif() endif()
if(ENABLE_GLES2) if(ENABLE_GLES2)
set(IRRDRVROBJ set(IRRDRVROBJ
${IRRDRVROBJ} ${IRRDRVROBJ}
OpenGLES2/Driver.cpp OpenGLES2/DriverGLES2.cpp
) )
endif() endif()
@ -505,7 +507,8 @@ target_link_libraries(IrrlichtMt PRIVATE
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
${JPEG_LIBRARY} ${JPEG_LIBRARY}
${PNG_LIBRARY} ${PNG_LIBRARY}
"$<$<BOOL:${USE_SDL2}>:SDL2::SDL2>" "$<$<BOOL:${USE_SDL2_SHARED}>:SDL2::SDL2>"
"$<$<BOOL:${USE_SDL2_STATIC}>:SDL2::SDL2-static>"
"$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>" "$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>"
${EGL_LIBRARY} ${EGL_LIBRARY}

View file

@ -2,7 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#include "Driver.h" #include "DriverGL3.h"
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
#include "mt_opengl.h" #include "mt_opengl.h"

View file

@ -2,7 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#include "Driver.h" #include "DriverGLES2.h"
#include <stdexcept> #include <stdexcept>
#include <cassert> #include <cassert>
#include "mt_opengl.h" #include "mt_opengl.h"

View file

@ -21,6 +21,6 @@
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.games</string> <string>public.app-category.games</string>
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
<false/> <true/>
</dict> </dict>
</plist> </plist>

View file

@ -7,6 +7,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <thread> #include <thread>
#include <unordered_map>
#include "wieldmesh.h" // ItemMesh #include "wieldmesh.h" // ItemMesh
#include "util/basic_macros.h" #include "util/basic_macros.h"

View file

@ -8,6 +8,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <unordered_set> #include <unordered_set>
#include <unordered_map>
#include "irr_v3d.h" #include "irr_v3d.h"
#include "mapnode.h" #include "mapnode.h"

View file

@ -3,8 +3,10 @@
cmake .. \ cmake .. \
-DCMAKE_FIND_FRAMEWORK=LAST \ -DCMAKE_FIND_FRAMEWORK=LAST \
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \ -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
-DUSE_SDL2_STATIC=TRUE \
-DSDL2_INCLUDE_DIRS=/opt/homebrew/include/SDL2 \
-DFREETYPE_LIBRARY=/opt/homebrew/lib/libfreetype.a \ -DFREETYPE_LIBRARY=/opt/homebrew/lib/libfreetype.a \
-DGETTEXT_INCLUDE_DIR=/path/to/include/dir \ -DGETTEXT_INCLUDE_DIR=/opt/homebrew/include \
-DGETTEXT_LIBRARY=/opt/homebrew/lib/libintl.a \ -DGETTEXT_LIBRARY=/opt/homebrew/lib/libintl.a \
-DLUA_LIBRARY=/opt/homebrew/lib/libluajit-5.1.a \ -DLUA_LIBRARY=/opt/homebrew/lib/libluajit-5.1.a \
-DOGG_LIBRARY=/opt/homebrew/lib/libogg.a \ -DOGG_LIBRARY=/opt/homebrew/lib/libogg.a \

View file

@ -29,7 +29,7 @@ install_linux_deps() {
install_macos_deps() { install_macos_deps() {
local pkgs=( local pkgs=(
cmake gettext freetype gmp jpeg-turbo jsoncpp leveldb cmake gettext freetype gmp jpeg-turbo jsoncpp leveldb
libogg libpng libvorbis luajit zstd libogg libpng libvorbis luajit zstd sdl2
) )
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_INSTALL_CLEANUP=1 export HOMEBREW_NO_INSTALL_CLEANUP=1