diff --git a/build.gradle b/build.gradle index 874bc4f..3e73184 100644 --- a/build.gradle +++ b/build.gradle @@ -21,20 +21,39 @@ import org.apache.tools.ant.taskdefs.condition.Os def getBuildParameters(base, bits) { def bitSuffix = (bits == 32) ? 'x86' : 'x86-64' + String bitProperty = System.getProperty("os.arch") + String mFlag = "-m" + String setupArg = "-DBITZ:STRING=" + // ARM inject + if(bitProperty == "arm") { + bitSuffix = "arm" + bits = "arm" + } else if (bitProperty == "aarch64") { + bitSuffix = "aarch64" + bits = "" + mFlag = "" + } + + if(!bits) { + setupArg = "" + } + + println "Your java home is " + System.getProperty("JAVA_HOME") + println "Secondary detection" + System.getProperty("java.home") if (Os.isFamily(Os.FAMILY_WINDOWS)) { return [ 'identifier': "win-${bitSuffix}", 'library': "${base}.dll", - 'setupArguments': ["-DBITZ:STRING=${bits}", '-A', (bits == 64 ? 'x64' : 'Win32')], + 'setupArguments': ["${setupArg}${bits}", '-A', (bits == 64 ? 'x64' : 'Win32')], 'buildArguments': ['--config', 'Release'], 'env': [:] ] } else if (Os.isFamily(Os.FAMILY_MAC)) { return [ - 'identifier': 'darwin', + 'identifier': "darwin-${bitProperty}", 'library': "lib${base}.dylib", - 'setupArguments': ["-DBITZ:STRING=${bits}"], + 'setupArguments': ["${setupArg}${bits}"], 'buildArguments': [], 'env': ['CXXFLAGS': "-m${bits}", 'CFLAGS': "-m${bits}", 'LDFLAGS': "-m${bits}"] ] @@ -42,16 +61,16 @@ def getBuildParameters(base, bits) { return [ 'identifier': "linux-${bitSuffix}", 'library': "lib${base}.so", - 'setupArguments': ["-DBITZ:STRING=${bits}"], + 'setupArguments': ["${setupArg}${bits}"], 'buildArguments': [], - 'env': ['CXXFLAGS': "-m${bits}", 'CFLAGS': "-m${bits}", 'LDFLAGS': "-m${bits}"] + 'env': ['CXXFLAGS': "${mFlag}${bits}", 'CFLAGS': "${mFlag}${bits}", 'LDFLAGS': "${mFlag}${bits}"] ] } } def getHomeDirectory() { def directory = file(System.getProperty('java.home')) - return directory.name == 'jre' ? directory.parentFile.absolutePath : directory.absolutePath + return directory.name == 'jre' || directory.name == 'jdk' ? directory.parentFile.absolutePath : directory.absolutePath } def createBuildTask(tasksHolder, config, bits) { @@ -61,6 +80,7 @@ def createBuildTask(tasksHolder, config, bits) { def deployDirectory = "${config.deployBase}/src/main/resources/natives/${parameters.identifier}" def taskBase = "${config.name}-${bits}" + println(System.getProperty("os.arch")) if (Os.isFamily(Os.FAMILY_MAC) && bits != 64) { return } diff --git a/udp-queue-natives/build.gradle b/udp-queue-natives/build.gradle index 65ffffa..221ac59 100644 --- a/udp-queue-natives/build.gradle +++ b/udp-queue-natives/build.gradle @@ -11,4 +11,4 @@ def buildTaskConfig = [ ] createBuildTask(tasks, buildTaskConfig, 32) -createBuildTask(tasks, buildTaskConfig, 64) +createBuildTask(tasks, buildTaskConfig, 64) \ No newline at end of file