diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07ec9a69..adaad318 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,6 +97,9 @@ jobs: echo "ENV PATH=\${PATH}:/opt/python/cp39-cp39/bin" >>${tmp_file} echo "ENV LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/opt/python/cp39-cp39/lib" >>${tmp_file} echo "ENV GITHUB_ACTIONS=${GITHUB_ACTIONS}" >>${tmp_file} + if [ "${{ matrix.device }}" == "gpu" ]; then + echo "ENV CUDA_PATH=/usr/local/cuda" >>${tmp_file} + fi docker build -t bmf_build:tmp -f ${tmp_file} . rm -rf ${tmp_file} docker run --rm -v $(pwd):/root/bmf -w /root/bmf bmf_build:tmp bash -c "./scripts/build_ffmpeg.sh --device=${{ matrix.device }} && git config --global --add safe.directory /root/bmf && ./build.sh" diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 758fffb9..03983e7a 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -52,7 +52,6 @@ if(BMF_ENABLE_FFMPEG) set(BMF_FFMPEG_TARGETS ffmpeg::avcodec ffmpeg::avformat ffmpeg::avfilter ffmpeg::avdevice ffmpeg::avutil ffmpeg::swscale ffmpeg::swresample) - add_definitions(-DBMF_FFMPEG_VERSION=${BMF_FFMPEG_VERSION}) else() set(BMF_FFMPEG_TARGETS) message(WARNING "FFMPEG libraries not found, disable it") diff --git a/cmake/ffmpeg.cmake b/cmake/ffmpeg.cmake index 170fcdb7..eeaf50b4 100644 --- a/cmake/ffmpeg.cmake +++ b/cmake/ffmpeg.cmake @@ -78,6 +78,7 @@ if(FFMPEG_LIBRARY_DIR AND FFMPEG_INCLUDE_DIR) if(TARGET ffmpeg::avcodec) find_ffmpeg_version(${FFMPEG_INCLUDE_DIR}/libavutil BMF_FFMPEG_VERSION) + add_definitions(-DBMF_FFMPEG_VERSION=${BMF_FFMPEG_VERSION}) set(FFMPEG_FOUND TRUE) else() set(FFMPEG_FOUND FALSE) @@ -93,6 +94,10 @@ else() set_property(TARGET ffmpeg::${ARGV0} PROPERTY INTERFACE_LINK_LIBRARIES ${LIBRARY_LINK_LIBRARIES}) unset(LIBRARY CACHE) + if("${ARGV0}" STREQUAL "avutil") + find_ffmpeg_version(${LIBRARY_INCLUDE_DIRS}/libavutil BMF_FFMPEG_VERSION) + add_definitions(-DBMF_FFMPEG_VERSION=${BMF_FFMPEG_VERSION}) + endif() endif() endfunction() @@ -106,7 +111,6 @@ else() define_ffmpeg_target(swresample) if(TARGET ffmpeg::avcodec) - find_ffmpeg_version(${FFMPEG_INCLUDE_DIR}/libavutil BMF_FFMPEG_VERSION) set(FFMPEG_FOUND TRUE) else() set(FFMPEG_FOUND FALSE)