Skip to content

Commit

Permalink
不使用任何并行库
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminwan committed May 25, 2022
1 parent 90cc423 commit d208b48
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OpenCV在OCR中只是做图像的读取保存、编解码、缩放等,可以
最后利用Github Actions进行编译。

### 20220524 update
opencv 4.5.5 linux WITH_OPENMP=OFF
opencv 4.5.5 不使用任何并行库

### 手动编译说明

Expand Down
20 changes: 3 additions & 17 deletions build-opencv4.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
#!/usr/bin/env bash
# build opencv 4.5.x base on https://github.com/nihui/opencv-mobile/blob/master/opencv4_cmake_options.txt

function cmakeParamsMac() {
function cmakeParams() {
mkdir -p "build-$1"
pushd "build-$1"
cmake -DCMAKE_BUILD_TYPE=$1 -DCMAKE_CONFIGURATION_TYPES=$1 \
-DCMAKE_INSTALL_PREFIX=install \
$(cat ../opencv4_cmake_options.txt) \
-DWITH_OPENMP=OFF \
..
cmake --build . --config $1 -j $NUM_THREADS
cmake --build . --config $1 --target install
popd
}

function cmakeParamsLinux() {
mkdir -p "build-$1"
pushd "build-$1"
cmake -DCMAKE_BUILD_TYPE=$1 -DCMAKE_CONFIGURATION_TYPES=$1 \
-DCMAKE_INSTALL_PREFIX=install \
$(cat ../opencv4_cmake_options.txt) \
-DWITH_OPENMP=ON \
..
cmake --build . --config $1 -j $NUM_THREADS
cmake --build . --config $1 --target install
Expand All @@ -33,11 +19,11 @@ NUM_THREADS=1
if [ $sysOS == "Darwin" ]; then
#echo "I'm MacOS"
NUM_THREADS=$(sysctl -n hw.ncpu)
cmakeParamsMac "Release"
cmakeParams "Release"
elif [ $sysOS == "Linux" ]; then
#echo "I'm Linux"
NUM_THREADS=$(grep ^processor /proc/cpuinfo | wc -l)
cmakeParamsLinux "Release"
cmakeParams "Release"
else
echo "Other OS: $sysOS"
fi
5 changes: 5 additions & 0 deletions opencv4_cmake_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@
-DBUILD_opencv_ml=OFF
-DBUILD_WITH_STATIC_CRT=OFF
-DWITH_ADE=OFF
-DWITH_TBB=OFF
-DWITH_HPX=OFF
-DWITH_OPENMP=OFF
-DWITH_GCD=OFF
-DWITH_CONCURRENCY=OFF
-DWITH_PTHREADS_PF=OFF

0 comments on commit d208b48

Please sign in to comment.