cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage urlproject(fastfetchVERSION 2.25.0.1LANGUAGES CDESCRIPTION "Fast neofetch-like system information tool"HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch")set(PROJECT_LICENSE "MIT license")#################### Target Platform ####################if(ANDROID)set(LINUX FALSE)elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")set(LINUX TRUE CACHE BOOL "..." FORCE) # LINUX means GNU/Linux, not just the kernelelseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")set(FreeBSD TRUE CACHE BOOL "..." FORCE)elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")set(SunOS TRUE CACHE BOOL "..." FORCE)elseif(NOT APPLE AND NOT WIN32)message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")endif()############################## Compile time dependencies ##############################set(THREADS_PREFER_PTHREAD_FLAG NOT WIN32)find_package(Threads)find_package(PkgConfig)if(NOT PKG_CONFIG_FOUND)message(WARNING "pkg-config not found, library detection might be limited")endif()include(CheckIncludeFile)###################### Configure options ######################include(CMakeDependentOption)cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR WIN32 OR ANDROID OR SunOS" OFF)cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD" OFF)cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_X11 "Enable x11" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR SunOS" OFF)cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX" OFF)cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR APPLE OR WIN32 OR SunOS" OFF)cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR FreeBSD OR APPLE OR SunOS" OFF)cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR FreeBSD OR WIN32 OR SunOS" OFF)cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR FreeBSD OR SunOS" OFF)cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR WIN32 OR ANDROID OR SunOS" OFF)cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF)cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID" OFF)cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF)option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)option(ENABLE_LTO "Enable link-time optimization in release mode if supported" ON)option(BUILD_TESTS "Build tests" OFF) # Also create test executablesoption(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release buildsoption(IS_MUSL "Build with musl libc" OFF) # Used by Github Actionsoption(INSTALL_LICENSE "Install license into /usr/share/licenses" ON)option(ENABLE_EMBEDDED_PCIIDS "Embed pci.ids into fastfetch, requires `python`" OFF)set(BINARY_LINK_TYPE_OPTIONS dlopen dynamic static)set(BINARY_LINK_TYPE dlopen CACHE STRING "How to link fastfetch")set_property(CACHE BINARY_LINK_TYPE PROPERTY STRINGS ${BINARY_LINK_TYPE_OPTIONS})if(NOT BINARY_LINK_TYPE IN_LIST BINARY_LINK_TYPE_OPTIONS)message(FATAL_ERROR "BINARY_LINK_TYPE must be one of ${BINARY_LINK_TYPE_OPTIONS}")endif()set(PACKAGE_MANAGERS AM APK BREW CHOCO DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PALUDIS PKG PKGTOOL RPM SCOOP SNAP SORCERY WINGET XBPS)foreach(package_manager ${PACKAGE_MANAGERS})if(package_manager STREQUAL "WINGET")option(PACKAGES_DISABLE_${package_manager} "Disable ${package_manager} package manager detection by default" ON)else()option(PACKAGES_DISABLE_${package_manager} "Disable ${package_manager} package manager detection by default" OFF)endif()endforeach()if (LINUX)set(CUSTOM_PCI_IDS_PATH "" CACHE STRING "Custom path to file pci.ids, defaults to `/usr/share/hwdata/pci.ids`")set(CUSTOM_AMDGPU_IDS_PATH "" CACHE STRING "Custom path to file amdgpu.ids, defaults to `/usr/share/libdrm/amdgpu.ids`")set(CUSTOM_OS_RELEASE_PATH "" CACHE STRING "Custom path to file os-release, defaults to `/etc/os-release`")endif()##################### Compiler options #####################if(NOT CMAKE_BUILD_TYPE)set(CMAKE_BUILD_TYPE RelWithDebInfo)endif()message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")if(ENABLE_THREADS)if(CMAKE_USE_WIN32_THREADS_INIT)message(STATUS "Threads type: Win32 thread")elseif(CMAKE_USE_PTHREADS_INIT)message(STATUS "Threads type: pthread")endif()else()message(STATUS "Threads type: disabled")endif()set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type")set(CMAKE_C_STANDARD 11)set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion")if(WIN32 OR ENABLE_DIRECTX_HEADERS)enable_language(CXX)set(CMAKE_CXX_STANDARD 17)set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WARNING_FLAGS}")endif()if(WIN32)set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--tsaware -Wl,--build-id -Wl,--subsystem,console:6.1,--major-os-version,6,--minor-os-version,1")elseif(APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang")set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-arc")endif()set(FASTFETCH_FLAGS_DEBUG "-fno-omit-frame-pointer")if(ENABLE_ASAN)message(STATUS "Address sanitizer enabled (DEBUG only)")set(FASTFETCH_FLAGS_DEBUG "${FASTFETCH_FLAGS_DEBUG} -fsanitize=address")endif()set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}${FASTFETCH_FLAGS_DEBUG}")set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}${FASTFETCH_FLAGS_DEBUG} -fstack-protector-all -fno-delete-null-pointer-checks")if(NOT WIN32)set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")endif()if(ENABLE_LTO AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")message(STATUS "Enabling LTO")include(CheckIPOSupported)check_ipo_supported(RESULT IPO_SUPPORTED)if(IPO_SUPPORTED)set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)endif()endif()######################## Target FS structure ########################if(NOT TARGET_DIR_ROOT)if(NOT ANDROID)set(TARGET_DIR_ROOT "")else()set(TARGET_DIR_ROOT "/data/data/com.termux/files/usr")endif()endif()if(NOT TARGET_DIR_USR)if(NOT ANDROID)set(TARGET_DIR_USR "${TARGET_DIR_ROOT}/usr")else()set(TARGET_DIR_USR "${TARGET_DIR_ROOT}")endif()endif()if(NOT TARGET_DIR_HOME)if(APPLE)set(TARGET_DIR_HOME "${TARGET_DIR_ROOT}/Users")elseif(ANDROID)set(TARGET_DIR_HOME "/data/data/com.termux/files/home")else()set(TARGET_DIR_HOME "${TARGET_DIR_ROOT}/home")endif()endif()if(NOT TARGET_DIR_ETC)set(TARGET_DIR_ETC "${TARGET_DIR_ROOT}/etc")endif()message(STATUS "Target dirs: ROOT=\"${TARGET_DIR_ROOT}\" USR=\"${TARGET_DIR_USR}\" HOME=\"${TARGET_DIR_HOME}\" ETC=\"${TARGET_DIR_ETC}\"")#https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.htmlif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)set(CMAKE_INSTALL_PREFIX "${TARGET_DIR_USR}" CACHE PATH "..." FORCE)endif()if(NOT CMAKE_INSTALL_SYSCONFDIR)set(CMAKE_INSTALL_SYSCONFDIR "${TARGET_DIR_ETC}" CACHE PATH "..." FORCE)endif()################## Tweak version ##################if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR}/.git")execute_process(COMMAND git describe --tagsWORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"OUTPUT_VARIABLE PROJECT_VERSION_GITOUTPUT_STRIP_TRAILING_WHITESPACE)string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_GIT}")endif()if(PROJECT_VERSION_TWEAK)string(REGEX MATCH "[0-9]+" PROJECT_VERSION_TWEAK_NUM "${PROJECT_VERSION_TWEAK}")else()set(PROJECT_VERSION_TWEAK_NUM 0)endif()############## Text data ##############function(fastfetch_encode_c_string STR OUTVAR)string(REGEX REPLACE "\n$" "" TEMP "${STR}") # Remove trailing newlinestring(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashesstring(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \nstring(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"set(${OUTVAR} "\"${TEMP}\"" PARENT_SCOPE)endfunction(fastfetch_encode_c_string)function(fastfetch_load_text FILENAME OUTVAR)file(READ "${FILENAME}" TEMP)fastfetch_encode_c_string("${TEMP}" TEMP)set(${OUTVAR} "${TEMP}" PARENT_SCOPE)endfunction(fastfetch_load_text)find_package(Python)if(Python_FOUND)execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json"OUTPUT_VARIABLE DATATEXT_JSON_HELP)if(DATATEXT_JSON_HELP STREQUAL "")message(ERROR "DATATEXT_JSON_HELP is empty, which should not happen!")endif()else()message(STATUS "Python3 is not found, 'help.json' will not be minified")file(READ "src/data/help.json" DATATEXT_JSON_HELP)endif()if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "fastfetch_pciids.c.inc")if(Python_FOUND)execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"OUTPUT_FILE "fastfetch_pciids.c.inc")else()message(STATUS "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")set(ENABLE_EMBEDDED_PCIIDS OFF)endif()endif()fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT)configure_file(src/fastfetch_config.h.in fastfetch_config.h @ONLY)configure_file(src/fastfetch_datatext.h.in fastfetch_datatext.h @ONLY)if(APPLE)configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)endif()string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)##################### Ascii image data #####################file(GLOB LOGO_FILES "src/logo/ascii/*.txt")set(LOGO_BUILTIN_H "#pragma once\n#pragma GCC diagnostic ignored \"-Wtrigraphs\"\n\n")foreach(file ${LOGO_FILES})fastfetch_load_text("${file}" content)get_filename_component(file "${file}" NAME_WE)string(TOUPPER "${file}" file)string(REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}")set(LOGO_BUILTIN_H "${LOGO_BUILTIN_H}#define FASTFETCH_DATATEXT_LOGO_${file}${content}\n")endforeach()file(GENERATE OUTPUT logo_builtin.h CONTENT "${LOGO_BUILTIN_H}")######################## libfastfetch target ########################set(LIBFASTFETCH_SRCsrc/common/percent.csrc/common/commandoption.csrc/common/font.csrc/common/format.csrc/common/init.csrc/common/jsonconfig.csrc/common/library.csrc/common/modules.csrc/common/netif/netif.csrc/common/option.csrc/common/parsing.csrc/common/printing.csrc/common/properties.csrc/common/settings.csrc/common/temps.csrc/detection/bluetoothradio/bluetoothradio.csrc/detection/bootmgr/bootmgr.csrc/detection/chassis/chassis.csrc/detection/cpu/cpu.csrc/detection/cpuusage/cpuusage.csrc/detection/disk/disk.csrc/detection/diskio/diskio.csrc/detection/displayserver/displayserver.csrc/detection/editor/editor.csrc/detection/font/font.csrc/detection/gpu/gpu.csrc/detection/media/media.csrc/detection/netio/netio.csrc/detection/opencl/opencl.csrc/detection/opengl/opengl_shared.csrc/detection/os/os.csrc/detection/packages/packages.csrc/detection/physicalmemory/physicalmemory.csrc/detection/publicip/publicip.csrc/detection/terminaltheme/terminaltheme.csrc/detection/terminalfont/terminalfont.csrc/detection/terminalshell/terminalshell.csrc/detection/version/version.csrc/detection/vulkan/vulkan.csrc/detection/weather/weather.csrc/logo/builtin.csrc/logo/image/im6.csrc/logo/image/im7.csrc/logo/image/image.csrc/logo/logo.csrc/modules/battery/battery.csrc/modules/bios/bios.csrc/modules/bluetooth/bluetooth.csrc/modules/bluetoothradio/bluetoothradio.csrc/modules/board/board.csrc/modules/bootmgr/bootmgr.csrc/modules/brightness/brightness.csrc/modules/break/break.csrc/modules/btrfs/btrfs.csrc/modules/camera/camera.csrc/modules/chassis/chassis.csrc/modules/colors/colors.csrc/modules/cpu/cpu.csrc/modules/cpucache/cpucache.csrc/modules/cpuusage/cpuusage.csrc/modules/cursor/cursor.csrc/modules/custom/custom.csrc/modules/command/command.csrc/modules/datetime/datetime.csrc/modules/de/de.csrc/modules/disk/disk.csrc/modules/diskio/diskio.csrc/modules/dns/dns.csrc/modules/editor/editor.csrc/modules/font/font.csrc/modules/gpu/gpu.csrc/modules/host/host.csrc/modules/icons/icons.csrc/modules/initsystem/initsystem.csrc/modules/gamepad/gamepad.csrc/modules/kernel/kernel.csrc/modules/lm/lm.csrc/modules/loadavg/loadavg.csrc/modules/locale/locale.csrc/modules/localip/localip.csrc/modules/memory/memory.csrc/modules/monitor/monitor.csrc/modules/netio/netio.csrc/modules/opencl/opencl.csrc/modules/opengl/opengl.csrc/modules/os/os.csrc/modules/packages/packages.csrc/modules/physicaldisk/physicaldisk.csrc/modules/physicalmemory/physicalmemory.csrc/modules/processes/processes.csrc/modules/player/player.csrc/modules/poweradapter/poweradapter.csrc/modules/publicip/publicip.csrc/modules/display/display.csrc/modules/separator/separator.csrc/modules/shell/shell.csrc/modules/sound/sound.csrc/modules/swap/swap.csrc/modules/media/media.csrc/modules/terminal/terminal.csrc/modules/terminaltheme/terminaltheme.csrc/modules/terminalfont/terminalfont.csrc/modules/terminalsize/terminalsize.csrc/modules/theme/theme.csrc/modules/title/title.csrc/modules/tpm/tpm.csrc/modules/uptime/uptime.csrc/modules/users/users.csrc/modules/version/version.csrc/modules/vulkan/vulkan.csrc/modules/wallpaper/wallpaper.csrc/modules/weather/weather.csrc/modules/wifi/wifi.csrc/modules/wm/wm.csrc/modules/wmtheme/wmtheme.csrc/modules/zpool/zpool.csrc/options/display.csrc/options/modules.csrc/options/logo.csrc/options/general.csrc/util/edidHelper.csrc/util/base64.csrc/util/FFlist.csrc/util/FFstrbuf.csrc/util/path.csrc/util/platform/FFPlatform.csrc/util/smbiosHelper.c)if(LINUX)list(APPEND LIBFASTFETCH_SRCsrc/common/dbus.csrc/common/io/io_unix.csrc/common/netif/netif_linux.csrc/common/networking_linux.csrc/common/processing_linux.csrc/detection/battery/battery_linux.csrc/detection/bios/bios_linux.csrc/detection/board/board_linux.csrc/detection/bootmgr/bootmgr_linux.csrc/detection/brightness/brightness_linux.csrc/detection/btrfs/btrfs_linux.csrc/detection/chassis/chassis_linux.csrc/detection/cpu/cpu_linux.csrc/detection/cpucache/cpucache_linux.csrc/detection/cpuusage/cpuusage_linux.csrc/detection/cursor/cursor_linux.csrc/detection/bluetooth/bluetooth_linux.csrc/detection/bluetoothradio/bluetoothradio_linux.csrc/detection/disk/disk_linux.csrc/detection/dns/dns_linux.csrc/detection/physicaldisk/physicaldisk_linux.csrc/detection/physicalmemory/physicalmemory_linux.csrc/detection/diskio/diskio_linux.csrc/detection/displayserver/linux/displayserver_linux.csrc/detection/displayserver/linux/drm.csrc/detection/displayserver/linux/wayland/wayland.csrc/detection/displayserver/linux/wayland/global-output.csrc/detection/displayserver/linux/wayland/zwlr-output.csrc/detection/displayserver/linux/wayland/kde-output.csrc/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.csrc/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.csrc/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.csrc/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.csrc/detection/displayserver/linux/wmde.csrc/detection/displayserver/linux/xcb.csrc/detection/displayserver/linux/xlib.csrc/detection/font/font_linux.csrc/detection/gpu/gpu_linux.csrc/detection/gpu/gpu_pci.csrc/detection/gtk_qt/gtk.csrc/detection/host/host_linux.csrc/detection/icons/icons_linux.csrc/detection/initsystem/initsystem_linux.csrc/detection/libc/libc_linux.csrc/detection/lm/lm_linux.csrc/detection/loadavg/loadavg_linux.csrc/detection/locale/locale_linux.csrc/detection/localip/localip_linux.csrc/detection/gamepad/gamepad_linux.csrc/detection/media/media_linux.csrc/detection/memory/memory_linux.csrc/detection/monitor/monitor_linux.csrc/detection/netio/netio_linux.csrc/detection/opengl/opengl_linux.csrc/detection/os/os_linux.csrc/detection/packages/packages_linux.csrc/detection/poweradapter/poweradapter_linux.csrc/detection/processes/processes_linux.csrc/detection/gtk_qt/qt.csrc/detection/sound/sound_linux.csrc/detection/swap/swap_linux.csrc/detection/terminalfont/terminalfont_linux.csrc/detection/terminalshell/terminalshell_linux.csrc/detection/terminalsize/terminalsize_linux.csrc/detection/theme/theme_linux.csrc/detection/tpm/tpm_linux.csrc/detection/uptime/uptime_linux.csrc/detection/users/users_linux.csrc/detection/wallpaper/wallpaper_linux.csrc/detection/wifi/wifi_linux.csrc/detection/wm/wm_nosupport.csrc/detection/de/de_linux.csrc/detection/wmtheme/wmtheme_linux.csrc/detection/camera/camera_linux.csrc/detection/zpool/zpool_linux.csrc/util/platform/FFPlatform_unix.csrc/util/binary_linux.c)elseif(ANDROID)list(APPEND LIBFASTFETCH_SRCsrc/common/io/io_unix.csrc/common/netif/netif_linux.csrc/common/networking_linux.csrc/common/processing_linux.csrc/detection/battery/battery_android.csrc/detection/bios/bios_android.csrc/detection/bluetooth/bluetooth_nosupport.csrc/detection/bluetoothradio/bluetoothradio_nosupport.csrc/detection/board/board_android.csrc/detection/bootmgr/bootmgr_nosupport.csrc/detection/brightness/brightness_nosupport.csrc/detection/btrfs/btrfs_nosupport.csrc/detection/chassis/chassis_nosupport.csrc/detection/cpu/cpu_linux.csrc/detection/cpucache/cpucache_linux.csrc/detection/cursor/cursor_nosupport.csrc/detection/cpuusage/cpuusage_linux.csrc/detection/disk/disk_linux.csrc/detection/dns/dns_linux.csrc/detection/physicaldisk/physicaldisk_linux.csrc/detection/physicalmemory/physicalmemory_nosupport.csrc/detection/diskio/diskio_linux.csrc/detection/displayserver/displayserver_android.csrc/detection/font/font_nosupport.csrc/detection/gpu/gpu_nosupport.csrc/detection/host/host_android.csrc/detection/icons/icons_nosupport.csrc/detection/initsystem/initsystem_linux.csrc/detection/libc/libc_android.csrc/detection/lm/lm_nosupport.csrc/detection/loadavg/loadavg_linux.csrc/detection/locale/locale_linux.csrc/detection/localip/localip_linux.csrc/detection/gamepad/gamepad_nosupport.csrc/detection/media/media_nosupport.csrc/detection/memory/memory_linux.csrc/detection/monitor/monitor_nosupport.csrc/detection/netio/netio_linux.csrc/detection/opengl/opengl_linux.csrc/detection/os/os_android.csrc/detection/packages/packages_linux.csrc/detection/poweradapter/poweradapter_nosupport.csrc/detection/processes/processes_linux.csrc/detection/sound/sound_nosupport.csrc/detection/swap/swap_linux.csrc/detection/terminalfont/terminalfont_android.csrc/detection/terminalshell/terminalshell_linux.csrc/detection/terminalsize/terminalsize_linux.csrc/detection/theme/theme_nosupport.csrc/detection/tpm/tpm_nosupport.csrc/detection/uptime/uptime_linux.csrc/detection/users/users_linux.csrc/detection/wallpaper/wallpaper_nosupport.csrc/detection/wifi/wifi_android.csrc/detection/wm/wm_nosupport.csrc/detection/de/de_nosupport.csrc/detection/wmtheme/wmtheme_nosupport.csrc/detection/camera/camera_android.csrc/detection/zpool/zpool_nosupport.csrc/util/platform/FFPlatform_unix.csrc/util/binary_linux.c)elseif(FreeBSD)list(APPEND LIBFASTFETCH_SRCsrc/common/dbus.csrc/common/io/io_unix.csrc/common/netif/netif_bsd.csrc/common/networking_linux.csrc/common/processing_linux.csrc/common/sysctl.csrc/detection/battery/battery_bsd.csrc/detection/bios/bios_bsd.csrc/detection/bluetooth/bluetooth_linux.csrc/detection/bluetoothradio/bluetoothradio_linux.csrc/detection/board/board_bsd.csrc/detection/bootmgr/bootmgr_bsd.csrc/detection/brightness/brightness_bsd.csrc/detection/btrfs/btrfs_nosupport.csrc/detection/chassis/chassis_bsd.csrc/detection/cpu/cpu_bsd.csrc/detection/cpucache/cpucache_shared.csrc/detection/cpuusage/cpuusage_bsd.csrc/detection/cursor/cursor_linux.csrc/detection/disk/disk_bsd.csrc/detection/dns/dns_linux.csrc/detection/physicaldisk/physicaldisk_bsd.csrc/detection/physicalmemory/physicalmemory_linux.csrc/detection/diskio/diskio_bsd.csrc/detection/displayserver/linux/displayserver_linux.csrc/detection/displayserver/linux/drm.csrc/detection/displayserver/linux/wayland/wayland.csrc/detection/displayserver/linux/wayland/global-output.csrc/detection/displayserver/linux/wayland/zwlr-output.csrc/detection/displayserver/linux/wayland/kde-output.csrc/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.csrc/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.csrc/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.csrc/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.csrc/detection/displayserver/linux/wmde.csrc/detection/displayserver/linux/xcb.csrc/detection/displayserver/linux/xlib.csrc/detection/font/font_linux.csrc/detection/gpu/gpu_bsd.csrc/detection/gpu/gpu_pci.csrc/detection/gtk_qt/gtk.csrc/detection/host/host_bsd.csrc/detection/lm/lm_linux.csrc/detection/icons/icons_linux.csrc/detection/initsystem/initsystem_linux.csrc/detection/libc/libc_bsd.csrc/detection/loadavg/loadavg_bsd.csrc/detection/locale/locale_linux.csrc/detection/localip/localip_linux.csrc/detection/gamepad/gamepad_bsd.csrc/detection/media/media_linux.csrc/detection/memory/memory_bsd.csrc/detection/monitor/monitor_linux.csrc/detection/netio/netio_bsd.csrc/detection/opengl/opengl_linux.csrc/detection/os/os_linux.csrc/detection/packages/packages_bsd.csrc/detection/poweradapter/poweradapter_nosupport.csrc/detection/processes/processes_bsd.csrc/detection/gtk_qt/qt.csrc/detection/sound/sound_bsd.csrc/detection/swap/swap_bsd.csrc/detection/terminalfont/terminalfont_linux.csrc/detection/terminalshell/terminalshell_linux.csrc/detection/terminalsize/terminalsize_linux.csrc/detection/theme/theme_linux.csrc/detection/tpm/tpm_nosupport.csrc/detection/uptime/uptime_bsd.csrc/detection/users/users_linux.csrc/detection/wallpaper/wallpaper_linux.csrc/detection/wifi/wifi_bsd.csrc/detection/wm/wm_nosupport.csrc/detection/de/de_linux.csrc/detection/wmtheme/wmtheme_linux.csrc/detection/camera/camera_linux.csrc/detection/zpool/zpool_linux.csrc/util/platform/FFPlatform_unix.csrc/util/binary_linux.c)elseif(APPLE)list(APPEND LIBFASTFETCH_SRCsrc/common/io/io_unix.csrc/common/netif/netif_bsd.csrc/common/networking_linux.csrc/common/processing_linux.csrc/common/sysctl.csrc/detection/battery/battery_apple.csrc/detection/bios/bios_apple.csrc/detection/bluetooth/bluetooth_apple.msrc/detection/bluetoothradio/bluetoothradio_apple.msrc/detection/board/board_apple.csrc/detection/bootmgr/bootmgr_apple.csrc/detection/brightness/brightness_apple.csrc/detection/btrfs/btrfs_nosupport.csrc/detection/chassis/chassis_nosupport.csrc/detection/cpu/cpu_apple.csrc/detection/cpucache/cpucache_apple.csrc/detection/cpuusage/cpuusage_apple.csrc/detection/cursor/cursor_apple.msrc/detection/disk/disk_bsd.csrc/detection/dns/dns_linux.csrc/detection/physicaldisk/physicaldisk_apple.csrc/detection/physicalmemory/physicalmemory_apple.msrc/detection/diskio/diskio_apple.csrc/detection/displayserver/displayserver_apple.csrc/detection/font/font_apple.msrc/detection/gpu/gpu_apple.csrc/detection/gpu/gpu_apple.msrc/detection/host/host_apple.csrc/detection/icons/icons_nosupport.csrc/detection/initsystem/initsystem_linux.csrc/detection/lm/lm_nosupport.csrc/detection/loadavg/loadavg_bsd.csrc/detection/libc/libc_apple.csrc/detection/locale/locale_linux.csrc/detection/localip/localip_linux.csrc/detection/gamepad/gamepad_apple.csrc/detection/media/media_apple.msrc/detection/memory/memory_apple.csrc/detection/monitor/monitor_apple.msrc/detection/netio/netio_bsd.csrc/detection/opengl/opengl_apple.csrc/detection/os/os_apple.msrc/detection/packages/packages_apple.csrc/detection/poweradapter/poweradapter_apple.csrc/detection/processes/processes_bsd.csrc/detection/sound/sound_apple.csrc/detection/swap/swap_apple.csrc/detection/terminalfont/terminalfont_apple.msrc/detection/terminalshell/terminalshell_linux.csrc/detection/terminalsize/terminalsize_linux.csrc/detection/theme/theme_nosupport.csrc/detection/tpm/tpm_nosupport.csrc/detection/uptime/uptime_bsd.csrc/detection/users/users_linux.csrc/detection/wallpaper/wallpaper_apple.msrc/detection/wifi/wifi_apple.msrc/detection/wm/wm_apple.csrc/detection/de/de_nosupport.csrc/detection/wmtheme/wmtheme_apple.msrc/detection/camera/camera_apple.msrc/detection/zpool/zpool_nosupport.csrc/util/apple/cf_helpers.csrc/util/apple/osascript.msrc/util/apple/smc_temps.csrc/util/platform/FFPlatform_unix.csrc/util/binary_apple.c)elseif(WIN32)list(APPEND LIBFASTFETCH_SRCsrc/common/io/io_windows.csrc/common/netif/netif_windows.csrc/common/networking_windows.csrc/common/processing_windows.csrc/detection/battery/battery_windows.csrc/detection/bios/bios_windows.csrc/detection/bluetooth/bluetooth_windows.csrc/detection/bluetoothradio/bluetoothradio_windows.csrc/detection/board/board_windows.csrc/detection/bootmgr/bootmgr_windows.csrc/detection/brightness/brightness_windows.cppsrc/detection/btrfs/btrfs_nosupport.csrc/detection/chassis/chassis_windows.csrc/detection/cpu/cpu_windows.csrc/detection/cpu/cpu_windows.cppsrc/detection/cpucache/cpucache_windows.csrc/detection/cpuusage/cpuusage_windows.csrc/detection/cursor/cursor_windows.csrc/detection/disk/disk_windows.csrc/detection/physicaldisk/physicaldisk_windows.csrc/detection/diskio/diskio_windows.csrc/detection/displayserver/displayserver_windows.csrc/detection/dns/dns_windows.csrc/detection/font/font_windows.csrc/detection/gpu/gpu_windows.csrc/detection/host/host_windows.csrc/detection/icons/icons_windows.csrc/detection/initsystem/initsystem_nosupport.csrc/detection/libc/libc_windows.cppsrc/detection/lm/lm_nosupport.csrc/detection/loadavg/loadavg_nosupport.csrc/detection/locale/locale_windows.csrc/detection/localip/localip_windows.csrc/detection/gamepad/gamepad_windows.csrc/detection/media/media_windows.csrc/detection/memory/memory_windows.csrc/detection/physicalmemory/physicalmemory_linux.csrc/detection/monitor/monitor_windows.csrc/detection/netio/netio_windows.csrc/detection/opengl/opengl_windows.csrc/detection/os/os_windows.cppsrc/detection/packages/packages_windows.csrc/detection/poweradapter/poweradapter_nosupport.csrc/detection/processes/processes_windows.csrc/detection/sound/sound_windows.cppsrc/detection/swap/swap_windows.csrc/detection/terminalfont/terminalfont_windows.csrc/detection/terminalshell/terminalshell_windows.csrc/detection/terminalsize/terminalsize_windows.csrc/detection/theme/theme_nosupport.csrc/detection/tpm/tpm_windows.csrc/detection/uptime/uptime_windows.csrc/detection/users/users_windows.csrc/detection/wallpaper/wallpaper_windows.csrc/detection/wifi/wifi_windows.csrc/detection/wm/wm_windows.cppsrc/detection/de/de_nosupport.csrc/detection/wmtheme/wmtheme_windows.csrc/detection/camera/camera_windows.cppsrc/detection/zpool/zpool_nosupport.csrc/util/windows/getline.csrc/util/windows/com.cppsrc/util/windows/registry.csrc/util/windows/unicode.csrc/util/windows/wmi.cppsrc/util/platform/FFPlatform_windows.csrc/util/binary_windows.c)elseif(SunOS)list(APPEND LIBFASTFETCH_SRCsrc/common/dbus.csrc/common/io/io_unix.csrc/common/netif/netif_bsd.csrc/common/networking_linux.csrc/common/processing_linux.csrc/detection/battery/battery_nosupport.csrc/detection/bios/bios_windows.csrc/detection/board/board_windows.csrc/detection/bootmgr/bootmgr_nosupport.csrc/detection/brightness/brightness_nosupport.csrc/detection/btrfs/btrfs_nosupport.csrc/detection/chassis/chassis_windows.csrc/detection/cpu/cpu_sunos.csrc/detection/cpucache/cpucache_shared.csrc/detection/cpuusage/cpuusage_sunos.csrc/detection/cursor/cursor_linux.csrc/detection/bluetooth/bluetooth_nosupport.csrc/detection/bluetoothradio/bluetoothradio_nosupport.csrc/detection/disk/disk_sunos.csrc/detection/dns/dns_linux.csrc/detection/physicaldisk/physicaldisk_nosupport.csrc/detection/physicalmemory/physicalmemory_linux.csrc/detection/diskio/diskio_sunos.csrc/detection/displayserver/linux/displayserver_linux.csrc/detection/displayserver/linux/drm.csrc/detection/displayserver/linux/wayland/wayland.csrc/detection/displayserver/linux/wayland/global-output.csrc/detection/displayserver/linux/wayland/zwlr-output.csrc/detection/displayserver/linux/wayland/kde-output.csrc/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.csrc/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.csrc/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.csrc/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.csrc/detection/displayserver/linux/wmde.csrc/detection/displayserver/linux/xcb.csrc/detection/displayserver/linux/xlib.csrc/detection/font/font_linux.csrc/detection/gpu/gpu_sunos.csrc/detection/gpu/gpu_pci.csrc/detection/gtk_qt/gtk.csrc/detection/host/host_windows.csrc/detection/icons/icons_linux.csrc/detection/initsystem/initsystem_linux.csrc/detection/libc/libc_nosupport.csrc/detection/lm/lm_nosupport.csrc/detection/loadavg/loadavg_sunos.csrc/detection/locale/locale_linux.csrc/detection/localip/localip_linux.csrc/detection/gamepad/gamepad_nosupport.csrc/detection/media/media_linux.csrc/detection/memory/memory_sunos.csrc/detection/monitor/monitor_linux.csrc/detection/netio/netio_sunos.csrc/detection/opengl/opengl_linux.csrc/detection/os/os_sunos.csrc/detection/packages/packages_sunos.csrc/detection/poweradapter/poweradapter_nosupport.csrc/detection/processes/processes_linux.csrc/detection/gtk_qt/qt.csrc/detection/sound/sound_linux.csrc/detection/swap/swap_sunos.csrc/detection/terminalfont/terminalfont_linux.csrc/detection/terminalshell/terminalshell_linux.csrc/detection/terminalsize/terminalsize_linux.csrc/detection/theme/theme_linux.csrc/detection/tpm/tpm_nosupport.csrc/detection/uptime/uptime_sunos.csrc/detection/users/users_linux.csrc/detection/wallpaper/wallpaper_linux.csrc/detection/wifi/wifi_nosupport.csrc/detection/wm/wm_nosupport.csrc/detection/de/de_linux.csrc/detection/wmtheme/wmtheme_linux.csrc/detection/camera/camera_nosupport.csrc/detection/zpool/zpool_linux.csrc/util/platform/FFPlatform_unix.csrc/util/binary_linux.c)endif()if(ENABLE_DIRECTX_HEADERS)message(STATUS "Enabling DirectX headers for WSL")list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_wsl.cpp)endif()# Proprietary GPU driver APIsif(LINUX OR FreeBSD OR WIN32)list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_nvidia.c)list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_mthreads.c)endif()if(WIN32)list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_intel.c)list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_amd.c)endif()include(CheckFunctionExists)check_function_exists(wcwidth HAVE_WCWIDTH)if(NOT HAVE_WCWIDTH)list(APPEND LIBFASTFETCH_SRC src/3rdparty/mk_wcwidch/wcwidth.c)endif()if(LINUX)check_function_exists(statx HAVE_STATX)endif()if(ENABLE_SYSTEM_YYJSON)find_package(yyjson)if(yyjson_FOUND)message(STATUS "System provided yyjson is used")else()message(FATAL_ERROR "ENABLE_SYSTEM_YYJSON is set but system provided yyjson is not found")endif()else()list(APPEND LIBFASTFETCH_SRCsrc/3rdparty/yyjson/yyjson.c)endif()add_library(libfastfetch OBJECT${LIBFASTFETCH_SRC})if(yyjson_FOUND)target_compile_definitions(libfastfetch PUBLIC FF_USE_SYSTEM_YYJSON)target_link_libraries(libfastfetch PUBLIC yyjson::yyjson)# `target_link_libraries(yyjson::yyjson)` sets rpath implicitlyelse()# Used for dlopen finding dylibs installed by homebrew# `/opt/homebrew/lib` is not on in dlopen search path by defaultif(APPLE)set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,/usr/local/lib")endif()endif()if(LINUX AND EXISTS "/lib/ld-musl-${CMAKE_HOST_SYSTEM_PROCESSOR}.so.1")execute_process(COMMAND "/lib/ld-musl-${CMAKE_HOST_SYSTEM_PROCESSOR}.so.1"ERROR_VARIABLE LD_MUSL_RESULT)if("${LD_MUSL_RESULT}" MATCHES "Version ([0-9]+\\.[0-9]+\\.[0-9]+)")target_compile_definitions(libfastfetch PUBLIC FF_MUSL_VERSION="${CMAKE_MATCH_1}")endif()endif()if(APPLE AND EXISTS "/usr/bin/otool")execute_process(COMMAND /usr/bin/otool -L /usr/bin/otoolOUTPUT_VARIABLE OTOOL_OTOOL_RESULT)if("${OTOOL_OTOOL_RESULT}" MATCHES "libSystem\\.B\\.dylib \\(.*current version ([0-9]+\\.[0-9]+\\.[0-9]+)\\)")target_compile_definitions(libfastfetch PUBLIC FF_LIBSYSTEM_VERSION="${CMAKE_MATCH_1}")endif()endif()if(FreeBSD AND EXISTS "/usr/local/bin/objdump")execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[^ )]*' -o | sort -Vru | head -1"OUTPUT_VARIABLE OBJDUMP_T_RESULT)if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}")endif()endif()target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__=1 _FILE_OFFSET_BITS=64)if(WIN32)target_compile_definitions(libfastfetch PUBLIC WIN32_LEAN_AND_MEAN=1)elseif(APPLE)target_compile_definitions(libfastfetch PUBLIC _DARWIN_C_SOURCE)elseif(SunOS)target_compile_definitions(libfastfetch PUBLIC __EXTENSIONS__ _POSIX_C_SOURCE=1)endif()if(HAVE_STATX)target_compile_definitions(libfastfetch PUBLIC FF_HAVE_STATX)endif()if(HAVE_WCWIDTH)target_compile_definitions(libfastfetch PUBLIC FF_HAVE_WCWIDTH)endif()if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})endif()if(NOT "${CUSTOM_AMDGPU_IDS_PATH}" STREQUAL "")message(STATUS "Custom file path of amdgpu.ids: ${CUSTOM_AMDGPU_IDS_PATH}")target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_AMDGPU_IDS_PATH=${CUSTOM_AMDGPU_IDS_PATH})endif()if(NOT "${CUSTOM_OS_RELEASE_PATH}" STREQUAL "")message(STATUS "Custom file path of os_release: ${CUSTOM_OS_RELEASE_PATH}")target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_OS_RELEASE_PATH=${CUSTOM_OS_RELEASE_PATH})endif()if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")message(STATUS "Enabling custom link type: ${BINARY_LINK_TYPE}")target_compile_definitions(libfastfetch PRIVATE FF_DISABLE_DLOPEN=1)endif()function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME)if(NOT ENABLE_${VARNAME})return()endif()if(PKG_CONFIG_FOUND)pkg_search_module(${VARNAME} QUIET ${PKGCONFIG_NAMES})endif()if(NOT ${VARNAME}_FOUND)find_package(${CMAKE_NAME} QUIET)set(${VARNAME}_FOUND ${${CMAKE_NAME}_FOUND})set(${VARNAME}_INCLUDE_DIRS ${${CMAKE_NAME}_INCLUDE_DIRS})set(${VARNAME}_LIBRARIES ${${CMAKE_NAME}_LIBRARIES})set(${VARNAME}_CFLAGS_OTHER ${${CMAKE_NAME}_CFLAGS_OTHER})endif()if(NOT ${VARNAME}_FOUND)message(STATUS "Library: missing: ${VARNAME}")return()endif()message(STATUS "Library: found ${VARNAME}")target_compile_definitions(libfastfetch PRIVATE FF_HAVE_${VARNAME}=1)target_include_directories(libfastfetch PRIVATE ${${VARNAME}_INCLUDE_DIRS})if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")target_link_directories(libfastfetch PUBLIC ${${VARNAME}_LIBRARY_DIRS})target_link_libraries(libfastfetch PRIVATE ${${VARNAME}_LIBRARIES})endif()foreach(FLAG ${${VARNAME}_CFLAGS_OTHER})if(FLAG MATCHES "-D.*")string(SUBSTRING ${FLAG} 2 -1 FLAG)target_compile_definitions(libfastfetch PRIVATE ${FLAG})endif()endforeach()endfunction()ff_lib_enable(VULKAN"vulkan""Vulkan")ff_lib_enable(WAYLAND"wayland-client""WaylandClient")ff_lib_enable(XCB_RANDR"xcb-randr""XcbRandr")ff_lib_enable(XCB"xcb""Xcb")ff_lib_enable(XRANDR"xrandr""XRandr")ff_lib_enable(X11"x11""X11")ff_lib_enable(DRM"libdrm""Libdrm")ff_lib_enable(GIO"gio-2.0""GIO")ff_lib_enable(DCONF"dconf""DConf")ff_lib_enable(DBUS"dbus-1""DBus")ff_lib_enable(XFCONF"libxfconf-0""XFConf")ff_lib_enable(SQLITE3"sqlite3""SQLite3")ff_lib_enable(RPM"rpm""RPM")ff_lib_enable(IMAGEMAGICK7"MagickCore-7.Q16HDRI;MagickCore-7.Q16;MagickCore-7;/usr/lib/imagemagick7/pkgconfig/MagickCore-7.Q16HDRI.pc;/usr/lib/imagemagick7/pkgconfig/MagickCore-7.Q16.pc;/usr/lib/imagemagick7/pkgconfig/MagickCore-7.pc""ImageMagick7")ff_lib_enable(IMAGEMAGICK6"MagickCore-6.Q16HDRI;MagickCore-6.Q16;MagickCore-6;/usr/lib/imagemagick6/pkgconfig/MagickCore-6.Q16HDRI.pc;/usr/lib/imagemagick6/pkgconfig/MagickCore-6.Q16.pc;/usr/lib/imagemagick6/pkgconfig/MagickCore-6.pc""ImageMagick6")ff_lib_enable(ZLIB"zlib""ZLIB")ff_lib_enable(CHAFA"chafa>=1.10""Chafa")ff_lib_enable(EGL"egl""EGL")ff_lib_enable(GLX"glx""GLX")ff_lib_enable(OSMESA"osmesa""OSMesa")ff_lib_enable(OPENCL"OpenCL""OpenCL")ff_lib_enable(FREETYPE"freetype2""FreeType2")ff_lib_enable(PULSE"libpulse""Pulse")ff_lib_enable(DDCUTIL"ddcutil""Ddcutil")ff_lib_enable(ELF"libelf""libelf")ff_lib_enable(DIRECTX_HEADERS"DirectX-Headers""DirectX-Headers")# The system <libzfs.h> is only usable on SunOS. We provide our local copy of it so it's always available.if(ENABLE_LIBZFS)if(BINARY_LINK_TYPE STREQUAL "dlopen")target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)else()set(CMAKE_REQUIRED_LIBRARIES_BACKUP ${CMAKE_REQUIRED_LIBRARIES})set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} zfs)check_function_exists("libzfs_init" LIBZFS_FOUND)set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACKUP})if(NOT LIBZFS_FOUND)message(STATUS "Library: missing: LIBZFS")else()message(STATUS "Library: found LIBZFS")target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)target_link_libraries(libfastfetch PRIVATE zfs)endif()endif()endif()if(ENABLE_THREADS)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_THREADS=1)if(CMAKE_USE_PTHREADS_INIT) #Threads::Threads is not set for WIN32target_link_libraries(libfastfetch PRIVATE Threads::Threads)endif()endif()if(ENABLE_EMBEDDED_PCIIDS)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_EMBEDDED_PCIIDS=1)endif()if(LINUX)target_link_libraries(libfastfetchPRIVATE "m")elseif(APPLE)target_link_libraries(libfastfetchPRIVATE "-framework AVFoundation"PRIVATE "-framework Cocoa"PRIVATE "-framework CoreFoundation"PRIVATE "-framework CoreAudio"PRIVATE "-framework CoreMedia"PRIVATE "-framework CoreVideo"PRIVATE "-framework CoreWLAN"PRIVATE "-framework IOBluetooth"PRIVATE "-framework IOKit"PRIVATE "-framework Metal"PRIVATE "-framework OpenGL"PRIVATE "-framework OpenCL"PRIVATE "-framework SystemConfiguration"PRIVATE "-weak_framework CoreDisplay"PRIVATE "-F /System/Library/PrivateFrameworks"PRIVATE "-weak_framework DisplayServices"PRIVATE "-weak_framework MediaRemote"PRIVATE "-weak_framework Apple80211")elseif(WIN32)target_compile_definitions(libfastfetch PRIVATE -D_WIN32_WINNT=0x0A00)target_link_libraries(libfastfetchPRIVATE "dwmapi"PRIVATE "gdi32"PRIVATE "iphlpapi"PRIVATE "ole32"PRIVATE "oleaut32"PRIVATE "ws2_32"PRIVATE "ntdll"PRIVATE "version"PRIVATE "setupapi"PRIVATE "hid"PRIVATE "wtsapi32"PRIVATE "imagehlp")elseif(FreeBSD)target_link_libraries(libfastfetchPRIVATE "m"PRIVATE "usbhid"PRIVATE "geom")elseif(SunOS)target_link_libraries(libfastfetchPRIVATE "m"PRIVATE "socket"PRIVATE "kstat"PRIVATE "proc"PRIVATE "zfs"PRIVATE "nvpair")elseif(ANDROID)CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)if(HAVE_LIBANDROID_WORDEXP_STATIC)target_link_libraries(libfastfetchPRIVATE -l:libandroid-wordexp.a)else()CHECK_LIBRARY_EXISTS(android-wordexp wordexp "" HAVE_LIBANDROID_WORDEXP)if(HAVE_LIBANDROID_WORDEXP)target_link_libraries(libfastfetchPRIVATE android-wordexp)endif()endif()endif()target_include_directories(libfastfetchPUBLIC ${PROJECT_BINARY_DIR}PUBLIC ${PROJECT_SOURCE_DIR}/src)target_link_libraries(libfastfetchPRIVATE ${CMAKE_DL_LIBS})target_compile_options(libfastfetch PRIVATE$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti>)if(WIN32)set(CMAKE_CXX_STANDARD 20)include(CheckIncludeFileCXX)CHECK_INCLUDE_FILE_CXX("winrt/Windows.Foundation.h" HAVE_WINRT)if(HAVE_WINRT)add_library(ffwinrt MODULE src/detection/media/media_windows.dll.cpp)target_link_libraries(ffwinrt PRIVATE "RuntimeObject")target_compile_definitions(ffwinrt PRIVATE WIN32_LEAN_AND_MEAN=1 WINRT_LEAN_AND_MEAN=1)target_link_options(ffwinrtPRIVATE "-static" # stdc++, winpthread, gcc_s, etc.)endif()set(CMAKE_CXX_STANDARD 17)endif()if(FreeBSD)set(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include")endif()if(LINUX OR FreeBSD)CHECK_INCLUDE_FILE("linux/videodev2.h" HAVE_LINUX_VIDEODEV2)if(HAVE_LINUX_VIDEODEV2)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_VIDEODEV2=1)endif()endif()if(LINUX)CHECK_INCLUDE_FILE("linux/wireless.h" HAVE_LINUX_WIRELESS)if(HAVE_LINUX_WIRELESS)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_WIRELESS=1)endif()endif()if(NOT WIN32)CHECK_INCLUDE_FILE("utmpx.h" HAVE_UTMPX)if(HAVE_UTMPX)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_UTMPX=1)endif()CHECK_INCLUDE_FILE("wordexp.h" HAVE_WORDEXP)if(HAVE_WORDEXP)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_WORDEXP=1)endif()if(ENABLE_THREADS AND CMAKE_USE_PTHREADS_INIT)CHECK_INCLUDE_FILE("pthread_np.h" HAVE_PTHREAD_NP)if(HAVE_PTHREAD_NP)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_PTHREAD_NP=1)set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} pthread_np.h)endif()set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} Threads::Threads)check_function_exists("pthread_timedjoin_np" HAVE_TIMEDJOIN_NP)if(HAVE_TIMEDJOIN_NP)target_compile_definitions(libfastfetch PRIVATE FF_HAVE_TIMEDJOIN_NP=1)else()message(WARNING "pthread_timedjoin_np was not found; networking timeout will not work")endif()endif()endif()set(PACKAGES_DISABLE_LIST "")foreach(package_manager ${PACKAGE_MANAGERS})if(PACKAGES_DISABLE_${package_manager})list(APPEND PACKAGES_DISABLE_LIST "${package_manager}")endif()endforeach()if("${PACKAGES_DISABLE_LIST}" STREQUAL "")set(PACKAGES_DISABLE_LIST "FF_PACKAGES_FLAG_NONE")else()message(STATUS "Disabled package managers: ${PACKAGES_DISABLE_LIST}")list(TRANSFORM PACKAGES_DISABLE_LIST PREPEND "FF_PACKAGES_FLAG_")list(TRANSFORM PACKAGES_DISABLE_LIST APPEND "_BIT")list(JOIN PACKAGES_DISABLE_LIST " | " PACKAGES_DISABLE_LIST)endif()target_compile_definitions(libfastfetch PRIVATE FF_PACKAGES_DISABLE_LIST=${PACKAGES_DISABLE_LIST})####################### Executable targets #######################add_executable(fastfetchsrc/fastfetch.c)target_compile_definitions(fastfetchPRIVATE FASTFETCH_TARGET_BINARY_NAME=fastfetch)target_link_libraries(fastfetchPRIVATE libfastfetch)add_executable(flashfetchsrc/flashfetch.c)target_compile_definitions(flashfetchPRIVATE FASTFETCH_TARGET_BINARY_NAME=flashfetch)target_link_libraries(flashfetchPRIVATE libfastfetch)# Prevent fastfetch from linking to libstdc++set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")set_target_properties(fastfetch PROPERTIES LINKER_LANGUAGE C)set_target_properties(flashfetch PROPERTIES LINKER_LANGUAGE C)if(WIN32)target_sources(fastfetchPRIVATE src/util/windows/version.rc)target_sources(flashfetchPRIVATE src/util/windows/version.rc)elseif(APPLE)target_link_options(fastfetchPRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist)target_link_options(flashfetchPRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist)endif()if(BINARY_LINK_TYPE STREQUAL "static")target_link_options(fastfetch PRIVATE "-static")target_link_options(flashfetch PRIVATE "-static")endif()#################### Testing targets ####################if (BUILD_TESTS)add_executable(fastfetch-test-strbuftests/strbuf.c)target_link_libraries(fastfetch-test-strbufPRIVATE libfastfetch)add_executable(fastfetch-test-listtests/list.c)target_link_libraries(fastfetch-test-listPRIVATE libfastfetch)add_executable(fastfetch-test-formattests/format.c)target_link_libraries(fastfetch-test-formatPRIVATE libfastfetch)enable_testing()add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)add_test(NAME test-list COMMAND fastfetch-test-list)add_test(NAME test-format COMMAND fastfetch-test-format)endif()################### install target ###################include(GNUInstallDirs)install(TARGETS fastfetch flashfetchDESTINATION "${CMAKE_INSTALL_BINDIR}")if (TARGET ffwinrt)install(TARGETS ffwinrtDESTINATION "${CMAKE_INSTALL_BINDIR}")endif()install(FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.bash"DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions"RENAME "${CMAKE_PROJECT_NAME}")install(FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.zsh"DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions"RENAME "_${CMAKE_PROJECT_NAME}")install(FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.fish"DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/fish/vendor_completions.d"RENAME "${CMAKE_PROJECT_NAME}.fish")install(DIRECTORY "${CMAKE_SOURCE_DIR}/presets"DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_PROJECT_NAME}")if(INSTALL_LICENSE)install(FILES "${CMAKE_SOURCE_DIR}/LICENSE"DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}")endif()install(FILES "${PROJECT_BINARY_DIR}/fastfetch.1"DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")################### package target ###################set(CPACK_GENERATOR "TGZ;ZIP")if(APPLE)string(TOLOWER "${CMAKE_PROJECT_NAME}-macos-universal" CPACK_PACKAGE_FILE_NAME)else() # We don't use this in Windowsif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")set(CMAKE_SYSTEM_PROCESSOR "amd64")endif()if(IS_MUSL)string(TOLOWER "${CMAKE_PROJECT_NAME}-musl-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)else()string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)endif()endif()if(LINUX)find_program(HAVE_DPKG "dpkg")if(HAVE_DPKG)set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")set(CPACK_DEBIAN_PACKAGE_SECTION, "utils")set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")if(NOT IS_MUSL)EXECUTE_PROCESS(COMMAND getconf GNU_LIBC_VERSIONOUTPUT_VARIABLE GLIBC_VERSIONOUTPUT_STRIP_TRAILING_WHITESPACE)if(GLIBC_VERSION)STRING(REPLACE "glibc " "" GLIBC_VERSION ${GLIBC_VERSION})set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= ${GLIBC_VERSION})")message(STATUS "found glibc ${GLIBC_VERSION}")else()message(WARNING "Could not determine glibc version. If `musl` is used, `-DIS_MUSL=ON` should be set")endif()endif()endif()find_program(HAVE_RPMBUILD "rpmbuild")if(HAVE_RPMBUILD)set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")set(CPACK_RPM_PACKAGE_LICENSE "MIT")endif()endif()set(CPACK_SET_DESTDIR ON)set(CPACK_PACKAGE_CONTACT "Linus Dierheimer <Linus@Dierheimer.de>")set(CPACK_PACKAGE_DESCRIPTION "\fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way. \It is written mostly in C to achieve much better performance.\")include(CPack)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。