Skip to content

Commit 7d74fc7

Browse files
committed
Add documentation
Signed-off-by: Gabriel Cuendet <[email protected]>
1 parent c0bb7a8 commit 7d74fc7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docsrc/tutorials/installation.rst

+28
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,34 @@ To build using the pre-CXX11 ABI use the ``pre_cxx11_abi`` config
238238
239239
bazel build //:libtorchtrt --config pre_cxx11_abi -c [dbg/opt]
240240
241+
**Building with CMake**
242+
-----------------------
243+
244+
It is possible to build the API libraries (in cpp/) and the torchtrtc executable using CMake instead of Bazel.
245+
Begin by installing CMake.
246+
247+
* Latest releases of CMake and instructions on how to install are available for different platforms
248+
[on their website](https://cmake.org/download/).
249+
250+
A few useful CMake options include:
251+
252+
* CMake finders for TensorRT and cuDNN are provided in `cmake/Modules`. In order for CMake to use them, pass
253+
`-DCMAKE_MODULE_PATH=cmake/Modules` when configuring the project with CMake.
254+
* Libtorch provides its own CMake finder. In case CMake doesn't find it, pass the path to your install of
255+
libtorch with `-DTorch_DIR=<path to libtorch>/share/cmake/Torch`
256+
* If TensorRT is not found with the provided cmake finder, specify `-DTensorRT_ROOT=<path to TensorRT>`
257+
* Finally, configure and build the project in a build directory of your choice with the following command
258+
from the root of Torch-TensorRT project:
259+
260+
.. code-block:: shell
261+
262+
cmake -S. -B<build directory> \
263+
[-DCMAKE_MODULE_PATH=cmake/Module] \
264+
[-DTorch_DID=<path to libtorch>/share/cmake/Torch] \
265+
[-DTensorRT_ROOT=<path to TensorRT>] \
266+
[-DCMAKE_BUILD_TYPE=Debug|Release]
267+
cmake --build <build directory>
268+
241269
**Building the Python package**
242270
--------------------------------
243271

0 commit comments

Comments
 (0)