-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix bugs in igntion-tools recipe #11309
Changes from all commits
755c364
8d0da44
5d4bfef
746d389
a2b8f6b
492fff5
6b5a21a
a199f37
22a6191
5a2203d
eb98ff0
5acf4f6
db3772e
27a7f97
972cd5a
432f607
862cede
7a71c2b
25ca98c
645a507
2efe7cd
8379fd7
566276a
ae68bd3
dfd79a3
3b54cde
1ff89f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import os | ||
from conans import CMake, ConanFile, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import conan.tools.files | ||
import textwrap | ||
|
||
required_conan_version = ">=1.29.1" | ||
required_conan_version = ">=1.43.0" | ||
|
||
|
||
class IgnitionToolsConan(ConanFile): | ||
name = "ignition-tools" | ||
license = "Apache-2.0" | ||
homepage = "https://ignitionrobotics.org/libs/tools" | ||
homepage = "https://gazebosim.org/libs/tools" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
description = "Provides general purpose classes and functions designed for robotic applications.." | ||
topics = ("ignition", "robotics", "tools") | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = {"shared": [True, False], "fPIC": [True, False]} | ||
default_options = {"shared": False, "fPIC": True} | ||
generators = "cmake", "cmake_find_package_multi" | ||
generators = "cmake", "cmake_find_package" | ||
exports_sources = "CMakeLists.txt", "patches/**" | ||
_cmake = None | ||
|
||
|
@@ -50,9 +52,7 @@ def validate(self): | |
min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) | ||
if not min_version: | ||
self.output.warn( | ||
"{} recipe lacks information about the {} compiler support.".format( | ||
self.name, self.settings.compiler | ||
) | ||
f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support." | ||
) | ||
else: | ||
if tools.Version(self.settings.compiler.version) < min_version: | ||
|
@@ -65,7 +65,8 @@ def validate(self): | |
) | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version],destination=self._source_subfolder, strip_root=True) | ||
tools.get(**self.conan_data["sources"][self.version], | ||
strip_root=True, destination=self._source_subfolder) | ||
|
||
def _configure_cmake(self): | ||
if self._cmake is not None: | ||
|
@@ -93,13 +94,47 @@ def package(self): | |
for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: | ||
tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), dll_pattern_to_remove) | ||
|
||
self._create_cmake_module_variables( | ||
os.path.join(self.package_folder, self._module_file_rel_path), | ||
tools.Version(self.version)) | ||
|
||
@staticmethod | ||
def _create_cmake_module_variables(module_file, version): | ||
content = textwrap.dedent("""\ | ||
set(IGN_TOOLS_CONAN_PACKAGE_DIR ${{CMAKE_CURRENT_LIST_DIR/../..}}) | ||
list(APPEND IGNITION-TOOLS_BINARY_DIRS ${{IGN_TOOLS_CONAN_PACKAGE_DIR}}/bin) | ||
list(APPEND IGNITION-TOOLS_INCLUDE_DIRS ${{IGN_TOOLS_CONAN_PACKAGE_DIR}}/include) | ||
list(APPEND IGNITION-TOOLS_LIBRARY_DIRS ${{IGN_TOOLS_CONAN_PACKAGE_DIR}}/libs) | ||
list(APPEND IGNITION-TOOLS_CFLAGS -I/${{IGN_TOOLS_CONAN_PACKAGE_DIR}}/include) | ||
list(APPEND IGNITION-TOOLS_CXX_FLAGS -std=c++11) | ||
set(ignition-tools{major}_VERSION_MAJOR {major}) | ||
set(ignition-tools{major}_VERSION_MINOR {minor}) | ||
set(ignition-tools{major}_VERSION_PATCH {patch}) | ||
set(ignition-tools{major}_VERSION_STRING "{major}.{minor}.{patch}") | ||
""".format(major=version.major, minor=version.minor, patch=version.patch)) | ||
tools.save(module_file, content) | ||
|
||
def package_info(self): | ||
version_major = tools.Version(self.version).major | ||
self.cpp_info.names["cmake_find_package"] = "ignition-tools{}".format(version_major) | ||
self.cpp_info.names["cmake_find_package_multi"] = "ignition-tools{}".format(version_major) | ||
|
||
self.cpp_info.components["libignition-tools"].libs = ["ignition-tools-backward"] | ||
self.cpp_info.components["libignition-tools"].includedirs.append("include/ignition/tools{}".format(version_major)) | ||
self.cpp_info.components["libignition-tools"].names["cmake_find_package"] = "ignition-tools{}".format(version_major) | ||
self.cpp_info.components["libignition-tools"].names["cmake_find_package_multi"] = "ignition-tools{}".format(version_major) | ||
self.cpp_info.components["libignition-tools"].names["pkg_config"] = "ignition-tools{}".format(version_major) | ||
lib_name = "ignition-tools" | ||
self.cpp_info.names["cmake_find_package"] = lib_name | ||
self.cpp_info.names["cmake_find_package_multi"] = lib_name | ||
self.cpp_info.set_property("cmake_file_name", "ignition-tools") | ||
self.cpp_info.components["backward"].names["cmake_find_package"] = "backward" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure whats the best option here but the targets are not correctly exporting from the upstream project... Does this match the projects intentions? I am not sure I can answer that... https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#exporting-targets calls out https://github.com/gazebosim/gz-tools/blob/ignition-tools_1.4.0/src/CMakeLists.txt#L29 main gets closer but it's still not doing something consumers would rely on AFAIK. |
||
self.cpp_info.components["backward"].names["cmake_find_package_multi"] = "backward" | ||
self.cpp_info.components["backward"].bindirs = ["bin"] | ||
|
||
self.cpp_info.components["backward"].libs = [] | ||
self.cpp_info.components["backward"].includedirs = [] | ||
if int(tools.Version(self.version).minor) > 2: | ||
self.cpp_info.components["backward"].libs.append(lib_name +"-backward") | ||
self.cpp_info.components["backward"].builddirs.append(self._module_dir_rel_path) | ||
self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) | ||
self.cpp_info.components["backward"].build_modules["cmake_find_package"] = [self._module_file_rel_path] | ||
self.cpp_info.components["backward"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] | ||
|
||
@property | ||
def _module_dir_rel_path(self): | ||
return os.path.join("lib", "cmake") | ||
@property | ||
def _module_file_rel_path(self): | ||
return os.path.join(self._module_dir_rel_path, f"conan-official-{self.name}-variables.cmake") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcar87 We have another check sum change for you to label 👏