Files
fastfetch/CMakeLists.txt
T

2315 lines
89 KiB
CMake
Raw Normal View History

2023-08-14 20:00:04 +08:00
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
2021-02-18 22:25:36 +01:00
2022-03-20 13:16:04 +01:00
project(fastfetch
2026-07-10 10:21:45 +08:00
VERSION 2.66.0
2022-03-20 13:16:04 +01:00
LANGUAGES C
2023-11-02 14:35:16 +08:00
DESCRIPTION "Fast neofetch-like system information tool"
2023-06-12 17:26:37 +02:00
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
2022-03-20 13:16:04 +01:00
)
2021-02-18 22:25:36 +01:00
2022-11-06 01:33:06 +08:00
set(PROJECT_LICENSE "MIT license")
if(DEFINED CMAKE_SYSTEM_PROCESSOR_OVERRIDE) # Used by github actions for i686 build
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR_OVERRIDE} CACHE INTERNAL "")
endif()
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" CMAKE_SYSTEM_PROCESSOR)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(CMAKE_SYSTEM_PROCESSOR "amd64")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
endif()
message(STATUS "Build for system processor: ${CMAKE_SYSTEM_PROCESSOR}")
###################
# Target Platform #
###################
if(ANDROID)
set(LINUX FALSE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
2022-09-19 22:23:31 +02:00
set(LINUX TRUE CACHE BOOL "..." FORCE) # LINUX means GNU/Linux, not just the kernel
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
2024-08-05 08:54:25 +08:00
set(FreeBSD TRUE CACHE BOOL "..." FORCE)
2024-10-04 15:58:17 +08:00
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
set(OpenBSD TRUE CACHE BOOL "..." FORCE)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "MidnightBSD")
set(FreeBSD TRUE CACHE BOOL "..." FORCE)
set(MidnightBSD TRUE CACHE BOOL "..." FORCE)
2024-10-27 11:43:36 +08:00
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "NetBSD")
set(NetBSD TRUE CACHE BOOL "..." FORCE)
2024-11-03 08:35:11 +08:00
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
set(FreeBSD TRUE CACHE BOOL "..." FORCE)
set(DragonFly TRUE CACHE BOOL "..." FORCE)
2024-06-16 01:02:48 +08:00
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
set(SunOS TRUE CACHE BOOL "..." FORCE)
2025-02-05 02:08:28 +01:00
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku")
set(Haiku TRUE CACHE BOOL "..." FORCE)
2025-05-19 15:07:46 +00:00
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
set(GNU TRUE CACHE BOOL "..." FORCE)
elseif(NOT APPLE AND NOT WIN32)
2022-10-02 17:52:09 +08:00
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
#############################
# Compile time dependencies #
#############################
2022-10-13 18:12:54 +08:00
set(THREADS_PREFER_PTHREAD_FLAG NOT WIN32)
find_package(Threads)
2022-11-24 18:10:49 +01:00
find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(WARNING "pkg-config not found, library detection might be limited")
endif()
include(CheckIncludeFile)
2026-06-13 08:26:27 +08:00
if(LINUX)
CHECK_INCLUDE_FILE("linux/version.h" HAVE_LINUX_VERSION_H)
if(NOT HAVE_LINUX_VERSION_H)
message(FATAL_ERROR "Linux headers (linux/version.h) not found! Please install linux-headers package.")
endif()
endif()
2022-06-08 16:25:14 +02:00
#####################
# Configure options #
#####################
2022-02-21 11:40:33 +05:00
2022-09-05 19:56:00 +02:00
include(CMakeDependentOption)
2025-08-24 12:05:14 +01:00
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 OR GNU" OFF)
cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD" OFF)
2025-09-01 09:59:24 +08:00
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
2025-08-24 12:05:14 +01:00
cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR GNU" OFF)
2026-06-23 15:33:58 +08:00
cmake_dependent_option(ENABLE_VADRM "Enable libva-drm" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR GNU" OFF)
cmake_dependent_option(ENABLE_VAX11 "Enable libva-x11" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR GNU" OFF)
2026-05-31 19:08:30 +08:00
cmake_dependent_option(ENABLE_VDPAU "Enable vdpau" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR GNU" OFF)
2025-09-01 09:59:24 +08:00
cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
2026-05-12 10:56:14 +08:00
cmake_dependent_option(ENABLE_EET "Enable eet" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
2025-09-01 09:59:24 +08:00
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR Haiku OR GNU" OFF)
2025-08-24 12:05:14 +01:00
cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR OpenBSD OR NetBSD OR SunOS OR GNU" OFF)
cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX OR GNU" OFF)
2025-09-01 09:59:24 +08:00
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR ANDROID OR WIN32 OR SunOS OR Haiku OR GNU" OFF)
2025-08-24 12:05:14 +01:00
cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR SunOS OR GNU" OFF)
2022-09-05 19:56:00 +02:00
cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
2025-08-24 12:05:14 +01:00
cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR WIN32 OR SunOS OR Haiku OR GNU" OFF)
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku OR GNU" OFF)
2022-09-26 23:07:18 +08:00
cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
2025-09-01 09:59:24 +08:00
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR ANDROID OR GNU" OFF)
cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
2025-08-24 12:05:14 +01:00
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly OR Haiku OR GNU" OFF)
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
2022-09-05 19:56:00 +02:00
2025-09-01 09:59:06 +08:00
option(ENABLE_ZLIB "Enable zlib" ON)
2023-11-18 15:18:09 +01:00
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
2023-10-31 14:57:32 +08:00
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
2026-06-29 16:20:08 +08:00
option(ENABLE_TRACER "Build fastfetch with function tracing" OFF)
2024-07-03 16:10:34 +08:00
option(ENABLE_LTO "Enable link-time optimization in release mode if supported" ON)
option(BUILD_FLASHFETCH "Build flashfetch" ON) # Also build the flashfetch binary
2022-09-05 19:56:00 +02:00
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
2024-04-16 22:58:06 +08:00
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
option(INSTALL_LICENSE "Install license into /usr/share/licenses" ON)
2024-09-25 16:41:55 +08:00
option(ENABLE_EMBEDDED_PCIIDS "Embed pci.ids into fastfetch, requires `python`" OFF)
option(ENABLE_EMBEDDED_AMDGPUIDS "Embed amdgpu.ids into fastfetch, requires `python`" OFF)
option(ENABLE_WORDEXP "Enable using of wordexp(3) if available, instead of glob(3)" ON)
option(ENABLE_LUA "Enable lua scripting for format strings" ON)
2026-05-18 01:42:13 +08:00
option(ENABLE_QUICKJS "Enable quickjs scripting for format strings" ON)
2025-12-05 21:09:00 +08:00
option(ENABLE_LIBZFS "Enable libzfs" ON)
2026-05-28 14:47:09 +08:00
option(ENABLE_WCWIDTH "Detect wide-width characters with wcwidth when calculating logo and separator width. Disable for a smaller and slightly faster build, but logos containing CJK/emoji may be measured too narrow and render incorrectly. Such usecases are uncommon." ON)
set(DEFAULT_STRUCTURE "Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Swap:Disk:LocalIp:Battery:PowerAdapter:Locale:Break:Colors" CACHE STRING "Default module structure for detection")
if(WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
2026-03-07 11:49:43 +08:00
option(ENABLE_WIN81_COMPAT "Enable legacy Windows compatibility (Windows 8.1 and later; Windows 7 unsupported)" ON)
endif()
if(APPLE)
option(ENABLE_APPLE_MEMSIZE_USABLE "Use usable memory size as total memory size in Memory module, to match other systems" OFF)
endif()
2022-06-08 16:25:14 +02:00
file(GLOB FF_MODULE_DIRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/modules" "${CMAKE_CURRENT_SOURCE_DIR}/src/modules/*/")
foreach(FF_MODULE_DIR ${FF_MODULE_DIRS})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/modules/${FF_MODULE_DIR}")
string(TOUPPER "${FF_MODULE_DIR}" FF_MODULE_UPPER)
option(MODULE_DISABLE_${FF_MODULE_UPPER} "Disable module ${FF_MODULE_DIR}" OFF)
endif()
endforeach()
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()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/modules/packages/option.h" PACKAGE_MANAGERS)
string(REGEX MATCHALL "FF_PACKAGES_FLAG_[A-Z]+_BIT" PACKAGE_MANAGERS "${PACKAGE_MANAGERS}")
string(REGEX REPLACE "FF_PACKAGES_FLAG_([A-Z]+)_BIT" "\\1" PACKAGE_MANAGERS "${PACKAGE_MANAGERS}")
list(SORT PACKAGE_MANAGERS)
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()
option(PACKAGES_REMOVE_DISABLED "Remove disabled package managers from the build entirely, instead of just skipping them at runtime" OFF)
if (LINUX)
set(CUSTOM_PCI_IDS_PATH "" CACHE STRING "Custom path to file pci.ids, defaults to `/usr/share/hwdata/pci.ids`")
2024-05-04 10:01:29 +08:00
set(CUSTOM_AMDGPU_IDS_PATH "" CACHE STRING "Custom path to file amdgpu.ids, defaults to `/usr/share/libdrm/amdgpu.ids`")
2024-05-06 16:25:08 +08:00
set(CUSTOM_OS_RELEASE_PATH "" CACHE STRING "Custom path to file os-release, defaults to `/etc/os-release`")
endif()
2022-06-08 16:25:14 +02:00
####################
# Compiler options #
####################
2021-10-20 08:12:15 +00:00
if(NOT CMAKE_BUILD_TYPE)
2023-06-09 22:38:55 +08:00
set(CMAKE_BUILD_TYPE RelWithDebInfo)
2021-10-20 08:12:15 +00:00
endif()
2021-03-07 20:05:00 +01:00
2022-09-22 23:10:34 +02:00
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
if(ENABLE_THREADS)
2022-10-13 18:12:54 +08:00
if(CMAKE_USE_WIN32_THREADS_INIT)
message(STATUS "Threads type: Win32 thread")
2022-10-13 18:12:54 +08:00
elseif(CMAKE_USE_PTHREADS_INIT)
message(STATUS "Threads type: pthread")
endif()
else()
message(STATUS "Threads type: disabled")
endif()
2022-09-22 23:10:34 +02:00
2025-01-14 10:05:38 +08:00
set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type -Werror=vla")
2023-06-12 21:18:22 +08:00
2026-07-13 10:18:01 +08:00
if(LINUX)
if(NOT IS_MUSL) # `NOT DEFINED IS_MUSL` doesn't work
execute_process(
COMMAND ${CMAKE_C_COMPILER} -print-file-name=libc.so
OUTPUT_VARIABLE LIBC_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(LIBC_PATH MATCHES "-musl")
set(IS_MUSL ON CACHE BOOL "Build with musl libc" FORCE)
endif()
endif()
if(IS_MUSL)
message(STATUS "MUSL libc detected")
# Silence ioctl related warnings
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-sign-conversion")
endif()
endif()
2026-07-13 10:35:03 +08:00
# Minimal compiler version supported: GCC 13 (2023-04-26), Clang 16 (2023-03-17)
# Most C23 features are allowed with noticeable exceptions of `constexpr` and `#embed`
# See https://cppreference.com/c/compiler_support/23 for detail
2026-07-10 16:35:46 +08:00
set(CMAKE_C_STANDARD 23)
2023-10-28 13:12:04 +08:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion")
2026-03-20 18:35:07 +08:00
if(WIN32 OR Haiku)
enable_language(CXX)
2026-04-30 20:26:12 +08:00
if(WIN32)
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
2024-06-11 19:48:25 +08:00
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")
2026-03-07 11:49:43 +08:00
if(ENABLE_WIN81_COMPAT)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--subsystem,console,--major-os-version,6,--minor-os-version,3")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--subsystem,console,--major-os-version,10,--minor-os-version,0")
endif()
elseif(APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang")
2024-01-03 09:41:02 +08:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-arc")
endif()
2022-10-02 17:52:09 +08:00
set(FASTFETCH_FLAGS_DEBUG "-fno-omit-frame-pointer")
2023-10-31 14:57:32 +08:00
if(ENABLE_ASAN)
message(STATUS "Address sanitizer enabled (DEBUG only)")
2023-09-25 16:40:26 +08:00
set(FASTFETCH_FLAGS_DEBUG "${FASTFETCH_FLAGS_DEBUG} -fsanitize=address")
2022-10-02 17:52:09 +08:00
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}")
2024-03-01 10:27:25 +08:00
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG} -fstack-protector-all -fno-delete-null-pointer-checks")
2023-02-25 13:30:31 +08:00
if(NOT WIN32)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
endif()
2024-07-03 16:10:34 +08:00
if(ENABLE_LTO AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Enabling LTO")
2022-10-11 13:15:43 +08:00
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
if(IPO_SUPPORTED)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
2022-06-08 16:25:14 +02:00
endif()
#######################
# Target FS structure #
#######################
2022-04-10 15:07:52 +02:00
if(NOT TARGET_DIR_ROOT)
2022-04-10 15:26:18 +02:00
if(NOT ANDROID)
set(TARGET_DIR_ROOT "")
else()
set(TARGET_DIR_ROOT "/data/data/com.termux/files/usr")
endif()
2022-04-10 15:07:52 +02:00
endif()
2022-04-10 15:26:18 +02:00
2022-04-10 15:07:52 +02:00
if(NOT TARGET_DIR_USR)
2022-04-10 15:26:18 +02:00
if(NOT ANDROID)
set(TARGET_DIR_USR "${TARGET_DIR_ROOT}/usr")
else()
set(TARGET_DIR_USR "${TARGET_DIR_ROOT}")
endif()
2022-04-10 15:07:52 +02:00
endif()
2022-04-10 15:26:18 +02:00
2022-04-10 15:07:52 +02:00
if(NOT TARGET_DIR_HOME)
2022-09-06 05:19:21 -07:00
if(APPLE)
set(TARGET_DIR_HOME "${TARGET_DIR_ROOT}/Users")
elseif(ANDROID)
2022-04-10 15:26:18 +02:00
set(TARGET_DIR_HOME "/data/data/com.termux/files/home")
2022-09-06 05:19:21 -07:00
else()
set(TARGET_DIR_HOME "${TARGET_DIR_ROOT}/home")
2022-04-10 15:26:18 +02:00
endif()
2022-04-10 15:07:52 +02:00
endif()
2022-10-01 22:53:11 +08:00
if(NOT TARGET_DIR_ETC)
2022-10-09 10:39:57 +02:00
set(TARGET_DIR_ETC "${TARGET_DIR_ROOT}/etc")
endif()
2023-02-21 21:40:55 +08:00
message(STATUS "Target dirs: ROOT=\"${TARGET_DIR_ROOT}\" USR=\"${TARGET_DIR_USR}\" HOME=\"${TARGET_DIR_HOME}\" ETC=\"${TARGET_DIR_ETC}\"")
2023-02-21 21:38:10 +08:00
2022-10-09 10:39:57 +02:00
#https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
if(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)
2022-10-01 22:53:11 +08:00
endif()
2022-06-08 16:25:14 +02:00
#################
# Tweak version #
#################
2021-10-22 21:53:29 +02:00
2022-04-10 15:07:52 +02:00
if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND git describe --tags
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
2024-08-09 09:52:53 +08:00
OUTPUT_VARIABLE PROJECT_VERSION_GIT
2022-04-10 15:07:52 +02:00
OUTPUT_STRIP_TRAILING_WHITESPACE
)
2024-08-09 09:52:53 +08:00
string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_GIT}")
2022-04-10 15:07:52 +02:00
endif()
2022-12-08 18:33:43 +08:00
if(PROJECT_VERSION_TWEAK)
string(REGEX MATCH "[0-9]+" PROJECT_VERSION_TWEAK_NUM "${PROJECT_VERSION_TWEAK}")
else()
set(PROJECT_VERSION_TWEAK_NUM 0)
endif()
2022-04-10 15:07:52 +02:00
2022-06-08 16:25:14 +02:00
#############
# Text data #
#############
2023-11-21 11:03:43 +08:00
function(fastfetch_encode_c_string STR OUTVAR)
2023-12-06 23:55:34 +08:00
string(REGEX REPLACE "\n$" "" TEMP "${STR}") # Remove trailing newline
2023-11-20 16:37:59 +08:00
string(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashes
string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n
string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"
set(${OUTVAR} "\"${TEMP}\"" PARENT_SCOPE)
2023-11-21 11:03:43 +08:00
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)
2024-11-13 10:24:57 +08:00
message(STATUS "Minifying 'help.json'")
2023-12-06 23:55:34 +08:00
execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"
2026-05-28 15:54:17 +08:00
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/help.json"
2023-11-21 11:03:43 +08:00
OUTPUT_VARIABLE DATATEXT_JSON_HELP)
if(DATATEXT_JSON_HELP STREQUAL "")
message(ERROR "DATATEXT_JSON_HELP is empty, which should not happen!")
endif()
2023-11-21 11:03:43 +08:00
else()
2024-11-13 10:24:57 +08:00
message(WARNING "Python3 is not found, 'help.json' will not be minified")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/doc/help.json" DATATEXT_JSON_HELP)
2023-11-21 11:03:43 +08:00
endif()
2023-11-20 16:37:59 +08:00
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
2024-09-25 16:41:55 +08:00
if(Python_FOUND)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/pci.ids")
message(STATUS "'${PROJECT_BINARY_DIR}/pci.ids' is missing, downloading...")
file(DOWNLOAD "https://pci-ids.ucw.cz/v2.2/pci.ids" "${PROJECT_BINARY_DIR}/pci.ids")
endif()
2024-11-13 10:24:57 +08:00
message(STATUS "Generating 'fastfetch_pciids.c.inc'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py" "${PROJECT_BINARY_DIR}/pci.ids"
2024-11-18 14:08:53 +08:00
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc"
RESULT_VARIABLE PYTHON_PCIIDS_RETCODE)
if(NOT PYTHON_PCIIDS_RETCODE EQUAL 0)
file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
2026-03-14 15:16:20 +08:00
message(WARNING "Failed to generate 'fastfetch_pciids.c.inc'")
set(ENABLE_EMBEDDED_PCIIDS OFF)
2024-11-18 14:08:53 +08:00
endif()
2024-09-25 16:41:55 +08:00
else()
2024-11-13 10:24:57 +08:00
message(WARNING "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
2024-09-25 16:41:55 +08:00
set(ENABLE_EMBEDDED_PCIIDS OFF)
endif()
endif()
if(ENABLE_EMBEDDED_AMDGPUIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc")
if(Python_FOUND)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/amdgpu.ids")
message(STATUS "'${PROJECT_BINARY_DIR}/amdgpu.ids' is missing, downloading...")
file(DOWNLOAD "https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids" "${PROJECT_BINARY_DIR}/amdgpu.ids")
endif()
message(STATUS "Generating 'fastfetch_amdgpuids.c.inc'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-amdgpuids.py" "${PROJECT_BINARY_DIR}/amdgpu.ids"
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc"
RESULT_VARIABLE PYTHON_AMDGPUIDS_RETCODE)
if(NOT PYTHON_AMDGPUIDS_RETCODE EQUAL 0)
file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc")
2026-03-14 15:16:20 +08:00
message(WARNING "Failed to generate 'fastfetch_amdgpuids.c.inc'")
set(ENABLE_EMBEDDED_AMDGPUIDS OFF)
endif()
else()
message(WARNING "Python3 is not found, 'fastfetch_amdgpuids.c.inc' will not be generated")
set(ENABLE_EMBEDDED_AMDGPUIDS OFF)
endif()
endif()
2024-11-13 10:24:57 +08:00
if(Python_FOUND)
message(STATUS "Generating 'fastfetch.1'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-man.py"
2024-11-18 14:08:53 +08:00
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch.1"
RESULT_VARIABLE PYTHON_MANPAGE_RETCODE)
if(NOT PYTHON_MANPAGE_RETCODE EQUAL 0)
message(FATAL_ERROR "Failed to generate 'fastfetch.1'")
endif()
2024-11-13 10:24:57 +08:00
else()
message(WARNING "Python3 is not found, use basic 'fastfetch.1.in' instead")
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
endif()
2023-11-21 11:03:43 +08:00
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
2021-10-22 21:53:29 +02:00
2023-07-28 14:12:48 +08:00
configure_file(src/fastfetch_config.h.in fastfetch_config.h @ONLY)
configure_file(src/fastfetch_datatext.h.in fastfetch_datatext.h @ONLY)
2023-10-11 15:17:14 +08:00
if(APPLE)
2026-01-06 10:02:44 +08:00
configure_file(src/common/apple/Info.plist.in Info.plist @ONLY)
2023-10-11 15:17:14 +08:00
endif()
2022-06-08 16:25:14 +02:00
2023-07-28 14:12:48 +08:00
####################
# Ascii image data #
####################
file(GLOB LOGO_FILES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/logo/ascii/[a-z_]/*.txt")
2023-12-04 15:00:25 +08:00
set(LOGO_BUILTIN_H "#pragma once\n#pragma GCC diagnostic ignored \"-Wtrigraphs\"\n\n")
2023-07-28 14:12:48 +08:00
foreach(file ${LOGO_FILES})
2023-11-21 11:03:43 +08:00
fastfetch_load_text("${file}" content)
2024-04-25 15:48:39 +08:00
get_filename_component(file "${file}" NAME_WE)
2023-07-28 14:12:48 +08:00
string(TOUPPER "${file}" file)
2023-07-29 20:47:02 +08:00
set(LOGO_BUILTIN_H "${LOGO_BUILTIN_H}#define FASTFETCH_DATATEXT_LOGO_${file} ${content}\n")
2023-07-28 14:12:48 +08:00
endforeach()
2023-07-29 20:47:02 +08:00
file(GENERATE OUTPUT logo_builtin.h CONTENT "${LOGO_BUILTIN_H}")
2021-03-06 11:28:38 +01:00
2022-06-08 16:25:14 +02:00
#######################
# libfastfetch target #
#######################
2022-02-21 11:40:33 +05:00
2022-09-04 12:43:30 +02:00
set(LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/commandoption.c
src/common/impl/duration.c
src/common/impl/font.c
src/common/impl/format.c
src/common/impl/frequency.c
src/common/impl/init.c
src/common/impl/jsonconfig.c
src/common/impl/library.c
2026-06-01 16:00:28 +08:00
src/common/impl/lua.c
2026-01-06 09:48:38 +08:00
src/common/impl/netif.c
src/common/impl/networking_common.c
src/common/impl/option.c
src/common/impl/parsing.c
src/common/impl/percent.c
src/common/impl/printing.c
src/common/impl/properties.c
src/common/impl/settings.c
src/common/impl/size.c
src/common/impl/temps.c
src/common/impl/time.c
src/common/impl/edidHelper.c
src/common/impl/base64.c
src/common/impl/FFlist.c
src/common/impl/FFstrbuf.c
src/common/impl/path.c
src/common/impl/FFPlatform.c
2026-03-31 20:01:25 +08:00
src/common/impl/smbios.c
2026-06-02 14:01:59 +08:00
src/common/impl/strutil.c
2024-07-28 10:55:07 +08:00
src/detection/bluetoothradio/bluetoothradio.c
2024-05-15 21:36:15 +08:00
src/detection/bootmgr/bootmgr.c
2023-06-22 17:32:01 +08:00
src/detection/chassis/chassis.c
2026-05-31 23:31:45 +08:00
src/detection/codec/codec.c
src/detection/codec/codec_vulkan.c
2022-09-04 22:20:12 +02:00
src/detection/cpu/cpu.c
src/detection/cpu/cpu_x86.c
2023-03-17 17:56:31 +08:00
src/detection/cpuusage/cpuusage.c
src/detection/command/command.c
2022-11-20 18:14:32 +01:00
src/detection/disk/disk.c
2023-10-07 16:21:26 +08:00
src/detection/diskio/diskio.c
2022-11-20 18:14:32 +01:00
src/detection/displayserver/displayserver.c
2024-05-22 16:13:36 +08:00
src/detection/editor/editor.c
2022-11-20 18:14:32 +01:00
src/detection/font/font.c
2022-09-05 17:42:42 +02:00
src/detection/gpu/gpu.c
2026-03-21 22:39:25 +08:00
src/detection/host/host_mac.c
2022-11-20 18:14:32 +01:00
src/detection/media/media.c
2023-09-27 00:05:37 +08:00
src/detection/netio/netio.c
2023-04-25 19:03:20 +08:00
src/detection/opencl/opencl.c
2024-07-10 00:20:11 +08:00
src/detection/opengl/opengl_shared.c
2022-11-20 18:14:32 +01:00
src/detection/os/os.c
src/detection/packages/packages.c
src/detection/physicalmemory/physicalmemory.c
2023-09-13 16:20:50 +08:00
src/detection/publicip/publicip.c
2024-01-22 16:03:32 +08:00
src/detection/terminaltheme/terminaltheme.c
src/detection/terminalfont/terminalfont.c
src/detection/terminalshell/terminalshell.c
2023-08-21 09:19:16 +08:00
src/detection/version/version.c
2023-02-14 17:50:53 +08:00
src/detection/vulkan/vulkan.c
2023-09-13 18:31:22 +08:00
src/detection/weather/weather.c
src/detection/zpool/zpool.c
2022-11-20 18:14:32 +01:00
src/logo/builtin.c
src/logo/image/im6.c
src/logo/image/im7.c
src/logo/image/image.c
src/logo/logo.c
2023-03-07 16:13:53 +08:00
src/modules/battery/battery.c
2023-03-10 14:48:09 +08:00
src/modules/bios/bios.c
2023-03-13 17:36:48 +08:00
src/modules/bluetooth/bluetooth.c
2024-07-28 00:05:07 +08:00
src/modules/bluetoothradio/bluetoothradio.c
2023-03-13 18:54:57 +08:00
src/modules/board/board.c
2024-05-15 21:36:15 +08:00
src/modules/bootmgr/bootmgr.c
2023-03-14 15:29:47 +08:00
src/modules/brightness/brightness.c
2023-03-13 19:01:08 +08:00
src/modules/break/break.c
2024-09-14 16:18:35 +08:00
src/modules/btrfs/btrfs.c
2024-02-02 15:09:54 +08:00
src/modules/camera/camera.c
2023-06-09 10:08:04 +08:00
src/modules/chassis/chassis.c
src/modules/codec/codec.c
2023-03-15 17:02:54 +08:00
src/modules/colors/colors.c
2023-03-15 18:17:24 +08:00
src/modules/cpu/cpu.c
src/modules/cpucache/cpucache.c
2023-03-17 17:56:31 +08:00
src/modules/cpuusage/cpuusage.c
2023-03-20 14:57:46 +08:00
src/modules/cursor/cursor.c
2023-03-20 15:46:00 +08:00
src/modules/custom/custom.c
2023-03-07 19:27:49 +08:00
src/modules/command/command.c
2023-03-09 19:38:03 +08:00
src/modules/datetime/datetime.c
2023-06-07 10:39:53 +08:00
src/modules/de/de.c
2023-04-02 00:13:11 +08:00
src/modules/disk/disk.c
2023-10-07 16:21:26 +08:00
src/modules/diskio/diskio.c
2024-06-12 14:47:58 +08:00
src/modules/dns/dns.c
2024-05-22 16:13:36 +08:00
src/modules/editor/editor.c
2023-04-04 12:28:52 +08:00
src/modules/font/font.c
2023-03-26 20:42:18 +08:00
src/modules/gpu/gpu.c
2023-03-10 11:26:53 +08:00
src/modules/host/host.c
2023-06-07 09:49:38 +08:00
src/modules/icons/icons.c
2024-05-28 23:46:13 +08:00
src/modules/initsystem/initsystem.c
2023-04-04 11:01:42 +08:00
src/modules/gamepad/gamepad.c
2023-03-10 14:14:32 +08:00
src/modules/kernel/kernel.c
2024-10-09 09:45:09 +08:00
src/modules/keyboard/keyboard.c
2023-06-20 23:01:18 +08:00
src/modules/lm/lm.c
2024-05-08 16:41:33 +08:00
src/modules/loadavg/loadavg.c
2023-04-04 17:47:42 +08:00
src/modules/locale/locale.c
2023-04-04 20:46:50 +08:00
src/modules/localip/localip.c
src/modules/logo/logo.c
2023-05-11 21:07:04 +08:00
src/modules/memory/memory.c
2024-10-01 12:10:15 +08:00
src/modules/monitor/monitor.c
2023-09-27 00:05:37 +08:00
src/modules/netio/netio.c
2023-06-07 15:10:44 +08:00
src/modules/opencl/opencl.c
2023-06-07 14:44:27 +08:00
src/modules/opengl/opengl.c
2023-03-07 14:56:13 +08:00
src/modules/os/os.c
2023-05-26 14:32:27 +08:00
src/modules/packages/packages.c
2023-12-18 10:43:20 +08:00
src/modules/physicaldisk/physicaldisk.c
2024-05-10 23:47:15 +08:00
src/modules/physicalmemory/physicalmemory.c
2023-06-09 10:24:20 +08:00
src/modules/processes/processes.c
2023-06-07 16:19:07 +08:00
src/modules/player/player.c
2023-06-05 16:57:55 +08:00
src/modules/poweradapter/poweradapter.c
2023-06-08 09:41:22 +08:00
src/modules/publicip/publicip.c
2023-03-10 10:56:36 +08:00
src/modules/display/display.c
2023-03-09 17:00:37 +08:00
src/modules/separator/separator.c
2023-06-01 11:37:52 +08:00
src/modules/shell/shell.c
2023-04-12 14:05:09 +08:00
src/modules/sound/sound.c
2023-05-11 21:07:04 +08:00
src/modules/swap/swap.c
2023-06-07 16:10:14 +08:00
src/modules/media/media.c
2024-10-09 09:45:09 +08:00
src/modules/mouse/mouse.c
2023-06-02 16:07:01 +08:00
src/modules/terminal/terminal.c
2024-01-22 16:03:32 +08:00
src/modules/terminaltheme/terminaltheme.c
2023-06-02 16:28:58 +08:00
src/modules/terminalfont/terminalfont.c
2023-07-26 10:27:40 +08:00
src/modules/terminalsize/terminalsize.c
2023-06-09 08:48:46 +08:00
src/modules/theme/theme.c
2023-03-09 18:11:03 +08:00
src/modules/title/title.c
2024-09-25 22:55:57 +08:00
src/modules/tpm/tpm.c
2023-04-25 19:57:27 +08:00
src/modules/uptime/uptime.c
2023-06-07 15:23:01 +08:00
src/modules/users/users.c
2023-08-21 09:19:16 +08:00
src/modules/version/version.c
2023-06-07 15:16:09 +08:00
src/modules/vulkan/vulkan.c
2023-06-07 10:14:08 +08:00
src/modules/wallpaper/wallpaper.c
2023-06-08 11:33:33 +08:00
src/modules/weather/weather.c
2023-05-23 15:30:59 +08:00
src/modules/wifi/wifi.c
2023-06-07 10:50:52 +08:00
src/modules/wm/wm.c
2023-04-28 19:11:55 +08:00
src/modules/wmtheme/wmtheme.c
2024-08-28 10:55:04 +08:00
src/modules/zpool/zpool.c
2026-01-06 09:13:40 +08:00
src/modules/modules.c
2023-10-26 10:26:15 +08:00
src/options/display.c
src/options/logo.c
src/options/general.c
)
2022-02-08 07:10:46 +02:00
2022-11-20 18:14:32 +01:00
if(LINUX)
2022-10-08 16:04:55 +08:00
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_linux.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_linux.c
2022-11-20 18:14:32 +01:00
src/detection/battery/battery_linux.c
src/detection/bios/bios_linux.c
src/detection/board/board_linux.c
2024-05-15 21:36:15 +08:00
src/detection/bootmgr/bootmgr_linux.c
2023-01-09 19:09:22 +08:00
src/detection/brightness/brightness_linux.c
2024-09-14 16:18:35 +08:00
src/detection/btrfs/btrfs_linux.c
2022-12-24 22:48:10 +08:00
src/detection/chassis/chassis_linux.c
src/detection/codec/codec_linux.c
2022-11-20 18:14:32 +01:00
src/detection/cpu/cpu_linux.c
src/detection/cpucache/cpucache_linux.c
2023-03-17 17:56:31 +08:00
src/detection/cpuusage/cpuusage_linux.c
2022-11-23 12:10:45 +08:00
src/detection/cursor/cursor_linux.c
2023-01-24 10:39:33 +01:00
src/detection/bluetooth/bluetooth_linux.c
2024-07-28 10:55:07 +08:00
src/detection/bluetoothradio/bluetoothradio_linux.c
2022-11-20 18:14:32 +01:00
src/detection/disk/disk_linux.c
2024-06-12 14:47:58 +08:00
src/detection/dns/dns_linux.c
2023-12-18 10:43:20 +08:00
src/detection/physicaldisk/physicaldisk_linux.c
2024-05-11 08:14:56 +00:00
src/detection/physicalmemory/physicalmemory_linux.c
2023-10-07 16:21:26 +08:00
src/detection/diskio/diskio_linux.c
2022-11-20 18:14:32 +01:00
src/detection/displayserver/linux/displayserver_linux.c
2025-09-01 09:59:24 +08:00
src/detection/displayserver/linux/common.c
2023-11-29 14:55:40 +08:00
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wayland/wayland.c
src/detection/displayserver/linux/wayland/global-output.c
src/detection/displayserver/linux/wayland/wl-output-protocol.c
src/detection/displayserver/linux/wayland/wp-color-management-v1-protocol.c
src/detection/displayserver/linux/wayland/kde-output.c
src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c
src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c
2022-11-20 18:14:32 +01:00
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_linux.c
src/detection/gpu/gpu_drm.c
2024-02-11 23:01:14 +08:00
src/detection/gpu/gpu_pci.c
src/detection/gpu/gpu_windows.c
2023-02-14 17:46:21 +08:00
src/detection/gtk_qt/gtk.c
2022-11-20 18:14:32 +01:00
src/detection/host/host_linux.c
2023-06-06 11:26:29 +08:00
src/detection/icons/icons_linux.c
2024-05-28 23:46:13 +08:00
src/detection/initsystem/initsystem_linux.c
2024-10-09 09:45:09 +08:00
src/detection/keyboard/keyboard_linux.c
src/detection/libc/libc_linux.c
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_linux.c
2024-05-08 16:41:33 +08:00
src/detection/loadavg/loadavg_linux.c
2024-01-15 14:50:47 +08:00
src/detection/locale/locale_linux.c
2022-10-08 22:48:13 +08:00
src/detection/localip/localip_linux.c
2023-02-01 21:28:42 +08:00
src/detection/gamepad/gamepad_linux.c
2022-11-20 18:14:32 +01:00
src/detection/media/media_linux.c
src/detection/memory/memory_linux.c
2024-10-09 09:45:09 +08:00
src/detection/mouse/mouse_linux.c
2023-09-27 00:05:37 +08:00
src/detection/netio/netio_linux.c
2022-11-20 18:14:32 +01:00
src/detection/opengl/opengl_linux.c
src/detection/os/os_linux.c
src/detection/packages/packages_linux.c
src/detection/packages/packages_nix.c
2024-01-04 13:54:11 +08:00
src/detection/poweradapter/poweradapter_linux.c
2022-11-20 18:14:32 +01:00
src/detection/processes/processes_linux.c
2023-02-14 17:46:21 +08:00
src/detection/gtk_qt/qt.c
2023-01-26 00:49:43 +08:00
src/detection/sound/sound_linux.c
2022-11-20 18:14:32 +01:00
src/detection/swap/swap_linux.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
2023-07-26 10:27:40 +08:00
src/detection/terminalsize/terminalsize_linux.c
2023-06-08 14:32:15 +08:00
src/detection/theme/theme_linux.c
2024-09-25 22:55:57 +08:00
src/detection/tpm/tpm_linux.c
2022-11-20 18:14:32 +01:00
src/detection/uptime/uptime_linux.c
src/detection/users/users_linux.c
2023-06-06 20:43:38 +08:00
src/detection/wallpaper/wallpaper_linux.c
2022-12-02 22:34:56 +08:00
src/detection/wifi/wifi_linux.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
2022-11-20 18:14:32 +01:00
src/detection/wmtheme/wmtheme_linux.c
2024-02-02 22:14:25 +08:00
src/detection/camera/camera_linux.c
2022-10-08 16:04:55 +08:00
)
2022-11-20 18:14:32 +01:00
elseif(ANDROID)
2022-09-19 22:23:31 +02:00
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_linux.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_linux.c
src/detection/battery/battery_android.c
2023-07-27 22:50:19 +08:00
src/detection/bios/bios_android.c
2023-01-24 10:46:00 +01:00
src/detection/bluetooth/bluetooth_nosupport.c
2024-07-28 00:05:07 +08:00
src/detection/bluetoothradio/bluetoothradio_nosupport.c
2023-07-27 19:47:26 +08:00
src/detection/board/board_android.c
2024-05-18 11:08:21 +08:00
src/detection/bootmgr/bootmgr_nosupport.c
2023-01-09 18:59:02 +08:00
src/detection/brightness/brightness_nosupport.c
2024-09-14 16:18:35 +08:00
src/detection/btrfs/btrfs_nosupport.c
2022-12-24 22:48:10 +08:00
src/detection/chassis/chassis_nosupport.c
2026-05-31 20:09:02 +08:00
src/detection/codec/codec_android.c
2022-09-19 22:23:31 +02:00
src/detection/cpu/cpu_linux.c
src/detection/cpucache/cpucache_linux.c
2025-09-01 09:59:24 +08:00
src/detection/cursor/cursor_linux.c
2023-03-17 17:56:31 +08:00
src/detection/cpuusage/cpuusage_linux.c
2022-10-27 14:58:29 +08:00
src/detection/disk/disk_linux.c
src/detection/dns/dns_linux.c
2023-12-18 10:43:20 +08:00
src/detection/physicaldisk/physicaldisk_linux.c
2024-05-10 23:47:15 +08:00
src/detection/physicalmemory/physicalmemory_nosupport.c
2023-10-08 09:51:13 +08:00
src/detection/diskio/diskio_linux.c
2023-07-19 13:59:40 +08:00
src/detection/displayserver/displayserver_android.c
2025-09-01 09:59:24 +08:00
src/detection/displayserver/linux/common.c
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/gtk_qt/gtk.c
src/detection/gtk_qt/qt.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_android.c
2022-11-20 18:14:32 +01:00
src/detection/host/host_android.c
2025-09-01 09:59:24 +08:00
src/detection/icons/icons_linux.c
2024-05-28 23:46:13 +08:00
src/detection/initsystem/initsystem_linux.c
2024-10-09 09:45:09 +08:00
src/detection/keyboard/keyboard_nosupport.c
src/detection/libc/libc_android.c
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_nosupport.c
2024-05-08 16:41:33 +08:00
src/detection/loadavg/loadavg_linux.c
2024-01-15 14:50:47 +08:00
src/detection/locale/locale_linux.c
2022-11-20 18:14:32 +01:00
src/detection/localip/localip_linux.c
2023-02-01 14:01:39 +08:00
src/detection/gamepad/gamepad_nosupport.c
2025-09-01 09:59:24 +08:00
src/detection/media/media_linux.c
2022-09-19 22:23:31 +02:00
src/detection/memory/memory_linux.c
2024-10-09 09:45:09 +08:00
src/detection/mouse/mouse_nosupport.c
2023-09-27 15:34:53 +08:00
src/detection/netio/netio_linux.c
2022-11-20 18:14:32 +01:00
src/detection/opengl/opengl_linux.c
src/detection/os/os_android.c
src/detection/packages/packages_linux.c
2025-08-14 14:41:53 +08:00
src/detection/packages/packages_nix.c
2022-11-20 18:14:32 +01:00
src/detection/poweradapter/poweradapter_nosupport.c
2022-10-26 17:20:39 +08:00
src/detection/processes/processes_linux.c
2025-09-01 09:59:24 +08:00
src/detection/sound/sound_linux.c
2022-10-18 23:46:42 +08:00
src/detection/swap/swap_linux.c
2022-11-20 18:14:32 +01:00
src/detection/terminalfont/terminalfont_android.c
2025-09-01 09:59:24 +08:00
src/detection/terminalfont/terminalfont_linux.c
2022-11-20 18:14:32 +01:00
src/detection/terminalshell/terminalshell_linux.c
2023-07-26 10:27:40 +08:00
src/detection/terminalsize/terminalsize_linux.c
2025-09-01 09:59:24 +08:00
src/detection/theme/theme_linux.c
2024-09-25 22:55:57 +08:00
src/detection/tpm/tpm_nosupport.c
2022-10-26 17:03:46 +08:00
src/detection/uptime/uptime_linux.c
2022-11-20 18:14:32 +01:00
src/detection/users/users_linux.c
2025-09-01 09:59:24 +08:00
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_android.c
2025-09-01 09:59:24 +08:00
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
2024-02-02 23:22:40 +08:00
src/detection/camera/camera_android.c
2022-09-19 22:23:31 +02:00
)
2024-08-05 08:54:25 +08:00
elseif(FreeBSD)
2022-09-19 22:23:31 +02:00
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_bsd.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/sysctl.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_bsd.c
2023-01-10 12:27:51 +08:00
src/detection/battery/battery_bsd.c
2022-12-29 20:12:14 +08:00
src/detection/bios/bios_bsd.c
2024-12-21 20:25:29 +08:00
src/detection/bluetoothradio/bluetoothradio_nosupport.c
2023-06-15 10:12:05 +08:00
src/detection/board/board_bsd.c
2024-05-16 10:59:10 +08:00
src/detection/bootmgr/bootmgr_bsd.c
2023-06-24 06:26:55 +00:00
src/detection/brightness/brightness_bsd.c
2024-09-14 16:18:35 +08:00
src/detection/btrfs/btrfs_nosupport.c
2023-06-15 10:15:31 +08:00
src/detection/chassis/chassis_bsd.c
src/detection/codec/codec_linux.c
2022-11-20 18:14:32 +01:00
src/detection/cpu/cpu_bsd.c
2024-06-21 15:21:55 +08:00
src/detection/cpucache/cpucache_shared.c
2023-03-17 17:56:31 +08:00
src/detection/cpuusage/cpuusage_bsd.c
2022-11-23 12:10:45 +08:00
src/detection/cursor/cursor_linux.c
2022-11-20 18:14:32 +01:00
src/detection/disk/disk_bsd.c
2024-06-12 14:47:58 +08:00
src/detection/dns/dns_linux.c
2023-12-18 10:43:20 +08:00
src/detection/physicaldisk/physicaldisk_bsd.c
2024-05-12 17:54:54 +08:00
src/detection/physicalmemory/physicalmemory_linux.c
2023-10-08 09:51:13 +08:00
src/detection/diskio/diskio_bsd.c
2022-11-24 18:54:52 +08:00
src/detection/displayserver/linux/displayserver_linux.c
2025-09-01 09:59:24 +08:00
src/detection/displayserver/linux/common.c
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wayland/wayland.c
src/detection/displayserver/linux/wayland/global-output.c
src/detection/displayserver/linux/wayland/kde-output.c
src/detection/displayserver/linux/wayland/wl-output-protocol.c
src/detection/displayserver/linux/wayland/wp-color-management-v1-protocol.c
src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c
src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c
2022-11-24 18:54:52 +08:00
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
2024-01-25 10:18:19 +08:00
src/detection/gpu/gpu_bsd.c
src/detection/gpu/gpu_drm.c
2024-02-11 23:01:14 +08:00
src/detection/gpu/gpu_pci.c
src/detection/gpu/gpu_bsddrm.c
2023-02-14 17:46:21 +08:00
src/detection/gtk_qt/gtk.c
2022-11-20 18:14:32 +01:00
src/detection/host/host_bsd.c
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_linux.c
2023-06-06 11:26:29 +08:00
src/detection/icons/icons_linux.c
2024-05-28 23:46:13 +08:00
src/detection/initsystem/initsystem_linux.c
2024-10-10 09:30:20 +08:00
src/detection/keyboard/keyboard_bsd.c
2023-10-09 13:28:30 +08:00
src/detection/libc/libc_bsd.c
2024-05-08 21:54:13 +08:00
src/detection/loadavg/loadavg_bsd.c
2024-01-15 14:50:47 +08:00
src/detection/locale/locale_linux.c
2022-11-20 18:14:32 +01:00
src/detection/localip/localip_linux.c
2023-06-15 14:22:47 +00:00
src/detection/gamepad/gamepad_bsd.c
2022-11-24 18:54:52 +08:00
src/detection/media/media_linux.c
2022-11-20 18:14:32 +01:00
src/detection/memory/memory_bsd.c
2024-10-10 09:30:20 +08:00
src/detection/mouse/mouse_bsd.c
2023-09-27 00:05:37 +08:00
src/detection/netio/netio_bsd.c
2022-10-06 17:47:49 +08:00
src/detection/opengl/opengl_linux.c
2022-11-24 18:54:52 +08:00
src/detection/os/os_linux.c
src/detection/packages/packages_bsd.c
2022-10-09 23:23:46 +08:00
src/detection/poweradapter/poweradapter_nosupport.c
2022-11-20 18:14:32 +01:00
src/detection/processes/processes_bsd.c
2023-02-14 17:46:21 +08:00
src/detection/gtk_qt/qt.c
src/detection/sound/sound_bsd.c
2022-11-20 18:14:32 +01:00
src/detection/swap/swap_bsd.c
2022-11-24 18:54:52 +08:00
src/detection/terminalfont/terminalfont_linux.c
2022-11-20 18:14:32 +01:00
src/detection/terminalshell/terminalshell_linux.c
2023-07-26 10:27:40 +08:00
src/detection/terminalsize/terminalsize_linux.c
2023-06-08 14:32:15 +08:00
src/detection/theme/theme_linux.c
2024-09-26 10:39:03 +08:00
src/detection/tpm/tpm_bsd.c
2022-11-20 18:14:32 +01:00
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
2023-06-06 20:43:38 +08:00
src/detection/wallpaper/wallpaper_linux.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
2022-11-24 18:54:52 +08:00
src/detection/wmtheme/wmtheme_linux.c
2024-02-04 09:22:24 +08:00
src/detection/camera/camera_linux.c
2022-09-23 00:10:48 +02:00
)
if(DragonFly)
list(APPEND LIBFASTFETCH_SRC
src/detection/bluetooth/bluetooth_nosupport.c
2025-03-23 12:23:30 +08:00
src/detection/wifi/wifi_nosupport.c
)
else()
list(APPEND LIBFASTFETCH_SRC
src/detection/bluetooth/bluetooth_bsd.c
2025-03-23 12:23:30 +08:00
src/detection/wifi/wifi_bsd.c
)
endif()
2024-10-27 11:43:36 +08:00
elseif(NetBSD)
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_bsd.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/sysctl.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_nbsd.c
src/detection/battery/battery_nbsd.c
2024-10-27 11:43:36 +08:00
src/detection/bios/bios_nbsd.c
2025-04-15 19:05:31 +08:00
src/detection/bluetooth/bluetooth_bsd.c
2024-12-21 20:25:29 +08:00
src/detection/bluetoothradio/bluetoothradio_nosupport.c
2024-10-27 11:43:36 +08:00
src/detection/board/board_nbsd.c
src/detection/bootmgr/bootmgr_bsd.c
src/detection/brightness/brightness_nbsd.c
2024-10-27 11:43:36 +08:00
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_nbsd.c
src/detection/codec/codec_linux.c
2024-10-30 23:29:05 +08:00
src/detection/cpu/cpu_nbsd.c
2025-02-15 14:45:09 +08:00
src/detection/cpucache/cpucache_shared.c
2024-10-28 15:19:05 +08:00
src/detection/cpuusage/cpuusage_bsd.c
2024-10-27 11:43:36 +08:00
src/detection/cursor/cursor_linux.c
src/detection/disk/disk_bsd.c
2024-10-27 11:43:36 +08:00
src/detection/dns/dns_linux.c
2026-04-03 21:01:49 +08:00
src/detection/physicaldisk/physicaldisk_nbsd.c
2025-02-15 14:45:09 +08:00
src/detection/physicalmemory/physicalmemory_linux.c
2024-11-01 15:02:47 +08:00
src/detection/diskio/diskio_nbsd.c
2024-10-27 11:43:36 +08:00
src/detection/displayserver/linux/displayserver_linux.c
2025-09-01 09:59:24 +08:00
src/detection/displayserver/linux/common.c
2024-10-27 11:43:36 +08:00
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wayland/wayland.c
src/detection/displayserver/linux/wayland/global-output.c
src/detection/displayserver/linux/wayland/kde-output.c
src/detection/displayserver/linux/wayland/wl-output-protocol.c
src/detection/displayserver/linux/wayland/wp-color-management-v1-protocol.c
2024-10-27 11:43:36 +08:00
src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c
src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_nbsd.c
2024-10-27 11:43:36 +08:00
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_nbsd.c
src/detection/lm/lm_linux.c
src/detection/icons/icons_linux.c
src/detection/initsystem/initsystem_linux.c
src/detection/keyboard/keyboard_nosupport.c
src/detection/libc/libc_nosupport.c
src/detection/loadavg/loadavg_bsd.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
src/detection/media/media_linux.c
src/detection/memory/memory_nbsd.c
2024-10-27 11:43:36 +08:00
src/detection/mouse/mouse_nosupport.c
2024-11-01 18:51:59 +08:00
src/detection/netio/netio_bsd.c
2024-10-27 11:43:36 +08:00
src/detection/opengl/opengl_linux.c
src/detection/os/os_nbsd.c
2025-05-26 15:12:47 +08:00
src/detection/packages/packages_nbsd.c
2024-10-27 11:43:36 +08:00
src/detection/poweradapter/poweradapter_nosupport.c
2024-11-01 00:20:51 +08:00
src/detection/processes/processes_nbsd.c
2024-10-27 11:43:36 +08:00
src/detection/gtk_qt/qt.c
src/detection/sound/sound_nbsd.c
2024-10-28 15:19:05 +08:00
src/detection/swap/swap_obsd.c
2024-10-27 11:43:36 +08:00
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_linux.c
src/detection/tpm/tpm_nosupport.c
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
2025-04-20 11:53:15 +08:00
src/detection/wifi/wifi_nbsd.c
2025-05-31 10:02:45 +08:00
src/detection/wm/wm_linux.c
2024-10-27 11:43:36 +08:00
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
)
2024-10-04 15:58:17 +08:00
elseif(OpenBSD)
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_bsd.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/sysctl.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-31 20:01:25 +08:00
src/common/impl/smbios.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_nosupport.c
2024-12-21 12:04:57 +08:00
src/detection/battery/battery_obsd.c
src/detection/bios/bios_windows.c
2024-12-21 20:25:29 +08:00
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/board/board_windows.c
src/detection/bootmgr/bootmgr_bsd.c
2024-12-20 22:11:28 +08:00
src/detection/brightness/brightness_obsd.c
2024-10-04 15:58:17 +08:00
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_windows.c
src/detection/codec/codec_linux.c
2024-10-04 15:58:17 +08:00
src/detection/cpu/cpu_obsd.c
src/detection/cpucache/cpucache_shared.c
2024-10-04 15:58:17 +08:00
src/detection/cpuusage/cpuusage_bsd.c
src/detection/cursor/cursor_linux.c
src/detection/disk/disk_bsd.c
src/detection/dns/dns_linux.c
2026-04-02 20:06:14 +08:00
src/detection/physicaldisk/physicaldisk_obsd.c
src/detection/physicalmemory/physicalmemory_linux.c
2024-11-01 15:21:47 +08:00
src/detection/diskio/diskio_obsd.c
2024-10-04 15:58:17 +08:00
src/detection/displayserver/linux/displayserver_linux.c
2025-09-01 09:59:24 +08:00
src/detection/displayserver/linux/common.c
2024-10-04 15:58:17 +08:00
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wayland/wayland.c
src/detection/displayserver/linux/wayland/global-output.c
src/detection/displayserver/linux/wayland/kde-output.c
src/detection/displayserver/linux/wayland/wl-output-protocol.c
src/detection/displayserver/linux/wayland/wp-color-management-v1-protocol.c
2024-10-04 15:58:17 +08:00
src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c
src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
2024-10-31 23:51:58 +08:00
src/detection/gpu/gpu_pci.c
src/detection/gpu/gpu_obsd.c
2026-06-12 21:37:06 +08:00
src/detection/gpu/gpu_drm.c
src/detection/gpu/gpu_bsddrm.c
2024-10-04 15:58:17 +08:00
src/detection/gtk_qt/gtk.c
src/detection/host/host_obsd.c
src/detection/lm/lm_nosupport.c
src/detection/icons/icons_linux.c
src/detection/initsystem/initsystem_linux.c
2024-10-09 09:45:09 +08:00
src/detection/keyboard/keyboard_nosupport.c
2024-10-04 15:58:17 +08:00
src/detection/libc/libc_nosupport.c
src/detection/loadavg/loadavg_bsd.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
src/detection/media/media_linux.c
src/detection/memory/memory_obsd.c
2024-10-09 09:45:09 +08:00
src/detection/mouse/mouse_nosupport.c
2024-11-01 18:51:59 +08:00
src/detection/netio/netio_bsd.c
2024-10-04 15:58:17 +08:00
src/detection/opengl/opengl_linux.c
src/detection/os/os_obsd.c
src/detection/packages/packages_obsd.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_obsd.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_obsd.c
2024-10-04 15:58:17 +08:00
src/detection/swap/swap_obsd.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_linux.c
src/detection/tpm/tpm_nosupport.c
src/detection/uptime/uptime_bsd.c
2024-11-01 18:44:09 +08:00
src/detection/users/users_obsd.c
2024-10-04 15:58:17 +08:00
src/detection/wallpaper/wallpaper_linux.c
2025-04-20 11:49:40 +08:00
src/detection/wifi/wifi_obsd.c
2025-05-31 10:16:26 +08:00
src/detection/wm/wm_linux.c
2024-10-04 15:58:17 +08:00
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
2024-10-29 09:34:43 +08:00
src/detection/camera/camera_linux.c
2024-10-04 15:58:17 +08:00
)
2022-11-20 18:14:32 +01:00
elseif(APPLE)
2022-10-27 10:46:33 +08:00
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/io_unix.c
src/common/impl/netif_apple.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/sysctl.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_apple.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_apple.c
2026-01-06 10:02:44 +08:00
src/common/apple/cf_helpers.c
src/common/apple/osascript.m
src/common/apple/smc_temps.c
src/common/apple/version.m
2022-11-20 18:14:32 +01:00
src/detection/battery/battery_apple.c
2023-01-24 22:13:53 +08:00
src/detection/bluetooth/bluetooth_apple.m
2024-07-28 13:06:29 +08:00
src/detection/bluetoothradio/bluetoothradio_apple.m
2024-05-16 16:27:37 +08:00
src/detection/bootmgr/bootmgr_apple.c
2023-01-09 18:59:02 +08:00
src/detection/brightness/brightness_apple.c
2024-09-14 16:18:35 +08:00
src/detection/btrfs/btrfs_nosupport.c
src/detection/codec/codec_apple.c
2022-11-20 18:14:32 +01:00
src/detection/cpu/cpu_apple.c
src/detection/cpucache/cpucache_apple.c
2023-03-26 20:41:03 +08:00
src/detection/cpuusage/cpuusage_apple.c
2023-03-20 11:14:58 +08:00
src/detection/cursor/cursor_apple.m
2022-11-20 18:14:32 +01:00
src/detection/disk/disk_bsd.c
src/detection/dns/dns_apple.c
2023-12-18 10:43:20 +08:00
src/detection/physicaldisk/physicaldisk_apple.c
2023-10-07 16:21:26 +08:00
src/detection/diskio/diskio_apple.c
2022-11-20 18:14:32 +01:00
src/detection/displayserver/displayserver_apple.c
src/detection/font/font_apple.m
src/detection/gpu/gpu_apple.c
src/detection/gpu/gpu_apple.m
2023-06-06 11:26:29 +08:00
src/detection/icons/icons_nosupport.c
2024-05-28 23:46:13 +08:00
src/detection/initsystem/initsystem_linux.c
2024-10-09 09:45:09 +08:00
src/detection/keyboard/keyboard_apple.c
2024-05-08 16:41:33 +08:00
src/detection/lm/lm_nosupport.c
2024-05-08 21:54:13 +08:00
src/detection/loadavg/loadavg_bsd.c
2023-10-09 10:43:58 +08:00
src/detection/libc/libc_apple.c
2024-01-15 14:50:47 +08:00
src/detection/locale/locale_linux.c
2022-11-20 18:14:32 +01:00
src/detection/localip/localip_linux.c
2023-02-01 20:23:46 +08:00
src/detection/gamepad/gamepad_apple.c
2022-11-20 18:14:32 +01:00
src/detection/media/media_apple.m
src/detection/memory/memory_apple.c
2024-10-09 09:45:09 +08:00
src/detection/mouse/mouse_apple.c
2024-11-15 14:35:25 +08:00
src/detection/netio/netio_apple.c
2022-11-20 18:14:32 +01:00
src/detection/opengl/opengl_apple.c
src/detection/os/os_apple.m
src/detection/packages/packages_apple.c
src/detection/packages/packages_nix.c
2022-11-20 18:14:32 +01:00
src/detection/poweradapter/poweradapter_apple.c
src/detection/processes/processes_bsd.c
2023-01-25 14:28:13 +08:00
src/detection/sound/sound_apple.c
2022-11-20 18:14:32 +01:00
src/detection/swap/swap_apple.c
src/detection/terminalfont/terminalfont_apple.m
src/detection/terminalshell/terminalshell_linux.c
2023-07-26 10:27:40 +08:00
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_apple.c
2025-03-31 23:40:01 +08:00
src/detection/tpm/tpm_apple.c
2022-11-20 18:14:32 +01:00
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
2024-01-03 10:12:37 +08:00
src/detection/wallpaper/wallpaper_apple.m
2022-11-28 16:34:56 +08:00
src/detection/wifi/wifi_apple.m
src/detection/wm/wm_apple.m
src/detection/de/de_nosupport.c
2022-11-20 18:14:32 +01:00
src/detection/wmtheme/wmtheme_apple.m
2024-02-02 15:09:54 +08:00
src/detection/camera/camera_apple.m
2022-10-27 10:46:33 +08:00
)
# CMAKE_SYSTEM_PROCESSOR has been normalized before
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")
list(APPEND LIBFASTFETCH_SRC
src/detection/bios/bios_windows.c
src/detection/board/board_windows.c
src/detection/chassis/chassis_windows.c
src/detection/host/host_windows.c
src/detection/physicalmemory/physicalmemory_linux.c
)
else()
list(APPEND LIBFASTFETCH_SRC
src/detection/bios/bios_apple.c
src/detection/board/board_apple.c
src/detection/chassis/chassis_apple.c
src/detection/host/host_apple.c
src/detection/physicalmemory/physicalmemory_apple.m
)
endif()
2022-11-20 18:14:32 +01:00
elseif(WIN32)
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/io_windows.c
src/common/impl/netif_windows.c
src/common/impl/networking_windows.c
src/common/impl/processing_windows.c
src/common/impl/FFPlatform_windows.c
src/common/impl/binary_windows.c
src/common/impl/debug_windows.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_windows.c
2026-01-06 10:02:44 +08:00
src/common/windows/getline.c
src/common/windows/com.c
2026-01-06 10:02:44 +08:00
src/common/windows/registry.c
src/common/windows/unicode.c
src/common/windows/variant.cpp
2026-01-06 10:02:44 +08:00
src/common/windows/version.c
2022-11-22 01:42:26 +08:00
src/detection/battery/battery_windows.c
2022-11-21 17:27:37 +08:00
src/detection/bios/bios_windows.c
2023-01-24 21:01:21 +08:00
src/detection/bluetooth/bluetooth_windows.c
2024-07-28 00:05:07 +08:00
src/detection/bluetoothradio/bluetoothradio_windows.c
2022-11-21 17:34:54 +08:00
src/detection/board/board_windows.c
2024-05-15 21:36:15 +08:00
src/detection/bootmgr/bootmgr_windows.c
src/detection/brightness/brightness_windows.c
2024-09-14 16:18:35 +08:00
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_windows.c
src/detection/codec/codec_windows.cpp
2022-11-21 22:26:50 +08:00
src/detection/cpu/cpu_windows.c
src/detection/cpucache/cpucache_windows.c
2023-03-17 17:56:31 +08:00
src/detection/cpuusage/cpuusage_windows.c
2022-11-23 12:10:45 +08:00
src/detection/cursor/cursor_windows.c
2022-11-20 18:14:32 +01:00
src/detection/disk/disk_windows.c
2023-12-18 10:43:20 +08:00
src/detection/physicaldisk/physicaldisk_windows.c
2023-10-07 16:21:26 +08:00
src/detection/diskio/diskio_windows.c
src/detection/displayserver/displayserver_windows.c
2024-06-12 16:33:13 +08:00
src/detection/dns/dns_windows.c
2022-11-23 19:57:55 +08:00
src/detection/font/font_windows.c
2023-03-25 13:04:44 +08:00
src/detection/gpu/gpu_windows.c
src/detection/gpu/gpu_windows.cpp
src/detection/host/host_windows.c
2023-06-06 14:47:51 +08:00
src/detection/icons/icons_windows.c
2024-05-28 23:46:13 +08:00
src/detection/initsystem/initsystem_nosupport.c
2024-10-09 09:45:09 +08:00
src/detection/keyboard/keyboard_windows.c
src/detection/libc/libc_windows.cpp
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_nosupport.c
2024-05-08 16:41:33 +08:00
src/detection/loadavg/loadavg_nosupport.c
2024-01-15 14:50:47 +08:00
src/detection/locale/locale_windows.c
2022-11-20 18:14:32 +01:00
src/detection/localip/localip_windows.c
src/detection/gamepad/gamepad_windows.c
2026-04-30 20:26:12 +08:00
src/detection/media/media_windows.cpp
src/detection/memory/memory_windows.c
2024-10-09 09:45:09 +08:00
src/detection/mouse/mouse_windows.c
2024-05-11 08:14:56 +00:00
src/detection/physicalmemory/physicalmemory_linux.c
2023-09-27 00:05:37 +08:00
src/detection/netio/netio_windows.c
2022-10-05 23:51:59 +08:00
src/detection/opengl/opengl_windows.c
src/detection/os/os_windows.c
2022-11-20 18:14:32 +01:00
src/detection/packages/packages_windows.c
src/detection/poweradapter/poweradapter_nosupport.c
2023-05-11 19:55:31 +08:00
src/detection/processes/processes_windows.c
2023-01-25 17:17:31 +08:00
src/detection/sound/sound_windows.cpp
2023-05-11 19:55:31 +08:00
src/detection/swap/swap_windows.c
src/detection/terminalfont/terminalfont_windows.c
2023-05-11 19:55:31 +08:00
src/detection/terminalshell/terminalshell_windows.c
2023-07-26 10:27:40 +08:00
src/detection/terminalsize/terminalsize_windows.c
src/detection/theme/theme_windows.c
2024-09-25 22:55:57 +08:00
src/detection/tpm/tpm_windows.c
2022-11-20 18:14:32 +01:00
src/detection/uptime/uptime_windows.c
2022-11-23 19:11:10 +08:00
src/detection/users/users_windows.c
2023-06-06 15:48:24 +08:00
src/detection/wallpaper/wallpaper_windows.c
2022-11-26 18:23:08 +08:00
src/detection/wifi/wifi_windows.c
src/detection/wm/wm_windows.c
src/detection/de/de_nosupport.c
2022-11-20 18:14:32 +01:00
src/detection/wmtheme/wmtheme_windows.c
2024-02-02 16:42:47 +08:00
src/detection/camera/camera_windows.cpp
2022-09-04 12:43:30 +02:00
)
2024-06-16 01:02:48 +08:00
elseif(SunOS)
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_apple.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-01 14:07:20 +08:00
src/common/impl/kmod_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/battery/battery_nosupport.c
2024-06-16 22:25:16 +08:00
src/detection/bios/bios_windows.c
src/detection/board/board_windows.c
2024-06-16 01:02:48 +08:00
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/brightness/brightness_nosupport.c
2024-09-14 16:18:35 +08:00
src/detection/btrfs/btrfs_nosupport.c
2024-06-16 22:25:16 +08:00
src/detection/chassis/chassis_windows.c
2024-06-17 01:01:21 +08:00
src/detection/cpu/cpu_sunos.c
2024-06-21 15:21:55 +08:00
src/detection/cpucache/cpucache_shared.c
2024-06-17 22:51:40 +08:00
src/detection/cpuusage/cpuusage_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/cursor/cursor_linux.c
src/detection/bluetooth/bluetooth_nosupport.c
2024-07-28 00:05:07 +08:00
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/codec/codec_linux.c
src/detection/disk/disk_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/dns/dns_linux.c
2025-06-22 01:16:50 +08:00
src/detection/physicaldisk/physicaldisk_sunos.c
2024-06-16 22:25:16 +08:00
src/detection/physicalmemory/physicalmemory_linux.c
2024-06-17 23:41:53 +08:00
src/detection/diskio/diskio_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/displayserver/linux/displayserver_linux.c
2025-09-01 09:59:24 +08:00
src/detection/displayserver/linux/common.c
2024-06-16 01:02:48 +08:00
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wayland/wayland.c
src/detection/displayserver/linux/wayland/global-output.c
src/detection/displayserver/linux/wayland/kde-output.c
src/detection/displayserver/linux/wayland/wl-output-protocol.c
src/detection/displayserver/linux/wayland/wp-color-management-v1-protocol.c
src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c
src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c
2024-06-16 01:02:48 +08:00
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
2024-06-17 12:37:11 +08:00
src/detection/gpu/gpu_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
2024-06-16 22:25:16 +08:00
src/detection/host/host_windows.c
src/detection/icons/icons_linux.c
2024-06-17 13:35:26 +08:00
src/detection/initsystem/initsystem_linux.c
2024-10-10 10:06:54 +08:00
src/detection/keyboard/keyboard_nosupport.c
2024-06-16 01:02:48 +08:00
src/detection/libc/libc_nosupport.c
src/detection/lm/lm_nosupport.c
2024-06-17 15:23:35 +08:00
src/detection/loadavg/loadavg_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
src/detection/media/media_linux.c
2024-06-17 15:52:45 +08:00
src/detection/memory/memory_sunos.c
2024-10-10 10:06:54 +08:00
src/detection/mouse/mouse_nosupport.c
2024-06-18 10:17:02 +08:00
src/detection/netio/netio_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/opengl/opengl_linux.c
src/detection/os/os_sunos.c
2024-06-17 01:01:21 +08:00
src/detection/packages/packages_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_linux.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_sunos.c
2024-06-17 16:43:52 +08:00
src/detection/swap/swap_sunos.c
2024-06-16 01:02:48 +08:00
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_linux.c
2024-09-25 22:55:57 +08:00
src/detection/tpm/tpm_nosupport.c
2024-06-16 01:02:48 +08:00
src/detection/uptime/uptime_sunos.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_nosupport.c
src/detection/wm/wm_nosupport.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_nosupport.c
)
2025-02-05 02:08:28 +01:00
elseif(Haiku)
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_haiku.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_nosupport.c
2026-01-06 10:02:44 +08:00
src/common/haiku/version.cpp
2025-02-13 23:27:14 +00:00
src/detection/battery/battery_haiku.c
src/detection/bios/bios_windows.c
src/detection/board/board_windows.c
2026-05-30 13:06:38 +02:00
src/detection/bootmgr/bootmgr_haiku.cpp
2026-05-30 17:01:45 +02:00
src/detection/brightness/brightness_haiku.cpp
2025-02-05 02:08:28 +01:00
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_windows.c
2025-02-12 00:16:50 +08:00
src/detection/cpu/cpu_haiku.c
src/detection/cpucache/cpucache_shared.c
2025-02-16 19:13:47 +08:00
src/detection/cpuusage/cpuusage_haiku.c
2025-02-05 02:08:28 +01:00
src/detection/cursor/cursor_nosupport.c
2025-02-16 20:37:21 +08:00
src/detection/bluetooth/bluetooth_haiku.cpp
2025-02-05 02:08:28 +01:00
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/codec/codec_linux.c
2025-02-12 00:17:18 +08:00
src/detection/disk/disk_haiku.cpp
2025-02-05 02:08:28 +01:00
src/detection/dns/dns_linux.c
2025-02-16 20:12:06 +08:00
src/detection/physicaldisk/physicaldisk_haiku.c
src/detection/physicalmemory/physicalmemory_linux.c
2025-02-05 02:08:28 +01:00
src/detection/diskio/diskio_nosupport.c
src/detection/displayserver/displayserver_haiku.cpp
src/detection/font/font_haiku.cpp
src/detection/gpu/gpu_haiku.c
2025-02-05 02:08:28 +01:00
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_windows.c
2025-02-05 02:08:28 +01:00
src/detection/icons/icons_nosupport.c
2025-02-17 21:22:12 +08:00
src/detection/initsystem/initsystem_haiku.c
2025-02-15 16:22:23 +01:00
src/detection/keyboard/keyboard_haiku.cpp
2025-02-05 02:08:28 +01:00
src/detection/libc/libc_nosupport.c
src/detection/lm/lm_nosupport.c
src/detection/loadavg/loadavg_nosupport.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
2025-02-16 20:18:04 +08:00
src/detection/gamepad/gamepad_haiku.cpp
2025-02-12 00:29:43 +00:00
src/detection/media/media_linux.c
2025-02-05 02:08:28 +01:00
src/detection/memory/memory_haiku.c
2025-02-15 16:13:19 +01:00
src/detection/mouse/mouse_haiku.cpp
2025-02-15 18:53:59 +01:00
src/detection/netio/netio_haiku.cpp
2025-02-16 22:52:51 +08:00
src/detection/opengl/opengl_haiku.cpp
2025-02-05 10:15:09 +08:00
src/detection/os/os_haiku.c
2025-02-05 02:08:28 +01:00
src/detection/packages/packages_haiku.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_haiku.c
src/detection/gtk_qt/qt.c
2025-02-12 00:17:36 +08:00
src/detection/sound/sound_haiku.cpp
2025-02-05 02:08:28 +01:00
src/detection/swap/swap_haiku.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_nosupport.c
src/detection/tpm/tpm_nosupport.c
src/detection/uptime/uptime_haiku.c
src/detection/users/users_linux.c
2026-05-10 03:35:25 +02:00
src/detection/wallpaper/wallpaper_haiku.cpp
2025-02-05 02:08:28 +01:00
src/detection/wifi/wifi_nosupport.c
src/detection/wm/wm_nosupport.c
src/detection/de/de_nosupport.c
2026-05-30 22:15:32 +02:00
src/detection/wmtheme/wmtheme_haiku.cpp
2025-02-05 02:08:28 +01:00
src/detection/camera/camera_nosupport.c
)
2025-05-19 15:07:46 +00:00
elseif(GNU)
list(APPEND LIBFASTFETCH_SRC
2026-01-06 09:48:38 +08:00
src/common/impl/dbus.c
src/common/impl/io_unix.c
src/common/impl/netif_gnu.c
src/common/impl/networking_linux.c
src/common/impl/processing_linux.c
src/common/impl/FFPlatform_unix.c
src/common/impl/binary_linux.c
2026-03-01 14:01:18 +08:00
src/common/impl/kmod_nosupport.c
2025-05-19 15:07:46 +00:00
src/detection/battery/battery_nosupport.c
src/detection/bios/bios_nosupport.c
src/detection/board/board_nosupport.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/brightness/brightness_nosupport.c
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_nosupport.c
src/detection/cpu/cpu_linux.c
src/detection/cpucache/cpucache_nosupport.c
src/detection/cpuusage/cpuusage_linux.c
src/detection/cursor/cursor_linux.c
src/detection/bluetooth/bluetooth_linux.c
src/detection/bluetoothradio/bluetoothradio_linux.c
src/detection/codec/codec_linux.c
2025-05-19 15:07:46 +00:00
src/detection/disk/disk_linux.c
src/detection/dns/dns_linux.c
src/detection/physicaldisk/physicaldisk_nosupport.c
src/detection/physicalmemory/physicalmemory_nosupport.c
src/detection/diskio/diskio_nosupport.c
src/detection/displayserver/linux/displayserver_linux.c
src/detection/displayserver/linux/wayland/wayland.c
2025-09-01 09:59:24 +08:00
src/detection/displayserver/linux/common.c
2025-05-19 15:07:46 +00:00
src/detection/displayserver/linux/drm.c
src/detection/displayserver/linux/wmde.c
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/font/font_linux.c
src/detection/gpu/gpu_gnu.c
2025-05-19 15:07:46 +00:00
src/detection/gpu/gpu_pci.c
src/detection/gtk_qt/gtk.c
src/detection/host/host_nosupport.c
src/detection/icons/icons_linux.c
src/detection/initsystem/initsystem_linux.c
src/detection/keyboard/keyboard_nosupport.c
src/detection/libc/libc_linux.c
src/detection/lm/lm_linux.c
src/detection/loadavg/loadavg_linux.c
src/detection/locale/locale_linux.c
src/detection/localip/localip_linux.c
src/detection/gamepad/gamepad_nosupport.c
src/detection/media/media_linux.c
src/detection/memory/memory_linux.c
src/detection/mouse/mouse_nosupport.c
src/detection/netio/netio_nosupport.c
src/detection/opengl/opengl_linux.c
src/detection/os/os_linux.c
src/detection/packages/packages_linux.c
2025-08-24 19:35:33 +08:00
src/detection/packages/packages_nix.c
2025-05-19 15:07:46 +00:00
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_linux.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/swap/swap_linux.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
src/detection/theme/theme_linux.c
src/detection/tpm/tpm_nosupport.c
src/detection/uptime/uptime_linux.c
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
2025-08-24 22:04:58 +08:00
src/detection/wifi/wifi_nosupport.c
2025-08-24 19:56:43 +08:00
src/detection/wm/wm_linux.c
2025-05-19 15:07:46 +00:00
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_nosupport.c
)
2022-09-04 12:43:30 +02:00
endif()
2026-06-29 16:20:08 +08:00
if(ENABLE_TRACER)
message(STATUS "Tracer is enabled")
list(APPEND LIBFASTFETCH_SRC src/common/impl/tracer.c)
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -finstrument-functions-after-inlining")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -finstrument-functions -Dinline=\"__attribute__((no_instrument_function)) inline\"")
endif()
if(NOT WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gcodeview -fuse-ld=lld")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--pdb=${CMAKE_BINARY_DIR}/fastfetch.pdb")
endif()
endif()
# Proprietary GPU driver APIs
2024-08-05 08:54:25 +08:00
if(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)
2026-04-30 20:26:12 +08:00
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "WinRT support is disabled due to known issues with g++")
set(HAVE_WINRT FALSE)
2026-04-30 20:26:12 +08:00
else()
include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX("winrt/Windows.Foundation.h" HAVE_WINRT)
if(HAVE_WINRT)
message(STATUS "WinRT headers are available, media detection will be enabled")
else()
message(WARNING "WinRT headers are NOT available, media detection will be disabled")
endif()
2026-04-30 20:26:12 +08:00
endif()
2024-01-01 12:38:06 +02:00
endif()
include(CheckFunctionExists)
if(NOT WIN32)
check_function_exists(pipe2 HAVE_PIPE2)
endif()
check_function_exists(memrchr HAVE_MEMRCHR)
if(NOT HAVE_MEMRCHR)
list(APPEND LIBFASTFETCH_SRC src/common/impl/memrchr.c)
endif()
2026-05-28 14:47:09 +08:00
if(ENABLE_WCWIDTH)
list(APPEND LIBFASTFETCH_SRC src/common/impl/wcwidth.c)
endif()
2023-08-19 11:10:14 +08:00
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_SRC
src/3rdparty/yyjson/yyjson.c
)
endif()
2022-09-04 12:43:30 +02:00
add_library(libfastfetch OBJECT
${LIBFASTFETCH_SRC}
)
foreach(FF_MODULE_DIR ${FF_MODULE_DIRS})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/modules/${FF_MODULE_DIR}")
string(TOUPPER "${FF_MODULE_DIR}" FF_MODULE_UPPER)
if(MODULE_DISABLE_${FF_MODULE_UPPER})
target_compile_definitions(libfastfetch PUBLIC FF_MODULE_DISABLE_${FF_MODULE_UPPER}=1)
endif()
endif()
endforeach()
include(CheckCSourceCompiles)
check_c_source_compiles("int main(void){int arr[1];return _Countof(arr);}" COMPILER_SUPPORTS_COUNT_OF)
if(COMPILER_SUPPORTS_COUNT_OF)
message(STATUS "_Countof is supported by the compiler")
target_compile_definitions(libfastfetch PUBLIC FF_SUPPORTS_COUNT_OF=1)
else()
message(STATUS "_Countof is NOT supported by the compiler")
endif()
2023-08-19 11:10:14 +08:00
if(yyjson_FOUND)
target_compile_definitions(libfastfetch PUBLIC FF_USE_SYSTEM_YYJSON=1)
2024-09-13 15:47:52 +08:00
target_link_libraries(libfastfetch PUBLIC yyjson::yyjson)
# `target_link_libraries(yyjson::yyjson)` sets rpath implicitly
endif()
# Used for dlopen finding dylibs installed by homebrew
# `/opt/homebrew/lib` is not on in dlopen search path by default
if(APPLE AND BINARY_LINK_TYPE STREQUAL "dlopen")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,/usr/local/lib")
2023-08-19 11:10:14 +08:00
endif()
2022-09-04 12:43:30 +02:00
if(ANDROID)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/vendor/lib64 -Wl,-rpath,/system/lib64")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/vendor/lib -Wl,-rpath,/system/lib")
endif()
endif()
2023-10-09 09:05:11 +08:00
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"
2023-10-09 10:43:40 +08:00
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}")
2023-10-08 21:03:10 +08:00
endif()
endif()
2023-10-09 10:43:58 +08:00
if(APPLE AND EXISTS "/usr/bin/otool")
execute_process(COMMAND /usr/bin/otool -L /usr/bin/otool
OUTPUT_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(MidnightBSD AND EXISTS "/usr/bin/objdump")
execute_process(COMMAND /bin/sh -c "/usr/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")
message(STATUS "Found FBSD ${CMAKE_MATCH_1}")
target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}")
endif()
elseif(FreeBSD AND EXISTS "/usr/local/bin/objdump")
2024-11-03 11:47:24 +08:00
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
2023-10-09 13:28:30 +08:00
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")
message(STATUS "Found FBSD ${CMAKE_MATCH_1}")
2023-10-09 13:28:30 +08:00
target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}")
endif()
elseif(DragonFly AND EXISTS "/usr/local/bin/objdump")
2024-11-03 11:47:24 +08:00
execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'DF[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1"
OUTPUT_VARIABLE OBJDUMP_T_RESULT)
if("${OBJDUMP_T_RESULT}" MATCHES "DF([0-9]+\\.[0-9]+)")
message(STATUS "Found DF ${CMAKE_MATCH_1}")
2024-11-03 11:47:24 +08:00
target_compile_definitions(libfastfetch PUBLIC FF_DF_VERSION="${CMAKE_MATCH_1}")
endif()
endif()
2023-10-08 21:03:10 +08:00
2024-10-17 16:42:59 +08:00
if(LINUX)
2024-10-23 16:09:27 +08:00
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE _ATFILE_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 _TIME_BITS=64) # "$<$<CONFIG:Release>:_FORTIFY_SOURCE=3>"
2024-10-17 16:42:59 +08:00
elseif(ANDROID)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE _FILE_OFFSET_BITS=64 "$<$<CONFIG:DEBUG>:__BIONIC_FORTIFY>" "$<$<CONFIG:DEBUG>:__BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED>")
2024-10-04 15:58:17 +08:00
elseif(WIN32)
2026-04-30 20:26:12 +08:00
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE WIN32_LEAN_AND_MEAN WINRT_LEAN_AND_MEAN _WIN32_WINNT=0x0A00 NOMINMAX UNICODE) # "$<$<CONFIG:Release>:_FORTIFY_SOURCE=3>"
elseif(APPLE)
2024-10-04 15:58:17 +08:00
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 _DARWIN_C_SOURCE)
elseif(OpenBSD)
target_compile_definitions(libfastfetch PUBLIC _XOPEN_SOURCE=700 _FILE_OFFSET_BITS=64 _BSD_SOURCE)
2024-10-31 22:39:25 +08:00
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/X11R6/lib") # detect x11 lib path automatically
2024-11-03 08:35:11 +08:00
elseif(DragonFly)
target_compile_definitions(libfastfetch PUBLIC __FreeBSD__)
2024-06-16 01:02:48 +08:00
elseif(SunOS)
2026-01-07 18:36:01 +08:00
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 __EXTENSIONS__ _POSIX_C_SOURCE)
2024-10-27 11:43:36 +08:00
elseif(NetBSD)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts")
2024-11-04 14:27:43 +08:00
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib") # ditto
2025-02-11 09:15:14 +08:00
elseif(Haiku)
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE)
2025-05-19 15:07:46 +00:00
elseif(GNU)
# On Hurd PATH_MAX is not defined. Set an arbitrary limit as workaround.
2026-01-05 10:45:19 +08:00
target_compile_definitions(libfastfetch PUBLIC _GNU_SOURCE PATH_MAX=4096 O_PATH=0)
2023-03-24 23:21:39 +08:00
endif()
2022-09-29 14:22:56 +08:00
if(APPLE)
if(ENABLE_APPLE_MEMSIZE_USABLE)
target_compile_definitions(libfastfetch PUBLIC FF_APPLE_MEMSIZE_USABLE=1)
else()
target_compile_definitions(libfastfetch PUBLIC FF_APPLE_MEMSIZE_USABLE=0)
endif()
endif()
if(WIN32)
check_function_exists(_msize HAVE_MSVC_MSIZE)
if(HAVE_MSVC_MSIZE)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_MSVC_MSIZE=1)
endif()
2026-03-07 11:49:43 +08:00
if(ENABLE_WIN81_COMPAT)
target_compile_definitions(libfastfetch PUBLIC FF_WIN81_COMPAT=1)
else()
2026-03-07 11:49:43 +08:00
target_compile_definitions(libfastfetch PUBLIC FF_WIN81_COMPAT=0)
endif()
else()
check_function_exists(malloc_usable_size HAVE_MALLOC_USABLE_SIZE)
if(HAVE_MALLOC_USABLE_SIZE)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_MALLOC_USABLE_SIZE=1)
else()
check_function_exists(malloc_size HAVE_MALLOC_SIZE)
if(HAVE_MALLOC_SIZE)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_MALLOC_SIZE=1)
endif()
endif()
endif()
if(FreeBSD OR OpenBSD OR NetBSD)
include(CheckStructHasMember)
set(CMAKE_REQUIRED_DEFINITIONS "-D_IFI_OQDROPS=1")
CHECK_STRUCT_HAS_MEMBER("struct if_data" ifi_oqdrops net/if.h HAVE_IFI_OQDROPS LANGUAGE C)
if(HAVE_IFI_OQDROPS)
target_compile_definitions(libfastfetch PUBLIC _IFI_OQDROPS FF_HAVE_IFI_OQDROPS)
endif()
unset(CMAKE_REQUIRED_DEFINITIONS)
endif()
if(HAVE_PIPE2)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_PIPE2)
endif()
if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")
message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")
target_compile_definitions(libfastfetch PUBLIC FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})
endif()
2024-05-04 10:01:29 +08:00
if(NOT "${CUSTOM_AMDGPU_IDS_PATH}" STREQUAL "")
message(STATUS "Custom file path of amdgpu.ids: ${CUSTOM_AMDGPU_IDS_PATH}")
target_compile_definitions(libfastfetch PUBLIC FF_CUSTOM_AMDGPU_IDS_PATH=${CUSTOM_AMDGPU_IDS_PATH})
2024-05-04 10:01:29 +08:00
endif()
2024-05-06 16:25:08 +08:00
if(NOT "${CUSTOM_OS_RELEASE_PATH}" STREQUAL "")
message(STATUS "Custom file path of os_release: ${CUSTOM_OS_RELEASE_PATH}")
target_compile_definitions(libfastfetch PUBLIC FF_CUSTOM_OS_RELEASE_PATH=${CUSTOM_OS_RELEASE_PATH})
2024-05-06 16:25:08 +08:00
endif()
2025-01-24 09:47:22 +08:00
if(NOT "${CUSTOM_LSB_RELEASE_PATH}" STREQUAL "")
message(STATUS "Custom file path of lsb_release: ${CUSTOM_LSB_RELEASE_PATH}")
target_compile_definitions(libfastfetch PUBLIC FF_CUSTOM_LSB_RELEASE_PATH=${CUSTOM_LSB_RELEASE_PATH})
2025-01-24 09:47:22 +08:00
endif()
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
message(STATUS "Enabling custom link type: ${BINARY_LINK_TYPE}")
target_compile_definitions(libfastfetch PUBLIC FF_DISABLE_DLOPEN=1)
if(NOT WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries")
endif()
endif()
2026-05-20 09:32:02 +08:00
function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME) # [CMAKE_TARGET_NAME]
2022-09-05 19:56:00 +02:00
if(NOT ENABLE_${VARNAME})
return()
2022-04-13 23:13:25 +02:00
endif()
2022-11-24 18:10:49 +01:00
if(PKG_CONFIG_FOUND)
pkg_search_module(${VARNAME} QUIET ${PKGCONFIG_NAMES})
2026-05-20 09:32:02 +08:00
if(${VARNAME}_FOUND)
set(${VARNAME}_FOUND "pkg-config")
endif()
2022-11-24 18:10:49 +01:00
endif()
if(NOT ${VARNAME}_FOUND)
find_package(${CMAKE_NAME} QUIET)
set(${VARNAME}_FOUND ${${CMAKE_NAME}_FOUND})
2026-05-20 09:32:02 +08:00
if(${VARNAME}_FOUND)
2026-05-20 16:16:22 +08:00
set(${VARNAME}_FOUND "CMake")
# Some CMake packages (e.g. quickjs) are target-based only and
# don't expose *_INCLUDE_DIRS/*_LIBRARIES variables.
if(ARGC GREATER 3)
set(_FF_CMAKE_TARGET ${ARGV3})
if(NOT _FF_CMAKE_TARGET STREQUAL "")
if(NOT DEFINED ${VARNAME}_INCLUDE_DIRS OR "${${VARNAME}_INCLUDE_DIRS}" STREQUAL "")
get_target_property(_FF_CMAKE_TARGET_INCLUDES ${_FF_CMAKE_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
if(_FF_CMAKE_TARGET_INCLUDES)
set(${VARNAME}_INCLUDE_DIRS ${_FF_CMAKE_TARGET_INCLUDES})
2026-05-20 09:32:02 +08:00
endif()
2026-05-20 16:16:22 +08:00
endif()
2026-05-20 09:32:02 +08:00
2026-05-20 16:16:22 +08:00
if(NOT DEFINED ${VARNAME}_LIBRARIES OR "${${VARNAME}_LIBRARIES}" STREQUAL "")
get_target_property(_FF_CMAKE_TARGET_LIBRARIES ${_FF_CMAKE_TARGET} INTERFACE_LINK_LIBRARIES)
if(_FF_CMAKE_TARGET_LIBRARIES)
set(${VARNAME}_LIBRARIES ${_FF_CMAKE_TARGET_LIBRARIES})
else()
set(${VARNAME}_LIBRARIES ${_FF_CMAKE_TARGET})
2026-05-20 09:32:02 +08:00
endif()
endif()
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
# INTERFACE_LINK_LIBRARIES doesn't expose libvarname.a
target_link_libraries(libfastfetch PRIVATE ${_FF_CMAKE_TARGET})
endif()
endif()
2026-05-20 16:16:22 +08:00
else()
set(${VARNAME}_INCLUDE_DIRS ${${CMAKE_NAME}_INCLUDE_DIRS})
set(${VARNAME}_LIBRARIES ${${CMAKE_NAME}_LIBRARIES})
set(${VARNAME}_CFLAGS_OTHER ${${CMAKE_NAME}_CFLAGS_OTHER})
endif()
endif()
2022-11-24 18:10:49 +01:00
endif()
2022-09-19 18:30:00 +02:00
if(NOT ${VARNAME}_FOUND)
2022-11-24 18:10:49 +01:00
message(STATUS "Library: missing: ${VARNAME}")
2022-09-19 18:30:00 +02:00
return()
endif()
2026-05-20 09:32:02 +08:00
message(STATUS "Library: found ${VARNAME} by ${${VARNAME}_FOUND}")
2022-11-24 18:10:49 +01:00
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_${VARNAME}=1)
2022-09-19 18:30:00 +02:00
target_include_directories(libfastfetch PRIVATE ${${VARNAME}_INCLUDE_DIRS})
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
target_link_directories(libfastfetch PRIVATE ${${VARNAME}_LIBRARY_DIRS})
target_link_libraries(libfastfetch PRIVATE ${${VARNAME}_LIBRARIES})
endif()
2022-09-19 18:30:00 +02:00
foreach(FLAG ${${VARNAME}_CFLAGS_OTHER})
if(FLAG MATCHES "-D.*")
string(SUBSTRING ${FLAG} 2 -1 FLAG)
target_compile_definitions(libfastfetch PUBLIC ${FLAG})
2022-05-29 16:23:56 +02:00
endif()
2022-09-05 19:56:00 +02:00
endforeach()
endfunction()
2022-11-24 18:10:49 +01:00
ff_lib_enable(VULKAN
"vulkan"
"Vulkan"
)
ff_lib_enable(WAYLAND
"wayland-client"
"WaylandClient"
)
ff_lib_enable(XCB_RANDR
"xcb-randr"
"XcbRandr"
)
ff_lib_enable(XRANDR
"xrandr"
"XRandr"
)
2023-11-29 14:55:40 +08:00
ff_lib_enable(DRM
"libdrm"
"Libdrm"
)
2026-06-23 15:33:58 +08:00
ff_lib_enable(VADRM
"libva-drm"
"Libva-drm"
2026-05-31 10:16:08 +08:00
)
2026-06-23 15:33:58 +08:00
ff_lib_enable(VAX11
"libva-x11"
"Libva-x11"
)
2026-05-31 19:08:30 +08:00
ff_lib_enable(VDPAU
"vdpau"
"vdpau"
)
2022-11-24 18:10:49 +01:00
ff_lib_enable(GIO
"gio-2.0"
"GIO"
)
ff_lib_enable(DCONF
"dconf"
"DConf"
)
2026-05-12 10:56:14 +08:00
ff_lib_enable(EET
"eet"
"Eet"
)
2022-11-24 18:10:49 +01:00
ff_lib_enable(DBUS
"dbus-1"
"DBus"
)
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"
)
2024-10-29 09:08:09 +08:00
if(NOT OpenBSD AND NOT NetBSD)
2024-10-04 15:58:17 +08:00
ff_lib_enable(GLX
"glx"
"GLX"
)
else()
ff_lib_enable(GLX
"gl"
"GL"
)
endif()
2022-11-24 18:10:49 +01:00
ff_lib_enable(OPENCL
"OpenCL"
"OpenCL"
)
ff_lib_enable(FREETYPE
"freetype2"
"FreeType2"
)
2023-01-26 15:48:28 +01:00
ff_lib_enable(PULSE
"libpulse"
"Pulse"
2023-01-26 00:49:43 +08:00
)
ff_lib_enable(DDCUTIL
"ddcutil"
"Ddcutil"
)
2024-08-08 15:03:10 +08:00
ff_lib_enable(ELF
"libelf"
"libelf"
)
ff_lib_enable(QUICKJS
"qjs"
"qjs"
2026-05-20 09:32:02 +08:00
"qjs"
)
2026-05-20 16:16:22 +08:00
if(ENABLE_LUA)
# Lua is a special case since its CMake config does not follow the usual pattern
find_package(Lua QUIET)
if(Lua_FOUND AND NOT DEFINED Lua_VERSION) # For CMake 4.2- compatible
set(Lua_VERSION ${LUA_VERSION_STRING})
set(Lua_VERSION_MAJOR ${LUA_VERSION_MAJOR})
set(Lua_VERSION_MINOR ${LUA_VERSION_MINOR})
endif()
if(Lua_FOUND)
if((NOT Lua_VERSION_MAJOR EQUAL 5) OR Lua_VERSION_MINOR LESS 3 OR Lua_VERSION_MINOR GREATER 5)
message(STATUS "Library: Lua version ${Lua_VERSION} is not supported, requires 5.3-5.5")
unset(Lua_FOUND)
else()
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_LUA=1)
target_include_directories(libfastfetch PUBLIC ${LUA_INCLUDE_DIR})
2026-05-20 16:16:22 +08:00
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
target_link_libraries(libfastfetch PRIVATE ${LUA_LIBRARIES})
endif()
message(STATUS "Library: found LUA ${Lua_VERSION} by CMake")
endif()
else()
message(STATUS "Library: missing: LUA")
endif()
endif()
if(ENABLE_THREADS)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_THREADS=1)
2022-10-13 18:12:54 +08:00
if(CMAKE_USE_PTHREADS_INIT) #Threads::Threads is not set for WIN32
target_link_libraries(libfastfetch PRIVATE Threads::Threads)
endif()
endif()
2024-09-25 16:41:55 +08:00
if(ENABLE_EMBEDDED_PCIIDS)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_EMBEDDED_PCIIDS=1)
2024-09-25 16:41:55 +08:00
endif()
if(ENABLE_EMBEDDED_AMDGPUIDS)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_EMBEDDED_AMDGPUIDS=1)
endif()
2025-12-01 17:17:46 +08:00
if(ENABLE_LIBZFS)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_LIBZFS=1)
2025-12-01 17:17:46 +08:00
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
target_link_libraries(libfastfetch
PRIVATE "zfs"
)
endif()
endif()
2026-05-28 14:47:09 +08:00
if(ENABLE_WCWIDTH)
2026-06-02 15:05:13 +08:00
target_compile_definitions(libfastfetch PUBLIC FF_ENABLE_WCWIDTH=1)
2026-05-28 14:47:09 +08:00
endif()
if(NOT HAVE_MEMRCHR)
2026-06-02 15:05:13 +08:00
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_CUSTOM_MEMRCHR=1)
endif()
2024-09-25 16:41:55 +08:00
if(LINUX)
target_link_libraries(libfastfetch
PRIVATE "m"
)
if(ENABLE_DIRECTX_HEADERS)
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
target_link_libraries(libfastfetch
PRIVATE "/usr/lib/wsl/lib/libdxcore.so"
)
endif()
endif()
elseif(APPLE)
2022-09-14 09:51:08 -07:00
target_link_libraries(libfastfetch
2024-02-02 15:09:54 +08:00
PRIVATE "-framework AVFoundation"
PRIVATE "-framework Cocoa"
2023-03-01 15:40:18 +08:00
PRIVATE "-framework CoreFoundation"
2023-01-25 14:28:13 +08:00
PRIVATE "-framework CoreAudio"
2024-02-02 15:09:54 +08:00
PRIVATE "-framework CoreMedia"
PRIVATE "-framework CoreVideo"
2023-03-01 15:40:18 +08:00
PRIVATE "-framework CoreWLAN"
2023-01-24 22:13:53 +08:00
PRIVATE "-framework IOBluetooth"
2023-03-01 15:40:18 +08:00
PRIVATE "-framework IOKit"
PRIVATE "-framework Metal"
2023-03-01 15:40:18 +08:00
PRIVATE "-framework OpenGL"
PRIVATE "-framework OpenCL"
2023-04-18 14:57:25 +08:00
PRIVATE "-framework SystemConfiguration"
2026-05-31 12:37:20 +08:00
PRIVATE "-framework VideoToolbox"
2023-03-01 15:40:18 +08:00
PRIVATE "-weak_framework CoreDisplay"
2023-10-27 16:59:10 +08:00
PRIVATE "-F /System/Library/PrivateFrameworks"
PRIVATE "-weak_framework DisplayServices"
PRIVATE "-weak_framework MediaRemote"
2022-09-14 09:51:08 -07:00
)
2022-10-14 16:39:48 +08:00
elseif(WIN32)
target_link_libraries(libfastfetch
2022-10-09 23:23:46 +08:00
PRIVATE "gdi32"
PRIVATE "iphlpapi"
2022-10-14 16:39:48 +08:00
PRIVATE "ole32"
PRIVATE "oleaut32"
2022-10-12 19:35:23 +08:00
PRIVATE "ws2_32"
2022-10-15 19:51:33 +08:00
PRIVATE "ntdll"
PRIVATE "version"
PRIVATE "hid"
2022-11-23 19:11:10 +08:00
PRIVATE "wtsapi32"
PRIVATE "cfgmgr32"
PRIVATE "winbrand"
2025-04-09 14:58:36 +08:00
PRIVATE "secur32"
)
2026-03-07 11:49:43 +08:00
if(NOT ENABLE_WIN81_COMPAT)
2025-04-15 16:39:34 +08:00
target_link_libraries(libfastfetch
PRIVATE "mincore"
)
endif()
2026-04-30 20:26:12 +08:00
if(HAVE_WINRT)
target_link_libraries(libfastfetch
PRIVATE "runtimeobject"
2026-04-30 20:26:12 +08:00
)
endif()
2026-06-29 16:20:08 +08:00
if(ENABLE_TRACER)
target_link_libraries(libfastfetch
PRIVATE "dbghelp"
)
endif()
2024-08-05 08:54:25 +08:00
elseif(FreeBSD)
2023-06-15 14:22:47 +00:00
target_link_libraries(libfastfetch
2023-08-22 16:14:24 +08:00
PRIVATE "m"
2023-06-15 14:22:47 +00:00
PRIVATE "usbhid"
PRIVATE "bluetooth"
2023-06-15 14:22:47 +00:00
)
2024-11-03 08:35:11 +08:00
if(NOT DragonFly)
target_link_libraries(libfastfetch
PRIVATE "geom"
)
2024-11-03 18:05:56 +08:00
else()
target_link_libraries(libfastfetch
PRIVATE "devstat"
)
2024-11-03 08:35:11 +08:00
endif()
2024-10-04 15:58:17 +08:00
elseif(OpenBSD)
target_link_libraries(libfastfetch
PRIVATE "m"
PRIVATE "kvm"
PRIVATE "sndio"
2026-04-02 20:06:14 +08:00
PRIVATE "util"
2024-10-04 15:58:17 +08:00
)
2024-10-27 11:50:30 +08:00
elseif(NetBSD)
target_link_libraries(libfastfetch
2025-04-15 19:05:31 +08:00
PRIVATE "bluetooth"
2024-10-27 11:50:30 +08:00
PRIVATE "m"
PRIVATE "prop"
2026-04-03 21:01:49 +08:00
PRIVATE "util"
2024-10-27 11:50:30 +08:00
)
2024-06-16 01:02:48 +08:00
elseif(SunOS)
target_link_libraries(libfastfetch
PRIVATE "m"
PRIVATE "socket"
2024-06-17 01:01:21 +08:00
PRIVATE "kstat"
2024-06-17 13:35:26 +08:00
PRIVATE "proc"
2025-06-21 20:35:26 +08:00
PRIVATE "devinfo"
2024-06-16 01:02:48 +08:00
)
2025-05-19 15:07:46 +00:00
elseif(GNU)
target_link_libraries(libfastfetch
PRIVATE "m"
)
elseif(ANDROID)
2025-08-30 13:30:37 +08:00
target_link_libraries(libfastfetch
PRIVATE "m"
)
if(ENABLE_WORDEXP)
# https://github.com/termux/termux-packages/pull/7056
CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
if(HAVE_LIBANDROID_WORDEXP_STATIC)
target_link_libraries(libfastfetch
PRIVATE -l:libandroid-wordexp.a
)
else()
CHECK_LIBRARY_EXISTS(android-wordexp wordexp "" HAVE_LIBANDROID_WORDEXP)
if(HAVE_LIBANDROID_WORDEXP)
target_link_libraries(libfastfetch
PRIVATE android-wordexp
)
endif()
endif()
endif()
2025-02-05 02:08:28 +01:00
elseif(Haiku)
target_link_libraries(libfastfetch
PRIVATE "network"
2025-02-15 18:53:59 +01:00
PRIVATE "bnetapi"
2025-02-12 00:17:36 +08:00
PRIVATE "media"
2025-02-16 20:18:04 +08:00
PRIVATE "device"
2025-02-16 20:37:21 +08:00
PRIVATE "bluetooth"
2025-02-16 22:52:51 +08:00
PRIVATE "GL"
2025-02-05 02:08:28 +01:00
PRIVATE "be"
2025-02-05 15:44:03 +08:00
PRIVATE "gnu"
2025-02-05 02:08:28 +01:00
)
2022-09-14 09:51:08 -07:00
endif()
2022-09-14 14:55:28 +02:00
target_include_directories(libfastfetch
PUBLIC ${PROJECT_BINARY_DIR}
PUBLIC ${PROJECT_SOURCE_DIR}/src
2021-04-09 14:07:05 +02:00
)
target_link_libraries(libfastfetch
PRIVATE ${CMAKE_DL_LIBS}
2021-02-18 22:25:36 +01:00
)
target_compile_options(libfastfetch PUBLIC
2024-06-11 19:48:25 +08:00
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti>)
if(FreeBSD)
2024-10-29 09:22:09 +08:00
set(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include")
endif()
2024-10-29 09:22:09 +08:00
if(LINUX OR FreeBSD OR OpenBSD OR NetBSD)
2024-07-30 11:06:27 +08:00
CHECK_INCLUDE_FILE("linux/videodev2.h" HAVE_LINUX_VIDEODEV2)
if(HAVE_LINUX_VIDEODEV2)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_LINUX_VIDEODEV2=1)
2024-07-30 11:06:27 +08:00
endif()
endif()
2024-07-30 11:06:27 +08:00
if(NOT WIN32)
CHECK_INCLUDE_FILE("utmpx.h" HAVE_UTMPX)
if(HAVE_UTMPX)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_UTMPX=1)
2024-07-30 11:06:27 +08:00
endif()
if(ENABLE_WORDEXP)
CHECK_INCLUDE_FILE("wordexp.h" HAVE_WORDEXP)
if(HAVE_WORDEXP)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_WORDEXP=1)
message(STATUS "wordexp.h found, wordexp support enabled")
else()
set(ENABLE_WORDEXP OFF)
endif()
2024-07-30 11:06:27 +08:00
endif()
if(NOT ENABLE_WORDEXP)
message(STATUS "wordexp.h not found or disabled, glob used instead")
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 PUBLIC 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 PUBLIC FF_HAVE_TIMEDJOIN_NP=1)
else()
message(WARNING "pthread_timedjoin_np was not found; networking timeout will not work")
endif()
2024-07-30 11:06:27 +08:00
endif()
2026-04-30 20:26:12 +08:00
elseif(HAVE_WINRT)
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_WINRT=1)
2024-06-11 16:41:57 +08:00
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 PUBLIC "FF_PACKAGES_DISABLE_LIST=${PACKAGES_DISABLE_LIST}")
if(PACKAGES_REMOVE_DISABLED)
target_compile_definitions(libfastfetch PUBLIC FF_PACKAGES_REMOVE_DISABLED=1)
endif()
2022-06-08 16:25:14 +02:00
######################
# Executable targets #
######################
2021-02-27 18:30:05 +01:00
add_executable(fastfetch
src/fastfetch.c
)
2022-12-08 18:33:43 +08:00
target_compile_definitions(fastfetch
2022-12-10 13:10:06 +08:00
PRIVATE FASTFETCH_TARGET_BINARY_NAME=fastfetch
2022-12-08 18:33:43 +08:00
)
target_link_libraries(fastfetch
PRIVATE libfastfetch
2021-02-27 18:30:05 +01:00
)
2024-06-11 16:41:57 +08:00
# 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)
2022-11-06 01:33:06 +08:00
if(WIN32)
target_sources(fastfetch
2026-01-06 10:02:44 +08:00
PRIVATE src/common/windows/version.rc
2022-11-06 01:33:06 +08:00
)
2023-10-11 15:17:14 +08:00
elseif(APPLE)
target_link_options(fastfetch
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
)
2022-11-06 01:33:06 +08:00
endif()
if(BINARY_LINK_TYPE STREQUAL "static")
target_link_options(fastfetch PRIVATE "-static")
endif()
# Apply all above parameters to flashfetch if it is built
if (BUILD_FLASHFETCH)
add_executable(flashfetch
src/flashfetch.c
)
target_compile_definitions(flashfetch
PRIVATE FASTFETCH_TARGET_BINARY_NAME=flashfetch
)
target_link_libraries(flashfetch
PRIVATE libfastfetch
)
set_target_properties(flashfetch PROPERTIES LINKER_LANGUAGE C)
if(WIN32)
target_sources(flashfetch
2026-01-06 10:02:44 +08:00
PRIVATE src/common/windows/version.rc
)
elseif(APPLE)
target_link_options(flashfetch
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
)
endif()
if(BINARY_LINK_TYPE STREQUAL "static")
target_link_options(flashfetch PRIVATE "-static")
endif()
endif()
2022-06-08 16:25:14 +02:00
###################
# Testing targets #
###################
2022-02-21 11:40:33 +05:00
2022-02-21 12:22:29 +05:00
if (BUILD_TESTS)
add_executable(fastfetch-test-strbuf
tests/strbuf.c
)
target_link_libraries(fastfetch-test-strbuf
PRIVATE libfastfetch
)
2022-09-20 22:45:36 +08:00
add_executable(fastfetch-test-list
tests/list.c
)
target_link_libraries(fastfetch-test-list
PRIVATE libfastfetch
)
2024-09-02 15:54:22 +08:00
add_executable(fastfetch-test-format
tests/format.c
)
target_link_libraries(fastfetch-test-format
PRIVATE libfastfetch
)
2025-04-17 10:48:18 +08:00
add_executable(fastfetch-test-color
tests/color.c
)
target_link_libraries(fastfetch-test-color
PRIVATE libfastfetch
)
2025-04-29 10:20:23 +08:00
add_executable(fastfetch-test-duration
tests/duration.c
)
target_link_libraries(fastfetch-test-duration
PRIVATE libfastfetch
)
add_executable(fastfetch-test-strutil
tests/strutil.c
)
target_link_libraries(fastfetch-test-strutil
PRIVATE libfastfetch
)
2022-02-21 12:22:29 +05:00
enable_testing()
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
2022-09-20 22:45:36 +08:00
add_test(NAME test-list COMMAND fastfetch-test-list)
2024-09-02 15:54:22 +08:00
add_test(NAME test-format COMMAND fastfetch-test-format)
2025-04-17 10:48:18 +08:00
add_test(NAME test-color COMMAND fastfetch-test-color)
2025-04-29 10:20:23 +08:00
add_test(NAME test-duration COMMAND fastfetch-test-duration)
add_test(NAME test-strutil COMMAND fastfetch-test-strutil)
2022-02-21 12:22:29 +05:00
endif()
2022-02-21 11:40:33 +05:00
2022-06-08 16:25:14 +02:00
##################
# install target #
##################
2022-03-25 11:57:58 +01:00
include(GNUInstallDirs)
2022-02-21 11:40:33 +05:00
2022-03-08 11:59:06 +01:00
install(
TARGETS fastfetch
DESTINATION "${CMAKE_INSTALL_BINDIR}"
2022-03-08 11:59:06 +01:00
)
2022-02-21 11:40:33 +05:00
if (TARGET flashfetch)
install(
TARGETS flashfetch
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()
2022-03-08 11:59:06 +01:00
install(
2024-05-30 21:37:05 +08:00
FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.bash"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions"
RENAME "${CMAKE_PROJECT_NAME}"
2022-02-21 11:40:33 +05:00
)
2024-08-25 19:58:47 +06:00
install(
FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.zsh"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions"
RENAME "_${CMAKE_PROJECT_NAME}"
)
2023-12-06 10:38:55 +08:00
install(
2024-05-30 21:37:05 +08:00
FILES "${CMAKE_SOURCE_DIR}/completions/${CMAKE_PROJECT_NAME}.fish"
2023-12-06 10:38:55 +08:00
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/fish/vendor_completions.d"
RENAME "${CMAKE_PROJECT_NAME}.fish"
)
2022-03-08 11:59:06 +01:00
install(
2022-08-12 21:39:27 +03:00
DIRECTORY "${CMAKE_SOURCE_DIR}/presets"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_PROJECT_NAME}"
2022-03-08 11:59:06 +01:00
)
if(INSTALL_LICENSE)
install(
FILES "${CMAKE_SOURCE_DIR}/LICENSE"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}"
)
endif()
2022-03-25 11:57:58 +01:00
2023-11-18 15:18:08 +01:00
install(
FILES "${PROJECT_BINARY_DIR}/fastfetch.1"
2023-12-05 14:05:52 +02:00
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
2023-11-18 15:18:08 +01:00
)
2022-06-08 16:25:14 +02:00
##################
# package target #
##################
2022-03-25 11:57:58 +01:00
2022-09-11 10:47:47 +02:00
set(CPACK_GENERATOR "TGZ;ZIP")
if(APPLE)
2025-06-17 09:01:38 +08:00
string(TOLOWER "${CMAKE_PROJECT_NAME}-macos-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME) # use macos instead of darwin
elseif(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()
2022-09-11 10:47:47 +02:00
if(LINUX)
2024-04-16 21:54:52 +08:00
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")
2024-05-05 21:29:32 +08:00
if(NOT IS_MUSL)
EXECUTE_PROCESS(
2024-05-05 21:29:32 +08:00
COMMAND getconf GNU_LIBC_VERSION
OUTPUT_VARIABLE GLIBC_VERSION
OUTPUT_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()
2024-05-05 21:29:32 +08:00
endif()
2024-04-16 21:54:52 +08:00
endif()
2022-09-11 10:47:47 +02:00
2025-06-04 09:05:04 +08:00
if(NOT IS_MUSL)
find_program(HAVE_RPMBUILD "rpmbuild")
if(HAVE_RPMBUILD)
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
2022-09-11 10:47:47 +02:00
2025-06-04 09:05:04 +08:00
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
endif()
endif()
elseif(FreeBSD AND NOT DragonFly)
2025-06-02 19:15:14 +08:00
set(CPACK_FREEBSD_PACKAGE_LICENSE "MIT")
2025-06-02 15:56:18 +08:00
set(CPACK_GENERATOR "${CPACK_GENERATOR};FREEBSD")
2022-09-11 10:47:47 +02:00
endif()
2022-07-26 22:13:09 +02:00
set(CPACK_SET_DESTDIR ON)
2022-03-25 11:57:58 +01:00
2025-09-28 14:36:55 +08:00
set(CPACK_PACKAGE_CONTACT "Carter Li <zhangsongcui@live.cn>")
2022-04-23 11:24:24 +02:00
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.\
2022-03-25 11:57:58 +01:00
")
2024-10-06 12:31:47 +08:00
include(CPack)