From 0e4d4f52a1b6cf0319b54038838c5ffcbf1c77d5 Mon Sep 17 00:00:00 2001 From: Adam Sotona Date: Thu, 8 Dec 2022 12:11:54 +0100 Subject: [PATCH] #15 JNBullet does not have Mac aarch64 target --- README.md | 2 ++ build.gradle | 4 ++-- gradle.properties | 2 +- .../gdx/physics/bullet/NativeSupport.java | 5 +++- toolchains/macosx_aarch64_clang.cmake | 24 +++++++++++++++++++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 toolchains/macosx_aarch64_clang.cmake diff --git a/README.md b/README.md index db42f5f99..dce609305 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ TeraBullet is a version of bullet with extensions for direct interactions for vo - linux_windows_amd64_mingw32.cmake - linux_windows_i686_mingw32.cmake - macosx_amd64_clang.cmake + - macosx_aarch64_clang.cmake - windows_amd64_msvc.cmake - windows_i386_msvc.cmake @@ -77,6 +78,7 @@ To build the java portion of bullet, simply run `./gradlew build` * mac - i686 - amd64 + - aarch64 ### System prerequisites diff --git a/build.gradle b/build.gradle index 331458480..364f6c8d2 100644 --- a/build.gradle +++ b/build.gradle @@ -6,14 +6,14 @@ plugins { import org.apache.tools.ant.taskdefs.condition.Os ext { if(Os.isFamily(Os.FAMILY_MAC)) { - natives = ["macosx_amd64_clang"] + natives = ["macosx_amd64_clang","macosx_aarch64_clang"] } else if (Os.isFamily(Os.FAMILY_UNIX)) { natives = ["linux_amd64_gcc","linux_i686_gcc","linux_windows_amd64_mingw32","linux_windows_i686_mingw32"] } else { throw new GradleException("This script only works on Linux or Mac") } - allNatives = ["linux_amd64_gcc","linux_i686_gcc","linux_windows_amd64_mingw32","linux_windows_i686_mingw32","macosx_amd64_clang"] + allNatives = ["linux_amd64_gcc","linux_i686_gcc","linux_windows_amd64_mingw32","linux_windows_i686_mingw32","macosx_amd64_clang","macosx_aarch64_clang"] generatedSrcDir = 'src/generated/java' } diff --git a/gradle.properties b/gradle.properties index 46a11792e..ec233e8b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=1.0.3-SNAPSHOT +version=1.0.4-SNAPSHOT diff --git a/src/main/java/com/badlogic/gdx/physics/bullet/NativeSupport.java b/src/main/java/com/badlogic/gdx/physics/bullet/NativeSupport.java index c150aa540..56e55618c 100644 --- a/src/main/java/com/badlogic/gdx/physics/bullet/NativeSupport.java +++ b/src/main/java/com/badlogic/gdx/physics/bullet/NativeSupport.java @@ -53,6 +53,7 @@ public final class NativeSupport { static boolean isWindows = System.getProperty("os.name").toLowerCase().contains("win"); static boolean isMacOS = System.getProperty("os.name").toLowerCase().contains("mac"); static boolean is64 = System.getProperty("os.arch").endsWith("64"); + static boolean isArm = System.getProperty("os.arch").endsWith("aarch64"); private static final Pattern PATH_SEPARATOR = Pattern.compile(File.pathSeparator); @@ -80,7 +81,9 @@ public static void load(String name) { target += "linux-"; } - if (is64) { + if (isArm) { + target += "aarch64"; + } else if (is64) { // Assume x86_64 target += "amd64"; } else { diff --git a/toolchains/macosx_aarch64_clang.cmake b/toolchains/macosx_aarch64_clang.cmake new file mode 100644 index 000000000..29aa387ae --- /dev/null +++ b/toolchains/macosx_aarch64_clang.cmake @@ -0,0 +1,24 @@ +# Copyright 2015, alex at staticlibs.net +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required ( VERSION 2.8.12 ) + +# default to Debug +set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" ) + +set ( CMAKE_SYSTEM_NAME Darwin ) +set ( CMAKE_SYSTEM_ARCH aarch64) + +set ( CMAKE_C_COMPILER clang ) +set ( CMAKE_CXX_COMPILER clang++ )