11cmake_minimum_required (VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22
33project (fastfetch
4- VERSION 2.36.0
4+ VERSION 2.36.1
55 LANGUAGES C
66 DESCRIPTION "Fast neofetch-like system information tool"
77 HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -56,31 +56,31 @@ include(CheckIncludeFile)
5656
5757include (CMakeDependentOption)
5858
59- cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS" OFF )
59+ cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku " OFF )
6060cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD" OFF )
6161cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
6262cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
6363cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
6464cmake_dependent_option(ENABLE_DRM_AMDGPU "Enable libdrm_amdgpu" ON "LINUX" OFF )
6565cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
6666cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
67- cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
67+ cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR Haiku " OFF )
6868cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
6969cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR OpenBSD OR NetBSD OR SunOS" OFF )
7070cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX" OFF )
71- cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR WIN32 OR SunOS" OFF )
71+ cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR WIN32 OR SunOS OR Haiku " OFF )
7272cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR SunOS" OFF )
7373cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF )
7474cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF )
7575cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR WIN32 OR SunOS OR Haiku" OFF )
76- cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR Haiku " OFF )
76+ cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS" OFF )
7777cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF )
7878cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS" OFF )
7979cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF )
8080cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF )
8181cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF )
8282cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF )
83- cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly" OFF )
83+ cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly OR Haiku " OFF )
8484cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF )
8585cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF )
8686cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "NetBSD OR OpenBSD OR SunOS" OFF )
@@ -94,6 +94,7 @@ option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by gith
9494option (IS_MUSL "Build with musl libc" OFF ) # Used by Github Actions
9595option (INSTALL_LICENSE "Install license into /usr/share/licenses" ON )
9696option (ENABLE_EMBEDDED_PCIIDS "Embed pci.ids into fastfetch, requires `python`" OFF )
97+ option (ENABLE_EMBEDDED_AMDGPUIDS "Embed amdgpu.ids into fastfetch, requires `python`" OFF )
9798
9899set (BINARY_LINK_TYPE_OPTIONS dlopen dynamic static )
99100set (BINARY_LINK_TYPE dlopen CACHE STRING "How to link fastfetch" )
@@ -141,7 +142,7 @@ set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=retu
141142set (CMAKE_C_STANDARD 11)
142143set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion" )
143144
144- if (WIN32 OR HAIKU OR ENABLE_DIRECTX_HEADERS)
145+ if (WIN32 OR Haiku OR ENABLE_DIRECTX_HEADERS)
145146 enable_language (CXX)
146147 set (CMAKE_CXX_STANDARD 17)
147148 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} " )
@@ -271,11 +272,16 @@ endif()
271272
272273if (ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR} /fastfetch_pciids.c.inc" )
273274 if (Python_FOUND)
275+ if (NOT EXISTS "${PROJECT_BINARY_DIR} /pci.ids" )
276+ message (STATUS "'${PROJECT_BINARY_DIR} /pci.ids' is missing, downloading..." )
277+ file (DOWNLOAD "https://pci-ids.ucw.cz/v2.2/pci.ids" "${PROJECT_BINARY_DIR} /pci.ids" )
278+ endif ()
274279 message (STATUS "Generating 'fastfetch_pciids.c.inc'" )
275- execute_process (COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR} /scripts/gen-pciids.py"
280+ execute_process (COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR} /scripts/gen-pciids.py" " ${PROJECT_BINARY_DIR} /pci.ids"
276281 OUTPUT_FILE "${PROJECT_BINARY_DIR} /fastfetch_pciids.c.inc"
277282 RESULT_VARIABLE PYTHON_PCIIDS_RETCODE)
278283 if (NOT PYTHON_PCIIDS_RETCODE EQUAL 0)
284+ file (REMOVE "${PROJECT_BINARY_DIR} /fastfetch_pciids.c.inc" )
279285 message (FATAL_ERROR "Failed to generate 'fastfetch_pciids.c.inc'" )
280286 endif ()
281287 else ()
@@ -284,6 +290,26 @@ if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids
284290 endif ()
285291endif ()
286292
293+ if (ENABLE_EMBEDDED_AMDGPUIDS AND NOT EXISTS "${PROJECT_BINARY_DIR} /fastfetch_amdgpuids.c.inc" )
294+ if (Python_FOUND)
295+ if (NOT EXISTS "${PROJECT_BINARY_DIR} /amdgpu.ids" )
296+ message (STATUS "'${PROJECT_BINARY_DIR} /amdgpu.ids' is missing, downloading..." )
297+ file (DOWNLOAD "https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids" "${PROJECT_BINARY_DIR} /amdgpu.ids" )
298+ endif ()
299+ message (STATUS "Generating 'fastfetch_amdgpuids.c.inc'" )
300+ execute_process (COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR} /scripts/gen-amdgpuids.py" "${PROJECT_BINARY_DIR} /amdgpu.ids"
301+ OUTPUT_FILE "${PROJECT_BINARY_DIR} /fastfetch_amdgpuids.c.inc"
302+ RESULT_VARIABLE PYTHON_AMDGPUIDS_RETCODE)
303+ if (NOT PYTHON_AMDGPUIDS_RETCODE EQUAL 0)
304+ file (REMOVE "${PROJECT_BINARY_DIR} /fastfetch_amdgpuids.c.inc" )
305+ message (FATAL_ERROR "Failed to generate 'fastfetch_amdgpuids.c.inc'" )
306+ endif ()
307+ else ()
308+ message (WARNING "Python3 is not found, 'fastfetch_amdgpuids.c.inc' will not be generated" )
309+ set (ENABLE_EMBEDDED_AMDGPUIDS OFF )
310+ endif ()
311+ endif ()
312+
287313if (Python_FOUND)
288314 message (STATUS "Generating 'fastfetch.1'" )
289315 execute_process (COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR} /scripts/gen-man.py"
@@ -1092,44 +1118,45 @@ elseif(SunOS)
10921118 )
10931119elseif (Haiku)
10941120 list (APPEND LIBFASTFETCH_SRC
1121+ src/common/dbus.c
10951122 src/common/io/io_unix.c
10961123 src/common/netif/netif_haiku.c
10971124 src/common/networking_linux.c
10981125 src/common/processing_linux.c
1099- src/detection/battery/battery_nosupport .c
1126+ src/detection/battery/battery_haiku .c
11001127 src/detection/bios/bios_nosupport.c
11011128 src/detection/board/board_nosupport.c
11021129 src/detection/bootmgr/bootmgr_nosupport.c
11031130 src/detection/brightness/brightness_nosupport.c
11041131 src/detection/btrfs/btrfs_nosupport.c
11051132 src/detection/chassis/chassis_nosupport.c
1106- src/detection/cpu/cpu_nosupport .c
1133+ src/detection/cpu/cpu_haiku .c
11071134 src/detection/cpucache/cpucache_nosupport.c
11081135 src/detection/cpuusage/cpuusage_nosupport.c
11091136 src/detection/cursor/cursor_nosupport.c
11101137 src/detection/bluetooth/bluetooth_nosupport.c
11111138 src/detection/bluetoothradio/bluetoothradio_nosupport.c
1112- src/detection/disk/disk_nosupport.c
1139+ src/detection/disk/disk_haiku.cpp
11131140 src/detection/dns/dns_linux.c
11141141 src/detection/physicaldisk/physicaldisk_nosupport.c
11151142 src/detection/physicalmemory/physicalmemory_nosupport.c
11161143 src/detection/diskio/diskio_nosupport.c
11171144 src/detection/displayserver/displayserver_haiku.cpp
11181145 src/detection/font/font_haiku.cpp
1119- src/detection/gpu/gpu_nosupport .c
1146+ src/detection/gpu/gpu_haiku .c
11201147 src/detection/gpu/gpu_pci.c
11211148 src/detection/gtk_qt/gtk.c
11221149 src/detection/host/host_nosupport.c
11231150 src/detection/icons/icons_nosupport.c
1124- src/detection/initsystem/initsystem_nosupport .c
1151+ src/detection/initsystem/initsystem_linux .c
11251152 src/detection/keyboard/keyboard_nosupport.c
11261153 src/detection/libc/libc_nosupport.c
11271154 src/detection/lm/lm_nosupport.c
11281155 src/detection/loadavg/loadavg_nosupport.c
11291156 src/detection/locale/locale_linux.c
11301157 src/detection/localip/localip_linux.c
11311158 src/detection/gamepad/gamepad_nosupport.c
1132- src/detection/media/media_nosupport .c
1159+ src/detection/media/media_linux .c
11331160 src/detection/memory/memory_haiku.c
11341161 src/detection/mouse/mouse_nosupport.c
11351162 src/detection/netio/netio_nosupport.c
@@ -1139,7 +1166,7 @@ elseif(Haiku)
11391166 src/detection/poweradapter/poweradapter_nosupport.c
11401167 src/detection/processes/processes_haiku.c
11411168 src/detection/gtk_qt/qt.c
1142- src/detection/sound/sound_nosupport.c
1169+ src/detection/sound/sound_haiku.cpp
11431170 src/detection/swap/swap_haiku.c
11441171 src/detection/terminalfont/terminalfont_linux.c
11451172 src/detection/terminalshell/terminalshell_linux.c
@@ -1279,6 +1306,8 @@ elseif(NetBSD)
12791306 target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE)
12801307 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts" )
12811308 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib" ) # ditto
1309+ elseif (Haiku)
1310+ target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE)
12821311endif ()
12831312
12841313if (FreeBSD OR OpenBSD OR NetBSD)
@@ -1509,6 +1538,9 @@ endif()
15091538if (ENABLE_EMBEDDED_PCIIDS)
15101539 target_compile_definitions (libfastfetch PRIVATE FF_HAVE_EMBEDDED_PCIIDS=1)
15111540endif ()
1541+ if (ENABLE_EMBEDDED_AMDGPUIDS)
1542+ target_compile_definitions (libfastfetch PRIVATE FF_HAVE_EMBEDDED_AMDGPUIDS=1)
1543+ endif ()
15121544
15131545if (LINUX)
15141546 target_link_libraries (libfastfetch
@@ -1614,6 +1646,7 @@ elseif(ANDROID)
16141646elseif (Haiku)
16151647 target_link_libraries (libfastfetch
16161648 PRIVATE "network"
1649+ PRIVATE "media"
16171650 PRIVATE "be"
16181651 PRIVATE "gnu"
16191652 )
0 commit comments