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

Document setting C++ compiler flags in GradleRIO #1151

Closed
calcmogul opened this issue Jan 25, 2021 · 2 comments
Closed

Document setting C++ compiler flags in GradleRIO #1151

calcmogul opened this issue Jan 25, 2021 · 2 comments

Comments

@calcmogul
Copy link
Member

Here's some examples from my team's build.gradle:

nativeUtils.platformConfigs.named("linuxathena").configure {
    it.cppCompiler.args.add('-Wall')
    it.cppCompiler.args.add('-Wextra')
    it.cppCompiler.args.add('-pedantic')
    it.cppCompiler.args.add('-Werror')
    it.cppCompiler.args.add('-Wno-unused-parameter')
    // Suppress warning from incorrect [[deprecated]] attribute usage in
    // CANSparkMax.h
    it.cppCompiler.args.add('-Wno-attributes')
}

if (OperatingSystem.current().isWindows()) {
    nativeUtils.platformConfigs.named(wpi.platforms.desktop).configure {
        it.cppCompiler.args.add('/W3')
        it.cppCompiler.args.add('/WX')
    }
} else {
    nativeUtils.platformConfigs.named(wpi.platforms.desktop).configure {
        it.cppCompiler.args.add('-Wall')
        it.cppCompiler.args.add('-Wextra')
        it.cppCompiler.args.add('-pedantic')
        it.cppCompiler.args.add('-Werror')
        it.cppCompiler.args.add('-Wno-unused-parameter')
    }
}

nativeUtils.platformConfigs.named("linuxx86-64").configure {
    it.linker.args.add('-lstdc++fs')
}

if (project.hasProperty("asan")) {
    nativeUtils.platformConfigs.named("linuxx86-64").configure {
        it.cppCompiler.args.add('-g3')
        it.cppCompiler.args.add('-fsanitize=address')
        it.linker.args.add('-fsanitize=address')
    }
}
@calcmogul calcmogul changed the title Document setting compiler flags in GradleRIO Document setting C++ compiler flags in GradleRIO Jan 25, 2021
@Daltz333
Copy link
Member

Not sure where to put this. Welcome to suggestions.

@sciencewhiz
Copy link
Collaborator

Fixed by #2393

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants