Browse Source

macOS Tiger platform and instructions

pull/7583/head
Gleb Mazovetskiy 1 year ago committed by Anders Jenbo
parent
commit
c47ff28156
  1. 7
      3rdParty/Lua/CMakeLists.txt
  2. 12
      CMake/Platforms.cmake
  3. 20
      CMake/platforms/macos_tiger.cmake
  4. 30
      CMake/platforms/macports/finders/FindMacportsLegacySupport.cmake
  5. 43
      docs/building.md

7
3rdParty/Lua/CMakeLists.txt vendored

@ -15,7 +15,12 @@ FetchContent_Declare_ExcludeFromAll(Lua
)
FetchContent_MakeAvailable_ExcludeFromAll(Lua)
if(ANDROID AND ("${ANDROID_ABI}" STREQUAL "armeabi-v7a" OR "${ANDROID_ABI}" STREQUAL "x86"))
if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND DARWIN_MAJOR_VERSION VERSION_EQUAL 8)
# We need legacy-support from MacPorts for:
# localtime_r gmtime_r
find_package(MacportsLegacySupport REQUIRED)
target_link_libraries(lua_static PRIVATE MacportsLegacySupport::MacportsLegacySupport)
elseif(ANDROID AND ("${ANDROID_ABI}" STREQUAL "armeabi-v7a" OR "${ANDROID_ABI}" STREQUAL "x86"))
target_compile_definitions(lua_internal INTERFACE -DLUA_USE_C89)
elseif(NINTENDO_3DS OR VITA OR NINTENDO_SWITCH OR NXDK)
target_compile_definitions(lua_static PUBLIC -DLUA_USE_C89)

12
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()

20
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)

30
CMake/platforms/macports/finders/FindMacportsLegacySupport.cmake

@ -0,0 +1,30 @@
# Provides missing functions, such as localtime_r
if(NOT TARGET MacportsLegacySupport::MacportsLegacySupport)
set(MacportsLegacySupport_INCLUDE_DIR /opt/local/include/LegacySupport)
mark_as_advanced(MacportsLegacySupport_INCLUDE_DIR)
find_library(MacportsLegacySupport_LIBRARY NAMES MacportsLegacySupport
PATHS /opt/local/lib)
mark_as_advanced(MacportsLegacySupport_LIBRARY)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
MacportsLegacySupport
DEFAULT_MSG
MacportsLegacySupport_LIBRARY MacportsLegacySupport_INCLUDE_DIR)
if(MacportsLegacySupport_FOUND)
set(MacportsLegacySupport_LIBRARIES ${MacportsLegacySupport_LIBRARY})
set(MacportsLegacySupport_INCLUDE_DIRS ${MacportsLegacySupport_INCLUDE_DIR})
add_library(MacportsLegacySupport::MacportsLegacySupport UNKNOWN IMPORTED)
set_target_properties(
MacportsLegacySupport::MacportsLegacySupport PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MacportsLegacySupport_INCLUDE_DIR}"
)
set_target_properties(
MacportsLegacySupport::MacportsLegacySupport PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${MacportsLegacySupport_LIBRARY}"
)
endif()
endif()

43
docs/building.md

@ -528,6 +528,49 @@ Executing `Packaging/miyoo_mini/build.sh` will create the folder `build-miyoo-mi
OnionOS Port Collection.
</details>
<details><summary>macOS 10.4 Tiger</summary>
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 lua54
# Set GCC 14 as the default GCC:
sudo port select --set gcc mp-gcc14
~~~
<!-- The following packages have issues so we use the vendored versions:
libfmt11 google-benchmark gtest -->
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
~~~
</details>
<details><summary><b>CMake build options</b></summary>
### General

Loading…
Cancel
Save