Skip to content
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

apriltag: add v3.4.2, remove old versions #20017

Merged
merged 14 commits into from
Sep 12, 2024
21 changes: 7 additions & 14 deletions recipes/apriltag/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
sources:
"3.4.2":
url: "https://github.com/AprilRobotics/apriltag/archive/refs/tags/v3.4.2.tar.gz"
sha256: "7e021bab89f136aa3cf736f772a635aaa353f93f6f8859495f4bd8c519be4805"
"3.1.4":
url: "https://github.com/AprilRobotics/apriltag/archive/refs/tags/v3.1.4.tar.gz"
sha256: "ad2888d432e9ddcad2f639f243479934a4cd677ed5d2f8dee3b3418617b64f5d"
"3.1.2":
url: "https://github.com/AprilRobotics/apriltag/archive/3.1.2.tar.gz"
sha256: "2759b044ff1dc9ef725e7c456b49283399ef78deee24754bc3617cbe369584f1"
"3.1.1":
url: "https://github.com/AprilRobotics/apriltag/archive/3.1.1.tar.gz"
sha256: "7349e1fcc8b2979230b46c0d62ccf2ba2bbd611d87ef80cfd37ffe74425f5efb"
patches:
"3.1.4":
- patch_file: "patches/3.1.4-0001-fix-cmake.patch"
- patch_file: "patches/3.1.1-0002-windows-nominmax.patch"
"3.1.2":
- patch_file: "patches/3.1.2-0001-fix-cmake.patch"
- patch_file: "patches/3.1.1-0002-windows-nominmax.patch"
"3.1.1":
- patch_file: "patches/3.1.1-0001-fix-cmake.patch"
- patch_file: "patches/3.1.1-0002-windows-nominmax.patch"
- patch_file: "patches/3.1.4-0001-disable-examples.patch"
patch_type: "conan"
patch_description: "Disable building of examples"
- patch_file: "patches/3.1.4-0002-fix-cmake.patch"
38 changes: 23 additions & 15 deletions recipes/apriltag/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
Expand All @@ -11,10 +11,10 @@

class ApriltagConan(ConanFile):
name = "apriltag"
description = ("AprilTag is a visual fiducial system, useful for a wide variety of tasks \
including augmented reality, robotics, and camera calibration")
description = ("AprilTag is a visual fiducial system, useful for a wide variety of tasks"
" including augmented reality, robotics, and camera calibration")
homepage = "https://april.eecs.umich.edu/software/apriltag"
topics = ("robotics",)
topics = ("robotics", "computer-vision", "augmented-reality", "camera-calibration")
license = "BSD-2-Clause"
url = "https://github.com/conan-io/conan-center-index"
package_type = "library"
Expand Down Expand Up @@ -45,24 +45,28 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
if is_msvc(self):
if is_msvc(self) and Version(self.version) < "3.3.0":
self.requires("pthreads4w/3.0.0", transitive_headers=True)

def validate(self):
if is_msvc(self) and self.settings.build_type == "Debug":
# segfault in test package...
raise ConanInvalidConfiguration(f"{self.ref} doesn't support Debug with msvc yet")
def build_requirements(self):
if Version(self.version) >= "3.4.0":
self.tool_requires("cmake/[>=3.16 <4]")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
VirtualBuildEnv(self).generate()
tc = CMakeToolchain(self)
if Version(self.version) >= "3.1.4":
tc.variables["BUILD_PYTHON_WRAPPER"] = False
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
tc.cache_variables["BUILD_EXAMPLES"] = False
tc.variables["BUILD_PYTHON_WRAPPER"] = False
if Version(self.version) < "3.4.0":
# Newer versions set it in the project CMakelists.txt
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
if self.settings.os == "Windows":
tc.preprocessor_definitions["NOMINMAX"] = ""
tc.generate()
if is_msvc(self):
if is_msvc(self) and Version(self.version) < "3.3.0":
deps = CMakeDeps(self)
deps.generate()

Expand All @@ -73,7 +77,7 @@ def build(self):
cmake.build()

def package(self):
copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "share"))
Expand All @@ -83,9 +87,13 @@ def package_info(self):
self.cpp_info.set_property("cmake_file_name", "apriltag")
self.cpp_info.set_property("cmake_target_name", "apriltag::apriltag")
self.cpp_info.set_property("pkg_config_name", "apriltag")
self.cpp_info.libs = ["apriltag"]
suffix = ""
if self.settings.build_type == "Debug" and Version(self.version) >= "3.2.0":
suffix = "d"
self.cpp_info.libs = ["apriltag" + suffix]
self.cpp_info.includedirs.append(os.path.join("include", "apriltag"))
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["m", "pthread"]
elif self.settings.os == "Windows":
self.cpp_info.system_libs = ["winmm"]
self.cpp_info.defines.append("NOMINMAX")
67 changes: 0 additions & 67 deletions recipes/apriltag/all/patches/3.1.1-0001-fix-cmake.patch

This file was deleted.

20 changes: 0 additions & 20 deletions recipes/apriltag/all/patches/3.1.1-0002-windows-nominmax.patch

This file was deleted.

83 changes: 0 additions & 83 deletions recipes/apriltag/all/patches/3.1.2-0001-fix-cmake.patch

This file was deleted.

15 changes: 15 additions & 0 deletions recipes/apriltag/all/patches/3.1.4-0001-disable-examples.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -101,6 +101,7 @@


# Examples
+if(BUILD_EXAMPLES)
# apriltag_demo
add_executable(apriltag_demo example/apriltag_demo.c)
target_link_libraries(apriltag_demo apriltag)
@@ -115,3 +116,4 @@

# install example programs
install(TARGETS apriltag_demo RUNTIME DESTINATION bin)
+endif()
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@@ -1,26 +1,31 @@
-cmake_minimum_required(VERSION 3.1)
-project(apriltag)
+cmake_minimum_required(VERSION 3.8)
+cmake_minimum_required(VERSION 3.15)
+project(apriltag LANGUAGES C)

-find_package(OpenCV QUIET)
Expand Down Expand Up @@ -40,30 +40,11 @@
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 3 VERSION 3.1.0)
@@ -33,6 +37,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC

# install library
@@ -35,6 +30,7 @@
install(TARGETS ${PROJECT_NAME} EXPORT apriltagTargets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
@@ -102,16 +107,13 @@ endif (NOT Python3_NOT_FOUND AND NOT Numpy_NOT_FOUND AND PYTHONLIBS_FOUND AND BU

# Examples
# apriltag_demo
-add_executable(apriltag_demo example/apriltag_demo.c)
-target_link_libraries(apriltag_demo apriltag)

# opencv_demo
-if(OpenCV_FOUND)
+if(0)
add_executable(opencv_demo example/opencv_demo.cc)
target_link_libraries(opencv_demo apriltag ${OpenCV_LIBRARIES})
set_target_properties(opencv_demo PROPERTIES CXX_STANDARD 11)
install(TARGETS opencv_demo RUNTIME DESTINATION bin)
-endif(OpenCV_FOUND)
+endif()

# install example programs
-install(TARGETS apriltag_demo RUNTIME DESTINATION bin)
# install header file hierarchy
2 changes: 1 addition & 1 deletion recipes/apriltag/all/test_package/test_package.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ int main(int argc, char *argv[])
apriltag_family_t *tf = tagStandard41h12_create();
apriltag_detector_add_family(td, tf);

tagStandard41h12_destroy(tf);
apriltag_detector_destroy(td);
tagStandard41h12_destroy(tf);

printf("Apriltag test_package ran successfully\n");

Expand Down
6 changes: 2 additions & 4 deletions recipes/apriltag/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
versions:
"3.1.4":
folder: all
"3.1.2":
"3.4.2":
folder: all
"3.1.1":
"3.1.4":
folder: all
Loading