| defineWpiUtilProperties() |
| if (wpiDeps == "wpi-dependencies-2018.gradle"){defineNIProperties()} |
| defineHALProperties() |
| defineNetworkTablesProperties() |
| defineWpiLibProperties() |
| //defineCsCoreProperties() |
| |
| def cppSetupModel = { project -> |
| project.model { |
| components { |
| CTRE_Phoenix(NativeLibrarySpec) { |
| targetPlatform 'arm' |
| setupDefines(project, binaries) |
| |
| binaries.all { |
| tasks.withType(CppCompile) { |
| cppCompiler.args << "-DNAMESPACED_WPILIB" << "-Werror" << "-Wall" |
| addUserLinks(linker, targetPlatform, false) |
| addHalLibraryLinks(it, linker, targetPlatform) |
| addWpiUtilLibraryLinks(it, linker, targetPlatform) |
| addNetworkTablesLibraryLinks(it, linker, targetPlatform) |
| addWpilibLibraryLinks(it, linker, targetPlatform) |
| // addCsCoreLibraryLinks(it, linker, targetPlatform) |
| if (wpiDeps == "wpi-dependencies-2018.gradle"){addNILibraryLinks(it, linker, targetPlatform)} |
| } |
| } |
| |
| sources { |
| cpp { |
| source { |
| srcDirs = [cppSrc, cppLibrarySrc] |
| includes = ["**/*.cpp"] |
| } |
| exportedHeaders { |
| srcDirs = [cppInclude, driverLibraryInclude, cppLibraryInclude, wpilibInclude, halInclude, wpiUtilInclude, netTablesInclude, NIInclude] |
| includes = ['**/*.h'] |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| ext.mergeStaticSetup = { pjt -> |
| if (combineStaticLibs) { |
| pjt.tasks.whenObjectAdded { task -> |
| def name = task.name.toLowerCase() |
| if (name.contains('create') && name.contains('staticlibrary')) { |
| def libraryPath = task.outputFile.parent |
| def library = file(task.outputFile.absolutePath) |
| project(':arm:driver').model { |
| binaries { |
| withType(StaticLibraryBinarySpec) { binary -> |
| ext.driverLibrary = new File(binary.staticLibraryFile.absolutePath) |
| } |
| } |
| } |
| task.doLast { |
| library.renameTo(file("${library}.m")) |
| copy { |
| from driverLibrary |
| into libraryPath |
| } |
| |
| ByteArrayOutputStream mriFile = new ByteArrayOutputStream() |
| mriFile << "create lib${libraryName}.a\n" |
| mriFile << "addlib lib${libraryName}.a.m\n" |
| mriFile << "addlib lib${libraryName}Driver.a\n" |
| mriFile << "save\n" |
| mriFile << "end\n" |
| |
| def stdIn = new ByteArrayInputStream(mriFile.buf) |
| |
| exec { |
| standardInput = stdIn |
| workingDir = libraryPath |
| commandLine "${compilerPrefixToUse}ar", '-M' |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| project(':arm:cpp') { |
| apply plugin: 'cpp' |
| |
| apply from: "${rootDir}/toolchains/arm.gradle" |
| |
| apply from: "${rootDir}/java/java.gradle" |
| |
| cppSetupModel(project) |
| |
| project.debugStripSetup() |
| mergeStaticSetup(project) |
| } |