mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Fixed the Windows build. Also added ensuring that vs2012 is installed if
vs2015 is detecting, and printing an error that actually makes sense if it is not. Finally, added a .gitreview file, so that git-review will be able to autodetect the host and project for ntcore automatically. Change-Id: I3cb9910d03d4742619770c91c06e3d5d1ee0f031
This commit is contained in:
5
.gitreview
Normal file
5
.gitreview
Normal file
@@ -0,0 +1,5 @@
|
||||
[gerrit]
|
||||
host=usfirst.collab.net
|
||||
port=29418
|
||||
project=ntcore
|
||||
defaultbranch=master
|
||||
34
build.gradle
34
build.gradle
@@ -12,6 +12,14 @@ def armjdkVersion = 'jdk1.8.0_33'
|
||||
def armjdkLocation = System.getProperty("user.home") + File.separator + armjdkFolder + File.separator + armjdkVersion
|
||||
def generatedJNIHeaderLoc = 'build/include'
|
||||
|
||||
def platformSpecificIncludeFlag(loc, cppCompiler) {
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
cppCompiler.args "/I$loc"
|
||||
} else {
|
||||
cppCompiler.args '-I', loc
|
||||
}
|
||||
}
|
||||
|
||||
model {
|
||||
toolChains {
|
||||
gcc(Gcc) {
|
||||
@@ -74,7 +82,11 @@ model {
|
||||
// If vs2015 is installed, fall back to vs2013 for now, until Gradle pulls in the right
|
||||
// includes for the win10 sdk.
|
||||
if (vs14Dir.exists()) {
|
||||
installDir = file('C:\\Program Files (x86)\\Microsoft Visual Studio 12.0')
|
||||
def vs12Dir = file('C:\\Program Files (x86)\\Microsoft Visual Studio 12.0')
|
||||
if (!vs12Dir.exists()) {
|
||||
throw new GradleException('Compilation with VS 2015 is not currently supported by Gradle. Please install VS 2013, or use the CMake build option.')
|
||||
}
|
||||
installDir = vs12Dir
|
||||
}
|
||||
eachPlatform {
|
||||
cppCompiler.withArguments { args ->
|
||||
@@ -108,6 +120,8 @@ model {
|
||||
targetPlatform 'x64'
|
||||
binaries.all {
|
||||
tasks.withType(CppCompile) {
|
||||
|
||||
|
||||
if (!project.hasProperty('skipJava')) {
|
||||
if (targetPlatform == platforms.arm) {
|
||||
dependsOn verifyArmJre
|
||||
@@ -115,25 +129,31 @@ model {
|
||||
// JDK is included for jni.h. We also need the arm-linux specific headers.
|
||||
// This does not need to change when compiling on Windows
|
||||
// The JNI headers are put into the build/include directory by the jniHeaders task
|
||||
// There is also only the one cross compiler for the arm platform, so we directly set
|
||||
// the include flags here without using the helper function
|
||||
cppCompiler.args '-I', "${armjdkLocation}/include"
|
||||
cppCompiler.args '-I', "${armjdkLocation}/include/linux"
|
||||
} else {
|
||||
def jdkLocation = org.gradle.internal.jvm.Jvm.current().javaHome
|
||||
cppCompiler.args '-I', "${jdkLocation}/include"
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include", cppCompiler)
|
||||
|
||||
if (targetPlatform.operatingSystem.macOsX) {
|
||||
cppCompiler.args '-I', "${jdkLocation}/include/darwin"
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/darwin", cppCompiler)
|
||||
} else if (targetPlatform.operatingSystem.linux) {
|
||||
cppCompiler.args '-I', "${jdkLocation}/include/linux"
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/linux", cppCompiler)
|
||||
} else if (targetPlatform.operatingSystem.windows) {
|
||||
cppCompiler.args '-I', "${jdkLocation}/include/win32"
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/win32", cppCompiler)
|
||||
} else if (targetPlatform.operatingSystem.freeBSD) {
|
||||
cppCompiler.args '-I', "${jdkLocation}/include/freebsd"
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/freebsd", cppCompiler)
|
||||
}
|
||||
}
|
||||
|
||||
jniHeadersNetworkTables.outputs.files.each { file ->
|
||||
cppCompiler.args '-I', file.getPath()
|
||||
if (targetPlatform == platforms.arm) {
|
||||
cppCompiler.args '-I', file.getPath()
|
||||
} else {
|
||||
platformSpecificIncludeFlag(file.getPath(), cppCompiler)
|
||||
}
|
||||
}
|
||||
dependsOn jniHeadersNetworkTables
|
||||
}
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: 'visual-studio'
|
||||
|
||||
model {
|
||||
toolChains {
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
visualCpp(VisualCpp) {
|
||||
def vs14Dir = file('C:\\Program Files (x86)\\Microsoft Visual Studio 14.0')
|
||||
// If vs2015 is installed, fall back to vs2013 for now, until Gradle pulls in the right
|
||||
// includes for the win10 sdk.
|
||||
if (vs14Dir.exists()) {
|
||||
def vs12Dir = file('C:\\Program Files (x86)\\Microsoft Visual Studio 12.0')
|
||||
if (!vs12Dir.exists()) {
|
||||
throw new GradleException('Compilation with VS 2015 is not currently supported by Gradle. Please install VS 2013, or use the CMake build option.')
|
||||
}
|
||||
installDir = vs12Dir
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
components {
|
||||
gmock(NativeLibrarySpec) {
|
||||
sources {
|
||||
|
||||
@@ -1,8 +1,25 @@
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: 'google-test'
|
||||
apply plugin: 'visual-studio'
|
||||
|
||||
model {
|
||||
toolChains {
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
visualCpp(VisualCpp) {
|
||||
def vs14Dir = file('C:\\Program Files (x86)\\Microsoft Visual Studio 14.0')
|
||||
// If vs2015 is installed, fall back to vs2013 for now, until Gradle pulls in the right
|
||||
// includes for the win10 sdk.
|
||||
if (vs14Dir.exists()) {
|
||||
def vs12Dir = file('C:\\Program Files (x86)\\Microsoft Visual Studio 12.0')
|
||||
if (!vs12Dir.exists()) {
|
||||
throw new GradleException('Compilation with VS 2015 is not currently supported by Gradle. Please install VS 2013, or use the CMake build option.')
|
||||
}
|
||||
installDir = vs12Dir
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
components {
|
||||
tests(NativeLibrarySpec) {
|
||||
sources {
|
||||
|
||||
Reference in New Issue
Block a user