Skip to content

Commit

Permalink
reworked the way you pass args
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Mar 9, 2024
1 parent f64234d commit 8307048
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 56 deletions.
65 changes: 28 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import org.gradle.api.InvalidUserDataException

plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2024.2.1"
}

def debug = project.hasProperty("debug");
def release = project.hasProperty("release");

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project DeployUtils.
deploy {
Expand Down Expand Up @@ -65,27 +70,20 @@ model {
}

binaries.all {
if (!project.hasProperty("opt")) {
def opt;
if (opt == null) {
opt = "release"
}

if (!opt == "release") {
cppCompiler.define "DEBUG"
} else {
cppCompiler.define "RELEASE"
}
} else {
if (opt == null) {
opt = "release"
}

if (!opt == "release") {
cppCompiler.define "DEBUG"
} else {
cppCompiler.define "RELEASE"
}
if (release && debug) {
throw new InvalidUserDataException("Cannot be both release and debug project");
}

if(!release && !debug) {
cppCompiler.define("RELEASE");
}

if(release) {
cppCompiler.define("RELEASE");
}

if (debug) {
cppCompiler.define("DEBUG");
}

lib project: ':wombat', library: 'Wombat', linkage: 'static'
Expand Down Expand Up @@ -116,28 +114,21 @@ model {
}

binaries.all {
if (!project.hasProperty("opt")) {
def opt;
if (opt == null) {
opt = "release"
if (release && debug) {
throw new InvalidUserDataException("Cannot be both release and debug project");
}

if (!opt == "release") {
cppCompiler.define "DEBUG"
} else {
cppCompiler.define "RELEASE"
if(!release && !debug) {
cppCompiler.define("RELEASE");
}
} else {
if (opt == null) {
opt = "release"

if(release) {
cppCompiler.define("RELEASE");
}

if (!opt == "release") {
cppCompiler.define "DEBUG"
} else {
cppCompiler.define "RELEASE"
if (debug) {
cppCompiler.define("DEBUG");
}
}

lib project: ':wombat', library: 'Wombat', linkage: 'static'
}
Expand Down
35 changes: 16 additions & 19 deletions wombat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import edu.wpi.first.toolchain.NativePlatforms
import org.gradle.api.InvalidUserDataException

apply plugin: 'cpp'
apply plugin: 'google-test-test-suite'
apply plugin: 'edu.wpi.first.GradleRIO'

def debug = project.hasProperty("debug");
def release = project.hasProperty("release");

model {
components {
Wombat(NativeLibrarySpec) {
Expand All @@ -24,27 +28,20 @@ model {
}

binaries.all {
if (!project.hasProperty("opt")) {
def opt;
if (opt == null) {
opt = "release"
}
if (release && debug) {
throw new InvalidUserDataException("Cannot be both release and debug project");
}

if (!opt == "release") {
cppCompiler.define "DEBUG"
} else {
cppCompiler.define "RELEASE"
}
} else {
if (opt == null) {
opt = "release"
}
if(!release && !debug) {
cppCompiler.define("RELEASE");
}

if (!opt == "release") {
cppCompiler.define "DEBUG"
} else {
cppCompiler.define "RELEASE"
}
if(release) {
cppCompiler.define("RELEASE");
}

if (debug) {
cppCompiler.define("DEBUG");
}

if (it.targetPlatform.name == "linuxathena")
Expand Down

0 comments on commit 8307048

Please sign in to comment.