2
0
MasterPassword/core/c/build.gradle

45 lines
1.5 KiB
Groovy
Raw Normal View History

import org.gradle.internal.jvm.Jvm
plugins {
id 'cpp-library'
id 'xcode'
id 'visual-studio'
}
description = 'Master Password Algorithm Implementation'
library {
linkage.set( [Linkage.STATIC, Linkage.SHARED] )
binaries.configureEach {
// Reconfigure the toolchain from C++ to C.
compileTask.get().source.setFrom( fileTree( dir: "src", include: "**/*.c" ) )
if (toolChain instanceof VisualCpp) {
compileTask.get().compilerArgs = ["/TC"]
} else if (toolChain instanceof GccCompatibleToolChain) {
compileTask.get().compilerArgs = ["-x", "c", "-std=c11"]
//linkTask.get().linkerArgs = ["-nodefaultlibs", "-lc"]
}
// Resolve our standard naming for OS platforms.
def platform = System.getProperty( "os.name" ).toLowerCase( Locale.ROOT )
if (platform.startsWith( "mac" ))
platform = "macos"
project.dependencies {
// Depend on JDK for JNI support.
add( includePathConfiguration.name,
files( new File( Jvm.current().javaHome, "include" ) ) { first().eachDir { from it } } )
// Depend on libsodium from `lib`; run `lib/bin/build_libsodium-${os}` first.
add( includePathConfiguration.name,
files( "../../lib/libsodium/build-${platform}~/out/include" ) )
add( linkLibraries.name,
fileTree( "../../lib/libsodium/build-${platform}~/out/lib" ) )
}
compileTask.get().compilerArgs.add "-DMPW_SODIUM=1"
}
}