Skip to content

Update cmake docs to reflect the recommended way of running cmake #6329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions docs/source/runtime-build-and-cross-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ likely to be useful to embedded systems users.
- `libexecutorch.a`: The core of the ExecuTorch runtime. Does not contain any
operator/kernel definitions or backend definitions.
- `libportable_kernels.a`: The implementations of ATen-compatible operators,
following the signatures in `//kernels/portable/functions.yaml`.
- `libportable_kernels_bindings.a`: Generated code that registers the contents
following the signatures in `[functions.yaml](https://github.com/pytorch/executorch/blob/release/0.4/kernels/portable/functions.yaml)`.
- `libportable_ops_lib.a`: Generated code that registers the contents
of `libportable_kernels.a` with the runtime.
- NOTE: This must be linked into your application with a flag like
`-Wl,-force_load` or `-Wl,--whole-archive`. It contains load-time functions
Expand Down Expand Up @@ -43,9 +43,9 @@ dependencies may have changed.
# cd to the root of the executorch repo
cd executorch

# Clean and configure the CMake build system. It's good practice to do this
# Clean cmake cache directory (cmake-out). It's a good practice to do this
# whenever cloning or pulling the upstream repo.
(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake ..)
bash install_requirements.sh --clean
```

Once this is done, you don't need to do it again until you pull from the upstream repo again, or if you modify any CMake-related files.
Expand All @@ -54,28 +54,25 @@ Once this is done, you don't need to do it again until you pull from the upstrea

The release build offers optimizations intended to improve performance and reduce binary size. It disables program verification and executorch logging, and adds optimizations flags.
```bash
-DCMAKE_BUILD_TYPE=Release
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release"
```

To further optimize the release build for size, use both:
To further optimize the release build for size, add:
```bash
-DCMAKE_BUILD_TYPE=Release \
-DOPTIMIZE_SIZE=ON
CMAKE_FLAGS="$CMAKE_FLAGS -DOPTIMIZE_SIZE=ON"
```

See [CMakeLists.txt](https://github.com/pytorch/executorch/blob/main/CMakeLists.txt)
See [CMakeLists.txt](https://github.com/pytorch/executorch/blob/release/0.4/CMakeLists.txt)

## Build the runtime components

Build all targets with

```bash
# cd to the root of the executorch repo
cd executorch

# Build using the configuration that you previously generated under the
# `cmake-out` directory.
#
cmake "$CMAKE_FLAGS" -Bcmake-out .

# NOTE: The `-j` argument specifies how many jobs/processes to use when
# building, and tends to speed up the build significantly. It's typical to use
# "core count + 1" as the `-j` value.
Expand Down
Loading