Install libexecutorch.a and libportable_kernels.a (#1036)
Summary:
This PR is the first one to decentralize options only used by examples, from root level CMakeLists.txt to examples directories.
To install these two libraries (`libexecutorch.a` and `libportable_kernels.a`), user needs to run:
```
cmake -DBUCK2="$BUCK" \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
-Bcmake-out .
cmake --build cmake-out -j9 --target install
```
Then in the console output we will have:
```
-- Installing: /home/larryliu/executorch/cmake-out/lib/libportable_kernels.a
-- Installing: /home/larryliu/executorch/cmake-out/lib/libexecutorch.a
-- Installing: /home/larryliu/executorch/cmake-out/lib/cmake/ExecuTorch/ExecuTorchConfig.cmake
```
In order to find these libraries, we can do the following in example CMakeLists.txt:
```
find_package(ExecuTorch REQUIRED)
```
Then the example CMakeLists.txt can depend on `executorch` and `portable_kernels`.
Pull Request resolved: https://github.com/pytorch/executorch/pull/1036
Reviewed By: dbort
Differential Revision: D50482400
Pulled By: larryliu0820
fbshipit-source-id: a20017ce90ce6e0c7826b421b46c4a6666c5f16b M
Mengwei Liu committed
6152ac456bc3b53c382632cae8fe4d6c028b7b70
Parent: 7814dd7
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 10/31/2023, 12:52:28 AM