Skip to content

Commit

Permalink
Fix arm64 apple darwin compile [skip skia]
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 5, 2024
1 parent 862a498 commit a45907d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ jobs:
setup: |
brew install llvm
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
export MACOSX_DEPLOYMENT_TARGET='11.0'
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
clang --version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cargo-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: stable - macOS - cargo - test
runs-on: macos-latest
runs-on: macos-14

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ fn main() {
}
"macos" => {
build.cpp_set_stdlib("c++");
if compile_target_arch == "aarch64" {
build.flag("-mmacosx-version-min=11.0");
} else {
build.flag("-mmacosx-version-min=10.13");
}
println!("cargo:rustc-link-lib=c++");
println!("cargo:rustc-link-lib=framework=ApplicationServices");
}
Expand Down
5 changes: 3 additions & 2 deletions skia-c/skia_c.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include <modules/svg/include/SkSVGNode.h>
#include <modules/svg/include/SkSVGRenderContext.h>
#include <src/ports/SkFontMgr_custom.h>
#include <src/ports/SkFontMgr_custom_empty.cpp>
#include <src/core/SkFontDescriptor.h>
#include <src/xml/SkXMLWriter.h>

Expand Down Expand Up @@ -85,6 +84,8 @@ typedef struct skiac_picture skiac_picture;
sk_sp<SkFontMgr>
SkFontMgr_New_Custom_Directory(const char *dir);

sk_sp<SkFontMgr> SkFontMgr_New_Custom_Empty();

enum class CssBaseline
{
Top,
Expand Down Expand Up @@ -135,7 +136,7 @@ struct skiac_font_collection
sk_sp<FontCollection> collection;
sk_sp<SkFontMgr> font_mgr;
sk_sp<TypefaceFontProviderCustom> assets;
skiac_font_collection() : collection(sk_make_sp<FontCollection>()), font_mgr(SkFontMgr_New_Custom_Empty()), assets(sk_make_sp<TypefaceFontProviderCustom>(font_mgr))
skiac_font_collection() : collection(sk_make_sp<FontCollection>()), font_mgr(SkFontMgr_New_Custom_Directory(SK_FONT_FILE_PREFIX)), assets(sk_make_sp<TypefaceFontProviderCustom>(font_mgr))
{
collection->setDefaultFontManager(SkFontMgr_New_Custom_Empty());
collection->setAssetFontManager(font_mgr);
Expand Down

0 comments on commit a45907d

Please sign in to comment.