diff --git a/build.gradle b/build.gradle index 7405f35ff3..68cc86d034 100644 --- a/build.gradle +++ b/build.gradle @@ -65,11 +65,9 @@ model { } else { x86 { architecture 'x86' - operatingSystem project.buildPlatform } x64 { architecture 'x86_64' - operatingSystem project.buildPlatform } } } diff --git a/gmock/build.gradle b/gmock/build.gradle index 4bcebfa153..65364868b1 100644 --- a/gmock/build.gradle +++ b/gmock/build.gradle @@ -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' } } } diff --git a/java/java.gradle b/java/java.gradle index 28f94041dd..34bf610ca3 100644 --- a/java/java.gradle +++ b/java/java.gradle @@ -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) } } diff --git a/test/tests.gradle b/test/tests.gradle index a830965143..fcedcbfc2d 100644 --- a/test/tests.gradle +++ b/test/tests.gradle @@ -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' } } diff --git a/toolchains/mac.gradle b/toolchains/mac.gradle index 9515609c94..ae1c822ff0 100644 --- a/toolchains/mac.gradle +++ b/toolchains/mac.gradle @@ -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}") } } }