Skip to content

Commit 0238547

Browse files
authored
Merge pull request opencv#17165 from komakai:objc-binding
Objc binding * Initial work on Objective-C wrapper * Objective-C generator script; update manually generated wrappers * Add Mat tests * Core Tests * Imgproc wrapper generation and tests * Fixes for Imgcodecs wrapper * Miscellaneous fixes. Swift build support * Objective-C wrapper build/install * Add Swift wrappers for videoio/objdetect/feature2d * Framework build;iOS support * Fix toArray functions;Use enum types whenever possible * Use enum types where possible;prepare test build * Update test * Add test runner scripts for iOS and macOS * Add test scripts and samples * Build fixes * Fix build (cmake 3.17.x compatibility) * Fix warnings * Fix enum name conflicting handling * Add support for document generation with Jazzy * Swift/Native fast accessor functions * Add Objective-C wrapper for calib3d, dnn, ml, photo and video modules * Remove IntOut/FloatOut/DoubleOut classes * Fix iOS default test platform value * Fix samples * Revert default framework name to opencv2 * Add converter util functions * Fix failing test * Fix whitespace * Add handling for deprecated methods;fix warnings;define __OPENCV_BUILD * Suppress cmake warnings * Reduce severity of "jazzy not found" log message * Fix incorrect #include of compatibility header in ios.h * Use explicit returns in subscript/get implementation * Reduce minimum required cmake version to 3.15 for Objective-C/Swift binding
1 parent f30b599 commit 0238547

File tree

237 files changed

+24107
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+24107
-28
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ bin/
2424
build
2525
node_modules
2626
CMakeSettings.json
27+
xcuserdata/

CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ OCV_OPTION(BUILD_FAT_JAVA_LIB "Create Java wrapper exporting all functions
452452
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
453453
OCV_OPTION(BUILD_CUDA_STUBS "Build CUDA modules stubs when no CUDA SDK" OFF IF (NOT APPLE_FRAMEWORK) )
454454
OCV_OPTION(BUILD_JAVA "Enable Java support" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
455+
OCV_OPTION(BUILD_OBJC "Enable Objective-C support" ON IF APPLE_FRAMEWORK )
455456

456457
# OpenCV installation options
457458
# ===================================================
@@ -1595,6 +1596,12 @@ if(BUILD_JAVA)
15951596
status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
15961597
endif()
15971598

1599+
# ========================== Objective-C =======================
1600+
if(BUILD_OBJC)
1601+
status("")
1602+
status(" Objective-C wrappers:" HAVE_opencv_objc THEN YES ELSE NO)
1603+
endif()
1604+
15981605
ocv_cmake_hook(STATUS_DUMP_EXTRA)
15991606

16001607
# ========================== auxiliary ==========================

cmake/OpenCVGenConfig.cmake

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java)
3030
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java)
3131
endif()
3232

33+
if(BUILD_OBJC AND HAVE_opencv_objc)
34+
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_objc)
35+
endif()
36+
37+
3338
# -------------------------------------------------------------------------------------------
3439
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
3540
# -------------------------------------------------------------------------------------------

cmake/OpenCVModule.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ macro(ocv_glob_module_sources)
788788
if (APPLE)
789789
file(GLOB_RECURSE lib_srcs_apple
790790
"${CMAKE_CURRENT_LIST_DIR}/src/*.mm"
791+
"${CMAKE_CURRENT_LIST_DIR}/src/*.swift"
791792
)
792793
list(APPEND lib_srcs ${lib_srcs_apple})
793794
endif()

modules/calib3d/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ if(DEBUG_opencv_calib3d)
77
list(APPEND debug_modules opencv_highgui)
88
endif()
99
ocv_define_module(calib3d opencv_imgproc opencv_features2d opencv_flann ${debug_modules}
10-
WRAP java python js
10+
WRAP java objc python js
1111
)
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"func_arg_fix" : {
3+
"findCirclesGrid" : { "blobDetector" : {"defval" : "cv::SimpleBlobDetector::create()"} }
4+
}
5+
}

0 commit comments

Comments
 (0)