James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 1 | import org.gradle.internal.os.OperatingSystem |
| 2 | |
| 3 | if (project.hasProperty('onlylinuxathena')) { |
| 4 | return; |
| 5 | } |
| 6 | |
| 7 | description = "Process Starter" |
| 8 | |
| 9 | apply plugin: 'cpp' |
| 10 | apply plugin: 'objective-cpp' |
| 11 | apply plugin: 'visual-studio' |
| 12 | apply plugin: 'edu.wpi.first.NativeUtils' |
| 13 | |
| 14 | ext { |
| 15 | nativeName = 'processstarter' |
| 16 | } |
| 17 | |
| 18 | apply from: "${rootDir}/shared/config.gradle" |
| 19 | |
| 20 | // Replace shared crt with static crt. |
| 21 | // Note this means no wpilib binaries can be dependencies |
| 22 | nativeUtils.platformConfigs.named(nativeUtils.wpi.platforms.windowsx64).configure { |
| 23 | cppCompiler.debugArgs.remove('/MDd') |
| 24 | cppCompiler.debugArgs.add('/MTd') |
| 25 | cppCompiler.releaseArgs.remove('/MD') |
| 26 | cppCompiler.releaseArgs.add('/MT') |
| 27 | } |
| 28 | |
| 29 | project(':').libraryBuild.dependsOn build |
| 30 | |
| 31 | model { |
| 32 | components { |
| 33 | "${nativeName}"(NativeExecutableSpec) { |
| 34 | baseName = 'processstarter' |
| 35 | binaries.all { |
| 36 | if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { |
| 37 | it.buildable = false |
| 38 | return |
| 39 | } |
| 40 | if (it.targetPlatform.operatingSystem.isMacOsX()) { |
| 41 | it.sources { |
| 42 | macObjCpp(ObjectiveCppSourceSet) { |
| 43 | source { |
| 44 | srcDirs 'src/main/native/osx' |
| 45 | include '**/*.mm' |
| 46 | } |
| 47 | exportedHeaders { |
| 48 | srcDirs 'src/main/native/include' |
| 49 | include '**/*.h' |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } else if (it.targetPlatform.operatingSystem.isLinux()) { |
| 54 | it.sources { |
| 55 | linuxCpp(CppSourceSet) { |
| 56 | source { |
| 57 | srcDirs 'src/main/native/linux' |
| 58 | include '**/*.cpp' |
| 59 | } |
| 60 | exportedHeaders { |
| 61 | srcDirs 'src/main/native/include' |
| 62 | include '**/*.h' |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | } else if (it.targetPlatform.operatingSystem.isWindows()) { |
| 67 | it.sources { |
| 68 | windowsCpp(CppSourceSet) { |
| 69 | source { |
| 70 | srcDirs 'src/main/native/windows' |
| 71 | include '**/*.cpp' |
| 72 | } |
| 73 | exportedHeaders { |
| 74 | srcDirs 'src/main/native/include' |
| 75 | include '**/*.h' |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | apply from: 'publish.gradle' |