diff --git a/CMakeLists.txt b/CMakeLists.txt index afa745478a9..b19bfac61b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,11 +112,12 @@ set(CMAKE_SKIP_BUILD_RPATH OFF) set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) # Automatically add all linked folders that are NOT in the build directory to # the rpath (per library?) -# TODO: Doesn't work for us right now because we are -# not installing .so's into the correct locations. For example we have -# libcustom_ops_aot_lib.so depending on _portable_lib.so, which was eventually -# put under /executorch/extension/pybindings/ but this rpath is -# not automatically added because at build time it seems `portable_lib` is being +# +# TODO: Doesn't work for us right now because we are not installing .so's into +# the correct locations. For example we have libcustom_ops_aot_lib.so depending +# on _portable_lib.so, which was eventually put under +# /executorch/extension/pybindings/ but this rpath is not +# automatically added because at build time it seems `portable_lib` is being # built under the same directory, so no extra rpath is being added. To properly # fix this we need to install `portable_lib` into the correct path. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) @@ -321,8 +322,9 @@ if(EXECUTORCH_USE_CPP_CODE_COVERAGE) " -fprofile-instr-generate -fcoverage-mapping" ) else() - message(FATAL_ERROR - "Code coverage for compiler ${CMAKE_CXX_COMPILER_ID} is unsupported" + message( + FATAL_ERROR + "Code coverage for compiler ${CMAKE_CXX_COMPILER_ID} is unsupported" ) endif() endif() @@ -633,8 +635,8 @@ if(EXECUTORCH_BUILD_PYBIND) endif() if(EXECUTORCH_BUILD_XNNPACK) - # need to explicitly specify XNNPACK and xnnpack-microkernels-prod here otherwise - # uses XNNPACK and microkernel-prod symbols from libtorch_cpu + # need to explicitly specify XNNPACK and xnnpack-microkernels-prod here + # otherwise uses XNNPACK and microkernel-prod symbols from libtorch_cpu list(APPEND _dep_libs xnnpack_backend XNNPACK xnnpack-microkernels-prod) endif() diff --git a/extension/training/CMakeLists.txt b/extension/training/CMakeLists.txt index 11f94b39a89..26a5c752d5b 100644 --- a/extension/training/CMakeLists.txt +++ b/extension/training/CMakeLists.txt @@ -25,47 +25,58 @@ target_include_directories( target_include_directories(extension_training PUBLIC ${EXECUTORCH_ROOT}/..) target_compile_options(extension_training PUBLIC ${_common_compile_options}) -target_link_libraries(extension_training executorch_core kernels_util_all_deps - extension_data_loader extension_module_static extension_tensor extension_flat_tensor ) - +target_link_libraries( + extension_training + executorch_core + kernels_util_all_deps + extension_data_loader + extension_module_static + extension_tensor + extension_flat_tensor +) list(TRANSFORM _train_xor__srcs PREPEND "${EXECUTORCH_ROOT}/") add_executable(train_xor ${_train_xor__srcs}) -target_include_directories( - train_xor PUBLIC ${_common_include_directories} -) +target_include_directories(train_xor PUBLIC ${_common_include_directories}) target_link_libraries( -train_xor gflags executorch_core portable_ops_lib extension_tensor - extension_training program_schema + train_xor + gflags + executorch_core + portable_ops_lib + extension_tensor + extension_training + program_schema ) target_compile_options(train_xor PUBLIC ${_common_compile_options}) if(EXECUTORCH_BUILD_PYBIND) # Pybind library. - set(_pybind_training_dep_libs - ${TORCH_PYTHON_LIBRARY} - etdump - executorch - util - torch - extension_training + set(_pybind_training_dep_libs ${TORCH_PYTHON_LIBRARY} etdump executorch util + torch extension_training ) if(EXECUTORCH_BUILD_XNNPACK) - # need to explicitly specify XNNPACK and xnnpack-microkernels-prod - # here otherwise uses XNNPACK and microkernel-prod symbols from libtorch_cpu - list(APPEND _pybind_training_dep_libs xnnpack_backend XNNPACK xnnpack-microkernels-prod) + # need to explicitly specify XNNPACK and xnnpack-microkernels-prod here + # otherwise uses XNNPACK and microkernel-prod symbols from libtorch_cpu + list(APPEND _pybind_training_dep_libs xnnpack_backend XNNPACK + xnnpack-microkernels-prod + ) endif() # pybind training - pybind11_add_module(_training_lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/pybindings/_training_lib.cpp) + pybind11_add_module( + _training_lib SHARED + ${CMAKE_CURRENT_SOURCE_DIR}/pybindings/_training_lib.cpp + ) target_include_directories(_training_lib PRIVATE ${TORCH_INCLUDE_DIRS}) - target_compile_options(_training_lib PUBLIC -Wno-deprecated-declarations -fPIC -frtti -fexceptions) + target_compile_options( + _training_lib PUBLIC -Wno-deprecated-declarations -fPIC -frtti -fexceptions + ) target_link_libraries(_training_lib PRIVATE ${_pybind_training_dep_libs}) install(TARGETS _training_lib - LIBRARY DESTINATION executorch/extension/training/pybindings + LIBRARY DESTINATION executorch/extension/training/pybindings ) endif()