Skip to content

Commit

Permalink
Merge branch 'main' into more-serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Jul 29, 2024
2 parents 557ebb1 + 4226d11 commit 47b98d9
Show file tree
Hide file tree
Showing 409 changed files with 173,578 additions and 1,256 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/comment-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ jobs:
content: "rocket",
});
- uses: actions/checkout@v4
- name: Checkout PR
with:
fetch-depth: 0
token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}
run: |
gh pr checkout $NUMBER
env:
GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}"
NUMBER: ${{ github.event.issue.number }}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
Expand All @@ -94,6 +99,10 @@ jobs:
run: ./wpilibj/generate_hids.py && ./wpilibc/generate_hids.py && ./wpilibNewCommands/generate_hids.py
- name: Run PWM Controllers
run: ./wpilibj/generate_pwm_motor_controllers.py && ./wpilibc/generate_pwm_motor_controllers.py
- name: Run imgui gl3w
run: ./thirdparty/imgui_suite/generate_gl3w.py
- name: Run imgui fonts
run: ./thirdparty/imgui_suite/generate_fonts.sh
- name: Commit
run: |
# Set credentials
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pregenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ jobs:
run: ./wpilibj/generate_hids.py && ./wpilibc/generate_hids.py && ./wpilibNewCommands/generate_hids.py
- name: Run PWM Controllers
run: ./wpilibj/generate_pwm_motor_controllers.py && ./wpilibc/generate_pwm_motor_controllers.py
- name: Run imgui gl3w
run: ./thirdparty/imgui_suite/generate_gl3w.py
- name: Run imgui fonts
run: ./thirdparty/imgui_suite/generate_fonts.sh
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/upstream-utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: Run apriltag.py
run: |
cd upstream_utils
./apriltag.py clone
./apriltag.py copy-upstream-to-thirdparty
- name: Run eigen.py
run: |
cd upstream_utils
Expand All @@ -45,11 +50,31 @@ jobs:
cd upstream_utils
./gcem.py clone
./gcem.py copy-upstream-to-thirdparty
- name: Run gl3w.py
run: |
cd upstream_utils
./gl3w.py clone
./gl3w.py copy-upstream-to-thirdparty
- name: Run glfw.py
run: |
cd upstream_utils
./glfw.py clone
./glfw.py copy-upstream-to-thirdparty
- name: Run googletest.py
run: |
cd upstream_utils
./googletest.py clone
./googletest.py copy-upstream-to-thirdparty
- name: Run imgui.py
run: |
cd upstream_utils
./imgui.py clone
./imgui.py copy-upstream-to-thirdparty
- name: Run implot.py
run: |
cd upstream_utils
./implot.py clone
./implot.py copy-upstream-to-thirdparty
- name: Run json.py
run: |
cd upstream_utils
Expand Down Expand Up @@ -90,6 +115,11 @@ jobs:
cd upstream_utils
./sleipnir.py clone
./sleipnir.py copy-upstream-to-thirdparty
- name: Run stb.py
run: |
cd upstream_utils
./stb.py clone
./stb.py copy-upstream-to-thirdparty
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ simgui.json

networktables.json

ntcore/connectionlistenertest.json
ntcore/timesynctest.json

# Created by the jenkins test script
test-reports

Expand Down Expand Up @@ -133,6 +136,7 @@ CMakeCache.txt
CMakeFiles
cmake_install.cmake
install_manifest.txt
CMakeUserPresets.json


### Gradle ###
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ endif()

if(WITH_GUI)
add_subdirectory(fieldImages)
add_subdirectory(imgui)
add_subdirectory(thirdparty/imgui_suite)
add_subdirectory(wpigui)
add_subdirectory(glass)
add_subdirectory(outlineviewer)
Expand Down
1 change: 1 addition & 0 deletions README-CMAKE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ WPILib is normally built with Gradle, however for some systems, such as Linux ba
* apriltag
* cameraserver
* cscore
* fieldImages
* hal (simulation HAL only)
* ntcore
* romiVendordep
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ The Java code quality tools Checkstyle, PMD, and Spotless can be run via `./grad

If you only want to run the Java autoformatter, run `./gradlew spotlessApply`.

### Generated files

Several files within WPILib are generated using Jinja. If a PR is opened that modifies these templates then the files can be generated through CI by commenting `/pregen` on the PR. A new commit will be pushed with the regenerated files.

### CMake

CMake is also supported for building. See [README-CMAKE.md](README-CMAKE.md).
Expand Down
78 changes: 39 additions & 39 deletions apriltag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,35 @@ project(apriltag)

include(CompileWarnings)
include(GenResources)
include(FetchContent)

fetchcontent_declare(
apriltaglib
GIT_REPOSITORY https://github.com/wpilibsuite/apriltag.git
GIT_TAG da208cc38c1b78fe89861616d44c0692e76b6b8b
file(
GLOB_RECURSE apriltaglib_src
src/main/native/thirdparty/apriltag/src/*.c
src/main/native/thirdparty/apriltag/src/*.cpp
)

# Don't use apriltag's CMakeLists.txt due to conflicting naming and JNI
fetchcontent_getproperties(apriltaglib)
if(NOT apriltaglib_POPULATED)
fetchcontent_populate(apriltaglib)
# Disable apriltag C library warnings
if(MSVC)
set_source_files_properties(
${apriltaglib_src}
PROPERTIES COMPILE_FLAGS "/wd2220 /wd4005 /wd4018 /wd4244 /wd4267 /wd4996"
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_source_files_properties(
${apriltaglib_src}
PROPERTIES
COMPILE_FLAGS
"-Wno-format-nonliteral -Wno-gnu-zero-variadic-macro-arguments -Wno-uninitialized -Wno-sign-compare -Wno-type-limits"
)
else()
set_source_files_properties(
${apriltaglib_src}
PROPERTIES
COMPILE_FLAGS
"-Wno-format-nonliteral -Wno-gnu-zero-variadic-macro-arguments -Wno-maybe-uninitialized -Wno-sign-compare -Wno-type-limits"
)
endif()

aux_source_directory(${apriltaglib_SOURCE_DIR}/common APRILTAGLIB_COMMON_SRC)
file(GLOB TAG_FILES ${apriltaglib_SOURCE_DIR}/tag*.c)
set(APRILTAGLIB_SRCS
${apriltaglib_SOURCE_DIR}/apriltag.c
${apriltaglib_SOURCE_DIR}/apriltag_pose.c
${apriltaglib_SOURCE_DIR}/apriltag_quad_thresh.c
)

file(GLOB apriltag_jni_src src/main/native/cpp/jni/AprilTagJNI.cpp)

if(WITH_JAVA)
Expand Down Expand Up @@ -72,7 +79,7 @@ if(WITH_JAVA)
install_jar(apriltag_jar DESTINATION ${java_lib_dest})
install_jar_exports(TARGETS apriltag_jar FILE apriltag_jar.cmake DESTINATION share/apriltag)

add_library(apriltagjni ${apriltag_jni_src})
add_library(apriltagjni ${apriltag_jni_src} ${apriltaglib_src})
wpilib_target_warnings(apriltagjni)
target_link_libraries(apriltagjni PUBLIC apriltag)

Expand Down Expand Up @@ -109,32 +116,12 @@ generate_resources(

file(GLOB apriltag_native_src src/main/native/cpp/*.cpp)

add_library(
apriltag
${apriltag_native_src}
${apriltag_resources_src}
${APRILTAGLIB_SRCS}
${APRILTAGLIB_COMMON_SRC}
${TAG_FILES}
)
add_library(apriltag ${apriltag_native_src} ${apriltag_resources_src} ${apriltaglib_src})
set_target_properties(apriltag PROPERTIES DEBUG_POSTFIX "d")

set_property(TARGET apriltag PROPERTY FOLDER "libraries")
target_compile_features(apriltag PUBLIC cxx_std_20)
wpilib_target_warnings(apriltag)
# disable warnings that apriltaglib can't handle
if(MSVC)
target_compile_options(apriltag PRIVATE /wd4018 /wd4005 /wd4996)
else()
target_compile_options(
apriltag
PRIVATE
-Wno-sign-compare
-Wno-gnu-zero-variadic-macro-arguments
-Wno-type-limits
-Wno-format-nonliteral
)
endif()

target_link_libraries(apriltag wpimath)

Expand All @@ -146,6 +133,19 @@ target_include_directories(
$<INSTALL_INTERFACE:${include_dest}/apriltag>
)

install(
DIRECTORY src/main/native/thirdparty/apriltag/include/
DESTINATION "${include_dest}/apriltag"
)
target_include_directories(
apriltag
SYSTEM
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/thirdparty/apriltag/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/thirdparty/apriltag/include/common>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/thirdparty/apriltag/src>
)

install(TARGETS apriltag EXPORT apriltag)
export(TARGETS apriltag FILE apriltag.cmake NAMESPACE apriltag::)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/apriltag")
Expand Down
58 changes: 54 additions & 4 deletions apriltag/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply from: "${rootDir}/shared/resources.gradle"

apply plugin: 'c'

ext {
nativeName = 'apriltag'
devMain = 'edu.wpi.first.apriltag.DevMain'
Expand All @@ -23,14 +25,24 @@ ext {
include '*.cpp'
}
}
apriltagC(CSourceSet) {
source {
srcDirs 'src/main/native/thirdparty/apriltag/src'
include '**/*.c', '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/main/native/thirdparty/apriltag/include',
'src/main/native/thirdparty/apriltag/include/common',
'src/main/native/thirdparty/apriltag/src'
}
}
}
}
}

evaluationDependsOn(':wpimath')

apply from: "${rootDir}/shared/jni/setupBuild.gradle"
apply from: "${rootDir}/shared/apriltaglib.gradle"
apply from: "${rootDir}/shared/opencv.gradle"

dependencies {
Expand All @@ -45,8 +57,48 @@ sourceSets {
}
}

cppHeadersZip {
from('src/main/native/thirdparty/apriltag/include') {
into '/'
}
}

// Suppress sign-compare warnings
nativeUtils.platformConfigs.each {
if (it.name.contains('windows')) {
it.cCompiler.args.add("/wd2220")
it.cCompiler.args.add("/wd4005")
it.cCompiler.args.add("/wd4018")
it.cCompiler.args.add("/wd4244")
it.cCompiler.args.add("/wd4267")
it.cCompiler.args.add("/wd4996")
} else if (it.name.contains('osx')) {
it.cCompiler.args.add("-Wno-format-nonliteral")
it.cCompiler.args.add("-Wno-gnu-zero-variadic-macro-arguments")
it.cCompiler.args.add("-Wno-uninitialized")
it.cCompiler.args.add("-Wno-sign-compare")
it.cCompiler.args.add("-Wno-type-limits")
} else {
it.cCompiler.args.add("-Wno-format-nonliteral")
it.cCompiler.args.add("-Wno-gnu-zero-variadic-macro-arguments")
it.cCompiler.args.add("-Wno-maybe-uninitialized")
it.cCompiler.args.add("-Wno-sign-compare")
it.cCompiler.args.add("-Wno-type-limits")
}
}

model {
components {}
components {
all {
it.sources.each {
it.exportedHeaders {
srcDirs 'src/main/native/include',
'src/main/native/thirdparty/apriltag/include',
'src/main/native/thirdparty/apriltag/include/common'
}
}
}
}
binaries {
all {
if (!it.buildable || !(it instanceof NativeBinarySpec)) {
Expand All @@ -61,8 +113,6 @@ model {
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}

nativeUtils.useRequiredLibrary(it, 'apriltaglib')
}
}
tasks {
Expand Down
Loading

0 comments on commit 47b98d9

Please sign in to comment.