Skip to content

Commit

Permalink
(#11635) OneDPL: add versions 2021.6.1 & 2021.7.0
Browse files Browse the repository at this point in the history
* Add recipe for 2021.x versions

* Update conanfile.py

Fix license path

* Use single recipe for all versions

* Update to conan v2 syntax

* Update conanfile.py
  • Loading branch information
jhabermas authored Aug 10, 2022
1 parent a8122f0 commit a6f93da
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 10 deletions.
6 changes: 6 additions & 0 deletions recipes/onedpl/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
sources:
"2021.7.0":
url: "https://github.com/oneapi-src/oneDPL/archive/refs/tags/oneDPL-2021.7.0-release.tar.gz"
sha256: "5484c6de482790206d877a4947dcef6e0a1e082dbfa5c6a5362e18072c4a3de3"
"2021.6.1":
url: "https://github.com/oneapi-src/oneDPL/archive/refs/tags/oneDPL-2021.6.1-release.tar.gz"
sha256: "4995fe2ed2724b89cdb52c4b6c9af22e146b48d2561abdafdaaa06262dbd67c4"
"20200330":
url: "https://github.com/oneapi-src/oneDPL/archive/20200330.tar.gz"
sha256: "3e040f6afdb200229dd58be2cf2a5f1613872f254231b18de2942aaf7e39ae2d"
19 changes: 12 additions & 7 deletions recipes/onedpl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from conans import ConanFile, tools
from conan.tools import files
from conan import ConanFile, tools
from conan.tools import files, scm
import os

required_conan_version = ">=1.43.0"
Expand All @@ -15,15 +15,13 @@ class OneDplConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/oneapi-src/oneDPL"
topics = ("stl", "parallelism")

settings = "os", "arch", "build_type", "compiler"
options = {
"backend": ["tbb", "serial"],
}
default_options = {
"backend": "tbb",
}

no_copy_source = True

@property
Expand All @@ -39,15 +37,22 @@ def package_id(self):

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 11)
if tools.scm.Version(self.version) >= "2021.7.0":
tools.build.check_min_cppstd(self, 17)
else:
tools.build.check_min_cppstd(self, 11)

def source(self):
files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)

def package(self):
version_major = int(tools.scm.Version(self.version).major()[0:4])
self.copy("*", src=os.path.join(self._source_subfolder, "include"), dst="include")
self.copy("*", src=os.path.join(self._source_subfolder, "stdlib"), dst="include")
self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses")
if version_major < 2021:
self.copy("*", src=os.path.join(self._source_subfolder, "stdlib"), dst="include")
self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses")
else:
self.copy("LICENSE.txt", src=os.path.join(self._source_subfolder, "licensing"), dst="licenses")

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "ParallelSTL")
Expand Down
3 changes: 2 additions & 1 deletion recipes/onedpl/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ conan_basic_setup(TARGETS)

find_package(ParallelSTL REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
message(STATUS "OneDPL test version: ${ONEDPL_VERSION_MAJOR}")
add_executable(${PROJECT_NAME} test_package.${ONEDPL_VERSION_MAJOR}.cpp)
target_link_libraries(${PROJECT_NAME} pstl::ParallelSTL)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
6 changes: 4 additions & 2 deletions recipes/onedpl/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conans import ConanFile, CMake, tools
from conans import ConanFile, CMake
from conan import tools
import os


Expand All @@ -8,10 +9,11 @@ class TestPackageConan(ConanFile):

def build(self):
cmake = CMake(self)
cmake.definitions["ONEDPL_VERSION_MAJOR"] = tools.scm.Version(self.deps_cpp_info["onedpl"].version).major()[0:4]
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
if not tools.build.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
12 changes: 12 additions & 0 deletions recipes/onedpl/all/test_package/test_package.2021.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <vector>
#include <oneapi/dpl/execution>
#include <oneapi/dpl/algorithm>

int main()
{
std::vector<int> data(10000000);
auto policy = oneapi::dpl::execution::par_unseq;
std::fill_n(policy, data.begin(), data.size(), -1);

return 0;
}
4 changes: 4 additions & 0 deletions recipes/onedpl/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
versions:
"20200330":
folder: all
"2021.6.1":
folder: all
"2021.7.0":
folder: all

0 comments on commit a6f93da

Please sign in to comment.