Skip to content

Commit

Permalink
reworked again
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Mar 9, 2024
1 parent 764d07e commit ed8ba11
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 54 deletions.
26 changes: 26 additions & 0 deletions arguments.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import org.gradle.api.InvalidUserDataException

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

if (release && debug) {
throw new InvalidUserDataException("Cannot be both release and debug project");
}

if(!release && !debug) {
ext {
arg = "RELEASE";
}
}

if(release) {
ext {
arg = "RELEASE";
}
}

if (debug) {
ext {
arg = "DEBUG";
}
}
44 changes: 8 additions & 36 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import org.gradle.api.InvalidUserDataException

plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2024.2.1"
id 'com.diffplug.spotless' version '6.20.0'
}

def debug = project.hasProperty("debug");
def release = project.hasProperty("release");
apply from: 'arguments.gradle'

//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.
Expand Down Expand Up @@ -71,22 +71,8 @@ model {
}

binaries.all {
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");
}

cppCompiler.define(arg);
cppCompiler.define("-O3");
lib project: ':wombat', library: 'Wombat', linkage: 'static'
}

Expand Down Expand Up @@ -115,22 +101,8 @@ model {
}

binaries.all {
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");
}

cppCompiler.define(arg);
cppCompiler.define("-O3");
lib project: ':wombat', library: 'Wombat', linkage: 'static'
}

Expand Down
21 changes: 3 additions & 18 deletions wombat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ 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");
apply from: '../arguments.gradle'

model {
components {
Expand All @@ -28,21 +26,8 @@ model {
}

binaries.all {
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");
}
cppCompiler.define(arg);
cppCompiler.define("-O3");

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

0 comments on commit ed8ba11

Please sign in to comment.