11cmake_minimum_required (VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22
33project (fastfetch
4- VERSION 2.26.1
4+ VERSION 2.27.0
55 LANGUAGES C
66 DESCRIPTION "Fast neofetch-like system information tool"
77 HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -18,6 +18,8 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
1818 set (LINUX TRUE CACHE BOOL "..." FORCE) # LINUX means GNU/Linux, not just the kernel
1919elseif ("${CMAKE_SYSTEM_NAME} " STREQUAL "FreeBSD" )
2020 set (FreeBSD TRUE CACHE BOOL "..." FORCE)
21+ elseif ("${CMAKE_SYSTEM_NAME} " STREQUAL "OpenBSD" )
22+ set (OpenBSD TRUE CACHE BOOL "..." FORCE)
2123elseif ("${CMAKE_SYSTEM_NAME} " STREQUAL "SunOS" )
2224 set (SunOS TRUE CACHE BOOL "..." FORCE)
2325elseif (NOT APPLE AND NOT WIN32 )
@@ -44,30 +46,30 @@ include(CheckIncludeFile)
4446
4547include (CMakeDependentOption)
4648
47- cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR WIN32 OR ANDROID OR SunOS" OFF )
48- cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD" OFF )
49- cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR SunOS" OFF )
50- cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR FreeBSD OR SunOS" OFF )
51- cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR SunOS" OFF )
52- cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR FreeBSD OR SunOS" OFF )
53- cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR SunOS" OFF )
49+ cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR WIN32 OR ANDROID OR SunOS" OFF )
50+ cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD OR OpenBSD " OFF )
51+ cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
52+ cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
53+ cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
54+ cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
55+ cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
5456cmake_dependent_option(ENABLE_DRM_AMDGPU "Enable libdrm_amdgpu" ON "LINUX" OFF )
55- cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR SunOS" OFF )
56- cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR SunOS" OFF )
57- cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR SunOS" OFF )
58- cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR SunOS" OFF )
59- cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR SunOS" OFF )
57+ cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
58+ cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
59+ cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
60+ cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
61+ cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR OpenBSD OR SunOS" OFF )
6062cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX" OFF )
61- cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR APPLE OR WIN32 OR SunOS" OFF )
62- cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR FreeBSD OR APPLE OR SunOS" OFF )
63+ cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR APPLE OR WIN32 OR SunOS" OFF )
64+ cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR FreeBSD OR OpenBSD OR APPLE OR SunOS" OFF )
6365cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF )
6466cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF )
65- cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR FreeBSD OR WIN32 OR SunOS" OFF )
66- cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR SunOS" OFF )
67- cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR FreeBSD OR SunOS" OFF )
68- cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR WIN32 OR ANDROID OR SunOS" OFF )
67+ cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR FreeBSD OR OpenBSD OR WIN32 OR SunOS" OFF )
68+ cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
69+ cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR FreeBSD OR OpenBSD OR SunOS" OFF )
70+ cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR OpenBSD OR WIN32 OR ANDROID OR SunOS" OFF )
6971cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF )
70- cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF )
72+ cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR OpenBSD OR SunOS" OFF )
7173cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF )
7274cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF )
7375cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID" OFF )
@@ -484,7 +486,6 @@ if(LINUX)
484486 src/detection/gamepad/gamepad_linux.c
485487 src/detection/media/media_linux.c
486488 src/detection/memory/memory_linux.c
487- src/detection/monitor/monitor_linux.c
488489 src/detection/netio/netio_linux.c
489490 src/detection/opengl/opengl_linux.c
490491 src/detection/os/os_linux.c
@@ -549,7 +550,6 @@ elseif(ANDROID)
549550 src/detection/gamepad/gamepad_nosupport.c
550551 src/detection/media/media_nosupport.c
551552 src/detection/memory/memory_linux.c
552- src/detection/monitor/monitor_nosupport.c
553553 src/detection/netio/netio_linux.c
554554 src/detection/opengl/opengl_linux.c
555555 src/detection/os/os_android.c
@@ -629,7 +629,6 @@ elseif(FreeBSD)
629629 src/detection/gamepad/gamepad_bsd.c
630630 src/detection/media/media_linux.c
631631 src/detection/memory/memory_bsd.c
632- src/detection/monitor/monitor_linux.c
633632 src/detection/netio/netio_bsd.c
634633 src/detection/opengl/opengl_linux.c
635634 src/detection/os/os_linux.c
@@ -656,6 +655,85 @@ elseif(FreeBSD)
656655 src/util/platform/FFPlatform_unix.c
657656 src/util/binary_linux.c
658657 )
658+ elseif (OpenBSD)
659+ list (APPEND LIBFASTFETCH_SRC
660+ src/common/dbus.c
661+ src/common/io/io_unix.c
662+ src/common/netif/netif_bsd.c
663+ src/common/networking_linux.c
664+ src/common/processing_linux.c
665+ src/common/sysctl.c
666+ src/detection/battery/battery_nosupport.c
667+ src/detection/bios/bios_nosupport.c
668+ src/detection/bluetooth/bluetooth_nosupport.c
669+ src/detection/bluetoothradio/bluetoothradio_nosupport.c
670+ src/detection/board/board_nosupport.c
671+ src/detection/bootmgr/bootmgr_nosupport.c
672+ src/detection/brightness/brightness_nosupport.c
673+ src/detection/btrfs/btrfs_nosupport.c
674+ src/detection/chassis/chassis_nosupport.c
675+ src/detection/cpu/cpu_obsd.c
676+ src/detection/cpucache/cpucache_nosupport.c
677+ src/detection/cpuusage/cpuusage_bsd.c
678+ src/detection/cursor/cursor_linux.c
679+ src/detection/disk/disk_bsd.c
680+ src/detection/dns/dns_linux.c
681+ src/detection/physicaldisk/physicaldisk_nosupport.c
682+ src/detection/physicalmemory/physicalmemory_nosupport.c
683+ src/detection/diskio/diskio_nosupport.c
684+ src/detection/displayserver/linux/displayserver_linux.c
685+ src/detection/displayserver/linux/drm.c
686+ src/detection/displayserver/linux/wayland/wayland.c
687+ src/detection/displayserver/linux/wayland/global -output .c
688+ src/detection/displayserver/linux/wayland/zwlr-output .c
689+ src/detection/displayserver/linux/wayland/kde-output .c
690+ src/detection/displayserver/linux/wayland/wlr-output -management-unstable-v1-protocol.c
691+ src/detection/displayserver/linux/wayland/kde-output -device-v2-protocol.c
692+ src/detection/displayserver/linux/wayland/kde-output -order-v1-protocol.c
693+ src/detection/displayserver/linux/wayland/xdg-output -unstable-v1-protocol.c
694+ src/detection/displayserver/linux/wmde.c
695+ src/detection/displayserver/linux/xcb.c
696+ src/detection/displayserver/linux/xlib.c
697+ src/detection/font/font_linux.c
698+ src/detection/gpu/gpu_nosupport.c
699+ src/detection/gtk_qt/gtk.c
700+ src/detection/host/host_obsd.c
701+ src/detection/lm/lm_nosupport.c
702+ src/detection/icons/icons_linux.c
703+ src/detection/initsystem/initsystem_linux.c
704+ src/detection/libc/libc_nosupport.c
705+ src/detection/loadavg/loadavg_bsd.c
706+ src/detection/locale/locale_linux.c
707+ src/detection/localip/localip_linux.c
708+ src/detection/gamepad/gamepad_nosupport.c
709+ src/detection/media/media_linux.c
710+ src/detection/memory/memory_obsd.c
711+ src/detection/netio/netio_nosupport.c
712+ src/detection/opengl/opengl_linux.c
713+ src/detection/os/os_obsd.c
714+ src/detection/packages/packages_obsd.c
715+ src/detection/poweradapter/poweradapter_nosupport.c
716+ src/detection/processes/processes_obsd.c
717+ src/detection/gtk_qt/qt.c
718+ src/detection/sound/sound_linux.c
719+ src/detection/swap/swap_obsd.c
720+ src/detection/terminalfont/terminalfont_linux.c
721+ src/detection/terminalshell/terminalshell_linux.c
722+ src/detection/terminalsize/terminalsize_linux.c
723+ src/detection/theme/theme_linux.c
724+ src/detection/tpm/tpm_nosupport.c
725+ src/detection/uptime/uptime_bsd.c
726+ src/detection/users/users_nosupport.c
727+ src/detection/wallpaper/wallpaper_linux.c
728+ src/detection/wifi/wifi_nosupport.c
729+ src/detection/wm/wm_nosupport.c
730+ src/detection/de/de_linux.c
731+ src/detection/wmtheme/wmtheme_linux.c
732+ src/detection/camera/camera_nosupport.c
733+ src/detection/zpool/zpool_nosupport.c
734+ src/util/platform/FFPlatform_unix.c
735+ src/util/binary_linux.c
736+ )
659737elseif (APPLE )
660738 list (APPEND LIBFASTFETCH_SRC
661739 src/common/io/io_unix.c
@@ -696,7 +774,6 @@ elseif(APPLE)
696774 src/detection/gamepad/gamepad_apple.c
697775 src/detection/media/media_apple.m
698776 src/detection/memory/memory_apple.c
699- src/detection/monitor/monitor_apple.m
700777 src/detection/netio/netio_bsd.c
701778 src/detection/opengl/opengl_apple.c
702779 src/detection/os/os_apple.m
@@ -764,7 +841,6 @@ elseif(WIN32)
764841 src/detection/media/media_windows.c
765842 src/detection/memory/memory_windows.c
766843 src/detection/physicalmemory/physicalmemory_linux.c
767- src/detection/monitor/monitor_windows.c
768844 src/detection/netio/netio_windows.c
769845 src/detection/opengl/opengl_windows.c
770846 src/detection/os/os_windows.cpp
@@ -848,7 +924,6 @@ elseif(SunOS)
848924 src/detection/gamepad/gamepad_nosupport.c
849925 src/detection/media/media_linux.c
850926 src/detection/memory/memory_sunos.c
851- src/detection/monitor/monitor_linux.c
852927 src/detection/netio/netio_sunos.c
853928 src/detection/opengl/opengl_linux.c
854929 src/detection/os/os_sunos.c
@@ -951,13 +1026,16 @@ if(FreeBSD AND EXISTS "/usr/local/bin/objdump")
9511026 endif ()
9521027endif ()
9531028
954- target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__=1 _FILE_OFFSET_BITS=64)
955- if (WIN32 )
956- target_compile_definitions (libfastfetch PUBLIC WIN32_LEAN_AND_MEAN=1)
1029+ if (LINUX OR ANDROID)
1030+ target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__=1 _FILE_OFFSET_BITS=64)
1031+ elseif (WIN32 )
1032+ target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE WIN32_LEAN_AND_MEAN=1 _WIN32_WINNT=0x0A00)
9571033elseif (APPLE )
958- target_compile_definitions (libfastfetch PUBLIC _DARWIN_C_SOURCE)
1034+ target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 _DARWIN_C_SOURCE)
1035+ elseif (OpenBSD)
1036+ target_compile_definitions (libfastfetch PUBLIC _XOPEN_SOURCE=700 _FILE_OFFSET_BITS=64 _BSD_SOURCE)
9591037elseif (SunOS)
960- target_compile_definitions (libfastfetch PUBLIC __EXTENSIONS__ _POSIX_C_SOURCE=1 )
1038+ target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 __EXTENSIONS__ _POSIX_C_SOURCE)
9611039endif ()
9621040
9631041if (HAVE_STATX)
@@ -1103,10 +1181,17 @@ ff_lib_enable(EGL
11031181 "egl"
11041182 "EGL"
11051183)
1106- ff_lib_enable(GLX
1107- "glx"
1108- "GLX"
1109- )
1184+ if (NOT OpenBSD)
1185+ ff_lib_enable(GLX
1186+ "glx"
1187+ "GLX"
1188+ )
1189+ else ()
1190+ ff_lib_enable(GLX
1191+ "gl"
1192+ "GL"
1193+ )
1194+ endif ()
11101195ff_lib_enable(OSMESA
11111196 "osmesa"
11121197 "OSMesa"
@@ -1200,7 +1285,6 @@ elseif(APPLE)
12001285 PRIVATE "-weak_framework Apple80211"
12011286 )
12021287elseif (WIN32 )
1203- target_compile_definitions (libfastfetch PRIVATE -D_WIN32_WINNT=0x0A00)
12041288 target_link_libraries (libfastfetch
12051289 PRIVATE "dwmapi"
12061290 PRIVATE "gdi32"
@@ -1221,6 +1305,11 @@ elseif(FreeBSD)
12211305 PRIVATE "usbhid"
12221306 PRIVATE "geom"
12231307 )
1308+ elseif (OpenBSD)
1309+ target_link_libraries (libfastfetch
1310+ PRIVATE "m"
1311+ PRIVATE "kvm"
1312+ )
12241313elseif (SunOS)
12251314 target_link_libraries (libfastfetch
12261315 PRIVATE "m"
@@ -1296,6 +1385,10 @@ if(NOT WIN32)
12961385 if (HAVE_WORDEXP)
12971386 target_compile_definitions (libfastfetch PRIVATE FF_HAVE_WORDEXP=1)
12981387 endif ()
1388+ CHECK_INCLUDE_FILE("glob.h" HAVE_GLOB)
1389+ if (HAVE_GLOB)
1390+ target_compile_definitions (libfastfetch PRIVATE FF_HAVE_GLOB=1)
1391+ endif ()
12991392 if (ENABLE_THREADS AND CMAKE_USE_PTHREADS_INIT)
13001393 CHECK_INCLUDE_FILE("pthread_np.h" HAVE_PTHREAD_NP)
13011394 if (HAVE_PTHREAD_NP)
@@ -1521,4 +1614,4 @@ fastfetch is a neofetch-like tool for fetching system information and displaying
15211614It is written mostly in C to achieve much better performance.\
15221615" )
15231616
1524- include (CPack)
1617+ include (CPack)
0 commit comments