Skip to content

Commit

Permalink
Merge pull request opencv#17165 from komakai:objc-binding
Browse files Browse the repository at this point in the history
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
  • Loading branch information
komakai authored Jun 8, 2020
1 parent f30b599 commit 0238547
Show file tree
Hide file tree
Showing 237 changed files with 24,107 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ bin/
build
node_modules
CMakeSettings.json
xcuserdata/
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ OCV_OPTION(BUILD_FAT_JAVA_LIB "Create Java wrapper exporting all functions
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
OCV_OPTION(BUILD_CUDA_STUBS "Build CUDA modules stubs when no CUDA SDK" OFF IF (NOT APPLE_FRAMEWORK) )
OCV_OPTION(BUILD_JAVA "Enable Java support" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
OCV_OPTION(BUILD_OBJC "Enable Objective-C support" ON IF APPLE_FRAMEWORK )

# OpenCV installation options
# ===================================================
Expand Down Expand Up @@ -1595,6 +1596,12 @@ if(BUILD_JAVA)
status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
endif()

# ========================== Objective-C =======================
if(BUILD_OBJC)
status("")
status(" Objective-C wrappers:" HAVE_opencv_objc THEN YES ELSE NO)
endif()

ocv_cmake_hook(STATUS_DUMP_EXTRA)

# ========================== auxiliary ==========================
Expand Down
5 changes: 5 additions & 0 deletions cmake/OpenCVGenConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java)
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java)
endif()

if(BUILD_OBJC AND HAVE_opencv_objc)
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_objc)
endif()


# -------------------------------------------------------------------------------------------
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
# -------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions cmake/OpenCVModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ macro(ocv_glob_module_sources)
if (APPLE)
file(GLOB_RECURSE lib_srcs_apple
"${CMAKE_CURRENT_LIST_DIR}/src/*.mm"
"${CMAKE_CURRENT_LIST_DIR}/src/*.swift"
)
list(APPEND lib_srcs ${lib_srcs_apple})
endif()
Expand Down
2 changes: 1 addition & 1 deletion modules/calib3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ if(DEBUG_opencv_calib3d)
list(APPEND debug_modules opencv_highgui)
endif()
ocv_define_module(calib3d opencv_imgproc opencv_features2d opencv_flann ${debug_modules}
WRAP java python js
WRAP java objc python js
)
5 changes: 5 additions & 0 deletions modules/calib3d/misc/objc/gen_dict.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"func_arg_fix" : {
"findCirclesGrid" : { "blobDetector" : {"defval" : "cv::SimpleBlobDetector::create()"} }
}
}
Loading

0 comments on commit 0238547

Please sign in to comment.