Note:Pybind11 build from source

Hi,
what I tried to reach in the past 2 days was to build the pybind11 from source. At first I failed to find information I expected in the pdf documentation in readme (I focused on the wrong chapter I later found).

I followed the history at first, and it was like:

1
2
3
4
5
6
7
rm -rf /usr/local/include/pybind
cd ~/git-repo
git clone (github pybind repository)
cd pybind
mkdir build/install -p
cd build/install
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release ../..

the viewer could be successfully built and run. The second attempt was following was following the pdf documentation in readme:

1
2
3
4
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
make check -j 4

along with sudo make install followed.

Up to this point, I don’t quite understand the purpose of mkdir before cmake, and the reason to why cmake and sudo make install seems to be the main point to build pybind11 instead of other action such as python3 setup.py install, and when to define certain variable such as -DCMAKE_INSTALL_PREFIX=/usr/local instead of leaving it default.