Add OpenBSD support for x86_64 and arm_64.

This commit is contained in:
Kurt Miller
2026-02-16 19:17:42 -05:00
committed by Ryan Kurtz
parent 5ccd4d7e31
commit e02b069461
12 changed files with 108 additions and 6 deletions

View File

@@ -84,6 +84,8 @@ model {
targetPlatform "mac_arm_64"
targetPlatform "freebsd_x86_64"
targetPlatform "freebsd_arm_64"
targetPlatform "openbsd_x86_64"
targetPlatform "openbsd_arm_64"
sources {
c {
source {
@@ -108,6 +110,8 @@ model {
targetPlatform "mac_arm_64"
targetPlatform "freebsd_x86_64"
targetPlatform "freebsd_arm_64"
targetPlatform "openbsd_x86_64"
targetPlatform "openbsd_arm_64"
sources {
c {
source {

View File

@@ -49,6 +49,10 @@ model {
gcc(Gcc).target(current)
clang(Clang).target(current)
}
if (isOpenBSD(current)) {
gcc(Gcc).target(current)
clang(Clang).target(current)
}
if (isWindows(current) && VISUAL_STUDIO_INSTALL_DIR) {
// https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288
visualCpp(VisualCpp) {

View File

@@ -27,7 +27,9 @@ project.ext.PLATFORMS = [
[name: "mac_x86_64", os: "osx", arch: "x86_64"],
[name: "mac_arm_64", os: "osx", arch: "arm64"],
[name: "freebsd_x86_64", os: "freebsd", arch: "x86_64"],
[name: "freebsd_arm_64", os: "freebsd", arch: "arm64"]
[name: "freebsd_arm_64", os: "freebsd", arch: "arm64"],
[name: "openbsd_x86_64", os: "openbsd", arch: "x86_64"],
[name: "openbsd_arm_64", os: "openbsd", arch: "arm64"]
]
/*********************************************************************************
@@ -57,6 +59,9 @@ ext.getCurrentPlatformName = {
case ~/FreeBSD.*/:
os = "freebsd"
break
case ~/OpenBSD.*/:
os = "openbsd"
break
default:
throw new GradleException("Unrecognized platform operating system: $os")
}
@@ -132,6 +137,20 @@ ext.isCurrentFreeBSD = {
return isFreeBSD(getCurrentPlatformName())
}
/*********************************************************************************
* Returns true if the given platform is OpenBSD.
*********************************************************************************/
ext.isOpenBSD = { platform_name ->
return platform_name.startsWith("openbsd")
}
/*********************************************************************************
* Returns true if the current platform is OpenBSD.
*********************************************************************************/
ext.isCurrentOpenBSD = {
return isOpenBSD(getCurrentPlatformName())
}
/*********************************************************************************
* Returns true if the given platform is Windows.
*********************************************************************************/