CMake is good
- build && compile
mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
make -j8
- run the executable file
cd ../bin
./<your_program>
.
├─app # test file
├─bin # binary output
├─build # cmake build and make output
├─include # head file
| ├─LinkedList.hpp
| └─...
├─src # source file
├─tools # compile tools chain
├─.clang-format # clang-format custom file
├─build.ps1 # build script in powershell
├─build.sh # build script in bash
├─CMakeLists.txt # CMake configuration
└─README.md
see directory exe
for detail that how to compile an executable file
see directory dynamic-library
for details that how to compile dynamic link library
see directory static-library
for detail that how to compile static link library
download gflags in GitHub, see "Installing a binary distribution package"
Download the same version of opencv and opencv_contrib in Releases orMirrors
Compile from source:
In Windows cmd:
cd opencv-4.5.2
md build
md build\3rdparty\ffmpeg
copy ..\download\*.cmake build\3rdparty\ffmpeg\
copy ..\download\*.dll build\3rdparty\ffmpeg\
md build\downloads\wechat_qrcode
copy ..\download\*.caffemodel build\downloads\wechat_qrcode
copy ..\download\*.prototxt build\downloads\wechat_qrcode
md build\downloads\xfeatures2d\
copy ..\download\*.i build\downloads\xfeatures2d\
md build\testdata\cv\face\
copy ..\download\face_landmark_model.dat build\testdata\cv\face\
cd build
cmake .. ^
-G "MinGW Makefiles" ^
-D CMAKE_INSTALL_PREFIX=C:/Users/Henryzhu/Programs/opencv ^
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.2/modules ^
-D CMAKE_BUILD_TYPE=Release ^
-DBUILD_opencv_python2=OFF ^
-DBUILD_opencv_python3=OFF ^
-D OPENCV_GENERATE_PKGCONFIG=ON ^
-D BUILD_SHARED_LIBS=OFF^
-D WITH_CUDA=ON ^
-D OPENCV_DNN_CUDA=ON ^
-D WITH_ONNX=ON ^
-D WITH_1394=OFF
make -j8
make install
Some file must be downloaded for OpenCV compiled. After cmake
command, see build/CMakeDownloadLog.txt
to get the files need to be downloaded, then download and put them to the corresponded folder:
- v0.1.1f.zip:
build/3rdparty/ade/v0.1.1f
- opencv_videoio_ffmpeg.dll:
build/3rdparty/ffmpeg/opencv_videoio_ffmpeg.dll
- opencv_videoio_ffmpeg_64.dll:
build/3rdparty/ffmpeg/opencv_videoio_ffmpeg_64.dll
- ffmpeg_version.cmake:
build/3rdparty/ffmpeg/ffmpeg_version.cmake
- detect.caffemodel:
build/downloads/wechat_qrcode/detect.caffemodel
- detect.prototxt:
build/downloads/wechat_qrcode/detect.prototxt
- sr.caffemodel:
build/downloads/wechat_qrcode/sr.caffemodel
- sr.prototxt:
build/downloads/wechat_qrcode
- boostdesc_bgm.i:
build/downloads/xfeatures2d/boostdesc_bgm.i
- boostdesc_bgm_bi.i:
build/downloads/xfeatures2d/boostdesc_bgm_bi.i
- boostdesc_bgm_hd.i:
build/downloads/xfeatures2d/boostdesc_bgm_hd.i
- boostdesc_binboost_064.i:
build/downloads/xfeatures2d/boostdesc_binboost_064.i
- boostdesc_binboost_128.i:
build/downloads/xfeatures2d/boostdesc_binboost_128.i
- boostdesc_binboost_256.i:
build/downloads/xfeatures2d/boostdesc_binboost_256.i
- boostdesc_lbgm.i:
build/downloads/xfeatures2d/boostdesc_lbgm.i
- vgg_generated_48.i:
build/downloads/xfeatures2d/vgg_generated_48.i
- vgg_generated_64.i:
build/downloads/xfeatures2d/vgg_generated_64.i
- vgg_generated_80.i:
build/downloads/xfeatures2d/vgg_generated_80.i
- vgg_generated_120.i:
build/downloads/xfeatures2d/vgg_generated_120.i
- face_landmark_model.dat:
build/testdata/cv/face//face_landmark_model.dat
In LLVM official website, choose corresponding Clang-Format Release for your OS in Other builds.
Then, you can download LLVM in this page or in Github Release
when installing LLVM,
in page Install Options
, select if add LLVM to the system
- Do not add LLVM to the system PATH
- Add LLVM to the system PATH for all user
- Add LLVM to the system PATH for current user
use clang-format
with parameter -style
and -i
-style
LLVM、Google、Chromium、Mozilla、WebKit or file(.clang-format)-i
clang-format -style=LLVM -i test.c
or you can edit your custom format file .clang-format
,
clang-format -i test.c
see Clang documentation for more detail of using Clang-Format
in file .git/config
[remote "origin"]
url = https://gitee.com/<user_name>/<repo_name>.git
url = https://github.com/<user_name>/<repo_name>.git
fetch = +refs/heads/*:refs/remotes/origin/*
A command-line utility for retrieving files using HTTP, HTTPS and FTP protocols.
Download:
- Windows binaries of GNU Wget (Downloading ZIP and add to system PATH is recommended.)