@ -13,32 +13,52 @@ set (SUPPRESS_WARNINGS_FLAGS "-Wno-incomplete-umbrella")
set (CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $${OBJC_COMPILE_FLAGS} $${SUPPRESS_WARNINGS_FLAGS}")
set (CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $${OBJC_COMPILE_FLAGS} $${SUPPRESS_WARNINGS_FLAGS}")
# grab the files
# grab the files
file(GLOB_RECURSE objc_sources "objc/*\.h" "objc/*\.m" "objc/*\.mm" "objc/*\.swift")
file(GLOB_RECURSE objc_sources "objc/*\.h" "objc/*\.m" "objc/*\.mm" "objc/*\.swift" "objc/*\.modulemap" )
file(GLOB_RECURSE objc_headers "*\.h")
file(GLOB_RECURSE objc_headers "*\.h")
add_library(opencv_objc_ framework STATIC $${objc_sources})
add_library($ framework STATIC $${objc_sources})
set_target_properties(opencv_objc_ framework PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties($ framework PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(opencv_objc_ framework PRIVATE "$${BUILD_ROOT}")
target_include_directories($ framework PRIVATE "$${BUILD_ROOT}")
target_include_directories(opencv_objc_ framework PRIVATE "$${BUILD_ROOT}/install/include")
target_include_directories($ framework PRIVATE "$${BUILD_ROOT}/install/include")
target_include_directories(opencv_objc_ framework PRIVATE "$${BUILD_ROOT}/install/include/opencv2")
target_include_directories($ framework PRIVATE "$${BUILD_ROOT}/install/include/opencv2")
foreach(m $${MODULES})
foreach(m $${MODULES})
target_include_directories(opencv_objc_ framework PRIVATE "$${BUILD_ROOT}/modules/objc/gen/objc/$${m}")
target_include_directories($ framework PRIVATE "$${BUILD_ROOT}/modules/objc/gen/objc/$${m}")
endforeach()
endforeach()
install(TARGETS opencv_objc_ framework LIBRARY DESTINATION lib)
install(TARGETS $ framework LIBRARY DESTINATION lib)
enable_language(Swift)
enable_language(Swift)
# Additional target properties
# Additional target properties
set_target_properties(opencv_objc_framework PROPERTIES
if (CMAKE_XCODE_BUILD_SYSTEM GREATER_EQUAL 12)
OUTPUT_NAME "$framework"
set_target_properties($framework PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "$${BUILD_ROOT}/lib"
OUTPUT_NAME "$framework"
XCODE_ATTRIBUTE_SWIFT_VERSION 5.0
ARCHIVE_OUTPUT_DIRECTORY "$${BUILD_ROOT}/lib"
XCODE_ATTRIBUTE_OTHER_SWIFT_FLAGS "-Xcc $${SUPPRESS_WARNINGS_FLAGS}"
XCODE_ATTRIBUTE_SWIFT_VERSION 5.0
FRAMEWORK TRUE
XCODE_ATTRIBUTE_DEFINES_MODULE YES
MACOSX_FRAMEWORK_IDENTIFIER org.opencv.$framework
XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION YES
PUBLIC_HEADER "$${objc_headers}"
XCODE_ATTRIBUTE_OTHER_SWIFT_FLAGS "-Xcc $${SUPPRESS_WARNINGS_FLAGS}"
DEFINE_SYMBOL CVAPI_EXPORTS
XCODE_ATTRIBUTE_MODULEMAP_FILE objc/$framework.modulemap
)
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER org.opencv.$framework
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER org.opencv.$framework
PUBLIC_HEADER "$${objc_headers}"
DEFINE_SYMBOL CVAPI_EXPORTS
)
else()
set_target_properties($framework PROPERTIES
OUTPUT_NAME "$framework"
ARCHIVE_OUTPUT_DIRECTORY "$${BUILD_ROOT}/lib"
XCODE_ATTRIBUTE_SWIFT_VERSION 5.0
XCODE_ATTRIBUTE_DEFINES_MODULE YES
XCODE_ATTRIBUTE_OTHER_SWIFT_FLAGS "-Xcc $${SUPPRESS_WARNINGS_FLAGS}"
XCODE_ATTRIBUTE_MODULEMAP_FILE objc/$framework.modulemap
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER org.opencv.$framework
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER org.opencv.$framework
PUBLIC_HEADER "$${objc_headers}"
DEFINE_SYMBOL CVAPI_EXPORTS
)
endif()