Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
927 stars 457 forks source link

CMake samples/metrics_monitor fail when no libdrm windows #2596

Closed OlivierLDff closed 3 years ago

OlivierLDff commented 3 years ago

Hi, i tried to build sample on my windows machine.

Here are my system information:

-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
-- No build type selected, default to release
-- Intel OpenCL SDK was not found (optional). The following will not be built: rotate_opencl plugin.
-- Intel(R) Media SDK was found here C:/Users/user/Documents/dev/msdk
-- Enabling API 1.34 feature set with flags
-- CMAKE_INSTALL_PREFIX=/opt/intel/mediasdk
-- Global Configuration of Targets
-- CMAKE_INSTALL_PREFIX=/opt/intel/mediasdk
-- MFX_PLUGINS_CONF_DIR=/mfx
-- MFX_MODULES_DIR=/opt/intel/mediasdk/lib
-- Intel OpenCL SDK was not found (optional). The following will not be built: rotate_opencl plugin.
CMake Error at samples/metrics_monitor/CMakeLists.txt:3 (if):
  if given arguments:

    "PKG_LIBDRM_FOUND" "AND" "(" "VERSION_GREATER" "2.4.91" ")"

  Unknown arguments specified

-- Configuring incomplete, errors occurred!

Here is the incriminated code https://github.com/Intel-Media-SDK/MediaSDK/blob/d058a653bc218f048139e3d41514d50923ae364a/samples/metrics_monitor/CMakeLists.txt#L3-L5

The error make sense, because ${PKG_LIBDRM_VERSION} is replaced with nothing in my case.

The best way to fix that in my opinion is to transform ${PKG_LIBDRM_VERSION} to "${PKG_LIBDRM_VERSION}". Like that the resulting expression will be a comparaison of an empty string with the version.

if( PKG_LIBDRM_FOUND AND
   ("${PKG_LIBDRM_VERSION}" VERSION_GREATER 2.4.91))

Would you consider such PR? Have a nice day. Olivier.

Edit: just realized that cmake isn't meant for windows. But the cmake error still apply for linux I think.

hotkidfamily commented 3 years ago

I have the same issue, did you resolve it? Then I modify this file as tutorials\cmakelist.txt L:21 , it's OK.

dmitryermilov commented 3 years ago

Hi @OlivierLDff , I prepared a fix: #2674

Hi @hotkidfamily , the issue you reported is broader. In fact you ask for workable cmake-style build for tutorials (and probably samples), while Olivier reported "just" a broken cmake generation.