Skip to content

Commit e5070e6

Browse files
authored
(conan-io#19857) llvm-openmp: add versions v13, v14, v15, v16 and v17-rc4
* llvm-openmp: add versions v13, v14, v15, v16 and v17-rc4 * llvm-openmp: disable armv8 Debug builds * llvm-openmp: disable LIBOMPTARGET_LLVM_INCLUDE_DIRS check * llvm-openmp: add build_libomptarget, default to False libomptarget is a relatively advanced library and much more complex to configure and build than libomp. * llvm-openmp: more robust version checks * llvm-openmp: bump v17 * llvm-openmp: fix copying of sources for v14 * llvm-openmp: rmdir lib/cmake
1 parent ec2feee commit e5070e6

14 files changed

+407
-103
lines changed

recipes/llvm-openmp/all/conandata.yml

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
sources:
2+
"17.0.4":
3+
openmp:
4+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.4/openmp-17.0.4.src.tar.xz"
5+
sha256: "535cbcca075430cb2d4e54a8062cb9646938170aeb72d359f13183f2a31b701a"
6+
cmake:
7+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.4/cmake-17.0.4.src.tar.xz"
8+
sha256: "1a5cbe4a1fcda56ecdd80f42c3437060a28c97ec31de1748f6ba6aa84948fb0f"
9+
"16.0.6":
10+
openmp:
11+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/openmp-16.0.6.src.tar.xz"
12+
sha256: "a2536f06373774f2829d892b72eea5f97bab20e69b26b03042d947f992eb8e38"
13+
cmake:
14+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/cmake-16.0.6.src.tar.xz"
15+
sha256: "39d342a4161095d2f28fb1253e4585978ac50521117da666e2b1f6f28b62f514"
16+
"15.0.7":
17+
openmp:
18+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/openmp-15.0.7.src.tar.xz"
19+
sha256: "3f168d38e7a37b928dcb94b33ce947f75d81eef6fa6a4f9d16b6dc5511c07358"
20+
cmake:
21+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/cmake-15.0.7.src.tar.xz"
22+
sha256: "8986f29b634fdaa9862eedda78513969fe9788301c9f2d938f4c10a3e7a3e7ea"
23+
"14.0.6":
24+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/openmp-14.0.6.src.tar.xz"
25+
sha256: "4f731ff202add030d9d68d4c6daabd91d3aeed9812e6a5b4968815cfdff0eb1f"
26+
"13.0.1":
27+
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/openmp-13.0.1.src.tar.xz"
28+
sha256: "6b79261371616c31fea18cd3ee1797c79ee38bcaf8417676d4fa366a24c96b4f"
229
"12.0.1":
330
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/openmp-12.0.1.src.tar.xz"
431
sha256: "60fe79440eaa9ebf583a6ea7f81501310388c02754dbe7dc210776014d06b091"
@@ -15,15 +42,46 @@ sources:
1542
url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/openmp-8.0.1.src.tar.xz"
1643
sha256: "3e85dd3cad41117b7c89a41de72f2e6aa756ea7b4ef63bb10dcddf8561a7722c"
1744
patches:
45+
"17.0.0-rc4":
46+
- patch_file: "patches/17/0001-disable-build-testing.patch"
47+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
48+
patch_type: "conan"
49+
"16.0.6":
50+
- patch_file: "patches/16/0001-disable-build-testing.patch"
51+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
52+
patch_type: "conan"
53+
"15.0.7":
54+
- patch_file: "patches/15/0001-disable-build-testing.patch"
55+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
56+
patch_type: "conan"
57+
"14.0.6":
58+
- patch_file: "patches/14/0001-disable-build-testing.patch"
59+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
60+
patch_type: "conan"
61+
"13.0.1":
62+
- patch_file: "patches/13/0001-disable-build-testing.patch"
63+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
64+
patch_type: "conan"
1865
"12.0.1":
19-
- patch_file: "patches/0001-disable-build-testing_12.0.1.patch"
20-
- patch_file: "patches/0002-disable-omp-target_12.0.1.patch"
66+
- patch_file: "patches/12/0001-disable-build-testing.patch"
67+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
68+
patch_type: "conan"
2169
"11.1.0":
22-
- patch_file: "patches/0001-disable-build-testing_11.1.0.patch"
23-
- patch_file: "patches/0003-fix-armv8-build_11.1.0.patch"
70+
- patch_file: "patches/11/0001-disable-build-testing.patch"
71+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
72+
patch_type: "conan"
73+
- patch_file: "patches/11/0002-fix-armv8-build.patch"
74+
patch_description: "Fix build issues on armv8 architecture"
75+
patch_type: "portability"
2476
"10.0.0":
25-
- patch_file: "patches/0001-disable-build-testing_10.0.0.patch"
77+
- patch_file: "patches/10/0001-disable-build-testing.patch"
78+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
79+
patch_type: "conan"
2680
"9.0.1":
27-
- patch_file: "patches/0001-disable-build-testing.patch"
81+
- patch_file: "patches/8/0001-disable-build-testing.patch"
82+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
83+
patch_type: "conan"
2884
"8.0.1":
29-
- patch_file: "patches/0001-disable-build-testing.patch"
85+
- patch_file: "patches/8/0001-disable-build-testing.patch"
86+
patch_description: "Disable building of tools, gdb-plugin, tests and docs"
87+
patch_type: "conan"

recipes/llvm-openmp/all/conanfile.py

Lines changed: 79 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
from conan import ConanFile
55
from conan.errors import ConanInvalidConfiguration
66
from conan.tools.apple import is_apple_os
7+
from conan.tools.build import check_min_cppstd
78
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
8-
from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, save
9+
from conan.tools.env import VirtualBuildEnv
10+
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, save, move_folder_contents, rmdir
911
from conan.tools.scm import Version
1012

1113
required_conan_version = ">=1.53.0"
@@ -21,26 +23,27 @@ class LLVMOpenMpConan(ConanFile):
2123
"implementation.")
2224
license = "Apache-2.0 WITH LLVM-exception"
2325
url = "https://github.com/conan-io/conan-center-index"
24-
homepage = "https://github.com/llvm/llvm-project/tree/master/openmp"
26+
homepage = "https://github.com/llvm/llvm-project/blob/main/openmp"
2527
topics = ("llvm", "openmp", "parallelism")
2628

2729
package_type = "library"
2830
settings = "os", "arch", "compiler", "build_type"
2931
options = {
3032
"shared": [True, False],
3133
"fPIC": [True, False],
34+
"build_libomptarget": [True, False],
3235
}
3336
default_options = {
3437
"shared": False,
3538
"fPIC": True,
39+
"build_libomptarget": False,
40+
}
41+
options_description = {
42+
"build_libomptarget": (
43+
"Build the LLVM OpenMP Offloading Runtime Library (libomptarget) "
44+
"in addition to the OpenMP Runtime Library (libomp)."
45+
)
3646
}
37-
38-
def export_sources(self):
39-
export_conandata_patches(self)
40-
41-
def config_options(self):
42-
if self.settings.os == "Windows":
43-
del self.options.fPIC
4447

4548
def _supports_compiler(self):
4649
supported_compilers_by_os = {
@@ -51,40 +54,93 @@ def _supports_compiler(self):
5154
the_compiler, the_os = self.settings.compiler.value, self.settings.os.value
5255
return the_compiler in supported_compilers_by_os.get(the_os, [])
5356

57+
@property
58+
def _compilers_minimum_version(self):
59+
return {
60+
"gcc": "7",
61+
"clang": "6",
62+
"apple-clang": "10",
63+
}
64+
65+
@property
66+
def _version_major(self):
67+
return Version(self.version).major
68+
69+
def export_sources(self):
70+
export_conandata_patches(self)
71+
72+
def config_options(self):
73+
if self.settings.os == "Windows":
74+
del self.options.fPIC
75+
5476
def configure(self):
5577
if self.options.shared:
5678
self.options.rm_safe("fPIC")
57-
if not self._supports_compiler():
58-
raise ConanInvalidConfiguration("llvm-openmp doesn't support compiler: {} on OS: {}.".
59-
format(self.settings.compiler, self.settings.os))
6079

80+
def requirements(self):
81+
if self.options.build_libomptarget and self._version_major >= 13:
82+
self.requires(f"llvm-core/{self.version}")
6183

6284
def layout(self):
6385
cmake_layout(self, src_folder="src")
6486

6587
def validate(self):
66-
if (
67-
Version(self.version) <= "10.0.0"
68-
and is_apple_os(self)
69-
and self.settings.arch == "armv8"
70-
):
71-
raise ConanInvalidConfiguration("ARM v8 not supported")
88+
if not self._supports_compiler():
89+
raise ConanInvalidConfiguration("llvm-openmp doesn't support compiler: "
90+
f"{self.settings.compiler} on OS: {self.settings.os}.")
91+
if self._version_major >= 17:
92+
if self.settings.compiler.cppstd:
93+
check_min_cppstd(self, 17)
94+
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
95+
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
96+
raise ConanInvalidConfiguration(f"{self.ref} requires C++17, which your compiler does not support.")
97+
if is_apple_os(self) and self.settings.arch == "armv8":
98+
if self._version_major <= 10:
99+
raise ConanInvalidConfiguration("ARM v8 not supported")
100+
if self._version_major != 11 and self.settings.build_type == "Debug":
101+
# All versions except for v11 crash with a segfault for the simple test_package.cpp test
102+
raise ConanInvalidConfiguration("Debug mode not supported for ARM v8")
103+
104+
def build_requirements(self):
105+
if self._version_major >= 17:
106+
self.tool_requires("cmake/[>=3.20 <4]")
72107

73108
def source(self):
74-
get(self, **self.conan_data["sources"][self.version], strip_root=True)
109+
if self._version_major >= 15:
110+
get(self, **self.conan_data["sources"][self.version]["openmp"], strip_root=True)
111+
get(self, **self.conan_data["sources"][self.version]["cmake"], strip_root=True, destination=self.export_sources_folder)
112+
copy(self, "*.cmake",
113+
src=os.path.join(self.export_sources_folder, "Modules"),
114+
dst=os.path.join(self.source_folder, "cmake"))
115+
elif self._version_major == 14:
116+
# v14 source archives also includes a cmake/ directory in the archive root
117+
get(self, **self.conan_data["sources"][self.version], destination=self.export_sources_folder)
118+
move_folder_contents(self, os.path.join(self.export_sources_folder, f"openmp-{self.version}.src"), self.source_folder)
119+
copy(self, "*.cmake",
120+
src=os.path.join(self.export_sources_folder, "cmake", "Modules"),
121+
dst=os.path.join(self.source_folder, "cmake"))
122+
else:
123+
get(self, **self.conan_data["sources"][self.version], strip_root=True)
75124

76125
def generate(self):
126+
env = VirtualBuildEnv(self)
127+
env.generate()
77128
tc = CMakeToolchain(self)
78129
tc.variables["OPENMP_STANDALONE_BUILD"] = True
79130
tc.variables["LIBOMP_ENABLE_SHARED"] = self.options.shared
80-
if self.settings.os in ["Linux", "FreeBSD"]:
81-
tc.variables["OPENMP_ENABLE_LIBOMPTARGET"] = self.options.shared
131+
tc.variables["OPENMP_ENABLE_LIBOMPTARGET"] = self.options.build_libomptarget
132+
# Do not buidl OpenMP Tools Interface (OMPT)
133+
tc.variables["LIBOMP_OMPT_SUPPORT"] = False
82134
tc.generate()
83135

84136
def _patch_sources(self):
85137
apply_conandata_patches(self)
86-
replace_in_file(self,os.path.join(self.source_folder, "runtime", "CMakeLists.txt"),
138+
replace_in_file(self, os.path.join(self.source_folder, "runtime", "CMakeLists.txt"),
87139
"add_subdirectory(test)", "")
140+
if self._version_major == 12:
141+
# v12 can be built without LLVM includes
142+
replace_in_file(self, os.path.join(self.source_folder, "libomptarget", "CMakeLists.txt"),
143+
"if (NOT LIBOMPTARGET_LLVM_INCLUDE_DIRS)", "if (FALSE)")
88144

89145
def build(self):
90146
self._patch_sources()
@@ -98,6 +154,7 @@ def package(self):
98154
dst=os.path.join(self.package_folder, "licenses"))
99155
cmake = CMake(self)
100156
cmake.install()
157+
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
101158

102159
# TODO: to remove in conan v2 once cmake_find_package* generators removed
103160
self._create_cmake_module_alias_targets(

recipes/llvm-openmp/all/patches/0002-disable-omp-target_12.0.1.patch

Lines changed: 0 additions & 15 deletions
This file was deleted.

recipes/llvm-openmp/all/patches/0001-disable-build-testing_10.0.0.patch renamed to recipes/llvm-openmp/all/patches/10/0001-disable-build-testing.patch

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
diff --git a/CMakeLists.txt b/CMakeLists.txt_dum
2-
index 9825183..4b4359b 100644
31
--- a/CMakeLists.txt
42
+++ b/CMakeLists.txt
5-
@@ -21,12 +21,6 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
6-
# Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
7-
set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}")
8-
9-
- # Group test settings.
10-
- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
11-
- "C compiler to use for testing OpenMP runtime libraries.")
12-
- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING
13-
- "C++ compiler to use for testing OpenMP runtime libraries.")
14-
- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
15-
else()
16-
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
17-
# If building in tree, we honor the same install suffix LLVM uses.
183
@@ -45,14 +39,6 @@ endif()
194
include(config-ix)
205
include(HandleOpenMPOptions)

recipes/llvm-openmp/all/patches/0001-disable-build-testing_11.1.0.patch renamed to recipes/llvm-openmp/all/patches/11/0001-disable-build-testing.patch

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
2-
index 6f0d9e728002..cf7bd7590f43 100644
31
--- a/CMakeLists.txt
42
+++ b/CMakeLists.txt
5-
@@ -21,12 +21,6 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
6-
# Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
7-
set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}")
8-
9-
- # Group test settings.
10-
- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
11-
- "C compiler to use for testing OpenMP runtime libraries.")
12-
- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING
13-
- "C++ compiler to use for testing OpenMP runtime libraries.")
14-
- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
15-
else()
16-
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
17-
# If building in tree, we honor the same install suffix LLVM uses.
183
@@ -45,15 +39,6 @@ endif()
194
include(config-ix)
205
include(HandleOpenMPOptions)
File renamed without changes.

recipes/llvm-openmp/all/patches/0001-disable-build-testing_12.0.1.patch renamed to recipes/llvm-openmp/all/patches/12/0001-disable-build-testing.patch

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
diff --git a/CMakeLists_orig.txt b/CMakeLists.txt
2-
index b8a2822..7950dde 100644
3-
--- a/CMakeLists_orig.txt
1+
--- a/CMakeLists.txt
42
+++ b/CMakeLists.txt
5-
@@ -21,12 +21,6 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
6-
# Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
7-
set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}")
8-
9-
- # Group test settings.
10-
- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
11-
- "C compiler to use for testing OpenMP runtime libraries.")
12-
- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING
13-
- "C++ compiler to use for testing OpenMP runtime libraries.")
14-
- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
15-
else()
16-
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
17-
# If building in tree, we honor the same install suffix LLVM uses.
183
@@ -47,14 +41,6 @@ endif()
194
include(config-ix)
205
include(HandleOpenMPOptions)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--- a/CMakeLists.txt
2+
+++ b/CMakeLists.txt
3+
@@ -44,14 +39,6 @@
4+
# Check and set up common compiler flags.
5+
include(config-ix)
6+
include(HandleOpenMPOptions)
7+
-
8+
-# Set up testing infrastructure.
9+
-include(OpenMPTesting)
10+
-
11+
-set(OPENMP_TEST_FLAGS "" CACHE STRING
12+
- "Extra compiler flags to send to the test compiler.")
13+
-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING
14+
- "OpenMP compiler flag to use for testing OpenMP runtime libraries.")
15+
16+
set(ENABLE_LIBOMPTARGET ON)
17+
# Currently libomptarget cannot be compiled on Windows or MacOS X.
18+
@@ -81,22 +68,3 @@
19+
20+
add_subdirectory(libomptarget)
21+
endif()
22+
-
23+
-set(ENABLE_OMPT_TOOLS ON)
24+
-# Currently tools are not tested well on Windows or MacOS X.
25+
-if (APPLE OR WIN32)
26+
- set(ENABLE_OMPT_TOOLS OFF)
27+
-endif()
28+
-
29+
-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP."
30+
- ${ENABLE_OMPT_TOOLS})
31+
-if (OPENMP_ENABLE_OMPT_TOOLS)
32+
- add_subdirectory(tools)
33+
-endif()
34+
-
35+
-
36+
-# Build documentation
37+
-add_subdirectory(docs)
38+
-
39+
-# Now that we have seen all testsuites, create the check-openmp target.
40+
-construct_check_openmp_target()

0 commit comments

Comments
 (0)