To test the dynamic library here, you need to open the dynamic link from the link library under the root directory and execute ldd main Let's take a look at the generated results:Ģ.3 follow the link path through ldd main The process of building the library is the same as that in the previous section. but for using functions without this method, must be compile open CV with Cmake. Here, we need to pay attention to the fact that external library dependency is not required during compilation, but during linking. dll files in openCv directory : opencvbuild圆4vc10bin. And create a directory inside of 'build' and name it 'mingw' incase you want to build using a different compiler later on. Create a directory in the opencv folder and name it 'build'. Install(FILES func.h DESTINATION include) Open the CMake GUI and select C:\opencv as the source directory (CMakeLists.txt should be present in C:\opencv).
OPENCV CMAKE ARCHIVE
Install(TARGETS mylib mylib_static LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
OPENCV CMAKE INSTALL
# Install dynamic and static libraries to / lib # Install shared libraries and header files # The installation command is also written here for completeness, which does not apply to him Set_target_properties(mylib_static PROPERTIES OUTPUT_NAME "mylib")
They should not be the same during construction # Here, we just rename them so that they have the same name. # To generate a library file with the same name as the dynamic library and the static library, you need a set instruction_ target_ properties # link_directories(/home/ubuntu/work/usr/lib) # include_directories(/home/ubuntu/work/usr/include) # The installation method is not used here, so it is commented out and added here for completeness # If you add through the installation method, you need to include the following two commands, otherwise the compilation will not pass 2.1 CMakeLists.txt in the root directory # Version judgment
OPENCV CMAKE HOW TO
How to separate them will be described later. It should be emphasized here that although construction and testing are put together, they can also be separated. At the same time, two CMakeLists.txt are created, one in the root directory and the other in src.
Layout of my project files: src is the source file directory of my construction library, and build is the generation directory of the construction library files. Start building your own library, which relies on opencv You can read this article directly: Click opencv installation tutorial, we recommend that you install version 3.x 2. How to build such a dynamic library? How to test when the build is ready? This chapter will introduce the process in detail: 1.ubuntu installation opencv I need to build a dynamic library, but this dynamic library depends on some external libraries, such as opencv and matlab. This section is what I encounter when I really use it.