From 9cd012f021a5b0569d81b4ea5bc97bcf892daf41 Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Sun, 10 Oct 2021 03:10:51 +0300 Subject: [PATCH 1/7] libfreenect2: Add new libfreenect2 package. --- recipes/libfreenect2/all/CMakeLists.txt | 7 + recipes/libfreenect2/all/conandata.yml | 8 + recipes/libfreenect2/all/conanfile.py | 106 +++++++++ .../all/patches/0.2.1-fix-cmake.patch | 203 ++++++++++++++++++ .../all/test_package/CMakeLists.txt | 11 + .../all/test_package/conanfile.py | 17 ++ .../all/test_package/test_package.cpp | 7 + recipes/libfreenect2/config.yml | 3 + 8 files changed, 362 insertions(+) create mode 100644 recipes/libfreenect2/all/CMakeLists.txt create mode 100644 recipes/libfreenect2/all/conandata.yml create mode 100644 recipes/libfreenect2/all/conanfile.py create mode 100644 recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch create mode 100644 recipes/libfreenect2/all/test_package/CMakeLists.txt create mode 100644 recipes/libfreenect2/all/test_package/conanfile.py create mode 100644 recipes/libfreenect2/all/test_package/test_package.cpp create mode 100644 recipes/libfreenect2/config.yml diff --git a/recipes/libfreenect2/all/CMakeLists.txt b/recipes/libfreenect2/all/CMakeLists.txt new file mode 100644 index 0000000000000..c986d294c7547 --- /dev/null +++ b/recipes/libfreenect2/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/libfreenect2/all/conandata.yml b/recipes/libfreenect2/all/conandata.yml new file mode 100644 index 0000000000000..620939a7b7e83 --- /dev/null +++ b/recipes/libfreenect2/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "0.2.1": + url: "https://github.com/OpenKinect/libfreenect2/archive/refs/tags/v0.2.1.tar.gz" + sha256: "c09e52c97b0e90335f4762ed5363293ad0fc1ea0064e578b879e7d15cc3559df" +patches: + "0.2.1": + - patch_file: "patches/0.2.1-fix-cmake.patch" + base_path: "source_subfolder" diff --git a/recipes/libfreenect2/all/conanfile.py b/recipes/libfreenect2/all/conanfile.py new file mode 100644 index 0000000000000..b90796af7924e --- /dev/null +++ b/recipes/libfreenect2/all/conanfile.py @@ -0,0 +1,106 @@ +from conans import ConanFile, CMake, tools +import os + + +class Libfreenect2Conan(ConanFile): + name = "libfreenect2" + license = ("Apache-2.0", "GPL-2.0") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/OpenKinect/libfreenect2" + description = "Open source drivers for the Kinect for Windows v2 device." + topics = ("usb", "camera", "kinect") + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_opencl": [True, False], + "with_opengl": [True, False], + "with_vaapi": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_opencl": True, + "with_opengl": True, + "with_vaapi": True, + } + generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt", "patches/*"] + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.os != "Linux": + del self.options.with_vaapi + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("libusb/1.0.24") + self.requires("libjpeg-turbo/2.1.1") + if self.options.get_safe("with_opencl"): + self.requires("opencl-headers/2021.04.29") + self.requires("opencl-icd-loader/2021.04.29") + if self.options.get_safe("with_opengl"): + self.requires("opengl/system") + self.requires("glfw/3.3.4") + if self.options.get_safe("with_vaapi"): + self.requires("vaapi/system") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["BUILD_EXAMPLES"] = False + self._cmake.definitions["BUILD_OPENNI2_DRIVER"] = False + self._cmake.definitions["ENABLE_CXX11"] = True + self._cmake.definitions["ENABLE_OPENCL"] = self.options.get_safe("with_opencl", False) + self._cmake.definitions["ENABLE_CUDA"] = False # TODO: CUDA + self._cmake.definitions["ENABLE_OPENGL"] = self.options.get_safe("with_opengl", False) + self._cmake.definitions["ENABLE_VAAPI"] = self.options.get_safe("with_vaapi", False) + self._cmake.definitions["ENABLE_TEGRAJPEG"] = False # TODO: TegraJPEG + self._cmake.definitions["ENABLE_PROFILING"] = False + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("APACHE20", src=self._source_subfolder, dst="licenses", keep_path=False) + self.copy("GPL2", src=self._source_subfolder, dst="licenses", keep_path=False) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "freenect2" + self.cpp_info.names["cmake_find_package_multi"] = "freenect2" + self.cpp_info.names["pkg_config"] = "freenect2" + self.cpp_info.libs = ["freenect2"] diff --git a/recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch b/recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch new file mode 100644 index 0000000000000..93324460a3d71 --- /dev/null +++ b/recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch @@ -0,0 +1,203 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d8ef047..a81aa8e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -90,8 +90,7 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) + SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) + + # dependencies +-FIND_PACKAGE(PkgConfig) # try find PKGConfig as it will be used if found +-FIND_PACKAGE(LibUSB REQUIRED) ++find_package(libusb REQUIRED) + + # Add includes + INCLUDE_DIRECTORIES( +@@ -99,7 +98,7 @@ INCLUDE_DIRECTORIES( + "${MY_DIR}/include/internal" + ${PROJECT_BINARY_DIR} # for generated headers + ${LIBFREENECT2_THREADING_INCLUDE_DIR} +- ${LibUSB_INCLUDE_DIRS} ++ # ${LibUSB_INCLUDE_DIRS} + ) + + SET(RESOURCES_INC_FILE "${PROJECT_BINARY_DIR}/resources.inc.h") +@@ -157,12 +156,12 @@ SET(SOURCES + ) + + SET(LIBRARIES +- ${LibUSB_LIBRARIES} ++ libusb::libusb + ${LIBFREENECT2_THREADING_LIBRARIES} + ) + + SET(LIBFREENECT2_DLLS +- ${LibUSB_DLL} ++ #${LibUSB_DLL} + ) + + SET(HAVE_VideoToolbox "no (Apple only)") +@@ -193,13 +192,14 @@ ENDIF(APPLE) + + SET(HAVE_VAAPI disabled) + IF(ENABLE_VAAPI) +- IF(PKG_CONFIG_FOUND) +- PKG_CHECK_MODULES(VAAPI libva libva-drm) +- ENDIF() +- FIND_PACKAGE(JPEG) ++ # IF(PKG_CONFIG_FOUND) ++ # PKG_CHECK_MODULES(VAAPI libva libva-drm) ++ # ENDIF() ++ find_package(vaapi REQUIRED) ++ find_package(libjpeg-turbo REQUIRED) + + SET(HAVE_VAAPI no) +- IF(VAAPI_FOUND AND JPEG_FOUND) ++ # IF(VAAPI_FOUND AND JPEG_FOUND) + SET(LIBFREENECT2_WITH_VAAPI_SUPPORT 1) + SET(HAVE_VAAPI yes) + +@@ -209,10 +209,10 @@ IF(ENABLE_VAAPI) + src/vaapi_rgb_packet_processor.cpp + ) + LIST(APPEND LIBRARIES +- ${VAAPI_LIBRARIES} +- ${JPEG_LIBRARY} ++ vaapi::vaapi ++ libjpeg-turbo::libjpeg-turbo + ) +- ENDIF() ++ # ENDIF() + ENDIF(ENABLE_VAAPI) + + SET(HAVE_TegraJPEG disabled) +@@ -237,38 +237,38 @@ IF(ENABLE_TEGRAJPEG) + ENDIF() + + IF(LIBFREENECT2_WITH_VT_SUPPORT) +- FIND_PACKAGE(TurboJPEG) ++ find_package(libjpeg-turbo REQUIRED) + ELSE() + # VAAPI can fail to start at runtime. It must have a fallback. +- FIND_PACKAGE(TurboJPEG REQUIRED) ++ find_package(libjpeg-turbo REQUIRED) + ENDIF() + + SET(HAVE_TurboJPEG no) +-IF(TurboJPEG_FOUND) ++IF(libjpeg-turbo_FOUND) + SET(LIBFREENECT2_WITH_TURBOJPEG_SUPPORT 1) + SET(HAVE_TurboJPEG yes) + +- INCLUDE_DIRECTORIES(${TurboJPEG_INCLUDE_DIRS}) ++ #INCLUDE_DIRECTORIES(${TurboJPEG_INCLUDE_DIRS}) + + LIST(APPEND SOURCES + src/turbo_jpeg_rgb_packet_processor.cpp + ) + + LIST(APPEND LIBRARIES +- ${TurboJPEG_LIBRARIES} ++ libjpeg-turbo::libjpeg-turbo + ) + + LIST(APPEND LIBFREENECT2_DLLS +- ${TurboJPEG_DLL} ++ #${TurboJPEG_DLL} + ) + ENDIF() + + SET(HAVE_OpenGL disabled) + IF(ENABLE_OPENGL) +- FIND_PACKAGE(GLFW3) +- FIND_PACKAGE(OpenGL) ++ find_package(glfw3 REQUIRED) ++ find_package(opengl_system REQUIRED) + SET(HAVE_OpenGL no) +- IF(GLFW3_FOUND AND OPENGL_FOUND) ++ # IF(GLFW3_FOUND AND OPENGL_FOUND) + SET(LIBFREENECT2_WITH_OPENGL_SUPPORT 1) + SET(HAVE_OpenGL yes) + +@@ -276,8 +276,8 @@ IF(ENABLE_OPENGL) + + LIST(APPEND LIBFREENECT2_DLLS ${GLFW3_DLL}) + LIST(APPEND LIBRARIES +- ${GLFW3_LIBRARIES} +- ${OPENGL_gl_LIBRARY} ++ glfw::glfw ++ opengl::opengl + ) + LIST(APPEND SOURCES + src/flextGL.cpp +@@ -292,19 +292,19 @@ IF(ENABLE_OPENGL) + src/shader/stage1.fs + src/shader/stage2.fs + ) +- ENDIF() ++ # ENDIF() + ENDIF(ENABLE_OPENGL) + + SET(HAVE_OpenCL disabled) + IF(ENABLE_OPENCL) +- FIND_PACKAGE(OpenCL) ++ find_package(opencl-icd-loader REQUIRED) + + SET(HAVE_OpenCL no) +- IF(OpenCL_FOUND) ++ #IF(OpenCL_FOUND) + SET(LIBFREENECT2_WITH_OPENCL_SUPPORT 1) + SET(HAVE_OpenCL yes) + +- IF(UNIX AND NOT APPLE) ++ IF(0) + INCLUDE(CheckOpenCLICDLoader) + IF(OpenCL_C_WORKS AND NOT OpenCL_CXX_WORKS) + SET(LIBFREENECT2_OPENCL_ICD_LOADER_IS_OLD 1) +@@ -312,7 +312,7 @@ IF(ENABLE_OPENCL) + MESSAGE(WARNING "Your libOpenCL.so is incompatible with CL/cl.h. Install ocl-icd-opencl-dev to update libOpenCL.so?") + ENDIF() + ENDIF() +- INCLUDE_DIRECTORIES(${OpenCL_INCLUDE_DIRS}) ++ #INCLUDE_DIRECTORIES(${OpenCL_INCLUDE_DIRS}) + + LIST(APPEND SOURCES + src/opencl_depth_packet_processor.cpp +@@ -320,7 +320,7 @@ IF(ENABLE_OPENCL) + ) + + LIST(APPEND LIBRARIES +- ${OpenCL_LIBRARIES} ++ opencl-icd-loader::opencl-icd-loader + ) + + LIST(APPEND RESOURCES +@@ -334,7 +334,7 @@ IF(ENABLE_OPENCL) + IF(UNIX AND NOT APPLE) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") + ENDIF() +- ENDIF(OpenCL_FOUND) ++ #ENDIF(OpenCL_FOUND) + ENDIF(ENABLE_OPENCL) + + SET(HAVE_CUDA disabled) +@@ -385,7 +385,7 @@ IF(ENABLE_CUDA) + ENDIF(ENABLE_CUDA) + + # RPATH handling for CUDA 8.0 libOpenCL.so conflict. See #804. +-IF(HAVE_OpenCL STREQUAL yes AND UNIX AND NOT APPLE) ++IF(0) + FILE(GLOB CUDA_ld_so_conf /etc/ld.so.conf.d/cuda*.conf) + IF(CUDA_ld_so_conf) + MESSAGE(WARNING "Your CUDA installation overrides OpenCL system library path.") +@@ -403,9 +403,9 @@ ENDIF() + # Both command line -DCMAKE_INSTALL_RPATH=... and CMake GUI settings are accepted. + # + # Anyway if wrong versions of libusb is used, errors will be reported explicitly. +-IF(NOT DEFINED CMAKE_INSTALL_RPATH AND NOT ${LibUSB_LIBDIR} MATCHES "^/usr/lib") ++IF(0 AND NOT DEFINED CMAKE_INSTALL_RPATH AND NOT ${LibUSB_LIBDIR} MATCHES "^/usr/lib") + SET(CMAKE_INSTALL_RPATH ${LibUSB_LIBDIR} CACHE STRING "Set RPATH for a private libusb") +-ELSEIF(DEFINED CMAKE_INSTALL_RPATH) ++ELSEIF(0 AND DEFINED CMAKE_INSTALL_RPATH) + SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} CACHE STRING "Set RPATH for a private libusb") + ENDIF() + IF(DEFINED CMAKE_INSTALL_RPATH) diff --git a/recipes/libfreenect2/all/test_package/CMakeLists.txt b/recipes/libfreenect2/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..55427248d4c0d --- /dev/null +++ b/recipes/libfreenect2/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(freenect2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} freenect2::freenect2) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/libfreenect2/all/test_package/conanfile.py b/recipes/libfreenect2/all/test_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/libfreenect2/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libfreenect2/all/test_package/test_package.cpp b/recipes/libfreenect2/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..043111f826b8f --- /dev/null +++ b/recipes/libfreenect2/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + libfreenect2::Freenect2 freenect2; + return EXIT_SUCCESS; +} diff --git a/recipes/libfreenect2/config.yml b/recipes/libfreenect2/config.yml new file mode 100644 index 0000000000000..f975c1e3261f7 --- /dev/null +++ b/recipes/libfreenect2/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.1": + folder: all From 9ab087b92dc7003fdddd7a820311d3d2ccac867f Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Sun, 10 Oct 2021 04:08:02 +0300 Subject: [PATCH 2/7] libfreenect2: Add missing system libraries and Macos frameworks. --- recipes/libfreenect2/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/libfreenect2/all/conanfile.py b/recipes/libfreenect2/all/conanfile.py index b90796af7924e..67e294cd34d2f 100644 --- a/recipes/libfreenect2/all/conanfile.py +++ b/recipes/libfreenect2/all/conanfile.py @@ -104,3 +104,7 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "freenect2" self.cpp_info.names["pkg_config"] = "freenect2" self.cpp_info.libs = ["freenect2"] + if self.settings.os == "Linux": + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) + elif self.settings.os == "Macos": + self.cpp_info.frameworks.append("VideoToolbox") From 670d48065c23c3eaa654b15f3d627e177b373703 Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Sun, 10 Oct 2021 04:49:52 +0300 Subject: [PATCH 3/7] libfreenect2: Add more missing Macos frameworks. --- recipes/libfreenect2/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libfreenect2/all/conanfile.py b/recipes/libfreenect2/all/conanfile.py index 67e294cd34d2f..170570c06ecb8 100644 --- a/recipes/libfreenect2/all/conanfile.py +++ b/recipes/libfreenect2/all/conanfile.py @@ -107,4 +107,4 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) elif self.settings.os == "Macos": - self.cpp_info.frameworks.append("VideoToolbox") + self.cpp_info.frameworks.extend(["VideoToolbox", "CoreFoundation", "CoreMedia", "CoreVideo"]) From 418d4cc98e6d4c80ae5b568e5e77ff3705056b38 Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Sun, 10 Oct 2021 13:50:25 +0300 Subject: [PATCH 4/7] libfreenect2: Add resource generation patch. --- recipes/libfreenect2/all/conandata.yml | 2 + .../patches/0.2.1-generate-resources.patch | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 recipes/libfreenect2/all/patches/0.2.1-generate-resources.patch diff --git a/recipes/libfreenect2/all/conandata.yml b/recipes/libfreenect2/all/conandata.yml index 620939a7b7e83..7fab4fd83db66 100644 --- a/recipes/libfreenect2/all/conandata.yml +++ b/recipes/libfreenect2/all/conandata.yml @@ -6,3 +6,5 @@ patches: "0.2.1": - patch_file: "patches/0.2.1-fix-cmake.patch" base_path: "source_subfolder" + - patch_file: "patches/0.2.1-generate-resources.patch" + base_path: "source_subfolder" diff --git a/recipes/libfreenect2/all/patches/0.2.1-generate-resources.patch b/recipes/libfreenect2/all/patches/0.2.1-generate-resources.patch new file mode 100644 index 0000000000000..36258bc3f57ef --- /dev/null +++ b/recipes/libfreenect2/all/patches/0.2.1-generate-resources.patch @@ -0,0 +1,41 @@ +This patch avoids compiling 'generate_resources_tool' to generate C sources of binary resources +and instead uses CMake functionality to generate the files. This patch is necessary to enable +cross-compiling without setting up host compiling environment. @sh0 + +diff --git a/cmake_modules/GenerateResources.cmake b/cmake_modules/GenerateResources.cmake +index 8616e38..6deea9a 100644 +--- a/cmake_modules/GenerateResources.cmake ++++ b/cmake_modules/GenerateResources.cmake +@@ -1,14 +1,23 @@ + FUNCTION(GENERATE_RESOURCES OUTPUT BASE_FOLDER) + +-ADD_EXECUTABLE(generate_resources_tool +- tools/generate_resources.cpp +-) +- +-ADD_CUSTOM_COMMAND( +- OUTPUT ${OUTPUT} +- COMMAND generate_resources_tool ${BASE_FOLDER} ${ARGN} > ${OUTPUT} +- WORKING_DIRECTORY ${BASE_FOLDER} +- DEPENDS generate_resources_tool ${ARGN} ++set(RES_INDEX "0") ++foreach (SRC_ENTRY ${ARGN}) ++ set(SRC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_ENTRY}") ++ get_filename_component(SRC_NAME "${SRC_ENTRY}" NAME) ++ file(SIZE "${SRC_PATH}" DATA_SIZE) ++ file(READ "${SRC_PATH}" DATA_BIN HEX) ++ string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," DATA_HEX ${DATA_BIN}) ++ string(APPEND RES_CONTENT "static unsigned char resource${RES_INDEX}[] = {\n ${DATA_HEX}\n};\n") ++ string(APPEND RES_DESCRIPTOR " { \"${SRC_NAME}\", resource${RES_INDEX}, sizeof(resource${RES_INDEX}) },\n") ++ math(EXPR RES_INDEX "${RES_INDEX} + 1") ++endforeach () ++file(WRITE "${OUTPUT}" ++ "${RES_CONTENT}" ++ "static ResourceDescriptor resource_descriptors[] = {\n" ++ "${RES_DESCRIPTOR}" ++ " {NULL, NULL, 0},\n" ++ "};\n" ++ "static int resource_descriptors_length = ${RES_INDEX};\n" + ) + + ENDFUNCTION(GENERATE_RESOURCES) From 664e2dd7e0e3db3a5b77220e217a677b0ab081f1 Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Sun, 10 Oct 2021 14:29:04 +0300 Subject: [PATCH 5/7] libfreenect2: Find library name automatically. --- recipes/libfreenect2/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libfreenect2/all/conanfile.py b/recipes/libfreenect2/all/conanfile.py index 170570c06ecb8..605abcfa5b80a 100644 --- a/recipes/libfreenect2/all/conanfile.py +++ b/recipes/libfreenect2/all/conanfile.py @@ -103,7 +103,7 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "freenect2" self.cpp_info.names["cmake_find_package_multi"] = "freenect2" self.cpp_info.names["pkg_config"] = "freenect2" - self.cpp_info.libs = ["freenect2"] + self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) elif self.settings.os == "Macos": From 189c3ebe6fbfe440a04a3d7d8068b8a87701bf50 Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Mon, 11 Oct 2021 23:14:59 +0300 Subject: [PATCH 6/7] libfreenect2: Removed get_safe usage as recommended. --- recipes/libfreenect2/all/conanfile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/libfreenect2/all/conanfile.py b/recipes/libfreenect2/all/conanfile.py index 605abcfa5b80a..dbb951cc733d9 100644 --- a/recipes/libfreenect2/all/conanfile.py +++ b/recipes/libfreenect2/all/conanfile.py @@ -50,10 +50,10 @@ def configure(self): def requirements(self): self.requires("libusb/1.0.24") self.requires("libjpeg-turbo/2.1.1") - if self.options.get_safe("with_opencl"): + if self.options.with_opencl: self.requires("opencl-headers/2021.04.29") self.requires("opencl-icd-loader/2021.04.29") - if self.options.get_safe("with_opengl"): + if self.options.with_opengl: self.requires("opengl/system") self.requires("glfw/3.3.4") if self.options.get_safe("with_vaapi"): @@ -77,9 +77,9 @@ def _configure_cmake(self): self._cmake.definitions["BUILD_EXAMPLES"] = False self._cmake.definitions["BUILD_OPENNI2_DRIVER"] = False self._cmake.definitions["ENABLE_CXX11"] = True - self._cmake.definitions["ENABLE_OPENCL"] = self.options.get_safe("with_opencl", False) + self._cmake.definitions["ENABLE_OPENCL"] = self.options.with_opencl self._cmake.definitions["ENABLE_CUDA"] = False # TODO: CUDA - self._cmake.definitions["ENABLE_OPENGL"] = self.options.get_safe("with_opengl", False) + self._cmake.definitions["ENABLE_OPENGL"] = self.options.with_opengl self._cmake.definitions["ENABLE_VAAPI"] = self.options.get_safe("with_vaapi", False) self._cmake.definitions["ENABLE_TEGRAJPEG"] = False # TODO: TegraJPEG self._cmake.definitions["ENABLE_PROFILING"] = False From 6f83c63cf5bf63ccdf6cf46b32633d0880983605 Mon Sep 17 00:00:00 2001 From: Siim Meerits Date: Thu, 14 Oct 2021 16:51:12 +0300 Subject: [PATCH 7/7] libfreenect2: Test package update. --- recipes/libfreenect2/all/test_package/CMakeLists.txt | 7 ++++--- recipes/libfreenect2/all/test_package/conanfile.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/libfreenect2/all/test_package/CMakeLists.txt b/recipes/libfreenect2/all/test_package/CMakeLists.txt index 55427248d4c0d..5742a7e29c0d5 100644 --- a/recipes/libfreenect2/all/test_package/CMakeLists.txt +++ b/recipes/libfreenect2/all/test_package/CMakeLists.txt @@ -2,10 +2,11 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -find_package(freenect2 REQUIRED CONFIG) +find_package(freenect2 REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} freenect2::freenect2) +target_link_libraries(${PROJECT_NAME} PRIVATE ${freenect2_LIBRARIES}) +target_include_directories(${PROJECT_NAME} PRIVATE ${freenect2_INCLUDE_DIRS}) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/libfreenect2/all/test_package/conanfile.py b/recipes/libfreenect2/all/test_package/conanfile.py index 49a3a66ea5bad..3da371b660e0a 100644 --- a/recipes/libfreenect2/all/test_package/conanfile.py +++ b/recipes/libfreenect2/all/test_package/conanfile.py @@ -4,7 +4,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "cmake", "cmake_find_package" def build(self): cmake = CMake(self)