Skip to content

Commit

Permalink
Update cmake docs to reflect the recommended way of running cmake (#6329
Browse files Browse the repository at this point in the history
)

* Update cmake docs to reflect the latest recommended way of running
cmake

Summary: Update the library name and make the cmake command a bit better

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

* Point to release/0.4 sources

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
larryliu0820 authored Oct 17, 2024
1 parent d59a511 commit a5a147f
Showing 1 changed file with 10 additions and 13 deletions.
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

0 comments on commit a5a147f

Please sign in to comment.