mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Fixes for mac builds
Change-Id: I66dafd5e6d5ff10e7fb98cf718bb6f9343d03184
This commit is contained in:
@@ -65,11 +65,9 @@ model {
|
||||
} else {
|
||||
x86 {
|
||||
architecture 'x86'
|
||||
operatingSystem project.buildPlatform
|
||||
}
|
||||
x64 {
|
||||
architecture 'x86_64'
|
||||
operatingSystem project.buildPlatform
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,9 @@ model {
|
||||
platforms {
|
||||
x86 {
|
||||
architecture 'x86'
|
||||
operatingSystem OperatingSystem.current().getFamilyName()
|
||||
}
|
||||
x64 {
|
||||
architecture 'x86_64'
|
||||
operatingSystem OperatingSystem.current().getFamilyName()
|
||||
}
|
||||
}
|
||||
components {
|
||||
@@ -47,7 +45,8 @@ model {
|
||||
if (toolChain in VisualCpp) {
|
||||
cppCompiler.args '-D_UNICODE', '-DUNICODE', '-DWIN32', '-D_WIN32', '-DSTRICT', '-DWIN32_LEAN_AND_MEAN', '-D_HAS_EXCEPTIONS=1'
|
||||
} else {
|
||||
cppCompiler.args '-Wall', '-Wshadow', '-fexceptions', '-Wextra', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-lpthreads', '-fPIC'
|
||||
cppCompiler.args '-Wall', '-Wshadow', '-fexceptions', '-Wextra', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-fPIC'
|
||||
linker.args '-pthread'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,14 +96,17 @@ ext.setupJniIncludes = { binaries ->
|
||||
def jdkLocation = org.gradle.internal.jvm.Jvm.current().javaHome
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include", cppCompiler)
|
||||
|
||||
if (targetPlatform.operatingSystem.macOsX) {
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/darwin", cppCompiler)
|
||||
} else if (targetPlatform.operatingSystem.linux) {
|
||||
if (targetPlatform.operatingSystem.linux) {
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/linux", cppCompiler)
|
||||
} else if (targetPlatform.operatingSystem.windows) {
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/win32", cppCompiler)
|
||||
} else if (targetPlatform.operatingSystem.freeBSD) {
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/freebsd", cppCompiler)
|
||||
} else if (file("$jdkLocation/include/darwin").exists()) {
|
||||
// TODO: As of Gradle 2.8, targetPlatform.operatingSystem.macOsX returns false
|
||||
// on El Capitan. We therefore manually test for the darwin folder and include it
|
||||
// if it exists
|
||||
platformSpecificIncludeFlag("${jdkLocation}/include/darwin", cppCompiler)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ binaries.withType(GoogleTestTestSuiteBinarySpec) {
|
||||
} else {
|
||||
lib project: ':gmock', library: "gmock", linkage: "static"
|
||||
}
|
||||
if (targetPlatform.operatingSystem.linux) {
|
||||
if (targetPlatform.operatingSystem.windows) {
|
||||
cppCompiler.args '/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS'
|
||||
} else {
|
||||
cppCompiler.args '-pthread', '-std=c++1y'
|
||||
linker.args '-pthread'
|
||||
} else {
|
||||
cppCompiler.args '/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ model {
|
||||
target('x86') {
|
||||
cppCompiler.withArguments { args ->
|
||||
args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors'
|
||||
args << '-Wno-unused-parameter' << '-fPIC' << '-m32'
|
||||
args << '-Wno-unused-parameter' << '-fPIC' << '-m32' << '-Wno-missing-field-initializers'
|
||||
}
|
||||
linker.withArguments { args ->
|
||||
args << '-m32'
|
||||
@@ -13,7 +13,7 @@ model {
|
||||
target('x64') {
|
||||
cppCompiler.withArguments { args ->
|
||||
args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors'
|
||||
args << '-Wno-unused-parameter' << '-fPIC'
|
||||
args << '-Wno-unused-parameter' << '-fPIC' << '-Wno-missing-field-initializers'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,26 +32,21 @@ ext.releaseSetup = { releaseTask ->
|
||||
binaries.withType(SharedLibraryBinarySpec) { binary ->
|
||||
if (!project.hasProperty('debug')) {
|
||||
def library = binary.sharedLibraryFile.absolutePath
|
||||
def debugLibrary = binary.sharedLibraryFile.absolutePath + ".debug"
|
||||
if (project.tasks.findByName("firstObjcopy${binary.name}") == null) {
|
||||
def firstObjcopy = project.tasks.create("firstObjcopy${binary.name}", Exec) { task ->
|
||||
task.commandLine 'objcopy', '--only-keep-debug', library, debugLibrary
|
||||
if (project.tasks.findByName("strip${binary.name}") == null) {
|
||||
def dsymutil = project.tasks.create("dsymutil${binary.name}", Exec) { task ->
|
||||
task.commandLine 'dsymutil', library
|
||||
}
|
||||
def strip = project.tasks.create("strip${binary.name}", Exec) { task ->
|
||||
task.commandLine 'strip', '-g', library
|
||||
task.commandLine 'strip', '-S', library
|
||||
}
|
||||
def secondObjcopy = project.tasks.create("secondObjcopy${binary.name}", Exec) { task ->
|
||||
task.commandLine 'objcopy', "--add-gnu-debuglink=$debugLibrary", library
|
||||
}
|
||||
secondObjcopy.dependsOn strip
|
||||
strip.dependsOn firstObjcopy
|
||||
strip.dependsOn dsymutil
|
||||
binary.tasks.whenObjectAdded { task ->
|
||||
if (task.name.contains('link')) {
|
||||
firstObjcopy.dependsOn task
|
||||
dsymutil.dependsOn task
|
||||
}
|
||||
}
|
||||
}
|
||||
releaseTask.dependsOn project.tasks.getByName("secondObjcopy${binary.name}")
|
||||
releaseTask.dependsOn project.tasks.getByName("strip${binary.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user