mirror of
https://github.com/opencv/opencv.git
synced 2025-06-26 22:31:22 +08:00
Merge pull request #27239 from avdivan:4.x
Android-SDK: check flag IPP package #27239 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
0bea67f57b
commit
a8a3b93043
@ -380,7 +380,40 @@ def get_ndk_dir():
|
||||
return android_sdk_ndk_bundle
|
||||
return None
|
||||
|
||||
def check_cmake_flag_enabled(cmake_file, flag_name, strict=True):
|
||||
print(f"Checking build flag '{flag_name}' in: {cmake_file}")
|
||||
|
||||
if not os.path.isfile(cmake_file):
|
||||
msg = f"ERROR: File {cmake_file} does not exist."
|
||||
if strict:
|
||||
print(msg)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("WARNING:", msg)
|
||||
return
|
||||
|
||||
with open(cmake_file, 'r') as file:
|
||||
for line in file:
|
||||
if line.strip().startswith(f"{flag_name}="):
|
||||
value = line.strip().split('=')[1]
|
||||
if value == '1':
|
||||
print(f"{flag_name}=1 found. Support is enabled.")
|
||||
return
|
||||
else:
|
||||
msg = f"ERROR: {flag_name} is set to {value}, expected 1."
|
||||
if strict:
|
||||
print(msg)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("WARNING:", msg)
|
||||
return
|
||||
msg = f"ERROR: {flag_name} not found in {os.path.basename(cmake_file)}."
|
||||
if strict:
|
||||
print(msg)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("WARNING:", msg)
|
||||
|
||||
#===================================================================================================
|
||||
|
||||
if __name__ == "__main__":
|
||||
@ -407,6 +440,7 @@ if __name__ == "__main__":
|
||||
parser.add_argument('--no_media_ndk', action="store_true", help="Do not link Media NDK (required for video I/O support)")
|
||||
parser.add_argument('--hwasan', action="store_true", help="Enable Hardware Address Sanitizer on ARM64")
|
||||
parser.add_argument('--disable', metavar='FEATURE', default=[], action='append', help='OpenCV features to disable (add WITH_*=OFF). To disable multiple, specify this flag again, e.g. "--disable TBB --disable OPENMP"')
|
||||
parser.add_argument('--no-strict-dependencies',action='store_false',dest='strict_dependencies',help='Disable strict dependency checking (default: strict mode ON)')
|
||||
args = parser.parse_args()
|
||||
|
||||
log.basicConfig(format='%(message)s', level=log.DEBUG)
|
||||
@ -485,9 +519,15 @@ if __name__ == "__main__":
|
||||
os.chdir(builder.libdest)
|
||||
builder.clean_library_build_dir()
|
||||
builder.build_library(abi, do_install, args.no_media_ndk)
|
||||
|
||||
#Check HAVE_IPP x86 / x86_64
|
||||
if abi.haveIPP():
|
||||
log.info("Checking HAVE_IPP for ABI: %s", abi.name)
|
||||
check_cmake_flag_enabled(os.path.join(builder.libdest,"CMakeVars.txt"), "HAVE_IPP", strict=args.strict_dependencies)
|
||||
|
||||
builder.gather_results()
|
||||
|
||||
|
||||
|
||||
if args.build_doc:
|
||||
builder.build_javadoc()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user