Unverified Commit 9a1f584f authored by Alexey Tsvetkov's avatar Alexey Tsvetkov Committed by GitHub

Add buildType compiler flags for native, wasm, objC (#409)

parent 074a2751
...@@ -61,6 +61,7 @@ if (supportWasm) { ...@@ -61,6 +61,7 @@ if (supportWasm) {
flags.set(listOf( flags.set(listOf(
*skiaPreprocessorFlags(), *skiaPreprocessorFlags(),
*buildType.clangFlags,
"-DSKIKO_WASM", "-DSKIKO_WASM",
"-fno-rtti", "-fno-rtti",
"-fno-exceptions" "-fno-exceptions"
...@@ -143,36 +144,30 @@ fun compileNativeBridgesTask(os: OS, arch: Arch): TaskProvider<CompileSkikoCppTa ...@@ -143,36 +144,30 @@ fun compileNativeBridgesTask(os: OS, arch: Arch): TaskProvider<CompileSkikoCppTa
when (os) { when (os) {
OS.IOS -> { OS.IOS -> {
val sdkRoot = "/Applications/Xcode.app/Contents/Developer/Platforms" val sdkRoot = "/Applications/Xcode.app/Contents/Developer/Platforms"
val iosFlags = listOf( val iosArchFlags = when (arch) {
"-std=c++17", Arch.Arm64 -> arrayOf(
"-target", "arm64-apple-ios",
"-isysroot", "$sdkRoot/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
)
Arch.X64 -> arrayOf(
"-target", "x86_64-apple-ios-simulator",
"-isysroot", "$sdkRoot/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
)
else -> throw GradleException("Unsupported arch: $arch")
}
flags.set(listOf(
*iosArchFlags,
*buildType.clangFlags,
"-stdlib=libc++", "-stdlib=libc++",
"-DSK_SHAPER_CORETEXT_AVAILABLE", "-DSK_SHAPER_CORETEXT_AVAILABLE",
"-DSK_BUILD_FOR_IOS", "-DSK_BUILD_FOR_IOS",
"-DSK_METAL" "-DSK_METAL",
) *skiaPreprocessorFlags(),
when (arch) { ))
Arch.Arm64 ->
flags.set(
listOf(
"-target", "arm64-apple-ios",
"-isysroot", "$sdkRoot/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
) +
iosFlags +
skiaPreprocessorFlags()
)
Arch.X64 -> flags.set(
listOf(
"-target", "x86_64-apple-ios-simulator",
"-isysroot", "$sdkRoot/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk")
+ iosFlags
+ skiaPreprocessorFlags()
)
else -> throw GradleException("Unsupported arch: $arch")
}
} }
OS.MacOS -> { OS.MacOS -> {
flags.set(listOf( flags.set(listOf(
"-std=c++17", *buildType.clangFlags,
"-DSK_SHAPER_CORETEXT_AVAILABLE", "-DSK_SHAPER_CORETEXT_AVAILABLE",
"-DSK_BUILD_FOR_MAC", "-DSK_BUILD_FOR_MAC",
"-DSK_METAL", "-DSK_METAL",
...@@ -181,7 +176,7 @@ fun compileNativeBridgesTask(os: OS, arch: Arch): TaskProvider<CompileSkikoCppTa ...@@ -181,7 +176,7 @@ fun compileNativeBridgesTask(os: OS, arch: Arch): TaskProvider<CompileSkikoCppTa
} }
OS.Linux -> { OS.Linux -> {
flags.set(listOf( flags.set(listOf(
"-std=c++17", *buildType.clangFlags,
"-fno-rtti", "-fno-rtti",
"-fno-exceptions", "-fno-exceptions",
"-fvisibility=hidden", "-fvisibility=hidden",
...@@ -721,9 +716,12 @@ if (hostOs == OS.MacOS) { ...@@ -721,9 +716,12 @@ if (hostOs == OS.MacOS) {
val outs = names.map { "$outDir/$it.o" }.toTypedArray() val outs = names.map { "$outDir/$it.o" }.toTypedArray()
workingDir = File(outDir) workingDir = File(outDir)
val skiaDir = skiaJvmBindingsDir.get().absolutePath val skiaDir = skiaJvmBindingsDir.get().absolutePath
dependsOn(skiaJvmBindingsDir)
commandLine = listOf( commandLine = listOf(
"clang", "clang",
*targetOs.clangFlags, *targetOs.clangFlags,
*buildType.clangFlags,
"-I$jdkHome/include", "-I$jdkHome/include",
"-I$jdkHome/include/darwin", "-I$jdkHome/include/darwin",
"-I$skiaDir", "-I$skiaDir",
...@@ -731,7 +729,6 @@ if (hostOs == OS.MacOS) { ...@@ -731,7 +729,6 @@ if (hostOs == OS.MacOS) {
"-I$skiaDir/include/gpu", "-I$skiaDir/include/gpu",
"-fobjc-arc", "-fobjc-arc",
"-DSK_METAL", "-DSK_METAL",
"-std=c++17",
"-c", "-c",
*srcs *srcs
) )
......
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