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

[Bug]: cmake compiling issues #344

Open
GeorgeZaher opened this issue Jul 20, 2024 · 1 comment
Open

[Bug]: cmake compiling issues #344

GeorgeZaher opened this issue Jul 20, 2024 · 1 comment

Comments

@GeorgeZaher
Copy link

Which component impacted?

Build

Is it regression? Good in old configuration?

No, this issue exist a long time

What happened?

Unable to compile properly, maybe issue FindMFX.cmake

What's the usage scenario when you are seeing the problem?

Others

What impacted?

~/oneAPI/vpl-gpu-rt-intel-onevpl-24.1.5/build$ cmake ..
-- No build type selected, default to release
-- Found MFX include at:
CMake Error at builder/FindMFX.cmake:23 (file):
file STRINGS file "/mfxdefs.h" cannot be read.
Call Stack (most recent call first):
builder/FindMFX.cmake:38 (get_mfx_version)
CMakeLists.txt:80 (include)

-- Enabling API . feature set with flags -DMFX_VERSION_USE_LATEST
-- OpenCL header files were found here: /home/george_z/oneAPI/vpl-gpu-rt-intel-onevpl-24.1.5/../../build_tools/OCLHeaders
fatal: not a git repository (or any of the parent directories): .git
-- CMAKE_INSTALL_PREFIX=/opt/intel/mediasdk
fatal: not a git repository (or any of the parent directories): .git
CMake Error at CMakeLists.txt:93 (message):
ConfTargets.cmake not found in
/home/george_z/oneAPI/vpl-gpu-rt-intel-onevpl-24.1.5/builder

-- Configuring incomplete, errors occurred!

Debug Information

no debug information

Do you want to contribute a patch to fix the issue?

Yes, I'm glad to submit a patch to fix it

@GeorgeZaher
Copy link
Author

Find the MFX include directory

find_path(MFX_INCLUDE_DIR
NAMES mfx/mfxdefs.h vpl/mfxdefs.h
PATHS
/home/george_z/oneAPI/MediaStack/opt/intel/media/include
NO_CMAKE_FIND_ROOT_PATH
)

Check if the include directory was found

if(NOT MFX_INCLUDE_DIR)
message(FATAL_ERROR "Could NOT find MFX (missing: MFX_INCLUDE)")
else()
message(STATUS "Found MFX include at: ${MFX_INCLUDE}")
endif()

Set the MFX libraries variable

set(MFX_LIBRARIES mfx)

Function to get the MFX version from the headers

function(get_mfx_version mfx_version_major mfx_version_minor)
file(STRINGS ${MFX_INCLUDE}/mfxdefs.h major REGEX "#define MFX_VERSION_MAJOR" LIMIT_COUNT 1)
if(major STREQUAL "") # old style version
file(STRINGS ${MFX_INCLUDE}/mfxvideo.h major REGEX "#define MFX_VERSION_MAJOR")
endif()
file(STRINGS ${MFX_INCLUDE}/mfxdefs.h minor REGEX "#define MFX_VERSION_MINOR" LIMIT_COUNT 1)
if(minor STREQUAL "") # old style version
file(STRINGS ${MFX_INCLUDE}/mfxvideo.h minor REGEX "#define MFX_VERSION_MINOR")
endif()
string(REPLACE "#define MFX_VERSION_MAJOR " "" major ${major})
string(REPLACE "#define MFX_VERSION_MINOR " "" minor ${minor})
set(${mfx_version_major} ${major} PARENT_SCOPE)
set(${mfx_version_minor} ${minor} PARENT_SCOPE)
endfunction()

Get the MFX version

get_mfx_version(major_vers minor_vers)

Set the API version and flags

set(API_VERSION "${major_vers}.${minor_vers}")
set(MFX_VERSION_MAJOR ${major_vers})
set(MFX_VERSION_MINOR ${minor_vers})
set(API_USE_LATEST TRUE)
set(API_FLAGS -DMFX_VERSION_USE_LATEST)

if(NOT TARGET onevpl-api)
add_library(onevpl-api INTERFACE)
target_include_directories(onevpl-api
INTERFACE
${MFX_INCLUDE}
${MFX_INCLUDE}/../mediasdk_structures
${MFX_INCLUDE}/private
)
target_compile_definitions(onevpl-api
INTERFACE MFX_ONEVPL
)
add_library(onevpl::api ALIAS onevpl-api)
endif()

set(MFX_API_TARGET onevpl::api)

Message for enabling the API version

message(STATUS "Enabling API ${major_vers}.${minor_vers} feature set with flags ${API_FLAGS}")

This is the issued finder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant