Generate header file in build.gradle
This commit is contained in:
123
build.gradle
123
build.gradle
@@ -19,4 +19,127 @@ version = '0.13'
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '1.12'
|
||||
}
|
||||
|
||||
model {
|
||||
platforms {
|
||||
windows_i386 {
|
||||
architecture 'i386'
|
||||
operatingSystem 'windows'
|
||||
}
|
||||
windows_amd64 {
|
||||
architecture 'amd64'
|
||||
operatingSystem 'windows'
|
||||
}
|
||||
}
|
||||
toolChains {
|
||||
gcc(Gcc) {
|
||||
addPlatformConfiguration(new TargetPlatformConfiguration() {
|
||||
boolean supportsPlatform(Platform platform) {
|
||||
platform.operatingSystem.current && platform.operatingSystem.name == 'windows' &&
|
||||
platform.architecture.name == 'amd64'
|
||||
}
|
||||
List<String> getCppCompilerArgs() { ['-m64', '-fpermissive'] }
|
||||
List<String> getCCompilerArgs() { ['-m64'] }
|
||||
List<String> getObjectiveCCompilerArgs() { ['-m64'] }
|
||||
List<String> getObjectiveCppCompilerArgs() { ['-m64'] }
|
||||
List<String> getAssemblerArgs() { ['--64'] }
|
||||
List<String> getLinkerArgs() { ['-m64'] }
|
||||
List<String> getStaticLibraryArchiverArgs() { [] }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def jniHeadersDir = file("$buildDir/headers")
|
||||
|
||||
task jniHeaders(dependsOn: compileJava) {
|
||||
def outputFile = file("$jniHeadersDir/wiiusej_WiiUseApi.h")
|
||||
inputs.files sourceSets.main.output
|
||||
outputs.file outputFile
|
||||
exec {
|
||||
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
|
||||
args '-o', outputFile
|
||||
args '-classpath', sourceSets.main.output.classesDir
|
||||
args '-classpath', file("$buildDir/../bin")
|
||||
args 'wiiusej.WiiUseApi'
|
||||
}
|
||||
}
|
||||
|
||||
libraries {
|
||||
main {
|
||||
baseName project.archivesBaseName
|
||||
}
|
||||
all {
|
||||
binaries.all {
|
||||
cppCompiler.args '-I' + jniHeadersDir
|
||||
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
|
||||
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
|
||||
linker.args '-Wl,--kill-at', '-static-libgcc', '-static-libstdc++'
|
||||
tasks.withType(CppCompile) { task ->
|
||||
task.dependsOn jniHeaders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(Upload) {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
repository(url: uri('.maven'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
jni
|
||||
}
|
||||
|
||||
def deployer = uploadJni.repositories.mavenDeployer
|
||||
|
||||
binaries.withType(SharedLibraryBinary) { binary ->
|
||||
if (!buildable) {
|
||||
return
|
||||
}
|
||||
def variantName = "${targetPlatform.operatingSystem.name}-${targetPlatform.architecture.name}"
|
||||
def taskName = "jar-${variantName}"
|
||||
def nativeJar = project.tasks.findByName(taskName)
|
||||
if (nativeJar == null) {
|
||||
nativeJar = project.task(taskName, type: Jar) {
|
||||
baseName = "${project.archivesBaseName}-$variantName"
|
||||
}
|
||||
artifacts {
|
||||
jni nativeJar
|
||||
}
|
||||
def jniPom = deployer.addFilter(variantName) { artifact, file ->
|
||||
return file == nativeJar.archivePath
|
||||
}
|
||||
jniPom.groupId = project.group
|
||||
jniPom.artifactId = nativeJar.baseName
|
||||
jniPom.version = project.version
|
||||
jniPom.scopeMappings.mappings.clear()
|
||||
}
|
||||
def builderTask = binary.tasks.builder
|
||||
nativeJar.into(project.group.replace('.', '/') + '/' + variantName) { from builderTask.outputFile }
|
||||
nativeJar.dependsOn builderTask
|
||||
}
|
||||
|
||||
def mainPom = uploadArchives.repositories.mavenDeployer.pom
|
||||
mainPom.groupId = project.group
|
||||
mainPom.artifactId = jar.baseName
|
||||
mainPom.version = project.version
|
||||
mainPom.scopeMappings.mappings.clear()
|
||||
mainPom.withXml { provider ->
|
||||
def node = provider.asNode()
|
||||
def deps = node.appendNode('dependencies')
|
||||
['windows-amd64', 'windows-i386'].each { platform ->
|
||||
def dep = deps.appendNode('dependency')
|
||||
dep.appendNode('groupId', project.group)
|
||||
dep.appendNode('artifactId', "${project.archivesBaseName}-${platform}")
|
||||
dep.appendNode('version', project.version)
|
||||
}
|
||||
def dep = deps.appendNode('dependency')
|
||||
dep.appendNode('groupId', 'com.github.boukefalos')
|
||||
dep.appendNode('artifactId', 'jlibloader')
|
||||
dep.appendNode('version', '0.1')
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
EXPORTS
|
||||
Java_wiiusej_WiiUseApi_connect
|
||||
Java_wiiusej_WiiUseApi_find
|
||||
Java_wiiusej_WiiUseApi_init
|
||||
Java_wiiusej_WiiUseApi_closeConnection
|
||||
Java_wiiusej_WiiUseApi_getUnId
|
||||
Java_wiiusej_WiiUseApi_cleanUp
|
||||
Java_wiiusej_WiiUseApi_activateRumble
|
||||
Java_wiiusej_WiiUseApi_deactivateRumble
|
||||
Java_wiiusej_WiiUseApi_activateIRTracking
|
||||
Java_wiiusej_WiiUseApi_deactivateIRTracking
|
||||
Java_wiiusej_WiiUseApi_activateMotionSensing
|
||||
Java_wiiusej_WiiUseApi_deactivateMotionSensing
|
||||
Java_wiiusej_WiiUseApi_setLeds
|
||||
Java_wiiusej_WiiUseApi_setOrientThreshold
|
||||
Java_wiiusej_WiiUseApi_setAccelThreshold
|
||||
Java_wiiusej_WiiUseApi_setAlphaSmoothing
|
||||
Java_wiiusej_WiiUseApi_reSync
|
||||
Java_wiiusej_WiiUseApi_activateSmoothing
|
||||
Java_wiiusej_WiiUseApi_deactivateSmoothing
|
||||
Java_wiiusej_WiiUseApi_activateContinuous
|
||||
Java_wiiusej_WiiUseApi_deactivateContinuous
|
||||
Java_wiiusej_WiiUseApi_setScreenRatio43
|
||||
Java_wiiusej_WiiUseApi_setScreenRatio169
|
||||
Java_wiiusej_WiiUseApi_setSensorBarAboveScreen
|
||||
Java_wiiusej_WiiUseApi_setSensorBarBelowScreen
|
||||
Java_wiiusej_WiiUseApi_setVirtualScreenResolution
|
||||
Java_wiiusej_WiiUseApi_getStatus
|
||||
Java_wiiusej_WiiUseApi_setTimeout
|
||||
Java_wiiusej_WiiUseApi_setIrSensitivity
|
||||
Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold
|
||||
Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold
|
||||
Java_wiiusej_WiiUseApi_windowsSetBluetoothStack
|
||||
Java_wiiusej_WiiUseApi_specialPoll
|
||||
@@ -1,277 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class wiiusej_WiiUseApi */
|
||||
|
||||
#ifndef _Included_wiiusej_WiiUseApi
|
||||
#define _Included_wiiusej_WiiUseApi
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: connect
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_connect
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: find
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_find
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: init
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_init
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: closeConnection
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: getUnId
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_getUnId
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: cleanUp
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_cleanUp
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: activateRumble
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateRumble
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: deactivateRumble
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateRumble
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: activateIRTracking
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateIRTracking
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: deactivateIRTracking
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateIRTracking
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: activateMotionSensing
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateMotionSensing
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: deactivateMotionSensing
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateMotionSensing
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setLeds
|
||||
* Signature: (IZZZZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setLeds
|
||||
(JNIEnv *, jobject, jint, jboolean, jboolean, jboolean, jboolean);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setOrientThreshold
|
||||
* Signature: (IF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setOrientThreshold
|
||||
(JNIEnv *, jobject, jint, jfloat);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setAccelThreshold
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAccelThreshold
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setAlphaSmoothing
|
||||
* Signature: (IF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAlphaSmoothing
|
||||
(JNIEnv *, jobject, jint, jfloat);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: reSync
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_reSync
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: activateSmoothing
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateSmoothing
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: deactivateSmoothing
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSmoothing
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: activateContinuous
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateContinuous
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: deactivateContinuous
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateContinuous
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setScreenRatio43
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio43
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setScreenRatio169
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio169
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setSensorBarAboveScreen
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarAboveScreen
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setSensorBarBelowScreen
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarBelowScreen
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setVirtualScreenResolution
|
||||
* Signature: (III)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setVirtualScreenResolution
|
||||
(JNIEnv *, jobject, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: getStatus
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setTimeout
|
||||
* Signature: (ISS)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setTimeout
|
||||
(JNIEnv *, jobject, jint, jshort, jshort);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setIrSensitivity
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setIrSensitivity
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setNunchukOrientationThreshold
|
||||
* Signature: (IF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold
|
||||
(JNIEnv *, jobject, jint, jfloat);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: setNunchukAccelerationThreshold
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: windowsSetBluetoothStack
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_windowsSetBluetoothStack
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: wiiusej_WiiUseApi
|
||||
* Method: specialPoll
|
||||
* Signature: (Lwiiusej/wiiusejevents/utils/EventsGatherer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user