From de964af80d24abbee63250b21407772137ef3fa6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 15 Oct 2020 13:15:11 +0700 Subject: [PATCH] Fix header selection issues, update Gradle --- .github/workflows/gradle.yml | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- kmath-gsl/build.gradle.kts | 21 ++++++++++++------- .../src/nativeInterop/cinterop/libgsl.def | 9 ++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1682e0d45..8697c3a72 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -37,7 +37,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: ./gradlew -Dorg.gradle.daemon=false --build-cache build build-osx: runs-on: macos-latest @@ -67,7 +67,7 @@ jobs: key: ${{ runner.os }}-konan-1.4.20-eap-37 restore-keys: ${{ runner.os }}-konan-1.4.20-eap-37 - name: Build with Gradle - run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache :kmath-gsl:cinteropLibgslNative build + run: sudo ./gradlew -Dorg.gradle.daemon=false --build-cache build build-windows: runs-on: windows-latest diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 12d38de6a..be52383ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kmath-gsl/build.gradle.kts b/kmath-gsl/build.gradle.kts index e0bf1227d..df1e635be 100644 --- a/kmath-gsl/build.gradle.kts +++ b/kmath-gsl/build.gradle.kts @@ -11,8 +11,8 @@ kotlin { explicitApiWarning() val nativeTarget = when (System.getProperty("os.name")) { - "Mac OS X" -> macosX64("native") - "Linux" -> linuxX64("native") + "Mac OS X" -> macosX64() + "Linux" -> linuxX64() else -> { logger.warn("Current OS cannot build any of kmath-gsl targets.") @@ -22,16 +22,14 @@ kotlin { val main by nativeTarget.compilations.getting { cinterops { - val libgsl by creating { - includeDirs { - headerFilterOnly("/usr/include/", "/usr/local/") - } - } + val libgsl by creating } } + val test by nativeTarget.compilations.getting + sourceSets { - val nativeMain by getting { + val nativeMain by creating { val codegen by tasks.creating { matricesCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Matrices.kt") vectorsCodegen(kotlin.srcDirs.first().absolutePath + "/kscience/kmath/gsl/_Vectors.kt") @@ -43,5 +41,12 @@ kotlin { api(project(":kmath-core")) } } + + val nativeTest by creating { + dependsOn(nativeMain) + } + + main.defaultSourceSet.dependsOn(nativeMain) + test.defaultSourceSet.dependsOn(nativeTest) } } diff --git a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def index e626f6690..cf31cd4f4 100644 --- a/kmath-gsl/src/nativeInterop/cinterop/libgsl.def +++ b/kmath-gsl/src/nativeInterop/cinterop/libgsl.def @@ -1,7 +1,6 @@ package=org.gnu.gsl -headers=gsl/gsl_blas.h headerFilter=gsl/** -compilerOpts=-I/usr/include/gsl -linkerOpts=-lgsl -linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib +compilerOpts.linux=-I/usr/include/ +compilerOpts.osx=-I/usr/local/ +linkerOpts.linux=-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgsl +linkerOpts.osx=-L/opt/local/lib -L/usr/local/lib -lgsl