Skip to content

Use cmake --build . instead of make #733

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 3 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion advanced_source/cpp_export.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions advanced_source/cpp_frontend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -201,17 +203,17 @@ 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
[100%] Built target dcgan

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

Expand Down