From 90dad69dc814ee2b4f401e3dd73bc54fb75b1a39 Mon Sep 17 00:00:00 2001 From: peterjc123 Date: Mon, 25 Nov 2019 10:27:24 +0800 Subject: [PATCH 1/3] Use `cmake --build .` instead of `make` --- advanced_source/cpp_export.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/advanced_source/cpp_export.rst b/advanced_source/cpp_export.rst index fdbf66201d5..f36c8c42b96 100644 --- a/advanced_source/cpp_export.rst +++ b/advanced_source/cpp_export.rst @@ -228,6 +228,8 @@ structure: .. tip:: On Windows, debug and release builds are not ABI-compatible. If you plan to build your project in debug mode, please try the debug version of LibTorch. + Also, make sure you specify the correct configuration in the `cmake --build .` + line below. The last step is building the application. For this, assume our example directory is laid out like this: @@ -246,7 +248,7 @@ We can now run the following commands to build the application from within the mkdir build cd build cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch .. - make + cmake --build . --config Release where ``/path/to/libtorch`` should be the full path to the unzipped LibTorch distribution. If all goes well, it will look something like this: From eec82bd1e55a0035868d3d7789a43e24245a3126 Mon Sep 17 00:00:00 2001 From: peterjc123 Date: Mon, 25 Nov 2019 10:31:10 +0800 Subject: [PATCH 2/3] Minor fix --- advanced_source/cpp_export.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced_source/cpp_export.rst b/advanced_source/cpp_export.rst index f36c8c42b96..95e37618e73 100644 --- a/advanced_source/cpp_export.rst +++ b/advanced_source/cpp_export.rst @@ -228,7 +228,7 @@ structure: .. tip:: On Windows, debug and release builds are not ABI-compatible. If you plan to build your project in debug mode, please try the debug version of LibTorch. - Also, make sure you specify the correct configuration in the `cmake --build .` + Also, make sure you specify the correct configuration in the ``cmake --build .`` line below. The last step is building the application. For this, assume our example From b08a7989f75bba09ce4e770a3a455d764c6e8b43 Mon Sep 17 00:00:00 2001 From: peterjc123 Date: Mon, 25 Nov 2019 10:48:30 +0800 Subject: [PATCH 3/3] More fixes --- advanced_source/cpp_frontend.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/advanced_source/cpp_frontend.rst b/advanced_source/cpp_frontend.rst index 78c4bbaf4d4..8dd1a8abf4a 100644 --- a/advanced_source/cpp_frontend.rst +++ b/advanced_source/cpp_frontend.rst @@ -105,6 +105,8 @@ environment, however you are free to follow along on MacOS or Windows too. .. tip:: On Windows, debug and release builds are not ABI-compatible. If you plan to build your project in debug mode, please try the debug version of LibTorch. + Also, make sure you specify the correct configuration in the ``cmake --build .`` + line below. The first step is to download the LibTorch distribution locally, via the link retrieved from the PyTorch website. For a vanilla Ubuntu Linux environment, this @@ -201,7 +203,7 @@ corresponding absolute path. Now, we are ready to build our application: -- Configuring done -- Generating done -- Build files have been written to: /home/build - root@fa350df05ecf:/home/build# make -j + root@fa350df05ecf:/home/build# cmake --build . --config Release Scanning dependencies of target dcgan [ 50%] Building CXX object CMakeFiles/dcgan.dir/dcgan.cpp.o [100%] Linking CXX executable dcgan @@ -209,9 +211,9 @@ corresponding absolute path. Now, we are ready to build our application: Above, we first created a ``build`` folder inside of our ``dcgan`` directory, entered this folder, ran the ``cmake`` command to generate the necessary build -(Make) files and finally compiled the project successfully by running ``make --j``. We are now all set to execute our minimal binary and complete this section -on basic project configuration: +(Make) files and finally compiled the project successfully by running ``cmake +--build . --config Release``. We are now all set to execute our minimal binary +and complete this section on basic project configuration: .. code-block:: shell