Skip to content
Snippets Groups Projects
Commit d2e9a86a authored by Vincent POLLET's avatar Vincent POLLET
Browse files

Update recipe

parent 74b4537c
No related branches found
No related tags found
1 merge request!463Update recipe
Pipeline #47195 failed
#!/usr/bin/env bash #!/usr/bin/env bash
set +x set +x
SHORT_OS_STR=$(uname -s)
MACHINE_STR=$(uname -m)
# CMake FindPNG seems to look in libpng not libpng16 # CMake FindPNG seems to look in libpng not libpng16
# https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindPNG.cmake#L55 # https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindPNG.cmake#L55
...@@ -11,54 +9,28 @@ ln -s $PREFIX/include/libpng16 $PREFIX/include/libpng ...@@ -11,54 +9,28 @@ ln -s $PREFIX/include/libpng16 $PREFIX/include/libpng
QT="5" QT="5"
V4L="1" V4L="1"
if [ "${SHORT_OS_STR:0:5}" == "Linux" ]; then if [[ "${target_platform}" == linux-* ]]; then
OPENMP="-DWITH_OPENMP=1"
# Looks like there's a bug in Opencv 3.2.0 for building with FFMPEG # Looks like there's a bug in Opencv 3.2.0 for building with FFMPEG
# with GCC opencv/issues/8097 # with GCC opencv/issues/8097
export CXXFLAGS="$CXXFLAGS -D__STDC_CONSTANT_MACROS" export CXXFLAGS="$CXXFLAGS -D__STDC_CONSTANT_MACROS"
export CPPFLAGS="${CPPFLAGS//-std=c++17/-std=c++11}" export CPPFLAGS="${CPPFLAGS//-std=c++17/-std=c++11}"
export CXXFLAGS="${CXXFLAGS//-std=c++17/-std=c++11}" export CXXFLAGS="${CXXFLAGS//-std=c++17/-std=c++11}"
OPENMP="-DWITH_OPENMP=1"
export LDFLAGS="${LDFLAGS} -Wl,-rpath-link,${PREFIX}/lib"
fi fi
if [ "${SHORT_OS_STR}" == "Darwin" ]; then if [[ "${target_platform}" == osx-* ]]; then
OPENMP=""
QT="0" QT="0"
V4L="0" V4L="0"
# The old OSX compilers don't know what to do with AVX instructions
# Therefore, we specify what CPU dispatch operations we want explicitely
# for OSX..
# I took this line from the default build flags that get spewed after
# a successful call to cmake without the parameter specified
# The default flag as of OpenCV 3.4.4 are:
# CPU_DISPATCH:STRING=SSE4_1;SSE4_2;AVX;FP16;AVX2;AVX512_SKX
CPU_DISPATCH_FLAGS="-DCPU_DISPATCH=SSE4_1;SSE4_2;AVX;FP16"
# remove -dead_strip_dylibs from LDFLAGS if it exists # remove -dead_strip_dylibs from LDFLAGS if it exists
export LDFLAGS=${LDFLAGS//"-dead_strip_dylibs"/} # export LDFLAGS=${LDFLAGS//"-dead_strip_dylibs"/}
fi fi
if [ "${MACHINE_STR}" == "aarch64" ] || [ "${MACHINE_STR:0:3}" == "arm" ] || [ "${MACHINE_STR:0:3}" == "ppc" ]; then if [[ "${target_platform}" != *-64 ]]; then
QT="0" QT="0"
fi fi
CMAKE_TOOLCHAIN_CMD_FLAGS="" export PKG_CONFIG_LIBDIR=$PREFIX/lib
if [ "$c_compiler" = clang ]; then
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_AR=${AR}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_LINKER=${LD}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_NM=${NM}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_RANLIB=${RANLIB}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_STRIP=${STRIP}"
elif [ "$c_compiler" = gcc ]; then
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_AR=${AR}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_LINKER=${LD}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_NM=${NM}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_OBJCOPY=${OBJCOPY}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_OBJDUMP=${OBJDUMP}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_RANLIB=${RANLIB}"
CMAKE_TOOLCHAIN_CMD_FLAGS="${CMAKE_TOOLCHAIN_CMD_FLAGS} -DCMAKE_STRIP=${STRIP}"
fi
mkdir -p build mkdir -p build
cd build cd build
...@@ -85,7 +57,7 @@ fi ...@@ -85,7 +57,7 @@ fi
PYTHON_SET_FLAG="-DBUILD_opencv_python${PY_MAJOR}=1" PYTHON_SET_FLAG="-DBUILD_opencv_python${PY_MAJOR}=1"
PYTHON_SET_EXE="-DPYTHON${PY_MAJOR}_EXECUTABLE=${PYTHON}" PYTHON_SET_EXE="-DPYTHON${PY_MAJOR}_EXECUTABLE=${PYTHON}"
PYTHON_SET_INC="-DPYTHON${PY_MAJOR}_INCLUDE_DIR=${INC_PYTHON} " PYTHON_SET_INC="-DPYTHON${PY_MAJOR}_INCLUDE_DIR=${INC_PYTHON} "
PYTHON_SET_NUMPY="-DPYTHON${PY_MAJOR}_NUMPY_INCLUDE_DIRS=${SP_DIR}/numpy/core/include" PYTHON_SET_NUMPY="-DPYTHON${PY_MAJOR}_NUMPY_INCLUDE_DIRS=$(python -c 'import numpy;print(numpy.get_include())')"
PYTHON_SET_LIB="-DPYTHON${PY_MAJOR}_LIBRARY=${LIB_PYTHON}" PYTHON_SET_LIB="-DPYTHON${PY_MAJOR}_LIBRARY=${LIB_PYTHON}"
PYTHON_SET_SP="-DPYTHON${PY_MAJOR}_PACKAGES_PATH=${SP_DIR}" PYTHON_SET_SP="-DPYTHON${PY_MAJOR}_PACKAGES_PATH=${SP_DIR}"
PYTHON_SET_INSTALL="-DOPENCV_PYTHON${PY_MAJOR}_INSTALL_PATH=${SP_DIR}" PYTHON_SET_INSTALL="-DOPENCV_PYTHON${PY_MAJOR}_INSTALL_PATH=${SP_DIR}"
...@@ -108,11 +80,9 @@ cmake -LAH -G "Ninja" \ ...@@ -108,11 +80,9 @@ cmake -LAH -G "Ninja" \
-DCMAKE_INSTALL_LIBDIR="lib" \ -DCMAKE_INSTALL_LIBDIR="lib" \
-DOPENCV_DOWNLOAD_TRIES=1\;2\;3\;4\;5 \ -DOPENCV_DOWNLOAD_TRIES=1\;2\;3\;4\;5 \
-DOPENCV_DOWNLOAD_PARAMS=INACTIVITY_TIMEOUT\;30\;TIMEOUT\;180\;SHOW_PROGRESS \ -DOPENCV_DOWNLOAD_PARAMS=INACTIVITY_TIMEOUT\;30\;TIMEOUT\;180\;SHOW_PROGRESS \
$CMAKE_TOOLCHAIN_CMD_FLAGS \
-DOPENCV_GENERATE_PKGCONFIG=ON \ -DOPENCV_GENERATE_PKGCONFIG=ON \
-DENABLE_CONFIG_VERIFICATION=ON \ -DENABLE_CONFIG_VERIFICATION=ON \
-DENABLE_PRECOMPILED_HEADERS=OFF \ -DENABLE_PRECOMPILED_HEADERS=OFF \
$CPU_DISPATCH_FLAGS \
$OPENMP \ $OPENMP \
-DWITH_MKL=ON \ -DWITH_MKL=ON \
-DWITH_EIGEN=1 \ -DWITH_EIGEN=1 \
...@@ -159,6 +129,7 @@ cmake -LAH -G "Ninja" \ ...@@ -159,6 +129,7 @@ cmake -LAH -G "Ninja" \
-DPNG_PNG_INCLUDE_DIR=${PREFIX}/include \ -DPNG_PNG_INCLUDE_DIR=${PREFIX}/include \
-DPROTOBUF_INCLUDE_DIR=${PREFIX}/include \ -DPROTOBUF_INCLUDE_DIR=${PREFIX}/include \
-DPROTOBUF_LIBRARIES=${PREFIX}/lib \ -DPROTOBUF_LIBRARIES=${PREFIX}/lib \
-DOPENCV_ENABLE_PKG_CONFIG=1 \
$PYTHON_SET_FLAG \ $PYTHON_SET_FLAG \
$PYTHON_SET_EXE \ $PYTHON_SET_EXE \
$PYTHON_SET_INC \ $PYTHON_SET_INC \
...@@ -175,8 +146,4 @@ cmake -LAH -G "Ninja" \ ...@@ -175,8 +146,4 @@ cmake -LAH -G "Ninja" \
$PYTHON_UNSET_INSTALL \ $PYTHON_UNSET_INSTALL \
.. ..
if [ "${MACHINE_STR:0:3}" == "ppc" ]; then ninja install -v -j${CPU_COUNT}
# PPC seems to run out of memory quite often, build with fewer jobs.
NINJA_OPTS=-j2
fi
ninja install -v ${NINJA_OPTS}
...@@ -42,19 +42,30 @@ source: ...@@ -42,19 +42,30 @@ source:
build: build:
number: 0 number: 0
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}_{{ PKG_BUILDNUM }} string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
run_exports: run_exports:
# https://abi-laboratory.pro/index.php?view=timeline&l=opencv # https://abi-laboratory.pro/index.php?view=timeline&l=opencv
# Things seem to change every patch versions, mostly the dnn module # Things seem to change every patch versions, mostly the dnn module
- libopencv - {{ pin_subpackage('libopencv', max_pin='x.x.x') }}
ignore_run_exports_from:
- python
requirements: requirements:
build: build:
- python {{ python }}
# [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- numpy
# numpy needed in build.sh whatever the platform [build_platform != target_platform]
# Required to find ffpmeg # Required to find ffpmeg
- pkg-config # [not win] - pkg-config # [not win]
- m2-patch # [win] - m2-patch # [win]
- cmake - cmake
- ninja - ninja
- libgcc # [linux]
# libgomp conda-forge only # [linux]
# ICE when enabling this
# - llvm-openmp # [osx]
- {{ compiler('c') }} - {{ compiler('c') }}
- {{ compiler('cxx') }} - {{ compiler('cxx') }}
- {{ cdt('mesa-libgl-devel') }} # [linux] - {{ cdt('mesa-libgl-devel') }} # [linux]
...@@ -79,6 +90,7 @@ requirements: ...@@ -79,6 +90,7 @@ requirements:
- zlib {{ zlib }} - zlib {{ zlib }}
- jpeg {{ jpeg }} - jpeg {{ jpeg }}
- libtiff {{ libtiff }} - libtiff {{ libtiff }}
- libwebp {{ libwebp }}
- harfbuzz {{ harfbuzz }} # [unix] - harfbuzz {{ harfbuzz }} # [unix]
- libpng {{ libpng }} - libpng {{ libpng }}
- ffmpeg {{ ffmpeg }} # [not win] - ffmpeg {{ ffmpeg }} # [not win]
...@@ -86,9 +98,16 @@ requirements: ...@@ -86,9 +98,16 @@ requirements:
- freetype {{ freetype }} - freetype {{ freetype }}
- glib {{ glib }} # [unix] - glib {{ glib }} # [unix]
run: run:
# https://github.com/conda-forge/harfbuzz-feedstock/pull/52
- harfbuzz # [unix]
# Don't depend on python in the run section # Don't depend on python in the run section
# py-opencv will depend on python # py-opencv will depend on python
- {{ pin_compatible('harfbuzz') }} # [unix] - qt 5.9.* # [not osx and not aarch64 and not ppc64le]
# https://github.com/conda-forge/opencv-feedstock/issues/174
# Seems like the OSX ABI has changed between 2.9 and 2.10???
# That or a dependency wasn't merged in
# Since we don't know the cause, we are choosing this pinning on all platforms.
- {{ pin_compatible('freetype', min_pin='x.x') }}
test: test:
...@@ -170,15 +189,27 @@ test: ...@@ -170,15 +189,27 @@ test:
outputs: outputs:
- name: libopencv - name: libopencv
- name: opencv - name: opencv
build:
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
requirements: requirements:
host:
# Explicitely add a python requirement so that the hash changes between
# opencv for pypy36 and python3.6
# similarly for pypy37 and python3.7
- python
run: run:
- {{ pin_subpackage('libopencv', exact=True) }} - {{ pin_subpackage('libopencv', exact=True) }}
- {{ pin_subpackage('py-opencv', exact=True) }} - {{ pin_subpackage('py-opencv', exact=True) }}
- name: py-opencv - name: py-opencv
build: build:
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
run_exports: run_exports:
- py-opencv # Should we even have this???
# don't pin the python version so hard.
# Actually, I have found pretty good compatibility in the python
# package
- {{ pin_subpackage('py-opencv') }}
requirements: requirements:
# There is no build script, but I just want it to think # There is no build script, but I just want it to think
# that it needs python and numpy at build time # that it needs python and numpy at build time
......
...@@ -87,6 +87,8 @@ libpng: ...@@ -87,6 +87,8 @@ libpng:
- 1.6.37 - 1.6.37
libtiff: libtiff:
- 4.1.0 - 4.1.0
libwebp:
- 1.1.0
mkl: mkl:
- 2019.4 - 2019.4
numpy: numpy:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment