@@ -238,6 +238,34 @@ To build using the pre-CXX11 ABI use the ``pre_cxx11_abi`` config
238
238
239
239
bazel build //:libtorchtrt --config pre_cxx11_abi -c [dbg/opt]
240
240
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
+
241
269
**Building the Python package **
242
270
--------------------------------
243
271
0 commit comments