-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[offload] Fix enabling unittests in standalone builds #138418
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
Conversation
Modify the unittest logic in offload to only look for `third-party/unittest` directory when `llvm_gtest` is not provided by LLVM itself (in-tree or installed). This makes it possible to run unittests in sparse checkouts without the `third-party/unittest` tree. While at it, also make sure `LLVM_THIRD_PARTY_DIR` is actually set while performing standalone builds. The logic is copied from `compiler-rt`.
@llvm/pr-subscribers-offload Author: Michał Górny (mgorny) ChangesModify the unittest logic in offload to only look for While at it, also make sure Full diff: https://github.com/llvm/llvm-project/pull/138418.diff 1 Files Affected:
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index 25c879710645c..ef10d9c949d0b 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -386,9 +386,12 @@ add_subdirectory(liboffload)
add_subdirectory(test)
# Add unit tests if GMock/GTest is present
-if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest)
- if (NOT TARGET llvm_gtest)
- add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
- endif()
+if (NOT LLVM_THIRD_PARTY_DIR)
+ set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
+endif()
+if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest AND NOT TARGET llvm_gtest)
+ add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
+endif()
+if (TARGET llvm_gtest)
add_subdirectory(unittests)
endif()
|
Co-authored-by: Joseph Huber <[email protected]>
Modify the unittest logic in offload to only look for `third-party/unittest` directory when `llvm_gtest` is not provided by LLVM itself (in-tree or installed). This makes it possible to run unittests in sparse checkouts without the `third-party/unittest` tree. While at it, also make sure `LLVM_THIRD_PARTY_DIR` is actually set while performing standalone builds. The logic is copied from `compiler-rt`. --------- Co-authored-by: Joseph Huber <[email protected]>
Modify the unittest logic in offload to only look for `third-party/unittest` directory when `llvm_gtest` is not provided by LLVM itself (in-tree or installed). This makes it possible to run unittests in sparse checkouts without the `third-party/unittest` tree. While at it, also make sure `LLVM_THIRD_PARTY_DIR` is actually set while performing standalone builds. The logic is copied from `compiler-rt`. --------- Co-authored-by: Joseph Huber <[email protected]>
Modify the unittest logic in offload to only look for `third-party/unittest` directory when `llvm_gtest` is not provided by LLVM itself (in-tree or installed). This makes it possible to run unittests in sparse checkouts without the `third-party/unittest` tree. While at it, also make sure `LLVM_THIRD_PARTY_DIR` is actually set while performing standalone builds. The logic is copied from `compiler-rt`. --------- Co-authored-by: Joseph Huber <[email protected]>
Modify the unittest logic in offload to only look for `third-party/unittest` directory when `llvm_gtest` is not provided by LLVM itself (in-tree or installed). This makes it possible to run unittests in sparse checkouts without the `third-party/unittest` tree. While at it, also make sure `LLVM_THIRD_PARTY_DIR` is actually set while performing standalone builds. The logic is copied from `compiler-rt`. --------- Co-authored-by: Joseph Huber <[email protected]>
Modify the unittest logic in offload to only look for
third-party/unittest
directory whenllvm_gtest
is not provided by LLVM itself (in-tree or installed). This makes it possible to run unittests in sparse checkouts without thethird-party/unittest
tree.While at it, also make sure
LLVM_THIRD_PARTY_DIR
is actually set while performing standalone builds. The logic is copied fromcompiler-rt
.