Adding libsodium
This commit is contained in:
parent
7238b09112
commit
3f7df6c651
@ -49,13 +49,6 @@ fun getHostOsName(): String {
|
|||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
val hostOsName = getHostOsName()
|
val hostOsName = getHostOsName()
|
||||||
if (ideaActive) {
|
|
||||||
when(hostOsName) {
|
|
||||||
"linux" -> linuxX64("native")
|
|
||||||
"macos" -> macosX64("native")
|
|
||||||
"windows" -> mingwX64("native")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hostOsName == "linux") {
|
if (hostOsName == "linux") {
|
||||||
jvm()
|
jvm()
|
||||||
js {
|
js {
|
||||||
@ -171,8 +164,6 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin(Deps.Common.stdLib))
|
implementation(kotlin(Deps.Common.stdLib))
|
||||||
implementation(kotlin(Deps.Common.test))
|
implementation(kotlin(Deps.Common.test))
|
||||||
implementation(Deps.Common.coroutines)
|
|
||||||
implementation(Deps.Common.kotlinBigNum)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val commonTest by getting {
|
val commonTest by getting {
|
||||||
@ -182,41 +173,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val nativeMain = if (ideaActive) {
|
|
||||||
val nativeMain by getting {
|
|
||||||
dependsOn(commonMain)
|
|
||||||
dependencies {
|
|
||||||
implementation(Deps.Native.coroutines)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nativeMain
|
|
||||||
} else {
|
|
||||||
val nativeMain by creating {
|
|
||||||
dependsOn(commonMain)
|
|
||||||
dependencies {
|
|
||||||
implementation(Deps.Native.coroutines)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nativeMain
|
|
||||||
}
|
|
||||||
val nativeTest = if (ideaActive) {
|
|
||||||
val nativeTest by getting {
|
|
||||||
dependsOn(commonTest)
|
|
||||||
dependencies {
|
|
||||||
implementation(Deps.Native.coroutines)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nativeTest
|
|
||||||
} else {
|
|
||||||
val nativeTest by creating {
|
|
||||||
dependsOn(commonTest)
|
|
||||||
dependencies {
|
|
||||||
implementation(Deps.Native.coroutines)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nativeTest
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hostOsName == "linux") {
|
if (hostOsName == "linux") {
|
||||||
val jvmMain by getting {
|
val jvmMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -246,87 +202,7 @@ kotlin {
|
|||||||
implementation(kotlin(Deps.Js.test))
|
implementation(kotlin(Deps.Js.test))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val linuxMain by getting {
|
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
}
|
||||||
val linuxTest by getting {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
//Not supported in coroutines at the moment
|
|
||||||
// val linuxArm32HfpMain by getting {
|
|
||||||
// dependsOn(nativeMain)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// val linuxArm32HfpTest by getting {
|
|
||||||
// dependsOn(nativeTest)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// val linuxArm64Main by getting {
|
|
||||||
// dependsOn(nativeMain)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// val linuxArm64Test by getting {
|
|
||||||
// dependsOn(nativeTest)
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hostOsName == "macos") {
|
|
||||||
|
|
||||||
val iosMain by getting {
|
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
val iosTest by getting {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
|
|
||||||
val ios64ArmMain by getting {
|
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
val ios64ArmTest by getting {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
|
|
||||||
val ios32ArmMain by getting {
|
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
val ios32ArmTest by getting {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
|
|
||||||
val macosX64Main by getting {
|
|
||||||
dependsOn(nativeMain)
|
|
||||||
}
|
|
||||||
val macosX64Test by getting {
|
|
||||||
dependsOn(nativeTest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Coroutines don't support mingwx86 yet
|
|
||||||
// val mingwX86Main by getting {
|
|
||||||
// dependsOn(commonMain)
|
|
||||||
// dependencies {
|
|
||||||
// implementation(Deps.Native.coroutines)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// val mingwX86Test by getting {
|
|
||||||
// dependsOn(commonTest)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
if (hostOsName == "windows") {
|
|
||||||
val mingwX64Main by getting {
|
|
||||||
dependsOn(commonMain)
|
|
||||||
dependencies {
|
|
||||||
implementation(Deps.Native.coroutines)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val mingwX64Test by getting {
|
|
||||||
dependsOn(commonTest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
all {
|
all {
|
||||||
languageSettings.enableLanguageFeature("InlineClasses")
|
languageSettings.enableLanguageFeature("InlineClasses")
|
||||||
|
@ -89,6 +89,11 @@ kotlin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
linuxX64("linux") {
|
linuxX64("linux") {
|
||||||
|
compilations.getByName("main") {
|
||||||
|
val libsodiumCinterop by cinterops.creating {
|
||||||
|
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
|
||||||
|
}
|
||||||
|
}
|
||||||
binaries {
|
binaries {
|
||||||
staticLib {
|
staticLib {
|
||||||
optimized = true
|
optimized = true
|
||||||
@ -383,14 +388,14 @@ tasks {
|
|||||||
|
|
||||||
testLogging {
|
testLogging {
|
||||||
events("PASSED", "FAILED", "SKIPPED")
|
events("PASSED", "FAILED", "SKIPPED")
|
||||||
// showStandardStreams = true
|
showStandardStreams = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsNodeTest by getting(KotlinJsTest::class) {
|
val jsNodeTest by getting(KotlinJsTest::class) {
|
||||||
testLogging {
|
testLogging {
|
||||||
events("PASSED", "FAILED", "SKIPPED")
|
events("PASSED", "FAILED", "SKIPPED")
|
||||||
showStandardStreams = true
|
// showStandardStreams = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,4 +484,18 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//configurations.forEach {
|
||||||
|
//
|
||||||
|
// if (it.name == "linuxCompileKlibraries") {
|
||||||
|
// println("Configuration name: ${it.name}")
|
||||||
|
// it.attributes {
|
||||||
|
// this.keySet().forEach { key ->
|
||||||
|
// val attribute = getAttribute(key)
|
||||||
|
// println(" |-- Attribute $key ${attribute}")
|
||||||
|
// attribute(org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations.ATTRIBUTE, "publicZ")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.blake2b
|
package com.ionspin.kotlin.crypto.hash.blake2b
|
||||||
|
import interop.*
|
||||||
|
import kotlinx.cinterop.*
|
||||||
/**
|
/**
|
||||||
* Created by Ugljesa Jovanovic
|
* Created by Ugljesa Jovanovic
|
||||||
* ugljesa.jovanovic@ionspin.com
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.hash.blake2b
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 24-May-2020
|
||||||
|
*/
|
||||||
|
|
||||||
|
import interop.*
|
||||||
|
import kotlinx.cinterop.*
|
||||||
|
import libsodium.*
|
||||||
|
|
||||||
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
class Blake2bLinuxTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testCinterop() {
|
||||||
|
val sodiumInitResult = sodium_init()
|
||||||
|
// println("Sodium init $sodiumInitResult")
|
||||||
|
println("1")
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
headers = sodium.h
|
headers = sodium.h
|
||||||
headerFilter = sodium.h sodium/**
|
headerFilter = sodium.h sodium/**
|
||||||
staticLibraries = libsodium.a
|
staticLibraries = libsodium.a
|
||||||
libraryPaths = lib
|
libraryPaths = /usr/lib
|
||||||
compilerOpts = -Iinclude
|
compilerOpts = -Iinclude -I/usr/include
|
||||||
linkerOpts = {{LDFLAGS}}
|
linkerOpts = -L/usr/lib -lsodium
|
Loading…
x
Reference in New Issue
Block a user