Skip to content

[SYCL][E2E] Use system header search paths for SYCL headers in SYCL lit tests. #18214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions sycl/test-e2e/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,18 @@
# Configure LD_LIBRARY_PATH or corresponding os-specific alternatives
if platform.system() == "Linux":
config.available_features.add("linux")
llvm_config.with_system_environment(["LD_LIBRARY_PATH", "LIBRARY_PATH", "CPATH"])
llvm_config.with_system_environment(
["LD_LIBRARY_PATH", "LIBRARY_PATH", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"]
)
llvm_config.with_environment(
"LD_LIBRARY_PATH", config.sycl_libs_dir, append_path=True
)

elif platform.system() == "Windows":
config.available_features.add("windows")
llvm_config.with_system_environment(["LIB", "CPATH", "INCLUDE"])
llvm_config.with_system_environment(
["LIB", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "INCLUDE"]
)
llvm_config.with_environment("LIB", config.sycl_libs_dir, append_path=True)
llvm_config.with_environment("PATH", config.sycl_libs_dir, append_path=True)
llvm_config.with_environment(
Expand All @@ -142,14 +146,19 @@

elif platform.system() == "Darwin":
# FIXME: surely there is a more elegant way to instantiate the Xcode directories.
llvm_config.with_system_environment("CPATH")
llvm_config.with_system_environment(["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"])
llvm_config.with_environment(
"CPATH",
"CPLUS_INCLUDE_PATH",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
append_path=True,
)
llvm_config.with_environment(
"CPATH",
"C_INCLUDE_PATH",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
append_path=True,
)
llvm_config.with_environment(
"CPLUS_INCLUDE_PATH",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
append_path=True,
)
Expand Down Expand Up @@ -537,9 +546,9 @@ def open_check_file(file_name):
"%sycl_options",
" "
+ os.path.normpath(os.path.join(config.sycl_libs_dir + "/../lib/sycl8.lib"))
+ " /I"
+ " -Xclang -isystem -Xclang "
+ config.sycl_include
+ " /I"
+ " -Xclang -isystem -Xclang "
+ os.path.join(config.sycl_include, "sycl"),
)
)
Expand All @@ -555,9 +564,9 @@ def open_check_file(file_name):
(
"%sycl_options",
(" -lsycl8" if platform.system() == "Windows" else " -lsycl")
+ " -I"
+ " -isystem "
+ config.sycl_include
+ " -I"
+ " -isystem "
+ os.path.join(config.sycl_include, "sycl")
+ " -L"
+ config.sycl_libs_dir,
Expand Down
11 changes: 8 additions & 3 deletions sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,19 @@

elif platform.system() == "Darwin":
# FIXME: surely there is a more elegant way to instantiate the Xcode directories.
llvm_config.with_system_environment("CPATH")
llvm_config.with_system_environment(["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"])
llvm_config.with_environment(
"CPATH",
"CPLUS_INCLUDE_PATH",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
append_path=True,
)
llvm_config.with_environment(
"CPATH",
"C_INCLUDE_PATH",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
append_path=True,
)
llvm_config.with_environment(
"CPLUS_INCLUDE_PATH",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
append_path=True,
)
Expand Down