22 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33 * SPDX-License-Identifier: Apache-2.0
44 */
5+ import aws.sdk.kotlin.gradle.crt.CMakeBuildType
56import aws.sdk.kotlin.gradle.crt.cmakeInstallDir
67import aws.sdk.kotlin.gradle.crt.configureCrtCMakeBuild
78import aws.sdk.kotlin.gradle.crt.disableCrossCompileTargets
@@ -10,6 +11,7 @@ import aws.sdk.kotlin.gradle.kmp.IDEA_ACTIVE
1011import aws.sdk.kotlin.gradle.kmp.configureKmpTargets
1112import aws.sdk.kotlin.gradle.util.typedProp
1213import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
14+ import org.jetbrains.kotlin.konan.target.KonanTarget
1315
1416plugins {
1517 alias(libs.plugins.kotlin.multiplatform)
@@ -23,7 +25,7 @@ version = sdkVersion
2325description = " Kotlin Multiplatform bindings for AWS SDK Common Runtime"
2426
2527// See: https://kotlinlang.org/docs/reference/opt-in-requirements.html#opting-in-to-using-api
26- val optinAnnotations = listOf (" kotlin.RequiresOptIn" )
28+ val optinAnnotations = listOf (" kotlin.RequiresOptIn" , " kotlinx.cinterop.ExperimentalForeignApi " )
2729
2830// KMP configuration from build plugin
2931configureKmpTargets()
@@ -136,7 +138,7 @@ kotlin {
136138 targets.withType<KotlinNativeTarget > {
137139 val knTarget = this
138140 logger.info(" configuring $knTarget : ${knTarget.name} " )
139- val cmakeInstallTask = configureCrtCMakeBuild(knTarget)
141+ val cmakeInstallTask = configureCrtCMakeBuild(knTarget, CMakeBuildType . Release )
140142 val targetInstallDir = project.cmakeInstallDir(knTarget)
141143 val headerDir = targetInstallDir.resolve(" include" )
142144 val libDir = targetInstallDir.resolve(" lib" )
@@ -148,6 +150,7 @@ kotlin {
148150 defFile(" $interopDir /crt.def" )
149151 includeDirs(headerDir)
150152 compilerOpts(" -L${libDir.absolutePath} " )
153+ extraOpts(" -libraryPath" , libDir.absolutePath)
151154 }
152155
153156 // cinterop tasks processes header files which requires the corresponding CMake build/install to run
@@ -158,6 +161,7 @@ kotlin {
158161 }
159162
160163 compilations[" test" ].compilerOptions.configure {
164+ // TODO - can we remove this if we are bundling the static libs
161165 freeCompilerArgs.addAll(listOf (" -linker-options" , " -L${libDir.absolutePath} " ))
162166 }
163167 }
0 commit comments