Skip to content

Add apriltag support to windows #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions patch/ros-jazzy-apriltag-detector-mit.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/apriltag_detector_mit/CMakeLists.txt b/apriltag_detector_mit/CMakeLists.txt
index d2d0b53..c204871 100644
--- a/apriltag_detector_mit/CMakeLists.txt
+++ b/apriltag_detector_mit/CMakeLists.txt
@@ -16,7 +16,10 @@
cmake_minimum_required(VERSION 3.16)
project(apriltag_detector_mit)

-add_compile_options(-Wall -Wextra -Wpedantic -Werror)
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ add_compile_options(-Wall -Wextra -Wpedantic -Werror)
+endif()
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# find dependencies
find_package(ament_cmake REQUIRED)
@@ -62,8 +65,7 @@ ament_export_libraries(${PROJECT_NAME})

install(
TARGETS ${PROJECT_NAME}
- EXPORT ${PROJECT_NAME}_export
- DESTINATION lib)
+ EXPORT ${PROJECT_NAME}_export)

if(BUILD_TESTING)
find_package(ament_cmake REQUIRED)
26 changes: 26 additions & 0 deletions patch/ros-jazzy-apriltag-detector-umich.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/apriltag_detector_umich/CMakeLists.txt b/apriltag_detector_umich/CMakeLists.txt
index 1899f1e..18d8fbd 100644
--- a/apriltag_detector_umich/CMakeLists.txt
+++ b/apriltag_detector_umich/CMakeLists.txt
@@ -16,7 +16,10 @@
cmake_minimum_required(VERSION 3.16)
project(apriltag_detector_umich)

-add_compile_options(-Wall -Wextra -Wpedantic -Werror)
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ add_compile_options(-Wall -Wextra -Wpedantic -Werror)
+endif()
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# find dependencies
find_package(ament_cmake REQUIRED)
@@ -64,8 +67,7 @@ ament_export_libraries(${PROJECT_NAME})

install(
TARGETS ${PROJECT_NAME}
- EXPORT ${PROJECT_NAME}_export
- DESTINATION lib)
+ EXPORT ${PROJECT_NAME}_export)

if(BUILD_TESTING)
find_package(ament_cmake REQUIRED)
33 changes: 33 additions & 0 deletions patch/ros-jazzy-apriltag-mit.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31c98e5..5ac04e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,10 @@ project(apriltag_mit VERSION 1.0.0 LANGUAGES CXX)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)

+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
+add_compile_definitions(_USE_MATH_DEFINES)
+
# set(CMAKE_CXX_CLANG_TIDY clang-tidy)

find_package(Eigen3 REQUIRED)
diff --git a/src/TagFamily.cc b/src/TagFamily.cc
index 023094b..0226a43 100644
--- a/src/TagFamily.cc
+++ b/src/TagFamily.cc
@@ -102,6 +102,13 @@ code_t Rotate90DegCwise(code_t w, int d) {
return wr;
}

+#ifdef _MSC_VER
+# include <intrin.h>
+unsigned __builtin_popcountll( unsigned long long data){
+ return __popcnt(data) + __popcnt(data >> 32);
+}
+#endif
+
unsigned HammingDistance(code_t a, code_t b) {
// Because code_t is unsigned long long
return __builtin_popcountll(a ^ b);
5 changes: 5 additions & 0 deletions vinca_win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ packages_select_by_deps:

- apriltag_detector

- apriltag_detector_umich

- apriltag_detector_mit


- ament_cmake_black

- behaviortree_cpp
Expand Down
Loading