diff --git a/build.gradle b/build.gradle index a0dae25590..3b22c03295 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ import org.opensearch.gradle.test.RestIntegTestTask import org.opensearch.gradle.testclusters.OpenSearchCluster import org.apache.tools.ant.taskdefs.condition.Os +import org.gradle.internal.os.OperatingSystem; import java.nio.file.Paths import java.util.concurrent.Callable @@ -293,12 +294,24 @@ task windowsPatches(type:Exec) { commandLine 'cmd', '/c', "Powershell -File $rootDir\\scripts\\windowsScript.ps1" } +task linuxPatches(type:Exec) { + commandLine 'chmod', '777', "$rootDir/scripts/linuxScript.sh" + commandLine 'sh', '-c',"$rootDir/scripts/linuxScript.sh" + //exec { + // executable "$rootDir/scripts/linuxScript.sh" + // } +} + task cmakeJniLib(type:Exec) { workingDir 'jni' if (Os.isFamily(Os.FAMILY_WINDOWS)) { dependsOn windowsPatches commandLine 'cmake', '.', "-G", "Unix Makefiles", "-DKNN_PLUGIN_VERSION=${opensearch_version}", "-DBLAS_LIBRARIES=$rootDir\\src\\main\\resources\\windowsDependencies\\libopenblas.dll", "-DLAPACK_LIBRARIES=$rootDir\\src\\main\\resources\\windowsDependencies\\libopenblas.dll" } + else if(OperatingSystem.current().isLinux()) { + dependsOn linuxPatches + commandLine 'cmake', '.', "-DKNN_PLUGIN_VERSION=${opensearch_version}" + } else { commandLine 'cmake', '.', "-DKNN_PLUGIN_VERSION=${opensearch_version}" } diff --git a/scripts/linuxScript.sh b/scripts/linuxScript.sh new file mode 100644 index 0000000000..58e8c3fba6 --- /dev/null +++ b/scripts/linuxScript.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. + + +git submodule update --init -- jni/external/nmslib +git submodule update --init -- jni/external/faiss + +sed -i 's/_mm_loadu_si64/_mm_loadl_epi64/g' jni/external/faiss/faiss/impl/code_distance/code_distance-avx2.h \ No newline at end of file