Unverified Commit 023a1695 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Reorg native source sets. (#183)

parent 0c27b1b9
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
......@@ -186,7 +186,13 @@ kotlin {
}
if (supportNative) {
// See https://kotlinlang.org/docs/mpp-share-on-platforms.html#configure-the-hierarchical-structure-manually
val nativeMain by creating {}
val macosMain by creating {
dependsOn(nativeMain)
}
val macosX64Main by getting {
dependsOn(macosMain)
}
}
}
......@@ -391,8 +397,8 @@ fun List<String>.findAllFiles(suffix: String): List<String> = this
project.tasks.register<Exec>("nativeBridgesCompile") {
dependsOn(skiaDir)
val inputDirs = listOf(
"$projectDir/src/macosX64Main/cpp/generated",
"$projectDir/src/macosX64Main/cpp/common",
"$projectDir/src/nativeMain/cpp/generated",
"$projectDir/src/nativeMain/cpp/common",
"$projectDir/src/commonMain/cpp/common"
)
val outDir = "$buildDir/nativeBridges/obj/$target"
......@@ -416,7 +422,7 @@ project.tasks.register<Exec>("nativeBridgesCompile") {
"-DSK_SHAPER_CORETEXT_AVAILABLE",
"-DSK_BUILD_FOR_MAC",
"-DSK_METAL",
"-I$projectDir/src/macosX64Main/cpp/include",
"-I$projectDir/src/nativeMain/cpp/include",
"-I$projectDir/src/commonMain/cpp/headers",
*skiaPreprocessorFlags,
*srcs
......
diff --git a/include/private/SkPathRef.h b/include/private/SkPathRef.h
index f9533d7261..9c178fb69f 100644
--- a/include/private/SkPathRef.h
+++ b/include/private/SkPathRef.h
@@ -8,6 +8,8 @@
#ifndef SkPathRef_DEFINED
#define SkPathRef_DEFINED
+#include <tuple>
+
#include "include/core/SkMatrix.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRRect.h"
diff --git a/third_party/icu/SkLoadICU.cpp b/third_party/icu/SkLoadICU.cpp
index ac7ba0c15d..b41af4e85a 100644
--- a/third_party/icu/SkLoadICU.cpp
+++ b/third_party/icu/SkLoadICU.cpp
@@ -68,6 +68,16 @@ static bool init_icu(void* addr) {
return true;
}
+static std::string library_directory() {
+ HMODULE hModule = NULL;
+ GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ reinterpret_cast<LPCSTR>(&library_directory), &hModule);
+ char path[MAX_PATH];
+ GetModuleFileNameA(hModule, path, MAX_PATH);
+ const char* end = strrchr(path, '\\');
+ return end ? std::string(path, end - path) : std::string();
+}
+
static std::string executable_directory() {
HMODULE hModule = GetModuleHandleA(NULL);
char path[MAX_PATH];
@@ -76,17 +86,21 @@ static std::string executable_directory() {
return end ? std::string(path, end - path) : std::string();
}
+static bool load_from(const std::string& dir) {
+ auto sPath = dir + "\\icudtl.dat";
+ if (void* addr = win_mmap(sPath.c_str())) {
+ if (init_icu(addr)) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool SkLoadICU() {
static bool good = false;
static std::once_flag flag;
std::call_once(flag, []() {
- std::string sPath = executable_directory();
- sPath += "\\icudtl.dat";
- if (void* addr = win_mmap(sPath.c_str())) {
- if (init_icu(addr)) {
- good = true;
- }
- }
+ good = load_from(executable_directory()) || load_from(library_directory());
});
return good;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment