aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/cmake/conan_imports.jinja
blob: d6b984b482dc80bdee200bfa52e569d89020294f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{%- 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 -%}
{%-     if use_conan2 -%}
{%-         if "bin" in srcdir %}
            {{ shift }}for bindir in dep.cpp_info.bindirs:
                {{ shift }}copy(self, pattern="{{ mask }}", src=bindir, dst=self.build_folder + "../../../../{{ dstdir }}")
{%-             if "swig" in mask %}
                # SWIG recipe under Conan2 does not set SWIG_LIB, do it manually here or else build fails
                if os.path.exists(os.path.join(bindir, "swig")):
                    env = Environment()
                    if not env.vars(self).get("SWIG_LIB"):
                        env.define("SWIG_LIB", os.path.join(bindir, "swiglib"))
{%-             endif -%}
{%-         elif "res" in srcdir %}
            {{ shift }}for resdir in dep.cpp_info.resdirs:
                {{ shift }}copy(self, pattern="{{ mask }}", src=resdir, dst=self.build_folder + "../../../../{{ dstdir }}")
{%-         elif "build" in srcdir %}
            {{ shift }}for builddir in dep.cpp_info.builddirs:
                {{ shift }}copy(self, pattern="{{ mask }}", src=builddir, dst=self.build_folder + "../../../../{{ dstdir }}")
{%-         elif ("src" in srcdir) or ("source" in srcdir) %}
            {{ shift }}for srcdir in dep.cpp_info.srcdirs:
                {{ shift }}copy(self, pattern="{{ mask }}", src=srcdir, dst=self.build_folder + "../../../../{{ dstdir }}")
{%-         elif "lib" in srcdir %}
            {{ shift }}for libdir in dep.cpp_info.libdirs:
                {{ shift }}copy(self, pattern="{{ mask }}", src=libdir, dst=self.build_folder + "../../../../{{ dstdir }}")
{%-         elif "include" in srcdir %}
            {{ shift }}for includedir in dep.cpp_info.includedirs:
                {{ shift }}copy(self, pattern="{{ mask }}", src=includedir, dst=self.build_folder + "../../../../{{ dstdir }}")
{%-         elif "frame" in srcdir %}
            {{ shift }}for framedir in dep.cpp_info.frameworkdirs:
                {{ shift }}copy(self, pattern="{{ mask }}", src=framedir, dst=self.build_folder + "../../../../{{ dstdir }}")
{%-         endif -%}
{%-     else %}
        {{ shift }}self.copy(pattern="{{ mask }}", src="{{ srcdir }}", dst="{{ dstdir }}")
{%-     endif -%}
{%- endfor -%}