@@ -179,8 +179,6 @@ option(EXECUTORCH_BUILD_KERNELS_QUANTIZED "Build the quantized kernels" OFF)
179
179
180
180
option (EXECUTORCH_BUILD_SDK "Build the ExecuTorch SDK" )
181
181
182
- option (EXECUTORCH_BUILD_SHARED_LIB "Build libexecutorch as a shared lib" OFF )
183
-
184
182
option (EXECUTORCH_BUILD_SIZE_TEST "Build the size test" OFF )
185
183
186
184
option (EXECUTORCH_BUILD_XNNPACK "Build the XNNPACK backend" OFF )
@@ -205,7 +203,6 @@ cmake_dependent_option(
205
203
206
204
if (EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT )
207
205
set (EXECUTORCH_BUILD_KERNELS_CUSTOM ON )
208
- set (EXECUTORCH_BUILD_SHARED_LIB ON )
209
206
endif ()
210
207
211
208
if (EXECUTORCH_BUILD_KERNELS_CUSTOM )
@@ -432,11 +429,7 @@ add_subdirectory(schema)
432
429
# Only contains primitive operators; does not contain portable kernels or other
433
430
# full operators. Does not contain any backends.
434
431
#
435
- if (EXECUTORCH_BUILD_SHARED_LIB )
436
- add_library (executorch_no_prim_ops SHARED ${_executorch_no_prim_ops__srcs} )
437
- else ()
438
- add_library (executorch_no_prim_ops STATIC ${_executorch_no_prim_ops__srcs} )
439
- endif ()
432
+ add_library (executorch_no_prim_ops ${_executorch_no_prim_ops__srcs} )
440
433
target_link_libraries (executorch_no_prim_ops PRIVATE program_schema )
441
434
# Check if dl exists for this toolchain and only then link it.
442
435
find_library (DL_LIBRARY_EXISTS NAMES dl )
@@ -470,13 +463,6 @@ target_link_options_shared_lib(executorch)
470
463
#
471
464
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/portable )
472
465
473
- if (EXECUTORCH_BUILD_KERNELS_CUSTOM )
474
- # TODO: move all custom kernels to ${CMAKE_CURRENT_SOURCE_DIR}/kernels/custom
475
- add_subdirectory (
476
- ${CMAKE_CURRENT_SOURCE_DIR} /examples/models/llama2/custom_ops
477
- )
478
- endif ()
479
-
480
466
if (EXECUTORCH_BUILD_KERNELS_OPTIMIZED )
481
467
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/optimized )
482
468
endif ()
@@ -592,8 +578,6 @@ if(EXECUTORCH_BUILD_COREML)
592
578
endif ()
593
579
594
580
if (EXECUTORCH_BUILD_PYBIND )
595
- set (EXECUTORCH_BUILD_SHARED_LIB ON )
596
-
597
581
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /third-party/pybind11 )
598
582
599
583
if (NOT EXECUTORCH_BUILD_EXTENSION_DATA_LOADER )
@@ -664,7 +648,7 @@ if(EXECUTORCH_BUILD_PYBIND)
664
648
target_link_libraries (util PRIVATE torch c10 executorch )
665
649
666
650
# pybind portable_lib
667
- pybind11_add_module (portable_lib extension/pybindings/pybindings.cpp )
651
+ pybind11_add_module (portable_lib SHARED extension/pybindings/pybindings.cpp )
668
652
# The actual output file needs a leading underscore so it can coexist with
669
653
# portable_lib.py in the same python package.
670
654
set_target_properties (portable_lib PROPERTIES OUTPUT_NAME "_portable_lib" )
@@ -673,7 +657,7 @@ if(EXECUTORCH_BUILD_PYBIND)
673
657
)
674
658
target_include_directories (portable_lib PRIVATE ${TORCH_INCLUDE_DIRS} )
675
659
target_compile_options (portable_lib PUBLIC ${_pybind_compile_options} )
676
- target_link_libraries (portable_lib PUBLIC ${_dep_libs} )
660
+ target_link_libraries (portable_lib PRIVATE ${_dep_libs} )
677
661
if (APPLE )
678
662
# pip wheels will need to be able to find the torch libraries. On Linux, the
679
663
# .so has non-absolute dependencies on libs like "libtorch.so" without
@@ -699,5 +683,12 @@ if(EXECUTORCH_BUILD_PYBIND)
699
683
)
700
684
endif ()
701
685
686
+ if (EXECUTORCH_BUILD_KERNELS_CUSTOM )
687
+ # TODO: move all custom kernels to ${CMAKE_CURRENT_SOURCE_DIR}/kernels/custom
688
+ add_subdirectory (
689
+ ${CMAKE_CURRENT_SOURCE_DIR} /examples/models/llama2/custom_ops
690
+ )
691
+ endif ()
692
+
702
693
# Print all summary
703
694
executorch_print_configuration_summary ()
0 commit comments