Skip to content

Commit

Permalink
* Introduce macosx-arm64 builds for libffi (issue #1182)
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed May 30, 2022
1 parent b0f6270 commit fff3415
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 78 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/libffi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
macosx-arm64:
runs-on: macos-10.15
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
macosx-x86_64:
runs-on: macos-10.15
steps:
Expand All @@ -73,7 +77,7 @@ jobs:
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
redeploy:
needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64]
needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-armhf, linux-arm64, linux-ppc64le, linux-x86, linux-x86_64, macosx-arm64, macosx-x86_64, windows-x86, windows-x86_64]
runs-on: ubuntu-18.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/redeploy@actions
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Include missing `opencv2/mcc/ccm.hpp` header file in presets for OpenCV ([discussion bytedeco/javacpp#568](https://github.com/bytedeco/javacpp/discussions/568))
* Fix a few incorrectly mapped instances of `std::unordered_map` for PyTorch ([issue #1164](https://github.com/bytedeco/javacpp-presets/issues/1164))
* Migrate builds for Leptonica and Tesseract to CMake ([issue #1163](https://github.com/bytedeco/javacpp-presets/issues/1163))
* Introduce `macosx-arm64` builds for Leptonica and Tesseract ([issue #814](https://github.com/bytedeco/javacpp-presets/issues/814))
* Introduce `macosx-arm64` builds for libffi ([issue #1182](https://github.com/bytedeco/javacpp-presets/issues/1182)), Leptonica, and Tesseract ([issue #814](https://github.com/bytedeco/javacpp-presets/issues/814))
* Map instances of `torch::OrderedDict` using C++ templates from PyTorch ([issue #623](https://github.com/bytedeco/javacpp-presets/issues/623))
* Add presets for Bullet Physics SDK 3.24 ([pull #1153](https://github.com/bytedeco/javacpp-presets/pull/1153))
* Add `long[] pytorch.Tensor.shape()` method for convenience ([pull #1161](https://github.com/bytedeco/javacpp-presets/pull/1161))
Expand Down
8 changes: 7 additions & 1 deletion libffi/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ case $PLATFORM in
make -j $MAKEJ
make install-strip
;;
macosx-*)
macosx-arm64)
sedinplace 's/\\\$rpath/@rpath/g' configure
CC="clang -arch arm64" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory --host="aarch64-apple-darwin"
make -j $MAKEJ
make install-strip
;;
macosx-x86_64)
sedinplace 's/\\\$rpath/@rpath/g' configure
CC="clang" ./configure --prefix="$INSTALL_PATH" --disable-multi-os-directory
make -j $MAKEJ
Expand Down
9 changes: 8 additions & 1 deletion libffi/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-ppc64le}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-arm64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand Down Expand Up @@ -114,7 +120,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-ppc64le.jar ${javacpp.moduleId}-macosx-arm64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -168,6 +174,7 @@
requires static org.bytedeco.${javacpp.moduleId}.linux.armhf;
requires static org.bytedeco.${javacpp.moduleId}.linux.arm64;
requires static org.bytedeco.${javacpp.moduleId}.linux.ppc64le;
requires static org.bytedeco.${javacpp.moduleId}.macosx.arm64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
2 changes: 1 addition & 1 deletion libffi/src/gen/java/org/bytedeco/libffi/ffi_cif.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
2 changes: 1 addition & 1 deletion libffi/src/gen/java/org/bytedeco/libffi/ffi_closure.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
50 changes: 0 additions & 50 deletions libffi/src/gen/java/org/bytedeco/libffi/ffi_go_closure.java

This file was deleted.

2 changes: 1 addition & 1 deletion libffi/src/gen/java/org/bytedeco/libffi/ffi_java_raw.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
2 changes: 1 addition & 1 deletion libffi/src/gen/java/org/bytedeco/libffi/ffi_raw.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
2 changes: 1 addition & 1 deletion libffi/src/gen/java/org/bytedeco/libffi/ffi_type.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi;

Expand Down
16 changes: 5 additions & 11 deletions libffi/src/gen/java/org/bytedeco/libffi/global/ffi.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Targeted by JavaCPP version 1.5.7: DO NOT EDIT THIS FILE
// Targeted by JavaCPP version 1.5.8-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.libffi.global;

Expand Down Expand Up @@ -451,19 +451,13 @@ public static native void ffi_raw_call(ffi_cif cif,
Fun_ffi_cif_Pointer_ffi_raw_Pointer fun,
Pointer user_data,
Pointer codeloc);
// Targeting ../ffi_go_closure.java


// #if !FFI_NATIVE_RAW_API
// #endif

public static native @Cast("ffi_status") int ffi_prep_go_closure(ffi_go_closure arg0, ffi_cif arg1,
Fun_ffi_cif_Pointer_PointerPointer_Pointer fun);
public static native @Cast("ffi_status") int ffi_prep_go_closure(ffi_go_closure arg0, ffi_cif arg1,
Fun_ffi_cif_Pointer_Pointer_Pointer fun);
// #endif /* FFI_CLOSURES */

public static native void ffi_call_go(ffi_cif cif, @Cast("void (*)(void)") Pointer fn, Pointer rvalue,
@Cast("void**") PointerPointer avalue, Pointer closure);
public static native void ffi_call_go(ffi_cif cif, @Cast("void (*)(void)") Pointer fn, Pointer rvalue,
@Cast("void**") @ByPtrPtr Pointer avalue, Pointer closure);
// #if FFI_GO_CLOSURES

// #endif /* FFI_GO_CLOSURES */

Expand Down
6 changes: 3 additions & 3 deletions libffi/src/main/java/org/bytedeco/libffi/presets/ffi.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Samuel Audet
* Copyright (C) 2021-2022 Samuel Audet
*
* Licensed either under the Apache License, Version 2.0, or (at your option)
* under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -61,14 +61,14 @@ public void map(InfoMap infoMap) {
infoMap.put(new Info("FFI_EXTRA_CIF_FIELDS", "FFI_NATIVE_RAW_API", "_CET_NOTRACK",
"FFI_LONG_LONG_MAX", "FFI_API", "FFI_EXTERN").cppTypes().annotations())
.put(new Info("defined (POWERPC64)", "LONG_LONG_MAX", "1").define(true))
.put(new Info("!FFI_NATIVE_RAW_API", "FFI_TARGET_HAS_COMPLEX_TYPE",
.put(new Info("FFI_GO_CLOSURES", "!FFI_NATIVE_RAW_API", "FFI_TARGET_HAS_COMPLEX_TYPE",
"defined(_WIN32)", "defined(X86_WIN32)", "defined(X86_WIN64)", "X86_WIN64",
"defined __x86_64__ && defined __ILP32__",
"defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))",
"defined(__ARM_PCS_VFP) || defined(_M_ARM)",
"defined(__ARM_PCS_VFP) || defined(_WIN32)",
"defined(POWERPC_DARWIN) || defined(POWERPC_AIX)",
"defined (POWERPC_AIX)", "defined (POWERPC_DARWIN)").define(false))
"defined (POWERPC_AIX)", "defined (POWERPC_DARWIN)").define(false).translate(true))
.put(new Info("FFI_TYPE_SMALL_STRUCT_1B", "FFI_TYPE_SMALL_STRUCT_2B",
"FFI_TYPE_SMALL_STRUCT_4B", "FFI_TYPE_MS_STRUCT", "FFI_TRAMPOLINE_SIZE",
"FFI_PPC_TYPE_LAST", "FFI_SIZEOF_ARG", "FFI_SIZEOF_JAVA_RAW").translate(false))
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,7 @@
<module>ffmpeg</module>
<module>openblas</module>
<module>llvm</module>
<module>libffi</module>
<module>leptonica</module>
<module>tesseract</module>
</modules>
Expand Down

0 comments on commit fff3415

Please sign in to comment.