diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml new file mode 100644 index 000000000..37f1e96e0 --- /dev/null +++ b/.github/workflows/mac.yml @@ -0,0 +1,16 @@ +name: macOS + +on: workflow_dispatch + +jobs: + release: + runs-on: macos-13 + steps: + - uses: actions/checkout@v3 + - name: Build + run: ./src/scripts/build_mac_ci.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: friction-ci-macOS-x86_64 + path: build-release/*.dmg diff --git a/src/cmake/friction-common.cmake b/src/cmake/friction-common.cmake index 94ea047a1..70c4494d4 100644 --- a/src/cmake/friction-common.cmake +++ b/src/cmake/friction-common.cmake @@ -26,6 +26,7 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) option(LINUX_DEPLOY "Linux Deploy" OFF) +option(MAC_DEPLOY "Mac Deploy" OFF) option(WIN_DEPLOY "Windows Deploy" OFF) option(BUILD_ENGINE "Build Engine" ON) set(ENGINE_LIB_PATH "/mnt/skia" CACHE STRING "Path to prebuilt skia library") @@ -36,6 +37,9 @@ endif() if(${WIN_DEPLOY}) add_definitions(-DWIN_DEPLOY) endif() +if(${MAC_DEPLOY}) + add_definitions(-DMAC_DEPLOY) +endif() if(NOT APPLE) if(UNIX AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt index a2f6fb69b..a0c0159cf 100644 --- a/src/engine/CMakeLists.txt +++ b/src/engine/CMakeLists.txt @@ -26,6 +26,7 @@ ProcessorCount(N) option(USE_SKIA_SYSTEM_LIBS "Use skia (third-party) system libraries on Linux" ON) option(LINUX_DEPLOY "Linux Deploy" OFF) +option(MAC_DEPLOY "Mac Deploy" OFF) option(SYNC_SKIA_DEPS "Sync third-party depends" ON) set(SKIA_SRC "${CMAKE_CURRENT_SOURCE_DIR}/skia") @@ -78,7 +79,11 @@ else() if(APPLE) set(GN_PATH ${SKIA_SRC}/bin/gn.bin) set(SKIA_UPDATE_CMD python3 "tools/git-sync-deps") - set(SKIA_ARGS "${SKIA_ARGS} extra_cflags_cc=[\"-frtti\"]") + if(${MAC_DEPLOY}) + set(SKIA_ARGS "${SKIA_ARGS} extra_cflags_cc=[\"-frtti\", \"-mmacosx-version-min=12.7\"]") + else() + set(SKIA_ARGS "${SKIA_ARGS} extra_cflags_cc=[\"-frtti\"]") + endif() endif() endif() diff --git a/src/engine/skia b/src/engine/skia index 994b99419..f6e5f9e8d 160000 --- a/src/engine/skia +++ b/src/engine/skia @@ -1 +1 @@ -Subproject commit 994b99419594173a2049943ca34b9bfd6758110c +Subproject commit f6e5f9e8dfa6d410d626a6c48882a2e1ab3db36a diff --git a/src/scripts/build_mac.sh b/src/scripts/build_mac.sh index 15b91b575..aec88e8d3 100755 --- a/src/scripts/build_mac.sh +++ b/src/scripts/build_mac.sh @@ -38,6 +38,8 @@ fi mkdir ${BUILD_DIR} && cd ${BUILD_DIR} cmake -G Ninja \ +-DCMAKE_OSX_DEPLOYMENT_TARGET=12.7 \ +-DMAC_DEPLOY=ON \ -DGIT_COMMIT=${COMMIT} \ -DGIT_BRANCH=${BRANCH} \ -DFRICTION_OFFICIAL_RELEASE=${REL} \ diff --git a/src/scripts/build_mac_ci.sh b/src/scripts/build_mac_ci.sh new file mode 100755 index 000000000..ccbf6583a --- /dev/null +++ b/src/scripts/build_mac_ci.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Friction - https://friction.graphics +# +# Copyright (c) Ole-André Rodlie and contributors +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +set -e -x + +CWD=`pwd` + +SDK=20240915 +URL=https://github.com/friction2d/friction-sdk/releases/download/${SDK} +SDK_TAR=friction-sdk-macOS12.7-v1.tar.bz2 + +if [ ! -d "${CWD}/sdk" ]; then + curl -OL ${URL}/${SDK_TAR} + tar xf ${SDK_TAR} +fi + +git submodule update -i --recursive + +CUSTOM=CI ./src/scripts/build_mac.sh diff --git a/src/ui/widgets/aboutwidget.cpp b/src/ui/widgets/aboutwidget.cpp index cfac931ad..c8cf043e2 100644 --- a/src/ui/widgets/aboutwidget.cpp +++ b/src/ui/widgets/aboutwidget.cpp @@ -119,6 +119,8 @@ AboutWidget::AboutWidget(QWidget *parent) parties << "skia_bundle" << "gperftools" << "qt" << "qscintilla" << "ffmpeg" << "unwind" << "xcb" << "xkbcommon"; #elif defined WIN_DEPLOY parties << "skia_bundle" << "qt" << "qscintilla" << "ffmpeg_win"; +#elif defined MAC_DEPLOY + parties << "skia_bundle" << "qt" << "qscintilla" << "ffmpeg_mac"; #else #ifdef FRICTION_BUNDLE_SKIA_BUNDLE parties << "skia_bundle";