diff --git a/CMakeLists.txt b/CMakeLists.txt index c48378d2270..8c7d255a5f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,7 +416,7 @@ target_link_libraries(executorch PRIVATE executorch_core) target_include_directories(executorch PUBLIC ${_common_include_directories}) target_compile_definitions(executorch PUBLIC C10_USING_CUSTOM_GENERATED_MACROS) target_compile_options(executorch PUBLIC ${_common_compile_options}) -target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(executorch) # # portable_ops_lib: A library to register core ATen ops using portable kernels, @@ -690,7 +690,7 @@ endif() if(EXECUTORCH_BUILD_KERNELS_QUANTIZED) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/quantized) - target_link_options_shared_lib(quantized_ops_lib) + executorch_target_link_options_shared_lib(quantized_ops_lib) endif() if(EXECUTORCH_BUILD_EXECUTOR_RUNNER) diff --git a/backends/apple/coreml/CMakeLists.txt b/backends/apple/coreml/CMakeLists.txt index 96684a50dce..d0013fb1a5f 100644 --- a/backends/apple/coreml/CMakeLists.txt +++ b/backends/apple/coreml/CMakeLists.txt @@ -199,7 +199,7 @@ if(APPLE) ${CMAKE_CURRENT_SOURCE_DIR}/third-party/coremltools/deps/protobuf/cmake ) - target_link_options_shared_lib(libprotobuf-lite) + executorch_target_link_options_shared_lib(libprotobuf-lite) target_link_libraries(coremldelegate PRIVATE libprotobuf-lite) endif() @@ -210,7 +210,7 @@ if(APPLE) ${FOUNDATION_FRAMEWORK} ${SQLITE_LIBRARY} ) - target_link_options_shared_lib(coremldelegate) + executorch_target_link_options_shared_lib(coremldelegate) if(EXECUTORCH_COREML_BUILD_EXECUTOR_RUNNER) target_link_libraries( diff --git a/backends/apple/mps/CMakeLists.txt b/backends/apple/mps/CMakeLists.txt index 90f75ffdbb9..af18c3dec06 100644 --- a/backends/apple/mps/CMakeLists.txt +++ b/backends/apple/mps/CMakeLists.txt @@ -70,7 +70,7 @@ target_link_libraries( ${MPS_FRAMEWORK} ${MPS_GRAPH_FRAMEWORK} ) -target_link_options_shared_lib(mpsdelegate) +executorch_target_link_options_shared_lib(mpsdelegate) target_compile_options(mpsdelegate PUBLIC ${_common_compile_options}) target_compile_options(mpsdelegate PRIVATE "-fno-objc-arc") diff --git a/backends/cadence/CMakeLists.txt b/backends/cadence/CMakeLists.txt index 17c88af8e11..d541fafe957 100644 --- a/backends/cadence/CMakeLists.txt +++ b/backends/cadence/CMakeLists.txt @@ -35,8 +35,8 @@ if(EXECUTORCH_CADENCE_CPU_RUNNER) # Find prebuilt libraries. executorch package should contain portable_ops_lib, # etdump, bundled_program. find_package(executorch CONFIG REQUIRED) - target_link_options_shared_lib(executorch) - target_link_options_shared_lib(portable_ops_lib) + executorch_target_link_options_shared_lib(executorch) + executorch_target_link_options_shared_lib(portable_ops_lib) target_include_directories(executorch INTERFACE ${_common_include_directories}) diff --git a/backends/mediatek/CMakeLists.txt b/backends/mediatek/CMakeLists.txt index 128faa70cc6..b87dcdd9325 100644 --- a/backends/mediatek/CMakeLists.txt +++ b/backends/mediatek/CMakeLists.txt @@ -40,6 +40,6 @@ target_sources( ${CMAKE_CURRENT_LIST_DIR}/runtime/NeuronExecutor.cpp ${CMAKE_CURRENT_LIST_DIR}/runtime/NeuronBufferAllocator.cpp ) -target_link_options_shared_lib(neuron_backend) +executorch_target_link_options_shared_lib(neuron_backend) install(TARGETS neuron_backend DESTINATION lib) diff --git a/backends/openvino/CMakeLists.txt b/backends/openvino/CMakeLists.txt index 8d07cd9a366..bf5fc3b217e 100644 --- a/backends/openvino/CMakeLists.txt +++ b/backends/openvino/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(openvino_backend PRIVATE openvino::runtime executorch_core # Add source files for OpenVINO backend target_sources(openvino_backend PRIVATE ${CMAKE_CURRENT_LIST_DIR}/runtime/OpenvinoBackend.cpp) -target_link_options_shared_lib(openvino_backend) +executorch_target_link_options_shared_lib(openvino_backend) if(EXECUTORCH_BUILD_OPENVINO_EXECUTOR_RUNNER) # Build executor runner binary for openvino backend diff --git a/backends/qualcomm/CMakeLists.txt b/backends/qualcomm/CMakeLists.txt index 9f353a50782..0b0836ca744 100644 --- a/backends/qualcomm/CMakeLists.txt +++ b/backends/qualcomm/CMakeLists.txt @@ -209,7 +209,7 @@ target_link_libraries( # # add linker option # -target_link_options_shared_lib(qnn_executorch_backend) +executorch_target_link_options_shared_lib(qnn_executorch_backend) # # add sources diff --git a/backends/vulkan/CMakeLists.txt b/backends/vulkan/CMakeLists.txt index e4fd991858e..68fec49a57a 100644 --- a/backends/vulkan/CMakeLists.txt +++ b/backends/vulkan/CMakeLists.txt @@ -24,10 +24,10 @@ if(NOT RUNTIME_PATH) set(RUNTIME_PATH ${CMAKE_CURRENT_SOURCE_DIR}/runtime) endif() -# Include this file to access target_link_options_shared_lib This is required to -# provide access to target_link_options_shared_lib which allows libraries to be -# linked with the --whole-archive flag. This is required for libraries that -# perform dynamic registration via static initialization. +# Include this file to access executorch_target_link_options_shared_lib This is +# required to provide access to executorch_target_link_options_shared_lib which +# allows libraries to be linked with the --whole-archive flag. This is required +# for libraries that perform dynamic registration via static initialization. include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) include(cmake/ShaderLibrary.cmake) @@ -113,7 +113,7 @@ target_include_directories( target_link_libraries(vulkan_backend PRIVATE vulkan_schema executorch_core) target_compile_options(vulkan_backend PRIVATE ${VULKAN_CXX_FLAGS}) # Link this library with --whole-archive due to dynamic backend registration -target_link_options_shared_lib(vulkan_backend) +executorch_target_link_options_shared_lib(vulkan_backend) set_property(TARGET vulkan_backend PROPERTY CXX_STANDARD 17) diff --git a/backends/vulkan/cmake/ShaderLibrary.cmake b/backends/vulkan/cmake/ShaderLibrary.cmake index 9d92de9114e..c06a9d7097c 100644 --- a/backends/vulkan/cmake/ShaderLibrary.cmake +++ b/backends/vulkan/cmake/ShaderLibrary.cmake @@ -81,7 +81,7 @@ function(vulkan_shader_lib library_name generated_spv_cpp) target_link_libraries(${library_name} vulkan_backend) target_compile_options(${library_name} PRIVATE ${VULKAN_CXX_FLAGS}) # Link this library with --whole-archive due to dynamic shader registrations - target_link_options_shared_lib(${library_name}) + executorch_target_link_options_shared_lib(${library_name}) endfunction() # Convenience macro to generate a SPIR-V shader library target. Given the path @@ -105,7 +105,7 @@ macro(vulkan_shader_library shaders_path library_name) target_link_libraries(${library_name} vulkan_backend) target_compile_options(${library_name} PRIVATE ${VULKAN_CXX_FLAGS}) # Link this library with --whole-archive due to dynamic shader registrations - target_link_options_shared_lib(${library_name}) + executorch_target_link_options_shared_lib(${library_name}) unset(VULKAN_SHADERGEN_ENV) unset(VULKAN_SHADERGEN_OUT_PATH) diff --git a/backends/vulkan/test/CMakeLists.txt b/backends/vulkan/test/CMakeLists.txt index 0b3f22875ad..da25b6e88d1 100644 --- a/backends/vulkan/test/CMakeLists.txt +++ b/backends/vulkan/test/CMakeLists.txt @@ -35,8 +35,8 @@ if(TARGET vulkan_backend) set(PYTHON_EXECUTABLE python3) endif() - # Include this file to access target_link_options_shared_lib This is required - # to provide access to target_link_options_shared_lib which allows libraries + # Include this file to access executorch_target_link_options_shared_lib This is required + # to provide access to executorch_target_link_options_shared_lib which allows libraries # to be linked with the --whole-archive flag. This is required for libraries # that perform dynamic registration via static initialization. include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) @@ -75,7 +75,7 @@ if(TARGET vulkan_backend) ${CMAKE_CURRENT_SOURCE_DIR}/vulkan_compute_api_test.cpp ) - target_link_options_shared_lib(vulkan_backend) + executorch_target_link_options_shared_lib(vulkan_backend) add_executable( vulkan_compute_api_test ${COMPUTE_API_TEST_CPP} ${TEST_UTILS_CPP} diff --git a/backends/vulkan/test/op_tests/CMakeLists.txt b/backends/vulkan/test/op_tests/CMakeLists.txt index 59baafe3cef..c19e818f63d 100644 --- a/backends/vulkan/test/op_tests/CMakeLists.txt +++ b/backends/vulkan/test/op_tests/CMakeLists.txt @@ -29,8 +29,8 @@ if(NOT EXECUTORCH_ROOT) set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) endif() -# Include this file to access target_link_options_shared_lib This is required to -# provide access to target_link_options_shared_lib which allows libraries to be +# Include this file to access executorch_target_link_options_shared_lib This is required to +# provide access to executorch_target_link_options_shared_lib which allows libraries to be # linked with the --whole-archive flag. This is required for libraries that # perform dynamic registration via static initialization. include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) @@ -66,7 +66,7 @@ set(COMMON_INCLUDES ${TORCH_BASE_PATH}/include/torch/csrc/api/include ) -target_link_options_shared_lib(vulkan_backend) +executorch_target_link_options_shared_lib(vulkan_backend) function(vulkan_op_test test_name test_src) set(extra_deps ${ARGN}) diff --git a/backends/xnnpack/CMakeLists.txt b/backends/xnnpack/CMakeLists.txt index b6ba211ecb3..0a5ec815542 100644 --- a/backends/xnnpack/CMakeLists.txt +++ b/backends/xnnpack/CMakeLists.txt @@ -116,7 +116,7 @@ target_include_directories( PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/third-party/cpuinfo/include ) target_compile_options(xnnpack_backend PUBLIC ${_common_compile_options}) -target_link_options_shared_lib(xnnpack_backend) +executorch_target_link_options_shared_lib(xnnpack_backend) install( TARGETS xnnpack_backend diff --git a/docs/source/kernel-library-custom-aten-kernel.md b/docs/source/kernel-library-custom-aten-kernel.md index 3eca9405aa9..6c54384127d 100644 --- a/docs/source/kernel-library-custom-aten-kernel.md +++ b/docs/source/kernel-library-custom-aten-kernel.md @@ -266,7 +266,7 @@ Link it into ExecuTorch runtime: In our `CMakeLists.txt` that builds the binary/ Here's an example to do it: ```cmake -# For target_link_options_shared_lib +# For executorch_target_link_options_shared_lib include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) # Add a custom op library @@ -282,7 +282,7 @@ target_link_libraries(custom_op_lib PUBLIC executorch) add_executable(custom_op_runner PUBLIC main.cpp) # Link this library with --whole-archive !! IMPORTANT !! this is to avoid the operators being stripped by linker -target_link_options_shared_lib(custom_op_lib) +executorch_target_link_options_shared_lib(custom_op_lib) # Link custom op lib target_link_libraries(custom_op_runner PUBLIC custom_op_lib) diff --git a/examples/devtools/CMakeLists.txt b/examples/devtools/CMakeLists.txt index 74cbf5e78e6..e9aa683f1fe 100644 --- a/examples/devtools/CMakeLists.txt +++ b/examples/devtools/CMakeLists.txt @@ -37,8 +37,8 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..) # Find prebuilt libraries. executorch package should contain portable_ops_lib, # etdump, bundled_program. find_package(executorch CONFIG REQUIRED) -target_link_options_shared_lib(executorch) -target_link_options_shared_lib(portable_ops_lib) +executorch_target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(portable_ops_lib) target_include_directories(executorch INTERFACE ${_common_include_directories}) diff --git a/examples/models/llama/CMakeLists.txt b/examples/models/llama/CMakeLists.txt index 5f56e111e3d..efa9c8e4009 100644 --- a/examples/models/llama/CMakeLists.txt +++ b/examples/models/llama/CMakeLists.txt @@ -82,7 +82,7 @@ find_package(gflags REQUIRED) # cross-compiling (e.g., to Android) to work as well. list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(executorch) # llama_runner library add_subdirectory(runner) @@ -100,18 +100,18 @@ if(TARGET optimized_native_cpu_ops_lib) cpublas eigen_blas ) - target_link_options_shared_lib(optimized_native_cpu_ops_lib) + executorch_target_link_options_shared_lib(optimized_native_cpu_ops_lib) else() list(APPEND link_libraries portable_ops_lib portable_kernels) - target_link_options_shared_lib(portable_ops_lib) + executorch_target_link_options_shared_lib(portable_ops_lib) endif() # quantized_ops_lib: Register quantized op kernels into the runtime -target_link_options_shared_lib(quantized_ops_lib) +executorch_target_link_options_shared_lib(quantized_ops_lib) list(APPEND link_libraries quantized_kernels quantized_ops_lib) if(TARGET custom_ops) - target_link_options_shared_lib(custom_ops) + executorch_target_link_options_shared_lib(custom_ops) list(APPEND link_libraries custom_ops) endif() @@ -126,13 +126,13 @@ if(EXECUTORCH_BUILD_TORCHAO) ${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/ao/torchao/experimental ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/ao/torchao/experimental ) - target_link_options_shared_lib(torchao_ops_executorch) + executorch_target_link_options_shared_lib(torchao_ops_executorch) list(APPEND link_libraries torchao_ops_executorch) if(EXECUTORCH_BUILD_MPS) add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/ao/torchao/experimental/ops/mps ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/ao/torchao/experimental/ops/mps) - target_link_options_shared_lib(torchao_ops_mps_executorch) + executorch_target_link_options_shared_lib(torchao_ops_mps_executorch) list(APPEND link_libraries torchao_ops_mps_executorch) endif() endif() @@ -162,19 +162,19 @@ if(TARGET xnnpack_backend) list(APPEND xnnpack_backend_libs kleidiai) endif() list(APPEND link_libraries ${xnnpack_backend_libs}) - target_link_options_shared_lib(xnnpack_backend) + executorch_target_link_options_shared_lib(xnnpack_backend) endif() # Vulkan backend if(TARGET vulkan_backend) list(APPEND link_libraries vulkan_backend) - target_link_options_shared_lib(vulkan_backend) + executorch_target_link_options_shared_lib(vulkan_backend) endif() # Qnn backend if(TARGET qnn_executorch_backend) list(APPEND link_libraries qnn_executorch_backend) - target_link_options_shared_lib(qnn_executorch_backend) + executorch_target_link_options_shared_lib(qnn_executorch_backend) endif() # MPS backend @@ -188,7 +188,7 @@ if(TARGET mpsdelegate) "-weak_framework MetalPerformanceShadersGraph" "-weak_framework Metal" ) - target_link_options_shared_lib(mpsdelegate) + executorch_target_link_options_shared_lib(mpsdelegate) endif() if(TARGET coremldelegate) @@ -202,7 +202,7 @@ if(TARGET coremldelegate) "-framework CoreML" "-framework Accelerate" ) - target_link_options_shared_lib(coremldelegate) + executorch_target_link_options_shared_lib(coremldelegate) endif() # This one is needed for cpuinfo where it uses android specific log lib diff --git a/examples/models/llava/CMakeLists.txt b/examples/models/llava/CMakeLists.txt index c988be028d0..500265cbb77 100644 --- a/examples/models/llava/CMakeLists.txt +++ b/examples/models/llava/CMakeLists.txt @@ -78,7 +78,7 @@ find_package(gflags REQUIRED) # find `executorch` libraries Same as for gflags list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(executorch) # llava_runner library add_subdirectory(runner) @@ -97,14 +97,14 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) cpublas eigen_blas ) - target_link_options_shared_lib(optimized_native_cpu_ops_lib) + executorch_target_link_options_shared_lib(optimized_native_cpu_ops_lib) else() list(APPEND link_libraries portable_ops_lib portable_kernels) - target_link_options_shared_lib(portable_ops_lib) + executorch_target_link_options_shared_lib(portable_ops_lib) endif() # quantized_ops_lib: Register quantized op kernels into the runtime -target_link_options_shared_lib(quantized_ops_lib) +executorch_target_link_options_shared_lib(quantized_ops_lib) list(APPEND link_libraries quantized_kernels quantized_ops_lib) if(EXECUTORCH_BUILD_KERNELS_LLM) @@ -135,19 +135,19 @@ if(TARGET xnnpack_backend) list(APPEND xnnpack_backend_libs kleidiai) endif() list(APPEND link_libraries ${xnnpack_backend_libs}) - target_link_options_shared_lib(xnnpack_backend) + executorch_target_link_options_shared_lib(xnnpack_backend) endif() # Vulkan backend if(TARGET vulkan_backend) list(APPEND link_libraries vulkan_backend) - target_link_options_shared_lib(vulkan_backend) + executorch_target_link_options_shared_lib(vulkan_backend) endif() # Qnn backend if(TARGET qnn_executorch_backend) list(APPEND link_libraries qnn_executorch_backend) - target_link_options_shared_lib(qnn_executorch_backend) + executorch_target_link_options_shared_lib(qnn_executorch_backend) endif() # MPS backend @@ -161,7 +161,7 @@ if(TARGET mpsdelegate) "-weak_framework MetalPerformanceShadersGraph" "-weak_framework Metal" ) - target_link_options_shared_lib(mpsdelegate) + executorch_target_link_options_shared_lib(mpsdelegate) endif() if(TARGET coremldelegate) @@ -175,7 +175,7 @@ if(TARGET coremldelegate) "-framework CoreML" "-framework Accelerate" ) - target_link_options_shared_lib(coremldelegate) + executorch_target_link_options_shared_lib(coremldelegate) endif() # This one is needed for cpuinfo where it uses android specific log lib diff --git a/examples/models/phi-3-mini/CMakeLists.txt b/examples/models/phi-3-mini/CMakeLists.txt index 0814476f6f9..930301fdd63 100644 --- a/examples/models/phi-3-mini/CMakeLists.txt +++ b/examples/models/phi-3-mini/CMakeLists.txt @@ -27,7 +27,7 @@ set(_common_include_directories list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..) find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH) -target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(executorch) set(BUILD_TESTING OFF) add_subdirectory( diff --git a/examples/models/yolo12/CMakeLists.txt b/examples/models/yolo12/CMakeLists.txt index dd0fcf4f5ef..9c92e5eaeae 100644 --- a/examples/models/yolo12/CMakeLists.txt +++ b/examples/models/yolo12/CMakeLists.txt @@ -30,18 +30,18 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..) # find `executorch` libraries Same as for gflags find_package(executorch CONFIG REQUIRED PATHS ${EXECUTORCH_ROOT}/cmake-out) -target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(executorch) add_subdirectory(${EXECUTORCH_ROOT}/third-party/gflags gflags) set(link_libraries gflags) list(APPEND link_libraries portable_ops_lib portable_kernels) -target_link_options_shared_lib(portable_ops_lib) +executorch_target_link_options_shared_lib(portable_ops_lib) if(USE_XNNPACK_BACKEND) set(xnnpack_backend_libs xnnpack_backend XNNPACK microkernels-prod) list(APPEND link_libraries ${xnnpack_backend_libs}) - target_link_options_shared_lib(xnnpack_backend) + executorch_target_link_options_shared_lib(xnnpack_backend) endif() if(USE_OPENVINO_BACKEND) @@ -54,7 +54,7 @@ if(USE_OPENVINO_BACKEND) ${CMAKE_CURRENT_BINARY_DIR}/../../lib ) list(APPEND link_libraries openvino_backend) - target_link_options_shared_lib(openvino_backend) + executorch_target_link_options_shared_lib(openvino_backend) endif() list(APPEND link_libraries extension_threadpool pthreadpool) diff --git a/examples/qualcomm/oss_scripts/llama/CMakeLists.txt b/examples/qualcomm/oss_scripts/llama/CMakeLists.txt index dadf51bf298..aee40fd3f18 100644 --- a/examples/qualcomm/oss_scripts/llama/CMakeLists.txt +++ b/examples/qualcomm/oss_scripts/llama/CMakeLists.txt @@ -16,7 +16,7 @@ target_include_directories( custom_ops PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../../include" ) target_link_libraries(custom_ops PUBLIC full_portable_ops_lib) -target_link_options_shared_lib(custom_ops) +executorch_target_link_options_shared_lib(custom_ops) # preprocess qnn runner src files for llama set(_llama_runner__srcs ${_llama_runner__srcs}) @@ -55,7 +55,7 @@ target_include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extension/llm/tokenizers/include ) -target_link_options_shared_lib(quantized_ops_lib) +executorch_target_link_options_shared_lib(quantized_ops_lib) target_link_libraries( qnn_llama_runner diff --git a/examples/selective_build/CMakeLists.txt b/examples/selective_build/CMakeLists.txt index faa3cf568a6..d52ba00f3a4 100644 --- a/examples/selective_build/CMakeLists.txt +++ b/examples/selective_build/CMakeLists.txt @@ -157,5 +157,5 @@ endif() target_link_libraries( selective_build_test PRIVATE executorch_core gflags select_build_lib ) -target_link_options_shared_lib(select_build_lib) +executorch_target_link_options_shared_lib(select_build_lib) target_compile_options(selective_build_test PUBLIC ${_common_compile_options}) diff --git a/extension/android/CMakeLists.txt b/extension/android/CMakeLists.txt index d9d2c982d39..f2b4fe522b0 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -60,7 +60,7 @@ set_target_properties(fbjni PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/third-party/fbjni/prefab/modules/fbjni/libs/android.${ANDROID_ABI}/libfbjni.so" ) -target_link_options_shared_lib(executorch) +executorch_target_link_options_shared_lib(executorch) add_library(executorch_jni SHARED jni/jni_layer.cpp jni/log.cpp jni/jni_layer_runtime.cpp) @@ -94,15 +94,15 @@ if(TARGET optimized_native_cpu_ops_lib) link_libraries optimized_native_cpu_ops_lib ) - target_link_options_shared_lib(optimized_native_cpu_ops_lib) + executorch_target_link_options_shared_lib(optimized_native_cpu_ops_lib) else() list(APPEND link_libraries portable_ops_lib portable_kernels) - target_link_options_shared_lib(portable_ops_lib) + executorch_target_link_options_shared_lib(portable_ops_lib) endif() if(TARGET quantized_kernels) list(APPEND link_libraries quantized_kernels quantized_ops_lib) - target_link_options_shared_lib(quantized_ops_lib) + executorch_target_link_options_shared_lib(quantized_ops_lib) endif() if(TARGET qnn_executorch_backend) @@ -110,12 +110,12 @@ if(TARGET qnn_executorch_backend) endif() if(TARGET xnnpack_backend) - target_link_options_shared_lib(xnnpack_backend) + executorch_target_link_options_shared_lib(xnnpack_backend) list(APPEND link_libraries xnnpack_backend XNNPACK pthreadpool cpuinfo xnnpack-microkernels-prod) endif() if(TARGET vulkan_backend) - target_link_options_shared_lib(vulkan_backend) + executorch_target_link_options_shared_lib(vulkan_backend) list(APPEND link_libraries vulkan_backend) endif() diff --git a/runtime/executor/test/CMakeLists.txt b/runtime/executor/test/CMakeLists.txt index c0b9c6c90c9..da0198975b4 100644 --- a/runtime/executor/test/CMakeLists.txt +++ b/runtime/executor/test/CMakeLists.txt @@ -172,7 +172,7 @@ target_link_libraries( executorch_core ) -target_link_options_shared_lib(test_backend_compiler_lib) +executorch_target_link_options_shared_lib(test_backend_compiler_lib) install( TARGETS test_backend_compiler_lib diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 28f7b110483..797dc4c50e8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -60,7 +60,7 @@ endif() # size_test_all_ops: binary with portable ops and no delegate backend # add_executable(size_test_all_ops ${_size_test__srcs}) -target_link_options_shared_lib(portable_ops_lib) +executorch_target_link_options_shared_lib(portable_ops_lib) target_link_libraries( size_test_all_ops executorch portable_ops_lib portable_kernels ) @@ -73,7 +73,7 @@ endif() # if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) add_executable(size_test_all_optimized_ops ${_size_test__srcs}) - target_link_options_shared_lib(optimized_native_cpu_ops_lib) + executorch_target_link_options_shared_lib(optimized_native_cpu_ops_lib) target_link_libraries( size_test_all_optimized_ops executorch optimized_native_cpu_ops_lib ) diff --git a/tools/cmake/Codegen.cmake b/tools/cmake/Codegen.cmake index 93331c7ed89..f4005b4a696 100644 --- a/tools/cmake/Codegen.cmake +++ b/tools/cmake/Codegen.cmake @@ -195,7 +195,7 @@ function(gen_custom_ops_aot_lib) include_directories(${TORCH_INCLUDE_DIRS}) target_link_libraries(${GEN_LIB_NAME} PRIVATE torch) - target_link_options_shared_lib(${GEN_LIB_NAME}) + executorch_target_link_options_shared_lib(${GEN_LIB_NAME}) if(TARGET portable_lib) target_link_libraries(${GEN_LIB_NAME} PRIVATE portable_lib) else() @@ -279,7 +279,7 @@ function(gen_operators_lib) endif() endif() - target_link_options_shared_lib(${GEN_LIB_NAME}) + executorch_target_link_options_shared_lib(${GEN_LIB_NAME}) set(_generated_headers ${_out_dir}/Functions.h ${_out_dir}/NativeFunctions.h) if(GEN_DTYPE_SELECTIVE_BUILD) list(APPEND _generated_headers ${_opvariant_h}) diff --git a/tools/cmake/Utils.cmake b/tools/cmake/Utils.cmake index 732f5ddd1e7..b4ce6d3edcb 100644 --- a/tools/cmake/Utils.cmake +++ b/tools/cmake/Utils.cmake @@ -21,7 +21,7 @@ # This is the funtion to use -Wl, --whole-archive to link static library NB: # target_link_options is broken for this case, it only append the interface link # options of the first library. -function(kernel_link_options target_name) +function(executorch_kernel_link_options target_name) # target_link_options(${target_name} INTERFACE # "$") target_link_options( @@ -31,16 +31,16 @@ function(kernel_link_options target_name) ) endfunction() -# Same as kernel_link_options but it's for MacOS linker -function(macos_kernel_link_options target_name) +# Same as executorch_kernel_link_options but it's for MacOS linker +function(executorch_macos_kernel_link_options target_name) target_link_options( ${target_name} INTERFACE "SHELL:LINKER:-force_load,$" ) endfunction() -# Same as kernel_link_options but it's for MSVC linker -function(msvc_kernel_link_options target_name) +# Same as executorch_kernel_link_options but it's for MSVC linker +function(executorch_msvc_kernel_link_options target_name) target_link_options( ${target_name} INTERFACE "SHELL:LINKER:/WHOLEARCHIVE:$" @@ -49,13 +49,13 @@ endfunction() # Ensure that the load-time constructor functions run. By default, the linker # would remove them since there are no other references to them. -function(target_link_options_shared_lib target_name) +function(executorch_target_link_options_shared_lib target_name) if(APPLE) - macos_kernel_link_options(${target_name}) + executorch_macos_kernel_link_options(${target_name}) elseif(MSVC) - msvc_kernel_link_options(${target_name}) + executorch_msvc_kernel_link_options(${target_name}) else() - kernel_link_options(${target_name}) + executorch_kernel_link_options(${target_name}) endif() endfunction() diff --git a/tools/cmake/executorch-config.cmake b/tools/cmake/executorch-config.cmake index 6472648786c..c3a0ca0b48f 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -183,7 +183,7 @@ set(shared_lib_list ) foreach(lib ${shared_lib_list}) if(TARGET ${lib}) - target_link_options_shared_lib(${lib}) + executorch_target_link_options_shared_lib(${lib}) endif() endforeach() @@ -196,5 +196,5 @@ if(TARGET xnnpack_backend) set_target_properties( xnnpack_backend PROPERTIES INTERFACE_LINK_LIBRARIES "${_deps}" ) - target_link_options_shared_lib(xnnpack_backend) + executorch_target_link_options_shared_lib(xnnpack_backend) endif()