Create a shared library for dlib

后端 未结 2 2092
孤街浪徒
孤街浪徒 2021-02-14 22:36

Following the instructions to compile dlib using cmake (here) generates a static dlib library:

cd examples
mkdir build
cd build
cmake ..
cmake --build . --config         


        
2条回答
  •  萌比男神i
    2021-02-14 22:49

    If you want to make a .so file then do this:

    cd dclib/dlib
    mkdir build
    cd build
    cmake -DBUILD_SHARED_LIBS=1 ..
    make
    sudo make install
    

    On a unix system, that will install dlib system wide. This means installing the .so file and also the header files so you can compile programs with a command like g++ main.cpp -ldlib. Finally, on linux systems you will also need to run sudo ldconfig after installing any new shared libraries.

    However, for most users, I would recommend using CMake as shown in the examples. That way would allow you to enable or disable debugging modes whenever you want and also makes distributing the project easier, both in source form and compiled form. For example, if you wanted to compile on windows then shared libraries are definitely not the way to go. Moreover, using CMake as shown in the examples will always work in a straightforward manner without any setup.

提交回复
热议问题