mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Java generics are too limited to do what we need. This refactors generic code previously in Unit and Measure into unit-specific classes that can have unit-safe math operations (notably, times and divide) that can return values in known units instead of a wildcarded Measure<?>. Unit-specific measure implementations are automatically generated by ./wpiunits/generate_units.py, which generates generic interfaces and mutable and immutable implementations of those interfaces. These make up the bulk of the diff of this PR (approximately 9300 LOC). This also adds units for angular and linear velocities, accelerations, and momenta; moment of inertia; and torque.
36 lines
1.0 KiB
CMake
36 lines
1.0 KiB
CMake
project(wpiunits)
|
|
|
|
# Java bindings
|
|
if(WITH_JAVA)
|
|
include(UseJava)
|
|
|
|
file(GLOB_RECURSE JAVA_SOURCES src/main/java/*.java src/generated/main/java/*.java)
|
|
|
|
add_jar(
|
|
wpiunits_jar
|
|
${JAVA_SOURCES}
|
|
OUTPUT_NAME wpiunits
|
|
OUTPUT_DIR ${WPILIB_BINARY_DIR}/${java_lib_dest}
|
|
)
|
|
set_property(TARGET wpiunits_jar PROPERTY FOLDER "java")
|
|
|
|
install_jar(wpiunits_jar DESTINATION ${java_lib_dest})
|
|
install_jar_exports(TARGETS wpiunits_jar FILE wpiunits.cmake DESTINATION share/wpiunits)
|
|
install(FILES wpiunits-config.cmake DESTINATION share/wpiunits)
|
|
endif()
|
|
|
|
if(WITH_JAVA_SOURCE)
|
|
include(UseJava)
|
|
include(CreateSourceJar)
|
|
add_source_jar(
|
|
wpiunits_src_jar
|
|
BASE_DIRECTORIES
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/main/java
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/generated/main/java
|
|
OUTPUT_NAME wpiunits-sources
|
|
)
|
|
set_property(TARGET wpiunits_src_jar PROPERTY FOLDER "java")
|
|
|
|
install_jar(wpiunits_src_jar DESTINATION ${java_lib_dest})
|
|
endif()
|