Skip to content

Commit

Permalink
macOS: deploy stuff
Browse files Browse the repository at this point in the history
Ref: #272
  • Loading branch information
rodlie committed Nov 4, 2024
1 parent 0d9df52 commit 0ae3992
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/cmake/friction-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
7 changes: 6 additions & 1 deletion src/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/engine/skia
Submodule skia updated 1 files
+3 −3 gn/toolchain/BUILD.gn
2 changes: 2 additions & 0 deletions src/scripts/build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand Down
36 changes: 36 additions & 0 deletions src/scripts/build_mac_ci.sh
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#

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
2 changes: 2 additions & 0 deletions src/ui/widgets/aboutwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 0ae3992

Please sign in to comment.