Building OpenCV static libraries
Let's start with OpenCV, which follows almost the same set of instructions for building libraries as we did for dynamic libraries. You can refer to Chapter 1, Introduction to OpenCV and Qt, for more information about this. Simply download the source codes, extract, and use CMake to configure your build, as it is mentioned in that chapter. This time though, in addition to checking the checkbox next to the BUILD_opencv_world
option, also make sure that all of the following options are turned off by unchecking the checkbox next to each one of them:
BUILD_DOCS
BUILD_EXAMPLES
BUILD_PERF_TESTS
BUILD_TESTS
BUILD_SHARED_LIBS
BUILD_WITH_STATIC_CRT
(only available on Windows)
Turning off the first four parameters is merely for speeding up the build process and is completely optional. Disabling BUILD_SHARED_LIBS
simply enables the static (non-shared) build mode of OpenCV libraries, and the last parameter (on Windows) helps with avoiding incompatible library files. Now, if...