diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6e87db7..e330eb2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -38,6 +38,8 @@ jobs: name: ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }} env: + BUILD_SCRIPT: build-opencv3-linux.sh + BUILD_OPTIONS: opencv3_cmake_options.txt PKG_NAME: opencv-${{ matrix.ver.cv }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }} JAVA_PKG_NAME: opencv-${{ matrix.ver.cv }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }}-java @@ -57,9 +59,8 @@ jobs: # 复制 - name: copy run: | - cp build-opencv3-linux.sh opencv-${{ matrix.ver.cv }} - cp build-opencv3-linux-java.sh opencv-${{ matrix.ver.cv }} - cp opencv3_cmake_options.txt opencv-${{ matrix.ver.cv }} + cp ${{ env.BUILD_SCRIPT }} opencv-${{ matrix.ver.cv }} + cp ${{ env.BUILD_OPTIONS }} opencv-${{ matrix.ver.cv }} - name: Host - update run: sudo apt-get update @@ -114,24 +115,24 @@ jobs: - name: Docker - build run: | docker exec --env-file env.custom -w /root ${{ matrix.os_name }} git config --global --add safe.directory "*" - docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} chmod a+x build-opencv3-linux.sh - docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} ./build-opencv3-linux.sh "${{ matrix.arch }}" + docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} chmod a+x ${{ env.BUILD_SCRIPT }} + docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} ./${{ env.BUILD_SCRIPT }} -n '${{ matrix.arch }}' # install文件夹改名linux,并使用7z压缩 - name: 7zip run: | - cp -r opencv-${{ matrix.ver.cv }}/build-Release/install linux + cp -r opencv-${{ matrix.ver.cv }}/build-Release-${{ matrix.arch }}/install linux 7z a ${{ env.PKG_NAME }}.7z linux rm -r -f linux - name: Docker - build run: | - docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} chmod a+x build-opencv3-linux-java.sh - docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} ./build-opencv3-linux-java.sh "${{ matrix.arch }}" + docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} chmod a+x ${{ env.BUILD_SCRIPT }} + docker exec --env-file env.custom -w /root/opencv-${{ matrix.ver.cv }} ${{ matrix.os_name }} ./${{ env.BUILD_SCRIPT }} -n '${{ matrix.arch }}' -j - name: 7zip java run: | - cp -r opencv-${{ matrix.ver.cv }}/build-Release/install/share/OpenCV/java ${{ env.JAVA_PKG_NAME }} + cp -r opencv-${{ matrix.ver.cv }}/build-Release-${{ matrix.arch }}/install/share/OpenCV/java ${{ env.JAVA_PKG_NAME }} 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }} # 上传artifact @@ -148,25 +149,25 @@ jobs: # path: ${{ env.JAVA_PKG_NAME }}.7z # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow +# - name: Unshallow +# run: git fetch --prune --unshallow # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV +# - name: Get git log +# id: git-log +# run: | +# previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) +# lastTag=$(git describe --abbrev=0 --tags) +# echo "previousTag:$previousTag ~ lastTag:$lastTag" +# log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') +# echo "$log" +# echo "log_state="$log"" >> $GITHUB_ENV # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md +# - name: Generate Changelog +# if: startsWith(github.ref, 'refs/tags/') +# run: | +# echo -e '${{ env.log_state }}' > release.md # 创建release 上传release # https://github.com/marketplace/actions/create-release @@ -174,7 +175,7 @@ jobs: uses: ncipollo/release-action@v1 with: prerelease: false - bodyFile: release.md +# bodyFile: release.md artifacts: 'opencv-*.7z' allowUpdates: true artifactContentType: application/x-7z-compressed diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7bde2b9..01d8ada 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -23,11 +23,12 @@ jobs: runs-on: macos-${{ matrix.list.os_ver }} env: + BUILD_SCRIPT: build-opencv3-mac.sh + BUILD_OPTIONS: opencv3_cmake_options.txt PKG_NAME: opencv-${{ matrix.ver.cv }}-macos-${{ matrix.list.os_ver }}-${{ matrix.arch }} JAVA_PKG_NAME: opencv-${{ matrix.ver.cv }}-macos-${{ matrix.list.os_ver }}-${{ matrix.arch }}-java steps: - # Setup JDK - name: Set up JDK uses: actions/setup-java@v4 with: @@ -63,27 +64,27 @@ jobs: # 复制 - name: copy run: | - cp build-opencv3-mac.sh opencv-${{ matrix.ver.cv }} - cp build-opencv3-mac-java.sh opencv-${{ matrix.ver.cv }} - cp opencv3_cmake_options.txt opencv-${{ matrix.ver.cv }} + cp ${{ env.BUILD_SCRIPT }} opencv-${{ matrix.ver.cv }} + cp ${{ env.BUILD_OPTIONS }} opencv-${{ matrix.ver.cv }} # 编译 - name: build run: | cd opencv-${{ matrix.ver.cv }} - chmod a+x build-opencv3-mac.sh &&./build-opencv3-mac.sh "${{ matrix.arch }}" + chmod a+x ${{ env.BUILD_SCRIPT }} &&./${{ env.BUILD_SCRIPT }} -n '${{ matrix.arch }}' # 7z压缩 - name: 7zip run: | cp -r opencv-${{ matrix.ver.cv }}/build-Release-${{ matrix.arch }}/install macos 7z a ${{ env.PKG_NAME }}.7z macos + rm -r -f macos # 编译 - name: build java run: | cd opencv-${{ matrix.ver.cv }} - chmod a+x build-opencv3-mac-java.sh &&./build-opencv3-mac-java.sh "${{ matrix.arch }}" + chmod a+x ${{ env.BUILD_SCRIPT }} &&./${{ env.BUILD_SCRIPT }} -n '${{ matrix.arch }}' -j # 7z压缩 - name: 7zip diff --git a/.github/workflows/musl-gcc.yml b/.github/workflows/musl-gcc.yml index 3e3ffdf..e596317 100644 --- a/.github/workflows/musl-gcc.yml +++ b/.github/workflows/musl-gcc.yml @@ -73,6 +73,8 @@ jobs: ] exclude: - target: loongarch64-linux-musl + - target: sh2-linux-muslfdpic + - target: sh2eb-linux-muslfdpic name: opencv-${{ matrix.ver.cv }}-${{ matrix.target }} diff --git a/build-opencv3-linux-java.sh b/build-opencv3-linux-java.sh deleted file mode 100644 index 621c103..0000000 --- a/build-opencv3-linux-java.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -# ./build-opencv3-linux-java.sh "386" -# ./build-opencv3-linux-java.sh "amd64" -# ./build-opencv3-linux-java.sh "arm" -# ./build-opencv3-linux-java.sh "arm64" -# ./build-opencv3-linux-java.sh "ppc64le" - -if [ "$1" ]; then - echo "TARGET_ARCH=$1" - export TARGET_ARCH="$1" -else - echo "Default target: amd64" - export TARGET_ARCH="amd64" -fi - -HOST_OS=$(uname -s) -NUM_THREADS=$(grep ^processor /proc/cpuinfo | wc -l) -BUILD_TYPE="Release" - -# get gcc version -export compiler=$(which gcc) -MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1) -MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) -PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1) - -if [ $HOST_OS == "Linux" ] && [ $TARGET_ARCH == "arm64" ] && [ "$MAJOR.$MINOR.$PATCHLEVEL" == "4.8.4" ]; then - echo "Linux arm64 gcc version is 4.8.4, turn off libwebp" - DISABLE_OPTION="-DBUILD_WEBP=OFF -DWITH_WEBP=OFF" -elif [ $HOST_OS == "Linux" ] && [ $TARGET_ARCH == "386" ] && [ "$MAJOR.$MINOR.$PATCHLEVEL" == "4.8.4" ]; then - echo "Linux 386 gcc version is 4.8.4, turn off openexr" - DISABLE_OPTION="-DBUILD_OPENEXR=OFF -DWITH_OPENEXR=OFF" -else - echo "Other gcc version" - DISABLE_OPTION="" -fi - -mkdir -p "build-$BUILD_TYPE" -pushd "build-$BUILD_TYPE" -cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCMAKE_CONFIGURATION_TYPES=$BUILD_TYPE \ - -DCMAKE_INSTALL_PREFIX=install \ - $(cat ../opencv3_cmake_options.txt) \ - $DISABLE_OPTION \ - -DBUILD_FAT_JAVA_LIB=ON \ - -DBUILD_JAVA=ON \ - -DBUILD_opencv_java=ON \ - -DBUILD_opencv_flann=ON \ - .. -cmake --build . -j $NUM_THREADS -cmake --build . --target install -popd - diff --git a/build-opencv3-linux.sh b/build-opencv3-linux.sh index 657af8b..0f68494 100644 --- a/build-opencv3-linux.sh +++ b/build-opencv3-linux.sh @@ -1,48 +1,74 @@ #!/usr/bin/env bash -# ./build-opencv3-linux.sh "386" -# ./build-opencv3-linux.sh "amd64" -# ./build-opencv3-linux.sh "arm" -# ./build-opencv3-linux.sh "arm64" -# ./build-opencv3-linux.sh "ppc64le" - -if [ "$1" ]; then - echo "TARGET_ARCH=$1" - export TARGET_ARCH="$1" +# ./build-opencv3-linux.sh -n 386 +# ./build-opencv3-linux.sh -n amd64 +# ./build-opencv3-linux.sh -n arm +# ./build-opencv3-linux.sh -n arm64 +# ./build-opencv3-linux.sh -n ppc64le + +HOST_OS=$(uname -s) +NUM_THREADS=1 +BUILD_TYPE=Release + +if [ "$HOST_OS" == "Linux" ]; then + NUM_THREADS=$(nproc) else - echo "Default target: amd64" - export TARGET_ARCH="amd64" + echo "Unsupported OS: $HOST_OS" + exit 0 fi -HOST_OS=$(uname -s) -NUM_THREADS=$(grep ^processor /proc/cpuinfo | wc -l) -BUILD_TYPE="Release" +JAVA_FLAG="" +TARGET_ARCH="" + +while getopts "n:j" arg; do + case $arg in + n) + echo "n(TARGET_ARCH):$OPTARG" + TARGET_ARCH="$OPTARG" + ;; + j) + echo "j's arg:$OPTARG" + JAVA_FLAG="-DBUILD_FAT_JAVA_LIB=ON -DBUILD_JAVA=ON -DBUILD_opencv_java=ON -DBUILD_opencv_flann=ON" + ;; + ?) + echo -e "unkonw argument." + exit 1 + ;; + esac +done + +if [ -z "$TARGET_ARCH" ]; then + echo -e "empty TARGET_ARCH." + echo -e "usage: ./build-opencv3-linux.sh -n amd64" + exit 1 +fi # get gcc version -export compiler=$(which gcc) -MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1) -MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) -PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1) - -if [ $HOST_OS == "Linux" ] && [ $TARGET_ARCH == "arm64" ] && [ "$MAJOR.$MINOR.$PATCHLEVEL" == "4.8.4" ]; then - echo "Linux arm64 gcc version is 4.8.4, turn off libwebp" - DISABLE_OPTION="-DBUILD_WEBP=OFF -DWITH_WEBP=OFF" -elif [ $HOST_OS == "Linux" ] && [ $TARGET_ARCH == "386" ] && [ "$MAJOR.$MINOR.$PATCHLEVEL" == "4.8.4" ]; then - echo "Linux 386 gcc version is 4.8.4, turn off openexr" - DISABLE_OPTION="-DBUILD_OPENEXR=OFF -DWITH_OPENEXR=OFF" +export _compiler=$(which gcc) +MAJOR=$(echo __GNUC__ | $_compiler -E -xc - | tail -n 1) +MINOR=$(echo __GNUC_MINOR__ | $_compiler -E -xc - | tail -n 1) +PATCH_LEVEL=$(echo __GNUC_PATCHLEVEL__ | $_compiler -E -xc - | tail -n 1) + +if [ "$HOST_OS" == "Linux" ] && [ "$TARGET_ARCH" == "arm64" ] && [ "$MAJOR.$MINOR.$PATCH_LEVEL" == "4.8.4" ]; then + echo "Linux arm64 gcc version is 4.8.4, turn off libwebp" + DISABLE_OPTION="-DBUILD_WEBP=OFF -DWITH_WEBP=OFF" +elif [ "$HOST_OS" == "Linux" ] && [ "$TARGET_ARCH" == "386" ] && [ "$MAJOR.$MINOR.$PATCH_LEVEL" == "4.8.4" ]; then + echo "Linux 386 gcc version is 4.8.4, turn off openexr" + DISABLE_OPTION="-DBUILD_OPENEXR=OFF -DWITH_OPENEXR=OFF" else - echo "Other gcc version" - DISABLE_OPTION="" + echo "Other gcc version" + DISABLE_OPTION="" fi -mkdir -p "build-$BUILD_TYPE" -pushd "build-$BUILD_TYPE" -cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCMAKE_CONFIGURATION_TYPES=$BUILD_TYPE \ - -DCMAKE_INSTALL_PREFIX=install \ - $(cat ../opencv3_cmake_options.txt) \ - $DISABLE_OPTION \ - .. -cmake --build . -j $NUM_THREADS -cmake --build . --target install -popd +BUILD_OUTPUT_PATH="build-$BUILD_TYPE-$TARGET_ARCH" +BUILD_INSTALL_PATH="$BUILD_OUTPUT_PATH/install" +mkdir -p "$BUILD_OUTPUT_PATH" + +cmake --compile-no-warning-as-error \ + -B"$BUILD_OUTPUT_PATH" \ + -DCMAKE_INSTALL_PREFIX="$BUILD_INSTALL_PATH" \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CONFIGURATION_TYPES=$BUILD_TYPE \ + $(cat opencv3_cmake_options.txt) \ + $DISABLE_OPTION \ + $JAVA_FLAG +cmake --build $BUILD_OUTPUT_PATH --config $BUILD_TYPE --parallel $NUM_THREADS --target install diff --git a/build-opencv3-mac-java.sh b/build-opencv3-mac-java.sh deleted file mode 100644 index be85bd7..0000000 --- a/build-opencv3-mac-java.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -# ./build-opencv3-mac-java.sh "x86_64" -# ./build-opencv3-mac-java.sh "arm64" - -if [ "$1" ]; then - echo "TARGET_ARCH=$1" - TARGET_ARCH="$1" -else - echo "TARGET_ARCH use default x86_64" - TARGET_ARCH="x86_64" -fi - -NUM_THREADS=$(sysctl -n hw.ncpu) -BUILD_TYPE="Release" - -mkdir -p "build-$BUILD_TYPE-$TARGET_ARCH" -pushd "build-$BUILD_TYPE-$TARGET_ARCH" || exit -cmake -DCMAKE_SYSTEM_NAME="Darwin" -DCMAKE_SYSTEM_PROCESSOR="$TARGET_ARCH" -DCMAKE_OSX_ARCHITECTURES="$TARGET_ARCH" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="10.9" \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CONFIGURATION_TYPES=$BUILD_TYPE \ - -DCMAKE_INSTALL_PREFIX=install \ - $(cat ../opencv3_cmake_options.txt) \ - -DBUILD_FAT_JAVA_LIB=ON \ - -DBUILD_JAVA=ON \ - -DBUILD_opencv_java=ON \ - -DBUILD_opencv_flann=ON \ - .. -cmake --build . --config $BUILD_TYPE -j $NUM_THREADS -cmake --build . --config $BUILD_TYPE --target install -popd \ No newline at end of file diff --git a/build-opencv3-mac.sh b/build-opencv3-mac.sh index e606a61..f816909 100644 --- a/build-opencv3-mac.sh +++ b/build-opencv3-mac.sh @@ -1,26 +1,56 @@ #!/usr/bin/env bash -# ./build-opencv3-mac.sh "x86_64" -# ./build-opencv3-mac.sh "arm64" +# ./build-opencv3-mac.sh -n x86_64 +# ./build-opencv3-mac.sh -n arm64 -if [ "$1" ]; then - echo "TARGET_ARCH=$1" - TARGET_ARCH="$1" +HOST_OS=$(uname -s) +NUM_THREADS=1 +BUILD_TYPE=Release + +if [ "$HOST_OS" == "Darwin" ]; then + NUM_THREADS=$(sysctl -n hw.ncpu) else - echo "TARGET_ARCH use default x86_64" - TARGET_ARCH="x86_64" + echo "Unsupport OS: $HOST_OS" + exit 0 fi -NUM_THREADS=$(sysctl -n hw.ncpu) -BUILD_TYPE="Release" - -mkdir -p "build-$BUILD_TYPE-$TARGET_ARCH" -pushd "build-$BUILD_TYPE-$TARGET_ARCH" || exit -cmake -DCMAKE_SYSTEM_NAME="Darwin" -DCMAKE_SYSTEM_PROCESSOR="$TARGET_ARCH" -DCMAKE_OSX_ARCHITECTURES="$TARGET_ARCH" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="10.9" \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CONFIGURATION_TYPES=$BUILD_TYPE \ - -DCMAKE_INSTALL_PREFIX=install \ - $(cat ../opencv3_cmake_options.txt) \ - .. -cmake --build . --config $BUILD_TYPE -j $NUM_THREADS -cmake --build . --config $BUILD_TYPE --target install -popd \ No newline at end of file +JAVA_FLAG="" +TARGET_ARCH="" + +while getopts "n:j" arg; do + case $arg in + n) + echo "n(TARGET_ARCH):$OPTARG" + TARGET_ARCH="$OPTARG" + ;; + j) + echo "j's arg:$OPTARG" + JAVA_FLAG="-DBUILD_FAT_JAVA_LIB=ON -DBUILD_JAVA=ON -DBUILD_opencv_java=ON -DBUILD_opencv_flann=ON" + ;; + ?) + echo -e "unkonw argument." + exit 1 + ;; + esac +done + +if [ -z "$TARGET_ARCH" ]; then + echo -e "empty TARGET_ARCH." + echo -e "usage1: ./build-opencv3-linux.sh -n x86_64" + echo -e "usage2: ./build-opencv3-linux.sh -n arm64" + exit 1 +fi + +BUILD_OUTPUT_PATH="build-$BUILD_TYPE-$TARGET_ARCH" +BUILD_INSTALL_PATH="$BUILD_OUTPUT_PATH/install" +mkdir -p "$BUILD_OUTPUT_PATH" + +cmake --compile-no-warning-as-error \ + -B"$BUILD_OUTPUT_PATH" \ + -DCMAKE_INSTALL_PREFIX="$BUILD_INSTALL_PATH" \ + -DCMAKE_SYSTEM_NAME="Darwin" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.9" \ + -DCMAKE_SYSTEM_PROCESSOR="$TARGET_ARCH" -DCMAKE_OSX_ARCHITECTURES="$TARGET_ARCH" \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CONFIGURATION_TYPES=$BUILD_TYPE \ + $(cat opencv3_cmake_options.txt) \ + $JAVA_FLAG + +cmake --build $BUILD_OUTPUT_PATH --config $BUILD_TYPE --parallel $NUM_THREADS --target install diff --git a/build-opencv3-win-java.bat b/build-opencv3-win-java.bat deleted file mode 100644 index 4c23be5..0000000 --- a/build-opencv3-win-java.bat +++ /dev/null @@ -1,71 +0,0 @@ -:: build opencv 3 for windows by benjaminwan -:: build-opencv3-win-java.bat x64 v142 md -:: build-opencv3-win-java.bat Win32 v142 md -:: build-opencv3-win-java.bat ARM64 v142 md - -@ECHO OFF -chcp 65001 -cls -SETLOCAL EnableDelayedExpansion - -IF "%1"=="" ( - echo input VS_ARCH none, use x64 - set VS_ARCH="x64" -)^ -ELSE ( - echo input VS_ARCH:%1 - set VS_ARCH="%1" -) - -IF "%2"=="" ( - echo input VS_VER none, use v142 - set VS_VER="v142" -)^ -ELSE ( - echo input VS_VER:%2 - set VS_VER="%2" -) - -IF "%3"=="" ( - echo input VS_CRT none, use mt - set VS_CRT="mt" -)^ -ELSE ( - echo input VS_CRT:%3 - set VS_CRT="%3" -) - -for /f "Delims=" %%x in (opencv3_cmake_options.txt) do set OPTIONS=!OPTIONS! %%x - -call :cmakeParams %VS_ARCH% %VS_VER% %VS_CRT% -GOTO:EOF - -:cmakeParams -mkdir "build-%~1-%~2-%~3" -pushd "build-%~1-%~2-%~3" -if "%~1" == "ARM64" ( - set ARM64_INTRINSICS="-DCV_ENABLE_INTRINSICS=OFF" -)^ -else ( - set ARM64_INTRINSICS="" -) -if "%~3" == "md" ( - set STATIC_CRT_ENABLED="OFF" -)^ -else ( - set STATIC_CRT_ENABLED="ON" -) -cmake -A "%~1" -T "%~2,host=x64" ^ - -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR="%~1" ^ - -DCMAKE_INSTALL_PREFIX=install ^ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=Release ^ - -DBUILD_WITH_STATIC_CRT=%STATIC_CRT_ENABLED% %ARM64_INTRINSICS% %OPTIONS% ^ - -DBUILD_FAT_JAVA_LIB=ON ^ - -DBUILD_JAVA=ON ^ - -DBUILD_opencv_java=ON ^ - -DBUILD_opencv_flann=ON ^ - .. -cmake --build . --config Release -j %NUMBER_OF_PROCESSORS% -cmake --build . --config Release --target install -popd -GOTO:EOF \ No newline at end of file diff --git a/build-opencv3-win.bat b/build-opencv3-win.bat deleted file mode 100644 index 350e937..0000000 --- a/build-opencv3-win.bat +++ /dev/null @@ -1,67 +0,0 @@ -:: build opencv 4 for windows by benjaminwan -:: build-opencv3-win.bat x64 v142 md -:: build-opencv3-win.bat Win32 v142 md -:: build-opencv3-win.bat ARM64 v142 md - -@ECHO OFF -chcp 65001 -cls -SETLOCAL EnableDelayedExpansion - -IF "%1"=="" ( - echo input VS_ARCH none, use x64 - set VS_ARCH="x64" -)^ -ELSE ( - echo input VS_ARCH:%1 - set VS_ARCH="%1" -) - -IF "%2"=="" ( - echo input VS_VER none, use v142 - set VS_VER="v142" -)^ -ELSE ( - echo input VS_VER:%2 - set VS_VER="%2" -) - -IF "%3"=="" ( - echo input VS_CRT none, use mt - set VS_CRT="mt" -)^ -ELSE ( - echo input VS_CRT:%3 - set VS_CRT="%3" -) - -for /f "Delims=" %%x in (opencv3_cmake_options.txt) do set OPTIONS=!OPTIONS! %%x - -call :cmakeParams %VS_ARCH% %VS_VER% %VS_CRT% -GOTO:EOF - -:cmakeParams -mkdir "build-%~1-%~2-%~3" -pushd "build-%~1-%~2-%~3" -if "%~1" == "ARM64" ( - set ARM64_INTRINSICS="-DCV_ENABLE_INTRINSICS=OFF" -)^ -else ( - set ARM64_INTRINSICS="" -) -if "%~3" == "md" ( - set STATIC_CRT_ENABLED="OFF" -)^ -else ( - set STATIC_CRT_ENABLED="ON" -) -cmake -A "%~1" -T "%~2,host=x64" ^ - -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR="%~1" ^ - -DCMAKE_INSTALL_PREFIX=install ^ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=Release ^ - -DBUILD_WITH_STATIC_CRT=%STATIC_CRT_ENABLED% %ARM64_INTRINSICS% %OPTIONS% ^ - .. -cmake --build . --config Release -j %NUMBER_OF_PROCESSORS% -cmake --build . --config Release --target install -popd -GOTO:EOF \ No newline at end of file