From 7dff4cd694332cbc9503fb27da0b7fe6e9ab6f1d Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 9 Dec 2024 06:46:09 +0000 Subject: [PATCH] macOS Tiger platform and instructions --- CMake/Platforms.cmake | 12 +++++++++ CMake/platforms/macos_tiger.cmake | 20 ++++++++++++++ docs/building.md | 43 +++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 CMake/platforms/macos_tiger.cmake diff --git a/CMake/Platforms.cmake b/CMake/Platforms.cmake index 7cf5d1692..850605031 100644 --- a/CMake/Platforms.cmake +++ b/CMake/Platforms.cmake @@ -88,4 +88,16 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") # to detect available APIs. string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}") string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}") + + if(DARWIN_MAJOR_VERSION VERSION_EQUAL 8) + include(platforms/macos_tiger) + endif() + + # For older macOS, we assume MacPorts because Homebrew only supports newer version + if(DARWIN_MAJOR_VERSION VERSION_LESS 11) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/platforms/macports/finders") + + # On MacPorts, libfmt is in a subdirectory: + list(APPEND CMAKE_MODULE_PATH "/opt/local/lib/libfmt11/cmake") + endif() endif() diff --git a/CMake/platforms/macos_tiger.cmake b/CMake/platforms/macos_tiger.cmake new file mode 100644 index 000000000..2367ac5a5 --- /dev/null +++ b/CMake/platforms/macos_tiger.cmake @@ -0,0 +1,20 @@ +# ASAN and UBSAN are not supported by macports gcc14 on PowerPC. +set(ASAN OFF) +set(UBSAN OFF) + +# SDL2 does not build for Tiger, so we use SDL1 instead. +set(USE_SDL1 ON) + +# ZeroTier is yet to be tested. +set(DISABLE_ZERO_TIER ON) + +# Use vendored libfmt until this issue is resolved: +# https://trac.macports.org/ticket/71503 +set(DEVILUTIONX_SYSTEM_LIBFMT OFF) +set(DEVILUTIONX_STATIC_LIBFMT ON) + +# https://trac.macports.org/ticket/71511 +set(DEVILUTIONX_SYSTEM_GOOGLETEST OFF) +set(DEVILUTIONX_STATIC_GOOGLETEST OFF) +set(DEVILUTIONX_SYSTEM_BENCHMARK OFF) +set(DEVILUTIONX_STATIC_BENCHMARK OFF) diff --git a/docs/building.md b/docs/building.md index 7ba245fbe..07844ca3b 100644 --- a/docs/building.md +++ b/docs/building.md @@ -528,6 +528,49 @@ Executing `Packaging/miyoo_mini/build.sh` will create the folder `build-miyoo-mi OnionOS Port Collection. +
macOS 10.4 Tiger + +For macOS Tiger, DevilutionX can be compiled using the compiler and libraries from [MacPorts](https://www.macports.org/). + +For PowerPC, you can use precompiled dependencies from here: + +http://macports-tiger-ppc.glebm.com/ + +After installing MacPorts, run: + +~~~ bash +# Some packages may require you to manually deactivate certain ports during installation. +# Remember to reactivate them after installing. +sudo port install curl curl-ca-bundle gcc14 cmake \ + libsdl12 libsdl_image libsodium bzip2 zlib + +# Set GCC 14 as the default GCC: +sudo port select --set gcc mp-gcc14 +~~~ + + + +Then, build DevilutionX: + +~~~ bash +CC=gcc cmake -S. -Bbuild-rel -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCPACK=ON -DMACOSX_STANDALONE_APP_BUNDLE=ON +cmake --build build-rel -j "$(sysctl -n hw.ncpu)" + +# `sudo` is required to produce a bundle with all the shared libraries. +sudo cmake --build build-rel --target package -j "$(sysctl -n hw.ncpu)" +~~~ + +To run tools from the `tools/` directory (only needed for development), you also need Python: + +~~~ bash +sudo port install python312 +sudo port select --set python python312 +sudo port select --set python3 python312 +~~~ + +
+
CMake build options ### General