conan_imports.jinja 2.5 KB

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