Update build setup for raspbian and debug binaries (#1384)

- Build both debug and release binaries
- Append "d" to debug libraries in the style of opencv
- Split shared and static classifiers
- Add raspbian support
This commit is contained in:
Thad House
2018-10-27 00:19:38 -07:00
committed by Peter Johnson
parent 8ff81f5a2a
commit a8aacd3657
41 changed files with 565 additions and 343 deletions

View File

@@ -7,6 +7,8 @@ resources:
containers:
- container: wpilib2019
image: wpilib/roborio-cross-ubuntu:2019-18.04
- container: raspbian
image: wpilib/raspbian-cross-ubuntu:18.04
jobs:
- job: Linux_Arm
@@ -28,6 +30,25 @@ jobs:
# checkStyleRunAnalysis: true
# pmdRunAnalysis: true
- job: Linux_Raspbian
pool:
vmImage: 'Ubuntu 16.04'
container: raspbian
steps:
- task: Gradle@2
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'build'
options: '-PonlyRaspbian'
# checkStyleRunAnalysis: true
# pmdRunAnalysis: true
- job: Linux
pool:
vmImage: 'Ubuntu 16.04'

View File

@@ -1,9 +1,9 @@
plugins {
id 'base'
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '2.2'
id 'edu.wpi.first.NativeUtils' version '1.7.7'
id 'edu.wpi.first.GradleJni' version '0.3.0'
id 'edu.wpi.first.GradleVsCode' version '0.4.2'
id 'edu.wpi.first.NativeUtils' version '2.0.1'
id 'edu.wpi.first.GradleJni' version '0.3.1'
id 'edu.wpi.first.GradleVsCode' version '0.6.1'
id 'idea'
id 'com.gradle.build-scan' version '1.15.1'
id 'net.ltgt.errorprone' version '0.6' apply false
@@ -77,6 +77,12 @@ subprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
def subproj = it
plugins.withType(NativeComponentPlugin) {
subproj.apply plugin: MultiBuilds
}
apply from: "${rootDir}/shared/java/javastyle.gradle"
repositories {

View File

@@ -0,0 +1,95 @@
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import org.gradle.model.Mutate;
import org.gradle.nativeplatform.test.googletest.GoogleTestTestSuiteBinarySpec;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
import org.gradle.nativeplatform.NativeExecutableBinarySpec
import org.gradle.nativeplatform.NativeBinarySpec;
import org.gradle.nativeplatform.NativeComponentSpec;
import org.gradle.nativeplatform.NativeLibrarySpec;
import org.gradle.nativeplatform.SharedLibraryBinarySpec;
import org.gradle.nativeplatform.StaticLibraryBinarySpec;
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.NativeToolChain;
import org.gradle.nativeplatform.toolchain.NativeToolChainRegistry;
import org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider;
import org.gradle.nativeplatform.toolchain.internal.ToolType;
import org.gradle.nativeplatform.toolchain.internal.gcc.AbstractGccCompatibleToolChain;
import org.gradle.nativeplatform.toolchain.internal.msvcpp.VisualCppToolChain;
import org.gradle.nativeplatform.toolchain.internal.tools.ToolRegistry;
import org.gradle.platform.base.BinarySpec;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentType;
import org.gradle.platform.base.TypeBuilder;
import org.gradle.nativeplatform.tasks.ObjectFilesToBinary;
import groovy.transform.CompileStatic;
import groovy.transform.CompileDynamic
import org.gradle.nativeplatform.BuildTypeContainer
@CompileStatic
class MultiBuilds implements Plugin<Project> {
@CompileStatic
public void apply(Project project) {
}
@CompileStatic
static class Rules extends RuleSource {
@Mutate
void setupBuildTypes(BuildTypeContainer buildTypes, ProjectLayout projectLayout) {
def project = (Project) projectLayout.projectIdentifier
if (project.hasProperty('releaseBuild')) {
buildTypes.create('debug')
} else {
buildTypes.create('release')
}
}
@CompileDynamic
private static void setBuildableFalseDynamically(NativeBinarySpec binary) {
binary.buildable = false
}
@Mutate
@CompileStatic
void disableReleaseGoogleTest(BinaryContainer binaries, ProjectLayout projectLayout) {
def project = (Project) projectLayout.projectIdentifier
if (project.hasProperty('testRelease')) {
return
}
binaries.withType(GoogleTestTestSuiteBinarySpec) { oSpec ->
GoogleTestTestSuiteBinarySpec spec = (GoogleTestTestSuiteBinarySpec) oSpec
if (spec.buildType.name == 'release') {
Rules.setBuildableFalseDynamically(spec)
}
}
// def crossCompileConfigs = []
// for (BuildConfig config : configs) {
// if (!BuildConfigRulesBase.isCrossCompile(config)) {
// continue
// }
// crossCompileConfigs << config.architecture
// }
// if (!crossCompileConfigs.empty) {
// binaries.withType(GoogleTestTestSuiteBinarySpec) { oSpec ->
// GoogleTestTestSuiteBinarySpec spec = (GoogleTestTestSuiteBinarySpec) oSpec
// if (crossCompileConfigs.contains(spec.targetPlatform.architecture.name)) {
// setBuildableFalseDynamically(spec)
// }
// }
// }
}
}
}

View File

@@ -62,7 +62,7 @@ class SingleNativeBuild implements Plugin<Project> {
components.each { component ->
if (component.name == "${nativeName}Base") {
base = (NativeLibrarySpec) component
} else if (component.name == "${nativeName}" || component.name == "${nativeName}JNI") {
} else if (component.name == "${nativeName}") {
subs << component
}
}
@@ -79,7 +79,8 @@ class SingleNativeBuild implements Plugin<Project> {
}
def tmpBaseBin = (NativeBinarySpec) oTmpBaseBin
if (tmpBaseBin.targetPlatform.operatingSystem.name == binary.targetPlatform.operatingSystem.name &&
tmpBaseBin.targetPlatform.architecture.name == binary.targetPlatform.architecture.name) {
tmpBaseBin.targetPlatform.architecture.name == binary.targetPlatform.architecture.name &&
tmpBaseBin.buildType == binary.buildType) {
baseBin = tmpBaseBin
}
}

View File

@@ -28,6 +28,7 @@ endif()
file(GLOB_RECURSE
cameraserver_native_src src/main/native/cpp/*.cpp)
add_library(cameraserver ${cameraserver_native_src})
set_target_properties(cameraserver PROPERTIES DEBUG_POSTFIX "d")
target_include_directories(cameraserver PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/cameraserver>)

View File

@@ -4,6 +4,57 @@ include(SubDirList)
find_package( OpenCV REQUIRED )
file(GLOB
cscore_native_src src/main/native/cpp/*.cpp)
file(GLOB cscore_linux_src src/main/native/linux/*.cpp)
file(GLOB cscore_osx_src src/main/native/osx/*.cpp)
file(GLOB cscore_windows_src src/main/native/windows/*.cpp)
add_library(cscore ${cscore_native_src})
set_target_properties(cscore PROPERTIES DEBUG_POSTFIX "d")
if(NOT MSVC)
if (APPLE)
target_sources(cscore PRIVATE ${cscore_osx_src})
else()
target_sources(cscore PRIVATE ${cscore_linux_src})
endif()
target_compile_options(cscore PRIVATE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE)
else()
target_sources(cscore PRIVATE ${cscore_windows_src})
target_compile_options(cscore PUBLIC -DNOMINMAX)
target_compile_options(cscore PRIVATE -D_CRT_SECURE_NO_WARNINGS)
endif()
target_include_directories(cscore PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/cscore>)
target_include_directories(cscore PRIVATE src/main/native/cpp)
target_link_libraries(cscore PUBLIC wpiutil ${OpenCV_LIBS})
set_property(TARGET cscore PROPERTY FOLDER "libraries")
install(TARGETS cscore EXPORT cscore DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/cscore")
if (MSVC)
set (cscore_config_dir ${wpilib_dest})
else()
set (cscore_config_dir share/cscore)
endif()
install(FILES cscore-config.cmake DESTINATION ${cscore_config_dir})
install(EXPORT cscore DESTINATION ${cscore_config_dir})
SUBDIR_LIST(cscore_examples "${CMAKE_CURRENT_SOURCE_DIR}/examples")
foreach(example ${cscore_examples})
file(GLOB cscore_example_src examples/${example}/*.cpp)
if(cscore_example_src)
add_executable(cscore_${example} ${cscore_example_src})
target_link_libraries(cscore_${example} cscore)
endif()
endforeach()
# Java bindings
if (NOT WITHOUT_JAVA)
find_package(Java REQUIRED)
@@ -50,68 +101,23 @@ if (NOT WITHOUT_JAVA)
set_property(TARGET cscore_jar PROPERTY FOLDER "java")
endif()
add_library(cscorejni ${cscore_jni_src})
target_link_libraries(cscorejni PUBLIC cscore wpiutil ${OpenCV_LIBS})
file(GLOB
cscore_native_src src/main/native/cpp/*.cpp)
file(GLOB cscore_linux_src src/main/native/linux/*.cpp)
file(GLOB cscore_osx_src src/main/native/osx/*.cpp)
file(GLOB cscore_windows_src src/main/native/windows/*.cpp)
set_property(TARGET cscorejni PROPERTY FOLDER "libraries")
add_library(cscore ${cscore_native_src} ${cscore_jni_src})
if(NOT MSVC)
if (APPLE)
target_sources(cscore PRIVATE ${cscore_osx_src})
else()
target_sources(cscore PRIVATE ${cscore_linux_src})
endif()
target_compile_options(cscore PRIVATE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE)
else()
target_sources(cscore PRIVATE ${cscore_windows_src})
target_compile_options(cscore PUBLIC -DNOMINMAX)
target_compile_options(cscore PRIVATE -D_CRT_SECURE_NO_WARNINGS)
endif()
target_include_directories(cscore PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/cscore>)
target_include_directories(cscore PRIVATE src/main/native/cpp)
target_link_libraries(cscore PUBLIC wpiutil ${OpenCV_LIBS})
set_property(TARGET cscore PROPERTY FOLDER "libraries")
if (NOT WITHOUT_JAVA)
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
target_include_directories(cscore PRIVATE ${JNI_INCLUDE_DIRS})
target_include_directories(cscore PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/jniheaders")
target_include_directories(cscorejni PRIVATE ${JNI_INCLUDE_DIRS})
target_include_directories(cscorejni PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/jniheaders")
else()
target_link_libraries(cscore PRIVATE cscore_jni_headers)
target_link_libraries(cscorejni PRIVATE cscore_jni_headers)
endif()
add_dependencies(cscore cscore_jar)
endif()
add_dependencies(cscorejni cscore_jar)
install(TARGETS cscore EXPORT cscore DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/cscore")
if (NOT WITHOUT_JAVA AND MSVC)
install(TARGETS cscore RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
if (MSVC)
set (cscore_config_dir ${wpilib_dest})
else()
set (cscore_config_dir share/cscore)
endif()
install(FILES cscore-config.cmake DESTINATION ${cscore_config_dir})
install(EXPORT cscore DESTINATION ${cscore_config_dir})
SUBDIR_LIST(cscore_examples "${CMAKE_CURRENT_SOURCE_DIR}/examples")
foreach(example ${cscore_examples})
file(GLOB cscore_example_src examples/${example}/*.cpp)
if(cscore_example_src)
add_executable(cscore_${example} ${cscore_example_src})
target_link_libraries(cscore_${example} cscore)
if (MSVC)
install(TARGETS cscorejni RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
endforeach()
install(TARGETS cscorejni EXPORT cscorejni DESTINATION "${main_lib_dest}")
endif()

View File

@@ -102,30 +102,11 @@ model {
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure']
}
cscoreJNI(ExportsConfig) {
x86SymbolFilter = { symbols ->
def retList = []
symbols.each { symbol ->
if (symbol.startsWith('CS_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
x64SymbolFilter = { symbols ->
def retList = []
symbols.each { symbol ->
if (symbol.startsWith('CS_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
}
}
components {
examplesMap.each { key, value ->
"${key}"(NativeExecutableSpec) {
targetBuildTypes 'debug'
binaries.all {
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib library: 'cscore', linkage: 'shared'

View File

@@ -24,7 +24,7 @@ public class CameraServerJNI {
static {
if (!libraryLoaded) {
try {
loader = new RuntimeLoader<>("cscore", RuntimeLoader.getDefaultExtractionRoot(), CameraServerJNI.class);
loader = new RuntimeLoader<>("cscorejni", RuntimeLoader.getDefaultExtractionRoot(), CameraServerJNI.class);
loader.loadLibrary();
} catch (IOException ex) {
ex.printStackTrace();

View File

@@ -22,6 +22,47 @@ endforeach()
string(REPLACE ";" "\n" usage_reporting_types_cpp "${usage_reporting_types_cpp}")
string(REPLACE ";" "\n" usage_reporting_instances_cpp "${usage_reporting_instances_cpp}")
file(GLOB
hal_shared_native_src src/main/native/cpp/cpp/*.cpp
hal_shared_native_src src/main/native/cpp/handles/*.cpp
hal_sim_native_src src/main/native/sim/*.cpp
hal_sim_native_src src/main/native/sim/MockData/*.cpp)
add_library(hal ${hal_shared_native_src})
set_target_properties(hal PROPERTIES DEBUG_POSTFIX "d")
if(USE_EXTERNAL_HAL)
include(${EXTERNAL_HAL_FILE})
else()
target_sources(hal PRIVATE ${hal_sim_native_src} ${hal_sim_jni_src})
endif()
configure_file(src/generate/FRCUsageReporting.h.in gen/hal/FRCUsageReporting.h)
set_target_properties(hal PROPERTIES OUTPUT_NAME "wpiHal")
target_include_directories(hal PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/hal>)
target_include_directories(hal PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/gen>
$<INSTALL_INTERFACE:${include_dest}/hal>)
target_link_libraries(hal PUBLIC wpiutil)
set_property(TARGET hal PROPERTY FOLDER "libraries")
install(TARGETS hal EXPORT hal DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/hal")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen DESTINATION "${include_dest}/hal")
if (MSVC)
set (hal_config_dir ${wpilib_dest})
else()
set (hal_config_dir share/hal)
endif()
install(FILES hal-config.cmake DESTINATION ${hal_config_dir})
install(EXPORT hal DESTINATION ${hal_config_dir})
# Java bindings
if (NOT WITHOUT_JAVA)
@@ -53,59 +94,32 @@ if (NOT WITHOUT_JAVA)
set_property(TARGET hal_jar PROPERTY FOLDER "java")
endif()
add_library(haljni ${hal_shared_jni_src})
file(GLOB
hal_shared_native_src src/main/native/cpp/cpp/*.cpp
hal_shared_native_src src/main/native/cpp/handles/*.cpp
hal_sim_native_src src/main/native/sim/*.cpp
hal_sim_native_src src/main/native/sim/MockData/*.cpp)
add_library(hal ${hal_shared_native_src} ${hal_shared_jni_src})
if(USE_EXTERNAL_HAL)
include(${EXTERNAL_HAL_FILE})
else()
target_sources(hal PRIVATE ${hal_sim_native_src} ${hal_sim_jni_src})
endif()
configure_file(src/generate/FRCUsageReporting.h.in gen/hal/FRCUsageReporting.h)
set_target_properties(hal PROPERTIES OUTPUT_NAME "wpiHal")
target_include_directories(hal PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/hal>)
target_include_directories(hal PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/gen>
$<INSTALL_INTERFACE:${include_dest}/hal>)
target_link_libraries(hal PUBLIC wpiutil)
set_property(TARGET hal PROPERTY FOLDER "libraries")
if (NOT WITHOUT_JAVA)
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
target_include_directories(hal PRIVATE ${JNI_INCLUDE_DIRS})
target_include_directories(hal PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/jniheaders")
if(USE_EXTERNAL_HAL)
include(${EXTERNAL_HAL_FILE})
else()
target_link_libraries(hal PRIVATE hal_jni_headers)
target_sources(haljni PRIVATE ${hal_sim_jni_src})
endif()
add_dependencies(hal hal_jar)
set_target_properties(haljni PROPERTIES OUTPUT_NAME "wpiHaljni")
target_link_libraries(haljni PUBLIC hal wpiutil)
set_property(TARGET haljni PROPERTY FOLDER "libraries")
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
target_include_directories(haljni PRIVATE ${JNI_INCLUDE_DIRS})
target_include_directories(haljni PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/jniheaders")
else()
target_link_libraries(haljni PRIVATE hal_jni_headers)
endif()
add_dependencies(haljni hal_jar)
if (MSVC)
install(TARGETS haljni RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
install(TARGETS haljni EXPORT haljni DESTINATION "${main_lib_dest}")
endif()
install(TARGETS hal EXPORT hal DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/hal")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen DESTINATION "${include_dest}/hal")
if (NOT WITHOUT_JAVA AND MSVC)
install(TARGETS hal RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
if (MSVC)
set (hal_config_dir ${wpilib_dest})
else()
set (hal_config_dir share/hal)
endif()
install(FILES hal-config.cmake DESTINATION ${hal_config_dir})
install(EXPORT hal DESTINATION ${hal_config_dir})

View File

@@ -51,11 +51,50 @@ ext {
binary.lib project: ':hal', library: 'hal', linkage: shared
}
addHalJniDependency = { binary->
binary.tasks.withType(AbstractNativeSourceCompileTask) {
it.dependsOn generateUsageReporting
}
binary.lib project: ':hal', library: 'halJNIShared', linkage: 'shared'
}
nativeName = 'hal'
setBaseName = 'wpiHal'
devMain = 'DevMain'
niLibraries = true
generatedHeaders = "$buildDir/generated/headers"
jniSplitSetup = {
it.tasks.withType(AbstractNativeSourceCompileTask) {
it.dependsOn generateUsageReporting
}
if (it.targetPlatform.architecture.name == 'athena') {
it.sources {
athenaJniCpp(CppSourceSet) {
source {
srcDirs = ["${rootDir}/shared/singlelib", "$buildDir/generated/cpp"]
include '**/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
srcDir generatedHeaders
}
}
}
} else {
it.sources {
simJniCpp(CppSourceSet) {
source {
srcDirs 'src/main/native/sim'
include '**/jni/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
srcDir generatedHeaders
}
}
}
}
}
splitSetup = {
it.tasks.withType(AbstractNativeSourceCompileTask) {
it.dependsOn generateUsageReporting
@@ -64,8 +103,9 @@ ext {
it.sources {
athenaCpp(CppSourceSet) {
source {
srcDirs = ['src/main/native/athena', "$buildDir/generated/cpp"]
srcDirs = ['src/main/native/athena']
include '**/*.cpp'
exclude '**/jni/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
@@ -79,6 +119,7 @@ ext {
source {
srcDirs 'src/main/native/sim'
include '**/*.cpp'
exclude '**/jni/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
@@ -138,25 +179,5 @@ model {
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure']
}
halJNI(ExportsConfig) {
x86SymbolFilter = { symbols ->
def retList = []
symbols.each { symbol ->
if (symbol.startsWith('HAL_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
x64SymbolFilter = { symbols ->
def retList = []
symbols.each { symbol ->
if (symbol.startsWith('HAL_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
}
}
}

View File

@@ -21,7 +21,7 @@ public class JNIWrapper {
static {
if (!libraryLoaded) {
try {
loader = new RuntimeLoader<>("wpiHal", RuntimeLoader.getDefaultExtractionRoot(), JNIWrapper.class);
loader = new RuntimeLoader<>("wpiHaljni", RuntimeLoader.getDefaultExtractionRoot(), JNIWrapper.class);
loader.loadLibrary();
} catch (IOException ex) {
ex.printStackTrace();

View File

@@ -52,6 +52,7 @@ jar {
model {
components {
myRobotCpp(NativeExecutableSpec) {
targetBuildTypes 'debug'
baseName = 'FRCUserProgram'
sources {
cpp {
@@ -75,6 +76,7 @@ model {
}
}
myRobotCppStatic(NativeExecutableSpec) {
targetBuildTypes 'debug'
baseName = 'FRCUserProgram'
sources {
cpp {

View File

@@ -1,5 +1,29 @@
project(ntcore)
file(GLOB
ntcore_native_src src/main/native/cpp/*.cpp
ntcore_native_src src/main/native/cpp/networktables/*.cpp
ntcore_native_src src/main/native/cpp/tables/*.cpp)
add_library(ntcore ${ntcore_native_src})
set_target_properties(ntcore PROPERTIES DEBUG_POSTFIX "d")
target_include_directories(ntcore PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/ntcore>)
target_link_libraries(ntcore PUBLIC wpiutil)
set_property(TARGET ntcore PROPERTY FOLDER "libraries")
install(TARGETS ntcore EXPORT ntcore DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/ntcore")
if (MSVC)
set (ntcore_config_dir ${wpilib_dest})
else()
set (ntcore_config_dir share/ntcore)
endif()
install(FILES ntcore-config.cmake DESTINATION ${ntcore_config_dir})
install(EXPORT ntcore DESTINATION ${ntcore_config_dir})
# Java bindings
if (NOT WITHOUT_JAVA)
@@ -26,42 +50,23 @@ if (NOT WITHOUT_JAVA)
set_property(TARGET ntcore_jar PROPERTY FOLDER "java")
endif()
add_library(ntcorejni ${ntcore_jni_src})
target_link_libraries(ntcorejni PUBLIC ntcore wpiutil)
file(GLOB
ntcore_native_src src/main/native/cpp/*.cpp
ntcore_native_src src/main/native/cpp/networktables/*.cpp
ntcore_native_src src/main/native/cpp/tables/*.cpp)
add_library(ntcore ${ntcore_native_src} ${ntcore_jni_src})
target_include_directories(ntcore PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/ntcore>)
target_link_libraries(ntcore PUBLIC wpiutil)
set_property(TARGET ntcorejni PROPERTY FOLDER "libraries")
set_property(TARGET ntcore PROPERTY FOLDER "libraries")
if (NOT WITHOUT_JAVA)
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
target_include_directories(ntcore PRIVATE ${JNI_INCLUDE_DIRS})
target_include_directories(ntcore PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/jniheaders")
else()
target_link_libraries(ntcore PRIVATE ntcore_jni_headers)
if (MSVC)
install(TARGETS ntcorejni RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
add_dependencies(ntcore ntcore_jar)
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
target_include_directories(ntcorejni PRIVATE ${JNI_INCLUDE_DIRS})
target_include_directories(ntcorejni PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/jniheaders")
else()
target_link_libraries(ntcorejni PRIVATE ntcore_jni_headers)
endif()
add_dependencies(ntcorejni ntcore_jar)
install(TARGETS ntcorejni EXPORT ntcorejni DESTINATION "${main_lib_dest}")
endif()
install(TARGETS ntcore EXPORT ntcore DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/ntcore")
if (NOT WITHOUT_JAVA AND MSVC)
install(TARGETS ntcore RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
if (MSVC)
set (ntcore_config_dir ${wpilib_dest})
else()
set (ntcore_config_dir share/ntcore)
endif()
install(FILES ntcore-config.cmake DESTINATION ${ntcore_config_dir})
install(EXPORT ntcore DESTINATION ${ntcore_config_dir})

View File

@@ -21,26 +21,6 @@ model {
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure']
}
ntcoreJNI(ExportsConfig) {
x86SymbolFilter = { symbols ->
def retList = []
symbols.each { symbol ->
if (symbol.startsWith('NT_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
x64SymbolFilter = { symbols ->
def retList = []
symbols.each { symbol ->
if (symbol.startsWith('NT_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
}
}
}

View File

@@ -19,7 +19,7 @@ public final class NetworkTablesJNI {
static {
if (!libraryLoaded) {
try {
loader = new RuntimeLoader<>("ntcore", RuntimeLoader.getDefaultExtractionRoot(), NetworkTablesJNI.class);
loader = new RuntimeLoader<>("ntcorejni", RuntimeLoader.getDefaultExtractionRoot(), NetworkTablesJNI.class);
loader.loadLibrary();
} catch (IOException ex) {
ex.printStackTrace();

View File

@@ -1,19 +1,29 @@
import edu.wpi.first.nativeutils.*
import org.gradle.internal.os.OperatingSystem
def windowsCompilerArgs = ['/EHsc', '/DNOMINMAX', '/Zi', '/FS', '/Zc:inline', '/MT']
def windowsCCompilerArgs = ['/Zi', '/FS', '/Zc:inline', '/MT']
def windowsReleaseCompilerArgs = ['/O2']
def windowsCompilerArgs = ['/EHsc', '/DNOMINMAX', '/Zi', '/FS', '/Zc:inline', '/MP4']
def windowsCCompilerArgs = ['/Zi', '/FS', '/Zc:inline']
def windowsReleaseCompilerArgs = ['/O2', '/MD']
def windowsDebugCompilerArgs = ['/Od', '/MDd']
def windowsLinkerArgs = ['/DEBUG:FULL']
def windowsReleaseLinkerArgs = ['/OPT:REF', '/OPT:ICF']
def linuxCrossCompilerArgs = ['-std=c++14', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
'-Wno-unused-parameter', '-Wno-error=deprecated-declarations', '-fPIC', '-rdynamic',
'-pthread']
def linuxCrossCCompilerArgs = ['-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
'-Wno-unused-parameter', '-fPIC', '-rdynamic', '-pthread']
def linuxCrossLinkerArgs = ['-rdynamic', '-pthread', '-ldl']
def linuxCrossReleaseCompilerArgs = ['-O2']
def linuxCrossDebugCompilerArgs = ['-Og']
def linuxCompilerArgs = ['-std=c++14', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
'-Wno-unused-parameter', '-Wno-error=deprecated-declarations', '-fPIC', '-rdynamic',
'-pthread']
def linuxCCompilerArgs = ['-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
'-Wno-unused-parameter', '-fPIC', '-rdynamic', '-pthread']
def linuxLinkerArgs = ['-rdynamic', '-pthread', '-ldl']
def linuxReleaseCompilerArgs = ['-Og']
def linuxReleaseCompilerArgs = ['-O2']
def linuxDebugCompilerArgs = ['-O0']
def linux32BitArg = '-m32'
@@ -98,26 +108,45 @@ def mac32PlatformDetect = {
}
}
if (!project.hasProperty('skipAthena')) {
if (!project.hasProperty('skipAthena') && !project.hasProperty('onlyRaspbian')) {
model {
buildConfigs {
roboRio(CrossBuildConfig) {
architecture = 'athena'
operatingSystem = 'linux'
toolChainPrefix = 'arm-frc2019-linux-gnueabi-'
compilerArgs = linuxCompilerArgs
CCompilerArgs = linuxCCompilerArgs
linkerArgs = linuxLinkerArgs
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
compilerArgs = linuxCrossCompilerArgs
CCompilerArgs = linuxCrossCCompilerArgs
linkerArgs = linuxCrossLinkerArgs
debugCompilerArgs = linuxCrossDebugCompilerArgs
releaseCompilerArgs = linuxCrossReleaseCompilerArgs
stripBuildTypes = ['debug', 'release']
compilerFamily = 'Gcc'
}
}
}
}
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('skipRaspbian') && !project.hasProperty('onlyAthena')) {
model {
buildConfigs {
raspbian(CrossBuildConfig) {
architecture = 'raspbian'
operatingSystem = 'linux'
toolChainPrefix = 'arm-raspbian9-linux-gnueabihf-'
compilerArgs = linuxCrossCompilerArgs
CCompilerArgs = linuxCrossCCompilerArgs
linkerArgs = linuxCrossLinkerArgs
debugCompilerArgs = linuxCrossDebugCompilerArgs
releaseCompilerArgs = linuxCrossReleaseCompilerArgs
stripBuildTypes = ['debug', 'release']
compilerFamily = 'Gcc'
}
}
}
}
if (!project.hasProperty('onlyAthena') && !hasProperty('onlyRaspbian')) {
model {
buildConfigs {
winX86(BuildConfig) {
@@ -128,6 +157,7 @@ if (!project.hasProperty('onlyAthena')) {
linkerArgs = windowsLinkerArgs
releaseCompilerArgs = windowsReleaseCompilerArgs
releaseLinkerArgs = windowsReleaseLinkerArgs
debugCompilerArgs = windowsDebugCompilerArgs
compilerFamily = 'VisualCpp'
detectPlatform = windows32PlatformDetect
}
@@ -139,6 +169,7 @@ if (!project.hasProperty('onlyAthena')) {
linkerArgs = windowsLinkerArgs
releaseCompilerArgs = windowsReleaseCompilerArgs
releaseLinkerArgs = windowsReleaseLinkerArgs
debugCompilerArgs = windowsDebugCompilerArgs
compilerFamily = 'VisualCpp'
detectPlatform = windows64PlatformDetect
}
@@ -150,7 +181,7 @@ if (!project.hasProperty('onlyAthena')) {
linkerArgs = linuxLinkerArgs
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
stripBuildTypes = ['debug', 'release']
compilerFamily = 'Gcc'
detectPlatform = linux64IntelPlatformDetect
}
@@ -182,7 +213,7 @@ if (project.hasProperty('linuxCross')) {
linkerArgs = linuxLinkerArgs
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
stripBuildTypes = ['debug', 'release']
skipByDefault = true
compilerFamily = 'Gcc'
}
@@ -199,7 +230,7 @@ if (project.hasProperty('linuxCross')) {
linkerArgs = linuxLinkerArgs
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
stripBuildTypes = ['debug', 'release']
compilerFamily = 'Gcc'
detectPlatform = linuxArmPlatformDetect
}
@@ -207,20 +238,56 @@ if (project.hasProperty('linuxCross')) {
}
}
ext.getClassifier = { binary ->
return NativeUtils.getClassifier(binary)
ext.getPublishClassifier = { binary ->
return NativeUtils.getPublishClassifier(binary)
}
ext.getPlatformPath = { binary ->
return NativeUtils.getPlatformPath(binary)
}
ext.createComponentZipTasks = { components, name, base, type, project, func ->
ext.appendDebugPathToBinaries = { binaries->
binaries.withType(StaticLibraryBinarySpec) {
if (it.buildType.name.contains('debug')) {
def staticFileDir = it.staticLibraryFile.parentFile
def staticFileName = it.staticLibraryFile.name
def staticFileExtension = staticFileName.substring(staticFileName.lastIndexOf('.'))
staticFileName = staticFileName.substring(0, staticFileName.lastIndexOf('.'))
staticFileName = staticFileName + 'd' + staticFileExtension
def newStaticFile = new File(staticFileDir, staticFileName)
it.staticLibraryFile = newStaticFile
}
}
binaries.withType(SharedLibraryBinarySpec) {
if (it.buildType.name.contains('debug')) {
def sharedFileDir = it.sharedLibraryFile.parentFile
def sharedFileName = it.sharedLibraryFile.name
def sharedFileExtension = sharedFileName.substring(sharedFileName.lastIndexOf('.'))
sharedFileName = sharedFileName.substring(0, sharedFileName.lastIndexOf('.'))
sharedFileName = sharedFileName + 'd' + sharedFileExtension
def newSharedFile = new File(sharedFileDir, sharedFileName)
def sharedLinkFileDir = it.sharedLibraryLinkFile.parentFile
def sharedLinkFileName = it.sharedLibraryLinkFile.name
def sharedLinkFileExtension = sharedLinkFileName.substring(sharedLinkFileName.lastIndexOf('.'))
sharedLinkFileName = sharedLinkFileName.substring(0, sharedLinkFileName.lastIndexOf('.'))
sharedLinkFileName = sharedLinkFileName + 'd' + sharedLinkFileExtension
def newLinkFile = new File(sharedLinkFileDir, sharedLinkFileName)
it.sharedLibraryLinkFile = newLinkFile
it.sharedLibraryFile = newSharedFile
}
}
}
ext.createComponentZipTasks = { components, names, base, type, project, func ->
def stringNames = names.collect {it.toString()}
def configMap = [:]
components.each {
if (it in NativeLibrarySpec && it.name == name) {
if (it in NativeLibrarySpec && stringNames.contains(it.name)) {
it.binaries.each {
def target = getClassifier(it)
if (!it.buildable) return
def target = getPublishClassifier(it)
if (configMap.containsKey(target)) {
configMap.get(target).add(it)
} else {
@@ -260,14 +327,16 @@ ext.createComponentZipTasks = { components, name, base, type, project, func ->
ext.createAllCombined = { list, name, base, type, project ->
def outputsFolder = file("$project.buildDir/outputs")
def task = project.tasks.create(base + '-all', type) {
description = 'Creates component archive for all classifiers'
def task = project.tasks.create(base + "-all", type) {
description = "Creates component archive for all classifiers"
destinationDir = outputsFolder
classifier = 'all'
classifier = "all"
baseName = base
duplicatesStrategy = 'exclude'
list.each {
if (it.name.endsWith('debug')) return
from project.zipTree(it.archivePath)
dependsOn it
}
@@ -303,7 +372,7 @@ ext.includeStandardZipFormat = { task, value ->
task.from(binary.sharedLibraryLinkFile) {
into getPlatformPath(binary) + '/shared'
}
} else if (binary instanceof StaticLibraryBinarySpec) {
} else if (binary instanceof StaticLibraryBinarySpec) {
task.dependsOn binary.tasks.createStaticLib
task.from(binary.staticLibraryFile) {
into getPlatformPath(binary) + '/static'

View File

@@ -5,7 +5,7 @@ model {
artifactId = 'googletest'
headerClassifier = 'headers'
ext = 'zip'
version = '1.8.0-1-4e4df22'
version = '1.8.0-4-4e4df22'
sharedConfigs = [:]
staticConfigs = project.staticGtestConfigs
}

View File

@@ -87,7 +87,7 @@ test {
}
}
if (project.hasProperty('onlyAthena')) {
if (project.hasProperty('onlyAthena') || project.hasProperty('onlyRaspbian')) {
test.enabled = false
}

View File

@@ -53,12 +53,7 @@ addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def taskList = createComponentZipTasks($.components, nativeName, zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(taskList, nativeName, zipBaseName, Zip, project)
}
def taskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
@@ -68,10 +63,6 @@ model {
artifact cppHeadersZip
artifact cppSourcesZip
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifactId = "${baseArtifactId}-cpp"
groupId artifactGroupId
version pubVersion

View File

@@ -60,10 +60,12 @@ model {
}
}
}
appendDebugPathToBinaries(binaries)
}
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -101,7 +103,7 @@ model {
}
binaries {
withType(GoogleTestTestSuiteBinarySpec) {
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
lib library: nativeName, linkage: 'shared'
} else {
it.buildable = false

View File

@@ -71,14 +71,9 @@ addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def taskList = createComponentZipTasks($.components, nativeName, zipBaseName, Zip, project, includeStandardZipFormat)
def taskList = createComponentZipTasks($.components, [nativeName, "${nativeName}JNIShared"], zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(taskList, nativeName, zipBaseName, Zip, project)
}
def jniTaskList = createComponentZipTasks($.components, "${nativeName}JNI", jniBaseName, Jar, project, { task, value ->
def jniTaskList = createComponentZipTasks($.components, ["${nativeName}JNI"], jniBaseName, Jar, project, { task, value ->
value.each { binary ->
if (binary.buildable) {
if (binary instanceof SharedLibraryBinarySpec) {
@@ -113,10 +108,6 @@ model {
artifact cppHeadersZip
artifact cppSourcesZip
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifactId = "${baseArtifactId}-cpp"
groupId artifactGroupId
version pubVersion

View File

@@ -33,9 +33,9 @@ apply from: "${rootDir}/shared/googletest.gradle"
if (project.hasProperty('niLibraries')) {
ext {
chipObjectComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(),
"${nativeName}JNI".toString(), "${nativeName}Test".toString()]
"${nativeName}JNI".toString(), "${nativeName}JNIShared".toString(), "${nativeName}Test".toString()]
netCommComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(),
"${nativeName}JNI".toString(), "${nativeName}Test".toString()]
"${nativeName}JNI".toString(), "${nativeName}JNIShared".toString(), "${nativeName}Test".toString()]
useNiJava = true
}
@@ -44,17 +44,16 @@ if (project.hasProperty('niLibraries')) {
model {
components {
"${nativeName}Base"(JniNativeLibrarySpec) {
"${nativeName}Base"(NativeLibrarySpec) {
if (project.hasProperty('setBaseName')) {
baseName = setBaseName
}
javaCompileTasks << compileJava
jniCrossCompileOptions << JniCrossCompileOptions('athena')
sources {
cpp {
source {
srcDirs 'src/main/native/cpp'
include '**/*.cpp'
exclude '**/jni/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
@@ -75,13 +74,10 @@ model {
}
}
}
"${nativeName}"(JniNativeLibrarySpec) {
"${nativeName}"(NativeLibrarySpec) {
if (project.hasProperty('setBaseName')) {
baseName = setBaseName
}
enableCheckTask true
javaCompileTasks << compileJava
jniCrossCompileOptions << JniCrossCompileOptions('athena')
sources {
cpp {
source {
@@ -99,21 +95,23 @@ model {
binaries.all {
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
appendDebugPathToBinaries(binaries)
}
"${nativeName}JNI"(JniNativeLibrarySpec) {
"${nativeName}JNIShared"(JniNativeLibrarySpec) {
if (project.hasProperty('setBaseName')) {
baseName = setBaseName
baseName = setBaseName + 'jni'
} else {
baseName = nativeName
baseName = nativeName + 'jni'
}
enableCheckTask true
javaCompileTasks << compileJava
jniCrossCompileOptions << JniCrossCompileOptions('athena')
jniCrossCompileOptions << JniCrossCompileOptions('raspbian')
sources {
cpp {
source {
srcDirs "${rootDir}/shared/singlelib"
include '**/*.cpp'
srcDirs 'src/main/native/cpp'
include '**/jni/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
@@ -128,12 +126,53 @@ model {
it.buildable = false
return
}
lib library: "${nativeName}", linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
if (project.hasProperty('jniSplitSetup')) {
jniSplitSetup(it)
}
}
}
"${nativeName}JNI"(JniNativeLibrarySpec) {
if (project.hasProperty('setBaseName')) {
baseName = setBaseName + 'jni'
} else {
baseName = nativeName + 'jni'
}
enableCheckTask true
javaCompileTasks << compileJava
jniCrossCompileOptions << JniCrossCompileOptions('athena')
jniCrossCompileOptions << JniCrossCompileOptions('raspbian')
sources {
cpp {
source {
srcDirs 'src/main/native/cpp'
include '**/jni/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
if (project.hasProperty('generatedHeaders')) {
srcDir generatedHeaders
}
}
}
}
binaries.all {
if (it instanceof StaticLibraryBinarySpec) {
it.buildable = false
return
}
lib library: "${nativeName}", linkage: 'static'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
if (project.hasProperty('jniSplitSetup')) {
jniSplitSetup(it)
}
}
}
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
@@ -151,6 +190,7 @@ model {
}
binaries.all {
lib library: nativeName, linkage: 'shared'
lib library: "${nativeName}JNIShared", linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
@@ -181,7 +221,7 @@ model {
}
binaries {
withType(GoogleTestTestSuiteBinarySpec) {
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
lib library: nativeName, linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
} else {

View File

@@ -16,7 +16,7 @@ model {
artifactId = 'chipobject'
headerClassifier = 'headers'
ext = 'zip'
version = '2019.4.1'
version = '2019.4.2'
sharedConfigs = chipObjectConfigs
staticConfigs = [:]
compileOnlyShared = true
@@ -26,7 +26,7 @@ model {
artifactId = 'netcomm'
headerClassifier = 'headers'
ext = 'zip'
version = '2019.4.1'
version = '2019.4.2'
sharedConfigs = netCommLibConfigs
staticConfigs = [:]
compileOnlyShared = true

View File

@@ -6,7 +6,7 @@ if (project.hasProperty('useCpp') && project.useCpp) {
artifactId = 'opencv-cpp'
headerClassifier = 'headers'
ext = 'zip'
version = '3.4.3-7'
version = '3.4.3-15'
sharedConfigs = project.sharedCvConfigs
staticConfigs = project.staticCvConfigs
linkExcludes = ['**/*java*']
@@ -17,12 +17,12 @@ if (project.hasProperty('useCpp') && project.useCpp) {
if (project.hasProperty('useJava') && project.useJava) {
dependencies {
compile 'edu.wpi.first.thirdparty.frc2019.opencv:opencv-java:3.4.3-7'
compile 'edu.wpi.first.thirdparty.frc2019.opencv:opencv-java:3.4.3-15'
if (!project.hasProperty('skipDev') || !project.skipDev) {
devCompile 'edu.wpi.first.thirdparty.frc2019.opencv:opencv-java:3.4.3-7'
devCompile 'edu.wpi.first.thirdparty.frc2019.opencv:opencv-java:3.4.3-15'
}
if (project.hasProperty('useDocumentation') && project.useDocumentation) {
javaSource 'edu.wpi.first.thirdparty.frc2019.opencv:opencv-java:3.4.3-7:sources'
javaSource 'edu.wpi.first.thirdparty.frc2019.opencv:opencv-java:3.4.3-15:sources'
}
}
}

View File

@@ -50,7 +50,7 @@ addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def pluginTaskList = createComponentZipTasks($.components, pluginName, zipBaseName, Zip, project, { task, value ->
def pluginTaskList = createComponentZipTasks($.components, [pluginName], zipBaseName, Zip, project, { task, value ->
value.each { binary ->
if (binary.buildable) {
if (binary instanceof SharedLibraryBinarySpec) {
@@ -63,21 +63,12 @@ model {
}
})
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(pluginTaskList, pluginName, zipBaseName, Zip, project)
}
publications {
cpp(MavenPublication) {
pluginTaskList.each {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip

View File

@@ -41,8 +41,10 @@ if (!project.hasProperty('onlyAthena')) {
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
appendDebugPathToBinaries(binaries)
}
"${pluginName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -55,12 +57,16 @@ if (!project.hasProperty('onlyAthena')) {
}
}
binaries.all {
project(':hal').addHalDependency(it, 'shared')
lib library: pluginName
if (project.hasProperty('includeNtCore')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
project(':hal').addHalDependency(it, 'shared')
lib library: pluginName
if (project.hasProperty('includeNtCore')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
}
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
} else {
it.buildable = false
}
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
}
@@ -72,7 +78,7 @@ if (!project.hasProperty('onlyAthena')) {
model {
tasks {
def c = $.components
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
project.tasks.create('runCpp', Exec) {
group = 'WPILib'
description = "Run the ${pluginName}Dev executable"

View File

@@ -52,6 +52,7 @@ model {
servo(NativeLibrarySpec)
drive_motor(NativeLibrarySpec)
all { component ->
component.targetBuildTypes 'debug'
sources {
cpp.lib library: "${component.name}", linkage: "static"
}

View File

@@ -100,6 +100,7 @@ if (!project.hasProperty('onlyAthena')) {
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -125,13 +126,17 @@ if (!project.hasProperty('onlyAthena')) {
}
binaries {
withType(GoogleTestTestSuiteBinarySpec) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib library: nativeName, linkage: 'shared'
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib library: nativeName, linkage: 'shared'
} else {
it.buildable = false
}
}
}
}
@@ -142,7 +147,7 @@ if (!project.hasProperty('onlyAthena')) {
model {
testSuites {
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
"${nativeName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : $.components) {
if (c.name == nativeName) {

View File

@@ -49,13 +49,7 @@ addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def halsim_adx_gyro_accelerometerTaskList = createComponentZipTasks($.components, nativeName, zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(halsim_adx_gyro_accelerometerTaskList, nativeName, zipBaseName, Zip, project)
}
def halsim_adx_gyro_accelerometerTaskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
@@ -63,10 +57,6 @@ model {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip

View File

@@ -21,7 +21,7 @@ apply from: "${rootDir}/shared/plugins/setupBuild.gradle"
model {
testSuites {
def comps = $.components
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
"${pluginName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : comps) {
if (c.name == pluginName) {

View File

@@ -57,7 +57,11 @@ void DSCommPacket::ReadMatchtimeTag(wpi::ArrayRef<uint8_t> tagData) {
store |= tagData[4] << 8;
store |= tagData[5];
float matchTime = *reinterpret_cast<float*>(&store);
static_assert(sizeof(uint32_t) == sizeof(float), "float must be 32 bits");
float matchTime = 0;
std::memcpy(&matchTime, &store, sizeof(float));
m_match_time = matchTime;
}

View File

@@ -105,6 +105,7 @@ if (!project.hasProperty('onlyAthena')) {
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -149,7 +150,7 @@ if (!project.hasProperty('onlyAthena')) {
model {
testSuites {
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
"${nativeName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : $.components) {
if (c.name == nativeName) {

View File

@@ -50,13 +50,7 @@ addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def lowfiSimTaskList = createComponentZipTasks($.components, nativeName, zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(lowfiSimTaskList, nativeName, zipBaseName, Zip, project)
}
def lowfiSimTaskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
@@ -64,10 +58,6 @@ model {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip

View File

@@ -8,6 +8,7 @@ file(GLOB_RECURSE
wpilibc_native_src src/main/native/cpp/*.cpp)
add_library(wpilibc ${wpilibc_native_src} ${CMAKE_CURRENT_BINARY_DIR}/WPILibVersion.cpp)
set_target_properties(wpilibc PROPERTIES DEBUG_POSTFIX "d")
target_include_directories(wpilibc PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>

View File

@@ -138,10 +138,12 @@ model {
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
}
appendDebugPathToBinaries(binaries)
}
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -200,7 +202,7 @@ model {
}
}
withType(GoogleTestTestSuiteBinarySpec) {
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')

View File

@@ -54,22 +54,14 @@ addTaskToCopyAllOutputs(cppSourcesZip)
model {
publishing {
def wpilibCTaskList = createComponentZipTasks($.components, 'wpilibc', zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(wpilibCTaskList, 'wpilibc', zipBaseName, Zip, project)
}
def wpilibCTaskList = createComponentZipTasks($.components, ['wpilibc'], zipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
wpilibCTaskList.each {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip

View File

@@ -85,6 +85,7 @@ model {
examplesMap.each { key, value ->
"${key}"(NativeExecutableSpec) {
targetBuildTypes 'debug'
binaries.all { binary ->
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
@@ -115,6 +116,7 @@ model {
}
templatesMap.each { key, value ->
"${key}"(NativeExecutableSpec) {
targetBuildTypes 'debug'
binaries.all { binary ->
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'

View File

@@ -30,6 +30,7 @@ apply from: "${rootDir}/shared/nilibraries.gradle"
model {
components {
wpilibcIntegrationTests(NativeExecutableSpec) {
targetBuildTypes 'debug'
baseName = 'FRCUserProgram'
binaries.all { binary ->
if (binary.targetPlatform.architecture.name == 'athena') {
@@ -53,7 +54,10 @@ model {
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared'
lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared'
project(':hal').addHalDependency(binary, 'shared')
project(':hal').addHalJniDependency(binary)
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
} else {

View File

@@ -96,6 +96,7 @@ apply from: "${rootDir}/shared/opencv.gradle"
model {
components {
wpilibjDev(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -104,6 +105,9 @@ model {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared'
lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
}
exportedHeaders {
@@ -113,6 +117,7 @@ model {
}
binaries.all {
project(':hal').addHalDependency(it, 'shared')
project(':hal').addHalJniDependency(it)
}
}
}

View File

@@ -70,6 +70,7 @@ set(uv_linux_src
)
add_library(wpiutil ${wpiutil_native_src} ${uv_native_src})
set_target_properties(wpiutil PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET wpiutil PROPERTY FOLDER "libraries")

View File

@@ -138,6 +138,7 @@ model {
components {
examplesMap.each { key, value ->
"${key}"(NativeExecutableSpec) {
targetBuildTypes 'debug'
binaries.all {
lib library: 'wpiutil', linkage: 'shared'
}