[K/N][perf] Support framework benchmark on macosArm64
This commit is contained in:
@@ -23,18 +23,22 @@ def frameworkName = 'benchmarksAnalyzer'
|
|||||||
|
|
||||||
def buildType = NativeBuildType.valueOf(findProperty('nativeBuildType') ?: 'DEBUG')
|
def buildType = NativeBuildType.valueOf(findProperty('nativeBuildType') ?: 'DEBUG')
|
||||||
|
|
||||||
|
def archSuffix = PlatformInfo.hostName.substring(PlatformInfo.hostName.lastIndexOf('_') + 1).capitalize()
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
sourceSets {
|
sourceSets {
|
||||||
macosMain {
|
nativeMain {
|
||||||
kotlin.srcDir "$toolsPath/benchmarks/shared/src"
|
kotlin.srcDir "$toolsPath/benchmarks/shared/src"
|
||||||
kotlin.srcDir "$toolsPath/benchmarksAnalyzer/src/main/kotlin"
|
kotlin.srcDir "$toolsPath/benchmarksAnalyzer/src/main/kotlin"
|
||||||
kotlin.srcDir "$rootProject.projectDir/../endorsedLibraries/kotlinx.cli/src/main/kotlin"
|
kotlin.srcDir "$rootProject.projectDir/../endorsedLibraries/kotlinx.cli/src/main/kotlin"
|
||||||
kotlin.srcDir "$rootProject.projectDir/../endorsedLibraries/kotlinx.cli/src/main/kotlin-native"
|
kotlin.srcDir "$rootProject.projectDir/../endorsedLibraries/kotlinx.cli/src/main/kotlin-native"
|
||||||
kotlin.srcDir "$toolsPath/benchmarksAnalyzer/src/main/kotlin-native"
|
kotlin.srcDir "$toolsPath/benchmarksAnalyzer/src/main/kotlin-native"
|
||||||
}
|
}
|
||||||
|
macosX64Main { dependsOn nativeMain }
|
||||||
|
macosArm64Main { dependsOn nativeMain }
|
||||||
}
|
}
|
||||||
|
|
||||||
configure([macosX64("macos")]) {
|
configure([macosX64(), macosArm64()]) {
|
||||||
compilations.main.cinterops {
|
compilations.main.cinterops {
|
||||||
libcurl {
|
libcurl {
|
||||||
defFile "$toolsPath/benchmarksAnalyzer/src/nativeInterop/cinterop/libcurl.def"
|
defFile "$toolsPath/benchmarksAnalyzer/src/nativeInterop/cinterop/libcurl.def"
|
||||||
@@ -42,7 +46,11 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macosX64("macos").binaries {
|
macosX64().binaries {
|
||||||
|
framework(frameworkName, [buildType])
|
||||||
|
}
|
||||||
|
|
||||||
|
macosArm64().binaries {
|
||||||
framework(frameworkName, [buildType])
|
framework(frameworkName, [buildType])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,7 +59,7 @@ MPPTools.addTimeListener(project)
|
|||||||
|
|
||||||
task konanRun {
|
task konanRun {
|
||||||
if (PlatformInfo.isMac()) {
|
if (PlatformInfo.isMac()) {
|
||||||
dependsOn 'build'
|
dependsOn "linkBenchmarksAnalyzerDebugFrameworkMacos${archSuffix}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,16 +83,26 @@ def compilerFlags(def buildType) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getMacTarget() {
|
||||||
|
if (PlatformInfo.isMac()) {
|
||||||
|
if (PlatformInfo.hostName == "macos_x64")
|
||||||
|
return kotlin.macosX64("macosX64")
|
||||||
|
else return kotlin.macosArm64("macosArm64")
|
||||||
|
}
|
||||||
|
throw new GradleException('Current host isn\'t run with Mac OS')
|
||||||
|
}
|
||||||
|
|
||||||
task konanJsonReport {
|
task konanJsonReport {
|
||||||
doLast {
|
doLast {
|
||||||
if (PlatformInfo.isMac()) {
|
if (PlatformInfo.isMac()) {
|
||||||
def applicationName = "FrameworkBenchmarksAnalyzer"
|
def applicationName = "FrameworkBenchmarksAnalyzer"
|
||||||
def frameworkPath = kotlin.macosX64("macos").binaries.
|
def macTarget = getMacTarget()
|
||||||
getFramework(frameworkName, kotlin.macosX64("macos").binaries.DEBUG).outputFile.absolutePath
|
def frameworkPath = macTarget.binaries.
|
||||||
|
getFramework(frameworkName, macTarget.binaries.DEBUG).outputFile.absolutePath
|
||||||
def nativeExecutable = new File("$frameworkPath/$frameworkName").canonicalPath
|
def nativeExecutable = new File("$frameworkPath/$frameworkName").canonicalPath
|
||||||
def nativeCompileTime = MPPTools.getNativeCompileTime(project, applicationName, ['compileKotlinMacos',
|
def nativeCompileTime = MPPTools.getNativeCompileTime(project, applicationName, ["compileKotlinMacos${archSuffix}".toString(),
|
||||||
'linkBenchmarksAnalyzerDebugFrameworkMacos',
|
"linkBenchmarksAnalyzerDebugFrameworkMacos${archSuffix}".toString(),
|
||||||
'cinteropLibcurlMacos'])
|
"cinteropLibcurlMacos${archSuffix}".toString()])
|
||||||
def properties = getCommonProperties() + ['type' : 'native',
|
def properties = getCommonProperties() + ['type' : 'native',
|
||||||
'compilerVersion': "${konanVersion}".toString(),
|
'compilerVersion': "${konanVersion}".toString(),
|
||||||
'flags' : compilerFlags(buildType).sort(),
|
'flags' : compilerFlags(buildType).sort(),
|
||||||
|
|||||||
Reference in New Issue
Block a user