Skip to content

Commit

Permalink
apriltag: improve patching
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Nov 16, 2023
1 parent 694df68 commit 0dedb91
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 7 deletions.
13 changes: 13 additions & 0 deletions recipes/apriltag/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ sources:
url: "https://github.com/AprilRobotics/apriltag/archive/refs/tags/v3.1.4.tar.gz"
sha256: "ad2888d432e9ddcad2f639f243479934a4cd677ed5d2f8dee3b3418617b64f5d"
patches:
"3.3.0":
- patch_file: "patches/3.3.0-0002-disable-examples.patch"
patch_type: "conan"
patch_description: "Disable building of examples"
"3.2.0":
- patch_file: "patches/3.2.0-0001-fix-cmake.patch"

Check warning on line 20 in recipes/apriltag/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/3.2.0-00 ... ^ (line: 20)
- patch_file: "patches/3.2.0-0002-disable-examples.patch"
patch_type: "conan"
patch_description: "Disable building of examples"
"3.1.7":
- patch_file: "patches/3.1.4-0001-fix-cmake.patch"

Check warning on line 25 in recipes/apriltag/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/3.1.4-00 ... ^ (line: 25)
- patch_file: "patches/3.1.7-0002-disable-examples.patch"
patch_type: "conan"
patch_description: "Disable building of examples"
"3.1.4":
- patch_file: "patches/3.1.4-0001-fix-cmake.patch"

Check warning on line 30 in recipes/apriltag/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/3.1.4-00 ... ^ (line: 30)
- patch_file: "patches/3.1.4-0002-disable-examples.patch"
patch_type: "conan"
patch_description: "Disable building of examples"
12 changes: 5 additions & 7 deletions recipes/apriltag/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ def generate(self):
def _patch_sources(self):
apply_conandata_patches(self)
# Fix DLL installation
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}",
"ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}\n"
"RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}")
# Skip the building and installation of examples
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"# Examples", "return()")
if Version(self.version) <= "3.3.0":
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}",
"ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}\n"
"RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}")

def build(self):
self._patch_sources()
Expand Down
15 changes: 15 additions & 0 deletions recipes/apriltag/all/patches/3.1.4-0002-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()
15 changes: 15 additions & 0 deletions recipes/apriltag/all/patches/3.1.7-0002-disable-examples.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -139,6 +139,7 @@


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

# install example programs
install(TARGETS apriltag_demo RUNTIME DESTINATION bin)
+endif()
15 changes: 15 additions & 0 deletions recipes/apriltag/all/patches/3.2.0-0002-disable-examples.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -162,6 +162,7 @@


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

# install example programs
install(TARGETS apriltag_demo RUNTIME DESTINATION bin)
+endif()
15 changes: 15 additions & 0 deletions recipes/apriltag/all/patches/3.3.0-0002-disable-examples.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -159,6 +159,7 @@
endif (NOT Python3_NOT_FOUND AND NOT Numpy_NOT_FOUND AND PYTHONLIBS_FOUND AND BUILD_PYTHON_WRAPPER)

# Examples
+if (BUILD_EXAMPLES)
# apriltag_demo
add_executable(apriltag_demo example/apriltag_demo.c)
target_link_libraries(apriltag_demo ${PROJECT_NAME})
@@ -177,3 +178,4 @@

# install example programs
install(TARGETS apriltag_demo RUNTIME DESTINATION bin)
+endif()

0 comments on commit 0dedb91

Please sign in to comment.