cocoa-xu / evision

Evision: An OpenCV-Erlang/Elixir binding
https://evision.app
Apache License 2.0
322 stars 22 forks source link

can't compile evision for ios #227

Closed thehaigo closed 4 months ago

thehaigo commented 6 months ago

trying this https://github.com/cocoa-xu/evision/pull/79

but can't compile opencv with below error cmake_opencv_4.8.0/modules/python_bindings_generator/headers.txt: No such file or directory

java,js bindings_generator are exists

env m1 mac erlang 26.2 elixir 1.16 xcode 15.1

edited option

IPHONEOS_DEPLOYMENT_TARGET ?= 12.0  # 9 -> 12
IPHONEOS_ARCH ?= arm64
DEFAULT_JOBS ?= 4 # 1 -> 4
IPHONEOS_OPTIONS = -DAPPLE_FRAMEWORK=ON -DOPENCV_INCLUDE_INSTALL_PATH=include \
        -DOPENCV_3P_LIB_INSTALL_PATH=lib/3rdparty -DFRAMEWORK_NAME=opencv2 -DIOS_ARCH=$(IPHONEOS_ARCH) \
        -DCMAKE_TOOLCHAIN_FILE=$(OPENCV_DIR)/platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake \
        -DCPU_BASELINE=DETECT -DCMAKE_C_FLAGS=-fembed-bitcode -DCMAKE_CXX_FLAGS=-fembed-bitcode \
        -DIPHONEOS_DEPLOYMENT_TARGET=$(IPHONEOS_DEPLOYMENT_TARGET) -D BUILD_opencv_objc=OFF -D BUILD_ZLIB=OFF \
        -DWITH_ADE=ON -D BUILD_opencv_gapi=ON 

tried add option -D BUILD_opencv_python_bindings_generator=ON but failed

cocoa-xu commented 4 months ago

Hi @thehaigo, I've fixed iOS build in the main branch, and it should work by setting the following env vars,

export EVISION_PREFER_PRECOMPILED=false
export MIX_TARGET=ios

And the precompiled version (w/ or w/o contrib modules) will be available in v0.1.36 (although you still need to redo the codesign for it).

Please feel free to reopen this issue if this fix doesn't work for you. :)