Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress enum-enum conversion warning on Linux cross compilers #238

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ java {

allprojects {
group = "edu.wpi.first"
version = "2025.8.0"
version = "2025.9.0"

if (project.hasProperty('publishVersion')) {
version = project.publishVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ public static class DefaultArguments {

public final String unixSymbolArg = "-g";

// -Wdeprecated-enum-enum-conversion was introduced in GCC 11
public final List<String> linuxCrossCompilerArgs = List.of("-std=c++20", "-Wformat=2", "-pedantic",
"-Wno-psabi", "-Wno-unused-parameter", "-fPIC", "-pthread");
public final List<String> linuxCrossCompilerExtraArgs11 = List.of("-Wno-error=deprecated-enum-enum-conversion");
public final List<String> linuxCrossCompilerExtraArgs10 = List.of("-Wno-error=deprecated-declarations");
"-Wno-psabi", "-Wno-unused-parameter", "-Wno-error=deprecated-enum-enum-conversion", "-fPIC",
"-pthread");
public final List<String> linuxCrossCCompilerArgs = List.of("-Wformat=2", "-pedantic", "-Wno-psabi",
"-Wno-unused-parameter", "-fPIC", "-pthread");
public final List<String> linuxCrossLinkerArgs = List.of("-rdynamic", "-pthread", "-ldl", "-latomic", "-Wl,-rpath,'$ORIGIN'");
Expand Down Expand Up @@ -115,13 +113,8 @@ public static class Platforms {
private final Map<String, PlatformConfig> windowsPlatforms = new HashMap<>();
private final Map<String, PlatformConfig> unixPlatforms = new HashMap<>();

public void addLinuxCrossArgs(PlatformConfig platform, int gccMajor) {
public void addLinuxCrossArgs(PlatformConfig platform) {
platform.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerArgs);
if (gccMajor >= 11) {
platform.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerExtraArgs11);
} else {
platform.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerExtraArgs10);
}
platform.getcCompiler().getArgs().addAll(defaultArguments.linuxCrossCCompilerArgs);
platform.getLinker().getArgs().addAll(defaultArguments.linuxCrossLinkerArgs);
platform.getCppCompiler().getDebugArgs().addAll(defaultArguments.linuxCrossDebugCompilerArgs);
Expand Down Expand Up @@ -229,16 +222,16 @@ public WPINativeUtilsExtension(NativeUtilsExtension nativeExt, Project project)
unixPlatforms.put(platforms.systemcore, linuxsystemcore);

linuxathena.getPlatformPath().set("linux/athena");
addLinuxCrossArgs(linuxathena, 12);
addLinuxCrossArgs(linuxathena);

linuxsystemcore.getPlatformPath().set("linux/systemcore");
addLinuxCrossArgs(linuxsystemcore, 12);
addLinuxCrossArgs(linuxsystemcore);

linuxarm32.getPlatformPath().set("linux/arm32");
addLinuxCrossArgs(linuxarm32, 10);
addLinuxCrossArgs(linuxarm32);

linuxarm64.getPlatformPath().set("linux/arm64");
addLinuxCrossArgs(linuxarm64, 10);
addLinuxCrossArgs(linuxarm64);

windowsx86.getPlatformPath().set("windows/x86");
addWindowsArgs(windowsx86);
Expand All @@ -256,13 +249,6 @@ public WPINativeUtilsExtension(NativeUtilsExtension nativeExt, Project project)
addMacArgs(osxuniversal);
}

public void addGcc11CrossArgs(String platform) {
PlatformConfig config = unixPlatforms.get(platform);
if (config != null) {
config.getCppCompiler().getArgs().addAll(defaultArguments.linuxCrossCompilerExtraArgs11);
}
}

public void addMacMinimumVersionArg() {
PlatformConfig platform = unixPlatforms.get(platforms.osxuniversal);
platform.getcCompiler().getArgs().add(defaultArguments.macMinimumVersionArg);
Expand Down
2 changes: 1 addition & 1 deletion testing/cpp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import edu.wpi.first.nativeutils.vendordeps.WPIVendorDepsPlugin

plugins {
id "cpp"
id "edu.wpi.first.NativeUtils" version "2025.8.0"
id "edu.wpi.first.NativeUtils" version "2025.9.0"
}

nativeUtils.addWpiNativeUtils()
Expand Down
Loading