@@ -33,6 +33,9 @@ OPTION(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON)
3333OPTION (ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON )
3434OPTION (ENABLE_ZLIB "Enable zlib" ON )
3535OPTION (ENABLE_CHAFA "Enable chafa" ON )
36+ OPTION (ENABLE_GL "Enable gl" ON )
37+ OPTION (ENABLE_EGL "Enable egl" ON )
38+ OPTION (ENABLE_GLX "Enable glx" ON )
3639
3740if (NOT CMAKE_BUILD_TYPE )
3841 set (CMAKE_BUILD_TYPE Release)
@@ -168,6 +171,7 @@ add_library(libfastfetch STATIC
168171 src/modules/date.c
169172 src/modules/time.c
170173 src/modules/colors.c
174+ src/modules/opengl.c
171175)
172176
173177if (ENABLE_LIBPCI)
@@ -343,7 +347,48 @@ if(ENABLE_CHAFA)
343347 message (WARNING "Package chafa>=1.10 not found. Building without support." )
344348 endif ()
345349 else ()
346- message (WARNING "Chafa not enabled, because neither ImageMagick6 nor ImageMagick7 is found. Building without support." )
350+ message (WARNING "Chafa not enabled, because neither ImageMagick6 nor ImageMagick7 were found. Building without support." )
351+ endif ()
352+ endif ()
353+
354+ if (ENABLE_GL)
355+ pkg_check_modules(GL gl)
356+ if (NOT GL_FOUND)
357+ message (WARNING "Package gl not found. Building without support." )
358+ endif ()
359+ endif ()
360+
361+ if (ENABLE_EGL)
362+ if (GL_FOUND)
363+ pkg_check_modules(EGL egl)
364+ if (EGL_FOUND)
365+ target_compile_definitions (libfastfetch PRIVATE FF_HAVE_EGL=1)
366+ else ()
367+ message (WARNING "Package egl not found. Building without support." )
368+ endif ()
369+ else ()
370+ message (WARNING "egl not enabled, because gl was not enabled or found. Building without support." )
371+ endif ()
372+ endif ()
373+
374+ if (ENABLE_GLX)
375+ if (GL_FOUND)
376+ pkg_check_modules(GLX glx)
377+ if (GLX_FOUND)
378+ target_compile_definitions (libfastfetch PRIVATE FF_HAVE_GLX=1)
379+ else ()
380+ message (WARNING "Package glx not found. Building without support." )
381+ endif ()
382+ else ()
383+ message (WARNING "glx not enabled, because gl was not enabled or found. Building without support" )
384+ endif ()
385+ endif ()
386+
387+ if (GL_FOUND)
388+ if (EGL_FOUND OR GLX_FOUND)
389+ target_compile_definitions (libfastfetch PRIVATE FF_HAVE_GL=1)
390+ else ()
391+ message (WARNING "gl not enabled, because neither egl nor glx were found. Building without support." )
347392 endif ()
348393endif ()
349394
@@ -368,6 +413,10 @@ target_include_directories(libfastfetch
368413 PRIVATE ${IMAGEMAGICK6_INCLUDE_DIRS}
369414 PRIVATE ${ZLIB_INCLUDE_DIRS}
370415 PRIVATE ${CHAFA_INCLUDE_DIRS}
416+ PRIVATE ${VULKAN_INCLUDE_DIRS}
417+ PRIVATE ${GL_INCLUDE_DIRS}
418+ PRIVATE ${EGL_INCLUDE_DIRS}
419+ PRIVATE ${GLX_INCLUDE_DIRS}
371420)
372421
373422target_link_libraries (libfastfetch
0 commit comments