File tree Expand file tree Collapse file tree 7 files changed +62
-2
lines changed Expand file tree Collapse file tree 7 files changed +62
-2
lines changed Original file line number Diff line number Diff line change 12
12
#
13
13
# This file should be formatted with
14
14
# ~~~
15
- # cmake-format -i Utils .cmake
15
+ # cmake-format -i Test .cmake
16
16
# ~~~
17
17
# It should also be cmake-lint clean.
18
18
#
19
19
20
+ include (${EXECUTORCH_ROOT} /build/Utils.cmake )
21
+
20
22
# Add code coverage flags to supported compilers
21
23
if (EXECUTORCH_USE_CPP_CODE_COVERAGE )
22
24
if ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "GNU" )
@@ -54,6 +56,9 @@ cmake_parse_arguments(ET_CXX_TEST "" "" "${multi_arg_names}" ${ARGN})
54
56
# Find prebuilt executorch library
55
57
find_package (executorch CONFIG REQUIRED )
56
58
59
+ target_link_options_shared_lib (extension_data_loader )
60
+ target_link_options_shared_lib (portable_ops_lib )
61
+
57
62
enable_testing ()
58
63
find_package (GTest CONFIG REQUIRED )
59
64
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ set(lib_list
43
43
qnn_executorch_backend
44
44
portable_ops_lib
45
45
extension_module
46
+ extension_module_static
46
47
xnnpack_backend
47
48
XNNPACK
48
49
cpuinfo
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ target_compile_options(
46
46
47
47
# Install libraries
48
48
install (
49
- TARGETS extension_module
49
+ TARGETS extension_module extension_module_static
50
50
DESTINATION lib
51
51
INCLUDES
52
52
DESTINATION ${_common_include_directories}
Original file line number Diff line number Diff line change
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ # @generated by test/utils/generate_gtest_cmakelists.py
8
+ #
9
+ # This file should be formatted with
10
+ # ~~~
11
+ # cmake-format -i CMakeLists.txt
12
+ # ~~~
13
+ # It should also be cmake-lint clean.
14
+ #
15
+
16
+ cmake_minimum_required (VERSION 3.19 )
17
+ project (extension_module_test )
18
+
19
+ # Use C++17 for test.
20
+ set (CMAKE_CXX_STANDARD 17 )
21
+
22
+ set (EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR} /../../.. )
23
+
24
+ include (${EXECUTORCH_ROOT} /build/Test.cmake )
25
+
26
+ set (_test_srcs module_test.cpp )
27
+
28
+ et_cxx_test (
29
+ extension_module_test
30
+ SOURCES
31
+ ${_test_srcs}
32
+ EXTRA_LIBS
33
+ extension_data_loader
34
+ extension_module_static
35
+ portable_kernels
36
+ portable_ops_lib
37
+ )
Original file line number Diff line number Diff line change 9
9
#include < gtest/gtest.h>
10
10
11
11
#include < executorch/extension/module/module.h>
12
+ #include < array>
12
13
13
14
using namespace ::testing;
14
15
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ build_executorch() {
27
27
-DCMAKE_INSTALL_PREFIX=cmake-out \
28
28
-DEXECUTORCH_USE_CPP_CODE_COVERAGE=ON \
29
29
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
30
+ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
30
31
-Bcmake-out
31
32
cmake --build cmake-out -j9 --target install
32
33
}
@@ -49,6 +50,8 @@ build_and_run_test() {
49
50
-Bcmake-out/" ${test_dir} "
50
51
cmake --build cmake-out/" ${test_dir} " -j9
51
52
53
+ export RESOURCES_PATH=extension/module/test/resources
54
+
52
55
for t in cmake-out/" ${test_dir} " /* test; do
53
56
if [ -e " $t " ]; then
54
57
LLVM_PROFILE_FILE=" cmake-out/$( basename $t ) .profraw" ./" $t " ;
Original file line number Diff line number Diff line change 11
11
" extension_data_loader"
12
12
]
13
13
},
14
+ {
15
+ "directory" : " extension/module/test" ,
16
+ "sources" : [
17
+ " module_test.cpp"
18
+ ],
19
+ "additional_libs" : [
20
+ " extension_data_loader" ,
21
+ " extension_module_static" ,
22
+ " portable_kernels" ,
23
+ " portable_ops_lib"
24
+
25
+ ]
26
+ },
14
27
{
15
28
"directory" : " runtime/core/portable_type/test" ,
16
29
"sources" : [
You can’t perform that action at this time.
0 commit comments