Skip to content

Commit

Permalink
thrust: improve source()
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Jan 10, 2024
1 parent d648f81 commit 7a19ebd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions recipes/thrust/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from conan import ConanFile
from conan.tools.files import copy, get
from conan.tools.files import copy, get, move_folder_contents, rmdir
from conan.tools.layout import basic_layout
from conan.tools.scm import Version

Expand Down Expand Up @@ -53,18 +53,21 @@ def package_id(self):
self.info.clear()

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
if Version(self.version) >= "2.0":
tmpdir = os.path.join(self.export_sources_folder, "tmp")
get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=tmpdir)
move_folder_contents(self, os.path.join(tmpdir, "thrust"), self.source_folder)
rmdir(self, tmpdir)
else:
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def package(self):
source_folder = self.source_folder
if Version(self.version) >= "2.2.0":
source_folder = os.path.join(self.source_folder, "thrust")
copy(self, "LICENSE",
src=source_folder,
src=self.source_folder,
dst=os.path.join(self.package_folder, "licenses"))
for pattern in ["*.h", "*.inl"]:
copy(self, pattern,
src=os.path.join(source_folder, "thrust"),
src=os.path.join(self.source_folder, "thrust"),
dst=os.path.join(self.package_folder, "include", "thrust"))

def package_info(self):
Expand Down

0 comments on commit 7a19ebd

Please sign in to comment.