Skip to content

Commit

Permalink
macos universal
Browse files Browse the repository at this point in the history
  • Loading branch information
redrezo committed Jul 6, 2022
1 parent b26b87c commit 96f147f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 58 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 27,6 @@ jobs:
#architecture: arm64
- name: Checkout Repo
uses: actions/checkout@v2
- name: Build aarch64
if: matrix.os == 'macos-latest'
uses: eskatos/gradle-command-action@v1
with:
arguments: -i :org.eclipse.fx.drift.native:publish -Pforce-aarch64
- name: Move aarch64 binaries
if: matrix.os == 'macos-latest'
shell: bash
run: |
mv ./native-repo/org/eclipse/fx/drift/driftfx ./native-repo/org/eclipse/fx/drift/driftfx_aarch64
mv ./native-repo/org/eclipse/fx/drift/driftfx_debug_macos ./native-repo/org/eclipse/fx/drift/driftfx_debug_macos_aarch64
mv ./native-repo/org/eclipse/fx/drift/driftfx_release_macos ./native-repo/org/eclipse/fx/drift/driftfx_release_macos_aarch64
- name: Clean aarch64
if: matrix.os == 'macos-latest'
uses: eskatos/gradle-command-action@v1
with:
arguments: -i clean
- name: Build
uses: eskatos/gradle-command-action@v1
with:
Expand Down
8 changes: 1 addition & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 79,6 @@ def getJava11() {

subprojects.each { subproject -> evaluationDependsOn( subproject.path ) }

task copyNativesMacosAarch64(type: Copy) {
from "native-repo/org/eclipse/fx/drift/driftfx_release_macos_aarch64/$Versioning.fullVersion/driftfx_release_macos-${Versioning.fullVersion}.dylib"
into 'org.eclipse.fx.drift/src/main/resources/native'
rename { fileName -> fileName.replaceAll("driftfx_release_macos-.*[.]dylib", "libdriftfx_aarch64.dylib") }
}
task copyNativesMacos(type: Copy) {
from "native-repo/org/eclipse/fx/drift/driftfx_release_macos/$Versioning.fullVersion/driftfx_release_macos-${Versioning.fullVersion}.dylib"
into 'org.eclipse.fx.drift/src/main/resources/native'
Expand All @@ -104,7 99,6 @@ task copyNatives {
group = "DriftFX"
description = "Copies the available natives from ./native-repo to ./org.eclipse.fx.drift/src/main/resources/native/"
dependsOn = [
copyNativesMacosAarch64,
copyNativesMacos,
copyNativesWindows,
copyNativesLinux
Expand Down Expand Up @@ -145,7 139,7 @@ task buildMultireleaseJar(type: Jar, dependsOn: [
'Private-Package': 'org.eclipse.fx.drift.internal',
'Bundle-ActivationPolicy': 'lazy',
'Bundle-Activator': 'org.eclipse.fx.drift.internal.OSGiActivator',
'Bundle-NativeCode': 'native/driftfx.dll;osname=Win32;processor=x86-64,native/libdriftfx.so;osname=Linux;processor=x86-64,native/libdriftfx.dylib;osname=MacOSX;processor=x86-64,native/libdriftfx_aarch64.dylib;osname=MacOSX;processor=aarch64',
'Bundle-NativeCode': 'native/driftfx.dll;osname=Win32;processor=x86-64,native/libdriftfx.so;osname=Linux;processor=x86-64,native/libdriftfx.dylib;osname=MacOSX;processor=x86-64,native/libdriftfx.dylib;osname=MacOSX;processor=aarch64',
'Drift-Version': "$Versioning.version",
'Drift-Qualifier': "$Versioning.qualifier",
'Drift-Timestamp': "$Versioning.timestamp",
Expand Down
48 changes: 17 additions & 31 deletions org.eclipse.fx.drift.native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 19,29 @@ plugins {
group = 'org.eclipse.fx.drift'
version = Versioning.fullVersion

def isForceAarch64() {
project.hasProperty("force-aarch64")
}

model {
toolChains {
visualStudio(VisualCpp) {

}
gcc(Gcc) {

toolChains {
visualStudio(VisualCpp) {}
gcc(Gcc) {}
clang(Clang) {
eachPlatform {
cppCompiler.withArguments { args ->
args << '-arch'
args << 'x86_64'
args << '-arch'
args << 'arm64'
}
clang(Clang) {
eachPlatform {
cppCompiler.withArguments { args ->
if (isForceAarch64()) {
println("forcing aarch64")
args << "-arch"
args << "arm64"
println(" => compiler args: " args)
}
}
linker.withArguments { args ->
if (isForceAarch64()) {
println("forcing aarch64")
args << "-arch"
args << "arm64"
println(" => linker args: " args)
}
}
}
linker.withArguments { args ->
args << '-arch'
args << 'x86_64'
args << '-arch'
args << 'arm64'
}
}
}
}
}



library {

baseName = 'driftfx'
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.fx.drift/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 49,8 @@ dependencies {
}

compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
options.encoding = 'UTF-8'
options.fork = true
options.forkOptions.executable = getJava8()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 108,7 @@ private static String getFilename(String libname) {
return "lib" libname ".so";
}
if (isMacOs()) {
return "lib" libname ("aarch64".equals(getOsArch()) ? "_aarch64" : "") ".dylib";
return "lib" libname ".dylib";
}
throw new RuntimeException("os not supported: " getOsName());
}
Expand Down

0 comments on commit 96f147f

Please sign in to comment.