Skip to content

Commit 9b8897f

Browse files
committed
Scope OpenMP to consuming targets
1 parent 037ccad commit 9b8897f

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ find_package(OpenMP REQUIRED COMPONENTS CXX)
3434

3535
if(OpenMP_FOUND)
3636
message(STATUS "OpenMP found - enabling parallel support")
37-
link_libraries(OpenMP::OpenMP_CXX)
3837
else()
3938
message(STATUS "OpenMP not found - parallel features disabled")
4039
endif()
4140

41+
set(ITLABAI_OPENMP_INCLUDE_DIR "" CACHE PATH
42+
"Optional extra include directory for the OpenMP runtime headers")
43+
if(ITLABAI_OPENMP_INCLUDE_DIR AND TARGET OpenMP::OpenMP_CXX)
44+
set_property(TARGET OpenMP::OpenMP_CXX APPEND PROPERTY
45+
INTERFACE_INCLUDE_DIRECTORIES "${ITLABAI_OPENMP_INCLUDE_DIR}"
46+
)
47+
endif()
48+
4249
add_library(itlabai_sycl INTERFACE)
4350

4451
if(ITLABAI_ENABLE_SYCL)

scripts/ci/sycl_configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def main() -> None:
3838

3939
openmp_include_dir = os.environ.get("ITLABAI_OPENMP_INCLUDE_DIR", "")
4040
if openmp_include_dir:
41-
cmake_args.append(f"-DOpenMP_CXX_INCLUDE_DIR={openmp_include_dir}")
41+
cmake_args.append(f"-DITLABAI_OPENMP_INCLUDE_DIR={openmp_include_dir}")
4242

4343
run(
4444
[

scripts/ci/sycl_x86_setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ def setup_unix_compilers(sycl_root: Path) -> None:
197197
if openmp_library is None:
198198
main_error("Unable to locate libiomp5.so for the SYCL toolchain")
199199

200-
search_roots = [Path(capture([str(cxx_path), "-print-resource-dir"])), sycl_root, Path("/opt/intel/oneapi")]
200+
search_roots = [
201+
Path(capture([str(cxx_path), "-print-resource-dir"])),
202+
sycl_root,
203+
Path("/opt/intel/oneapi"),
204+
]
201205
search_roots.extend(Path("/usr/lib").glob("llvm-*"))
202206
openmp_header = find_file(search_roots, "omp.h")
203207
if openmp_header is None:

0 commit comments

Comments
 (0)