Skip to content

Commit 10cb72f

Browse files
committed
Update on "[ET-VK] Fix OSS build + separate test build into its own CMakeLists.txt"
## Context As title. In the next diff, the vulkan test binary will be added to CI. Differential Revision: [D57747739](https://our.internmc.facebook.com/intern/diff/D57747739) [ghstack-poisoned]
1 parent fa15c58 commit 10cb72f

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

backends/vulkan/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <iostream>
2+
3+
int main(int argc, char** argv)
4+
{
5+
std::cout << "Hello World!" << std::endl;
6+
return 0;
7+
}

backends/vulkan/test/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
cmake_minimum_required(VERSION 3.19)
1818
project(executorch)
1919

20-
find_package(executorch CONFIG REQUIRED)
20+
find_package(executorch CONFIG REQUIRED COMPONENTS vulkan_backend)
2121
find_package(GTest CONFIG REQUIRED)
2222

23+
# Only build tests if Vulkan was compiled
24+
find_library(LIB_VULKAN_BACKEND vulkan_backend)
25+
26+
if(LIB_VULKAN_BACKEND)
27+
2328
if(NOT EXECUTORCH_ROOT)
2429
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
2530
endif()
@@ -80,3 +85,5 @@ target_link_libraries(
8085
test_shaderlib
8186
)
8287
target_compile_options(vulkan_compute_api_test PRIVATE ${VULKAN_CXX_FLAGS})
88+
89+
endif()

runtime/core/portable_type/targets.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def define_common_targets():
2626
visibility = [
2727
"//executorch/runtime/core/exec_aten/...",
2828
"//executorch/runtime/core/portable_type/test/...",
29-
"//executorch/backends/...",
3029
],
3130
exported_deps = [
3231
":scalar_type",

test/run_oss_cpp_tests.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ build_and_run_test() {
2727
local test_dir=$1
2828
cmake "${test_dir}" -Bcmake-out/"${test_dir}" -DCMAKE_INSTALL_PREFIX=cmake-out
2929
cmake --build cmake-out/"${test_dir}" -j9
30-
for t in cmake-out/"${test_dir}"/*test; do ./"$t"; done
30+
31+
for t in cmake-out/"${test_dir}"/*test; do
32+
if [ -e $t ]; then
33+
./"$t";
34+
fi
35+
done
3136
}
3237

3338
probe_tests() {

0 commit comments

Comments
 (0)