aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/hardcoded-cmake/conanfile.py.jinja
diff options
context:
space:
mode:
authordimdim11 <dimdim11@yandex-team.com>2024-07-08 10:06:07 +0300
committerdimdim11 <dimdim11@yandex-team.com>2024-07-08 10:19:09 +0300
commitfe8133de2464d069bfedc6f65b5156c12db4aa2f (patch)
tree26e2eaa1680a483082a04ed28cebebb8467036f3 /build/export_generators/hardcoded-cmake/conanfile.py.jinja
parent8559b4b939beae62d76b5f217510f07bf8389a76 (diff)
downloadydb-fe8133de2464d069bfedc6f65b5156c12db4aa2f.tar.gz
Conan2 support by use_conan2 flag in yexport.toml
Conan2 support by use_conan2 flag in yexport.toml 53b2f6c57e617e4efacd04b2205da51579655ac8
Diffstat (limited to 'build/export_generators/hardcoded-cmake/conanfile.py.jinja')
-rw-r--r--build/export_generators/hardcoded-cmake/conanfile.py.jinja71
1 files changed, 71 insertions, 0 deletions
diff --git a/build/export_generators/hardcoded-cmake/conanfile.py.jinja b/build/export_generators/hardcoded-cmake/conanfile.py.jinja
new file mode 100644
index 0000000000..65c9460edd
--- /dev/null
+++ b/build/export_generators/hardcoded-cmake/conanfile.py.jinja
@@ -0,0 +1,71 @@
+from conan import ConanFile
+
+{%- if use_conan2 %}
+
+from conan.tools.files import copy
+from conan.tools.cmake import CMakeToolchain, CMakeDeps, cmake_layout
+
+{%- endif %}
+
+
+class App(ConanFile):
+
+ settings = "os", "compiler", "build_type", "arch"
+
+ options = {
+{%- for conan_option in conan_options -%}
+{%- set option_and_value = rsplit(conan_option, "=", 2) %}"{{ option_and_value[0] }}": "{{ option_and_value[1] }}"
+{%- if not loop.last -%}, {% endif -%}
+{%- endfor -%}
+}
+
+ requires =
+{%- for conan_require in conan_packages %} "{{ conan_require }}"
+{%- if not loop.last -%},{%- endif -%}
+{%- endfor %}
+
+ tool_requires =
+{%- for conan_tool_require in conan_tool_packages %} "{{ conan_tool_require }}"
+{%- if not loop.last -%},{%- endif -%}
+{%- endfor %}
+
+{%- if use_conan2 %}
+
+ def generate(self):
+ CMakeDeps(self).generate()
+ CMakeToolchain(self).generate()
+
+ for dep in self.dependencies.values():
+ if dep.cpp_info.bindirs:
+{%- for conan_import in conan_imports -%}
+{%- set search_and_dstdir = rsplit(conan_import|trim, "->", 2) -%}
+{%- set search = search_and_dstdir[0]|trim -%}
+{%- set dstdir = search_and_dstdir[1]|trim -%}
+{%- set srcdir_and_mask = rsplit(search, ",", 2) -%}
+{%- set srcdir = srcdir_and_mask[0]|trim -%}
+{%- set mask = srcdir_and_mask[1]|trim %}
+ copy(self, pattern="{{ mask }}", src=dep.cpp_info.bindirs[0], dst=self.build_folder + "../../../../{{ dstdir }}")
+{%- endfor %}
+
+ def layout(self):
+ cmake_layout(self)
+
+{%- else -%}
+
+ generators = "cmake_find_package", "cmake_paths"
+
+ def imports(self):
+{%- for conan_import in conan_imports -%}
+{%- set search_and_dstdir = rsplit(conan_import|trim, "->", 2) -%}
+{%- set search = search_and_dstdir[0]|trim -%}
+{%- set dstdir = search_and_dstdir[1]|trim -%}
+{%- set srcdir_and_mask = rsplit(search, ",", 2) -%}
+{%- set srcdir = srcdir_and_mask[0]|trim -%}
+{%- set mask = srcdir_and_mask[1]|trim %}
+ self.copy(pattern="{{ mask }}", src="{{ srcdir }}", dst="{{ dstdir }}")
+{%- endfor %}
+
+ def layout(self):
+ cmake_layout(self)
+
+{%- endif %}