mirror of
https://github.com/opencv/opencv.git
synced 2024-11-30 14:29:49 +08:00
Android build scripts for Windows are updated to recognize ninja
This commit is contained in:
parent
a110dc14ca
commit
bf8c4a27be
@ -15,6 +15,10 @@ SET SCRIPTS_DIR=%cd%
|
|||||||
IF EXIST .\wincfg.cmd CALL .\wincfg.cmd
|
IF EXIST .\wincfg.cmd CALL .\wincfg.cmd
|
||||||
POPD
|
POPD
|
||||||
|
|
||||||
|
:: inherit old names
|
||||||
|
IF NOT DEFINED CMAKE SET CMAKE="%CMAKE_EXE%"
|
||||||
|
IF NOT DEFINED MAKE SET MAKE="%MAKE_EXE%"
|
||||||
|
|
||||||
:: defaults
|
:: defaults
|
||||||
IF NOT DEFINED BUILD_DIR SET BUILD_DIR=build
|
IF NOT DEFINED BUILD_DIR SET BUILD_DIR=build
|
||||||
IF NOT DEFINED ANDROID_ABI SET ANDROID_ABI=armeabi-v7a
|
IF NOT DEFINED ANDROID_ABI SET ANDROID_ABI=armeabi-v7a
|
||||||
@ -25,8 +29,8 @@ PUSHD .
|
|||||||
IF NOT DEFINED ANDROID_NDK (ECHO. & ECHO You should set an environment variable ANDROID_NDK to the full path to your copy of Android NDK & GOTO end)
|
IF NOT DEFINED ANDROID_NDK (ECHO. & ECHO You should set an environment variable ANDROID_NDK to the full path to your copy of Android NDK & GOTO end)
|
||||||
(CD "%ANDROID_NDK%") || (ECHO. & ECHO Directory "%ANDROID_NDK%" specified by ANDROID_NDK variable does not exist & GOTO end)
|
(CD "%ANDROID_NDK%") || (ECHO. & ECHO Directory "%ANDROID_NDK%" specified by ANDROID_NDK variable does not exist & GOTO end)
|
||||||
|
|
||||||
IF NOT EXIST "%CMAKE_EXE%" (ECHO. & ECHO You should set an environment variable CMAKE_EXE to the full path to cmake executable & GOTO end)
|
IF NOT EXIST "%CMAKE%" (ECHO. & ECHO You should set an environment variable CMAKE to the full path to cmake executable & GOTO end)
|
||||||
IF NOT EXIST "%MAKE_EXE%" (ECHO. & ECHO You should set an environment variable MAKE_EXE to the full path to native port of make executable & GOTO end)
|
IF NOT EXIST "%MAKE%" (ECHO. & ECHO You should set an environment variable MAKE to the full path to native port of make executable & GOTO end)
|
||||||
|
|
||||||
IF NOT %BUILD_JAVA_PART%==1 GOTO required_variables_checked
|
IF NOT %BUILD_JAVA_PART%==1 GOTO required_variables_checked
|
||||||
|
|
||||||
@ -42,6 +46,11 @@ IF NOT DEFINED JAVA_HOME (ECHO. & ECHO You should set an environment variable JA
|
|||||||
:required_variables_checked
|
:required_variables_checked
|
||||||
POPD
|
POPD
|
||||||
|
|
||||||
|
:: check for ninja
|
||||||
|
echo "%MAKE%"|findstr /i ninja >nul:
|
||||||
|
IF %errorlevel%==1 (SET BUILD_WITH_NINJA=0) ELSE (SET BUILD_WITH_NINJA=1)
|
||||||
|
IF %BUILD_WITH_NINJA%==1 (SET CMAKE_GENERATOR=Ninja) ELSE (SET CMAKE_GENERATOR=MinGW Makefiles)
|
||||||
|
|
||||||
:: create build dir
|
:: create build dir
|
||||||
IF DEFINED REBUILD rmdir /S /Q "%BUILD_DIR%" 2>NUL
|
IF DEFINED REBUILD rmdir /S /Q "%BUILD_DIR%" 2>NUL
|
||||||
MKDIR "%BUILD_DIR%" 2>NUL
|
MKDIR "%BUILD_DIR%" 2>NUL
|
||||||
@ -53,16 +62,17 @@ ECHO ANDROID_ABI=%ANDROID_ABI%
|
|||||||
ECHO.
|
ECHO.
|
||||||
IF NOT %BUILD_OPENCV%==1 GOTO other-cmake
|
IF NOT %BUILD_OPENCV%==1 GOTO other-cmake
|
||||||
:opencv-cmake
|
:opencv-cmake
|
||||||
("%CMAKE_EXE%" -G"MinGW Makefiles" -DANDROID_ABI="%ANDROID_ABI%" -DCMAKE_TOOLCHAIN_FILE="%SOURCE_DIR%"\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%MAKE_EXE%" %* "%SOURCE_DIR%\..") && GOTO cmakefin
|
("%CMAKE%" -G"%CMAKE_GENERATOR%" -DANDROID_ABI="%ANDROID_ABI%" -DCMAKE_TOOLCHAIN_FILE="%SOURCE_DIR%"\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%MAKE%" %* "%SOURCE_DIR%\..") && GOTO cmakefin
|
||||||
ECHO. & ECHO cmake failed & GOTO end
|
ECHO. & ECHO cmake failed & GOTO end
|
||||||
:other-cmake
|
:other-cmake
|
||||||
("%CMAKE_EXE%" -G"MinGW Makefiles" -DANDROID_ABI="%ANDROID_ABI%" -DOpenCV_DIR="%OPENCV_BUILD_DIR%" -DCMAKE_TOOLCHAIN_FILE="%OPENCV_BUILD_DIR%\..\android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM="%MAKE_EXE%" %* "%SOURCE_DIR%") && GOTO cmakefin
|
("%CMAKE%" -G"%CMAKE_GENERATOR%" -DANDROID_ABI="%ANDROID_ABI%" -DOpenCV_DIR="%OPENCV_BUILD_DIR%" -DCMAKE_TOOLCHAIN_FILE="%OPENCV_BUILD_DIR%\..\android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM="%MAKE%" %* "%SOURCE_DIR%") && GOTO cmakefin
|
||||||
ECHO. & ECHO cmake failed & GOTO end
|
ECHO. & ECHO cmake failed & GOTO end
|
||||||
:cmakefin
|
:cmakefin
|
||||||
|
|
||||||
:: run make
|
:: run make
|
||||||
ECHO. & ECHO Building native libs...
|
ECHO. & ECHO Building native libs...
|
||||||
("%MAKE_EXE%" -j %NUMBER_OF_PROCESSORS% VERBOSE=%VERBOSE%) || (ECHO. & ECHO make failed & GOTO end)
|
IF %BUILD_WITH_NINJA%==0 ("%MAKE%" -j %NUMBER_OF_PROCESSORS% VERBOSE=%VERBOSE%) || (ECHO. & ECHO make failed & GOTO end)
|
||||||
|
IF %BUILD_WITH_NINJA%==1 ("%MAKE%") || (ECHO. & ECHO ninja failed & GOTO end)
|
||||||
|
|
||||||
IF NOT %BUILD_JAVA_PART%==1 GOTO end
|
IF NOT %BUILD_JAVA_PART%==1 GOTO end
|
||||||
POPD && PUSHD %SOURCE_DIR%
|
POPD && PUSHD %SOURCE_DIR%
|
||||||
|
Loading…
Reference in New Issue
Block a user