opengl CMAKE在Windows中找不到带有VCPKG的EGL

liwlm1x9  于 2023-06-29  发布在  Windows
关注(0)|答案(1)|浏览(206)

我正在将一个工作项目移植到windows,我正在使用vcpkg来管理非原生库。安装程序似乎工作正常,因为cmake可以正确找到许多库(即:freetype,openssh,libzip,tesseract,leptonica,...)但是opengl失败了。CMake找到OpenGl,但没有找到EGL,并且EGL库已安装(使用vcpkg)。
VCPKG安装相关内容:

ls installed/x64-windows/lib/
ANGLE.lib     brotlicommon.lib              cairo.lib       freetype.lib  jpeg.lib              libcurl.lib         libpgport.lib    libssl.lib          libxml2.lib     mbedtls.lib   pkgconfig/       sqlite3.lib      utf8proc.lib
GlU32.Lib     brotlidec.lib                 charset.lib     getopt.lib    leptonica-1.83.1.lib  libecpg.lib         libpgtypes.lib   libwebp.lib         lz4.lib         mbedx509.lib  pthreadVC3.lib   ssh.lib          zlib.lib
OpenGL32.Lib  brotlienc.lib                 dl.lib          gif.lib       libEGL.lib            libecpg_compat.lib  libpng16.lib     libwebpdecoder.lib  lzma.lib        openjp2.lib   pthreadVCE3.lib  tesseract53.lib  zstd.lib
ZXing.lib     bz2.lib                       fmt.lib         iconv.lib     libGLESv2.lib         libexpat.lib        libpq.lib        libwebpdemux.lib    lzo2.lib        pixman-1.lib  pthreadVSE3.lib  tiff.lib
archive.lib   cairo-script-interpreter.lib  fontconfig.lib  intl.lib      libcrypto.lib         libpgcommon.lib     libsharpyuv.lib  libwebpmux.lib      mbedcrypto.lib  pkgconf.lib   spdlog.lib       turbojpeg.lib

ls installed/x64-windows/include/
EGL/    ZXing/           dirent.h         expat_config.h    glm/        jpeglib.h       libssh/            lz4hc.h       opj_stdint.h        pgtypes_interval.h   postgres_ext.h  sqlca.h                 tiff.h       zdict.h
GL/     _ptw32.h         dlfcn.h          expat_external.h  headers/    leptonica/      libxml/            lzma/         pg_config.h         pgtypes_numeric.h    psa/            sqlda-compat.h          tiffconf.h   zlib.h
GLES/   archive.h        ecpg_config.h    fmt/              iconv.h     libcharset.h    libxml2/           lzma.h        pg_config_ext.h     pgtypes_timestamp.h  pthread.h       sqlda-native.h          tiffio.h     zstd.h
GLES2/  archive_entry.h  ecpg_informix.h  fontconfig/       informix/   libintl.h       localcharset.h     lzo/          pg_config_manual.h  pixman-1/            sched.h         sqlda.h                 tiffvers.h   zstd_errors.h
GLES3/  brotli/          ecpgerrno.h      freetype/         internal/   libpng16/       lz4.h              mbedtls/      pg_config_os.h      pkgconf/             semaphore.h     sqlite3-vcpkg-config.h  turbojpeg.h
GLSC/   bzlib.h          ecpglib.h        ft2build.h        jconfig.h   libpq/          lz4file.h          openjpeg.h    pgtypes.h           png.h                server/         sqlite3.h               utf8proc.h
GLSC2/  cairo/           ecpgtype.h       getopt.h          jerror.h    libpq-events.h  lz4frame.h         openssl/      pgtypes_date.h      pngconf.h            spdlog/         sqlite3ext.h            webp/
KHR/    curl/            expat.h          gif_lib.h         jmorecfg.h  libpq-fe.h      lz4frame_static.h  opj_config.h  pgtypes_error.h     pnglibconf.h         sql3types.h     tesseract/              zconf.h

CMakeList.txt的简化版本

cmake_minimum_required(VERSION 3.8)
find_package(OpenGL REQUIRED COMPONENTS OpenGL EGL)

include_directories(OpenGL::EGL OpenGL::GL)

set (GL_HEADERS
    quegl.h
)
set (GL_SOURCES
    quegl.cpp
)
add_library (quillkhronos SHARED ${GL_HEADERS} ${GL_SOURCES} )
target_link_libraries (quillkhronos LINK_PUBLIC quill OpenGL::EGL OpenGL::GL )

CMAKE输出:

Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/projects/quill -B C:/projects/build-quill-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug "-DENABLE_OPENGL:BOOL=ON" in C:\projects\build-quill-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug.
-- VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;
-- VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;
CMake Error at C:/Qt/Tools/CMake_64/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenGL (missing: EGL)
Call Stack (most recent call first):
  C:/Qt/Tools/CMake_64/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Qt/Tools/CMake_64/share/cmake-3.23/Modules/FindOpenGL.cmake:443 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:853 (_find_package)
  quillkhronos/CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!
See also "C:/projects/build-quill-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug/CMakeFiles/CMakeOutput.log".
See also "C:/projects/build-quill-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug/CMakeFiles/CMakeError.log".
CMake process exited with exit code 1.

Elapsed time: 00:00.
z3yyvxxp

z3yyvxxp1#

EGL通常在Windows上不可用。Windows的等价物是WGL。
FindOpenGL.cmake假设本机OpenGL接口,因为EGL仅适用于GLVND。
然而,如果需要,angle(DX重定向)和梅萨(软件)可以提供libEGL作为 Package 器,并且在KDE extra-cmake-modules中存在FindEGL.cmake,但是我不建议直接使用扩展。
据我所知,你的意思是通过要求驱动程序提供一个指向所请求的扩展函数(如果支持的话)的指针来访问扩展,然后通过所述指针调用函数。(但这只是我有限的知识,没有用opengl做过任何事情,只是构建和打包梅萨/angle/qt)

相关问题