Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Don't parallel-test on Windows, protect FFmpeg version checks #684

Merged
merged 4 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,18 @@ if(NOT Catch2_FOUND)
endif()
if(BUILD_TESTING)
include(Catch)
# Parallel tests seem to hang randomly on Windows
if(ENABLE_PARALLEL_CTEST)
# Figure out the amount of parallelism for CTest
include(ProcessorCount)
ProcessorCount(CPU_COUNT)
if(CPU_COUNT GREATER 1)
add_feature_info("Parallel tests" TRUE "Unit tests can use ${CPU_COUNT} processors")
list(APPEND CTEST_OPTIONS "-j${CPU_COUNT}")
if(WIN32)
message(WARNING "Win32 detected, disabling parallel unit tests")
else()
# Figure out the amount of parallelism for CTest
include(ProcessorCount)
ProcessorCount(CPU_COUNT)
if(CPU_COUNT GREATER 1)
add_feature_info("Parallel tests" TRUE "Unit tests can use ${CPU_COUNT} processors")
list(APPEND CTEST_OPTIONS "-j${CPU_COUNT}")
endif()
endif()
endif()
if(VERBOSE_TESTS)
Expand Down
16 changes: 11 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ mark_as_advanced(QT_VERSION_STR)
# Find FFmpeg libraries (used for video encoding / decoding)
find_package(FFmpeg REQUIRED COMPONENTS avcodec avformat avutil swscale)

set(all_comps avcodec avformat avutil swscale avresample)
set(all_comps avcodec avformat avutil swscale)
if(TARGET FFmpeg::swresample)
list(APPEND all_comps swresample)
else()
Expand All @@ -302,7 +302,7 @@ foreach(ff_comp IN LISTS all_comps)
if(TARGET FFmpeg::${ff_comp})
target_link_libraries(openshot PUBLIC FFmpeg::${ff_comp})
# Keep track of some FFmpeg lib versions, to embed in our version header
if(${ff_comp} IN_LIST version_comps)
if(${ff_comp} IN_LIST version_comps AND ${ff_comp}_VERSION)
string(TOUPPER ${ff_comp} v_name)
set(${v_name}_VERSION_STR ${${ff_comp}_VERSION} CACHE STRING "${ff_comp} version used" FORCE)
mark_as_advanced(${v_name}_VERSION_STR)
Expand All @@ -311,7 +311,7 @@ foreach(ff_comp IN LISTS all_comps)
endforeach()

# Version check for hardware-acceleration code
if(TARGET FFmpeg::avcodec AND USE_HW_ACCEL)
if(USE_HW_ACCEL AND avcodec_VERSION)
if(${avcodec_VERSION} VERSION_GREATER 57.107.100)
set(HAVE_HW_ACCEL TRUE)
endif()
Expand All @@ -327,11 +327,17 @@ endif()
# Include in feature summary
if(USE_HW_ACCEL AND HAVE_HW_ACCEL)
set(FFMPEG_HARDWARE_ACCELERATION TRUE)
elseif(USE_HW_ACCEL)
set(FFMPEG_HARDWARE_ACCELERATION "NOTFOUND")
else()
set(FFMPEG_HARDWARE_ACCELERATION FALSE)
endif()
set(_hwaccel_help "GPU-accelerated routines (FFmpeg 3.4+)")
add_feature_info("FFmpeg hwaccel" FFMPEG_HARDWARE_ACCELERATION ${_hwaccel_help})

# Report HWAccel status, unless it's indeterminate
if (NOT FFMPEG_HARDWARE_ACCELERATION STREQUAL "NOTFOUND")
set(_hwaccel_help "GPU-accelerated routines (FFmpeg 3.4+)")
add_feature_info("FFmpeg hwaccel" FFMPEG_HARDWARE_ACCELERATION ${_hwaccel_help})
endif()

################### OPENMP #####################
# Check for OpenMP (used for multi-core processing)
Expand Down