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
2023-10-02 18:03:10 +08:00
VERSION 2.1.0
2022-03-20 13:16:04 +01:00
LANGUAGES C
2022-09-14 19:12:51 +02:00
DESCRIPTION "Fast 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" )
2022-09-05 18:30:30 +02:00
###################
# Target Platform #
###################
2022-11-25 19:17:37 +08:00
if ( ANDROID )
set ( LINUX FALSE )
elseif ( "${CMAKE_SYSTEM_NAME}" MATCHES ".*[Ll]inux.*" )
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}" MATCHES ".*[Bb][Ss][Dd].*" )
set ( BSD TRUE CACHE BOOL "..." FORCE )
2022-11-25 19:17:37 +08:00
elseif ( NOT APPLE AND NOT WIN32 )
2022-10-02 17:52:09 +08:00
message ( FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}" )
2022-09-05 18:30:30 +02:00
endif ()
2022-10-12 14:13:20 +08:00
#############################
# Compile time dependencies #
#############################
2022-10-13 18:12:54 +08:00
set ( THREADS_PREFER_PTHREAD_FLAG NOT WIN32 )
2022-10-12 14:13:20 +08:00
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 ()
2022-10-12 14:13:20 +08:00
include ( CheckIncludeFile )
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 )
2022-09-20 11:16:08 +02:00
cmake_dependent_option ( ENABLE_LIBPCI "Enable libpci" ON "LINUX OR BSD" OFF )
2022-10-20 15:46:41 +08:00
cmake_dependent_option ( ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR WIN32 OR ANDROID" OFF )
2022-09-20 11:16:08 +02:00
cmake_dependent_option ( ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_XCB "Enable xcb" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_XRANDR "Enable xrandr" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_X11 "Enable x11" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_GIO "Enable gio-2.0" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_DCONF "Enable dconf" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_DBUS "Enable dbus-1" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR BSD" OFF )
2023-06-06 18:34:54 +08:00
cmake_dependent_option ( ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR BSD OR APPLE" OFF )
2022-09-05 19:56:00 +02:00
cmake_dependent_option ( ENABLE_RPM "Enable rpm" ON "LINUX" OFF )
2022-12-22 02:07:35 +08:00
cmake_dependent_option ( ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR BSD OR APPLE OR WIN32" OFF )
2022-12-19 20:38:31 +08:00
cmake_dependent_option ( ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR BSD OR APPLE" OFF )
2022-09-05 19:56:00 +02:00
cmake_dependent_option ( ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF )
2022-09-11 12:03:01 +02:00
cmake_dependent_option ( ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF )
2022-09-20 11:16:08 +02:00
cmake_dependent_option ( ENABLE_EGL "Enable egl" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_GLX "Enable glx" ON "LINUX OR BSD" OFF )
cmake_dependent_option ( ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD" OFF )
2022-10-14 16:39:48 +08:00
cmake_dependent_option ( ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN32" OFF )
2023-01-17 12:45:26 +08:00
cmake_dependent_option ( ENABLE_LIBNM "Enable libnm" ON "LINUX" OFF )
2022-09-26 23:07:18 +08:00
cmake_dependent_option ( ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF )
2023-01-26 15:48:28 +01:00
cmake_dependent_option ( ENABLE_PULSE "Enable pulse" ON "LINUX OR BSD" OFF )
2023-07-09 17:22:04 +08:00
cmake_dependent_option ( ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF )
2023-09-20 23:55:36 +08:00
cmake_dependent_option ( ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF )
2023-02-24 17:45:50 +08:00
cmake_dependent_option ( ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF )
2023-07-13 09:53:31 +08:00
cmake_dependent_option ( ENABLE_PCI_MEMORY "Enable detecting GPU memory size with libpci" OFF "LINUX OR BSD" OFF )
2023-08-19 11:10:14 +08:00
cmake_dependent_option ( ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embeded) yyjson library" OFF "LINUX OR APPLE OR BSD OR WIN32 OR ANDROID" OFF )
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
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}" )
2022-10-12 14:13:20 +08:00
if ( ENABLE_THREADS )
2022-10-13 18:12:54 +08:00
if ( CMAKE_USE_WIN32_THREADS_INIT )
2022-10-12 14:13:20 +08:00
message ( STATUS "Threads type: Win32 thread" )
2022-10-13 18:12:54 +08:00
elseif ( CMAKE_USE_PTHREADS_INIT )
message ( STATUS "Threads type: pthread" )
2022-10-12 14:13:20 +08:00
endif ()
else ()
message ( STATUS "Threads type: disabled" )
endif ()
2022-09-22 23:10:34 +02:00
2023-06-16 20:40:50 +08:00
set ( WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type" )
2023-06-12 21:18:22 +08:00
2022-06-08 15:52:55 +02:00
set ( CMAKE_C_STANDARD 11 )
2023-06-16 20:40:50 +08:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration" )
2022-09-18 15:53:51 +02:00
2023-09-20 23:55:36 +08:00
if ( WIN32 OR ENABLE_DIRECTX_HEADERS )
2023-06-23 11:41:22 +08:00
enable_language ( CXX )
set ( CMAKE_CXX_STANDARD 17 )
2023-06-12 21:18:22 +08:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -fno-exceptions -fno-rtti" )
2023-09-20 23:55:36 +08:00
endif ()
if ( WIN32 )
2023-01-11 09:37:00 +08:00
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--tsaware -Wl,--build-id -Wl,--subsystem,console:6.1,--major-os-version,6,--minor-os-version,1" )
2022-10-05 00:41:43 +08:00
endif ()
2022-09-18 15:53:51 +02:00
# Used for dlopen finding dylibs installed by homebrew
# `/opt/homebrew/lib` is not on in dlopen search path by default
2022-09-10 10:53:08 +08:00
if ( APPLE AND DEFINED ENV{HOMEBREW_PREFIX} )
2022-09-17 16:02:56 +08:00
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib" )
2022-09-10 10:53:08 +08:00
endif ()
2022-09-17 16:02:56 +08:00
2022-10-02 17:52:09 +08:00
set ( FASTFETCH_FLAGS_DEBUG "-fno-omit-frame-pointer" )
2023-09-26 09:14:15 +08:00
if ( NOT WIN32 AND NOT APPLE )
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 ()
2022-09-18 15:53:51 +02:00
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}" )
2023-02-25 13:30:31 +08:00
set ( CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}" )
if ( NOT WIN32 )
set ( CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic" )
endif ()
2022-10-11 13:15:43 +08:00
if ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
2023-09-20 23:55:36 +08:00
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 } "
OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH " -[0-9]+ " PROJECT_VERSION_TWEAK " ${ PROJECT_VERSION_TWEAK } ")
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 #
#############
function(fastfetch_load_text FILENAME OUTVAR)
file(READ " ${ FILENAME } " TEMP)
2022-10-10 10:16:43 +02:00
string(REGEX REPLACE " \n$" "" TEMP "${TEMP}" ) # Remove trailing newline
string ( REPLACE "\n" "\\n" TEMP "${TEMP}" ) # Replace newlines with \n
string ( REPLACE "\"" " \\\"" TEMP "${TEMP}" ) # Replace quotes with \"
string ( REPLACE "$\\" "" TEMP "${TEMP}" ) # Remove $\, so we can unescape some things
2022-06-08 16:25:14 +02:00
set ( "${OUTVAR}" "${TEMP}" PARENT_SCOPE )
endfunction ( fastfetch_load_text )
2021-10-23 14:59:11 +02:00
fastfetch_load_text ( src/data/structure.txt DATATEXT_STRUCTURE )
2022-07-21 14:37:13 +02:00
fastfetch_load_text ( src/data/config_system.txt DATATEXT_CONFIG_SYSTEM )
fastfetch_load_text ( src/data/config_user.txt DATATEXT_CONFIG_USER )
2023-08-07 14:15:11 +08:00
fastfetch_load_text ( src/data/config_user.jsonc DATATEXT_CONFIG_USER_JSONC )
2021-10-22 21:53:29 +02:00
fastfetch_load_text ( src/data/help.txt DATATEXT_HELP )
fastfetch_load_text ( src/data/help_color.txt DATATEXT_HELP_COLOR )
fastfetch_load_text ( src/data/help_format.txt DATATEXT_HELP_FORMAT )
fastfetch_load_text ( src/data/help_config.txt DATATEXT_HELP_CONFIG )
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 )
2022-06-08 16:25:14 +02:00
2023-07-28 14:12:48 +08:00
####################
# Ascii image data #
####################
function ( fastfetch_load_raw_text FILENAME OUTVAR )
file ( READ "${FILENAME}" TEMP )
string ( REGEX REPLACE "\n$" "" TEMP "${TEMP}" ) # Remove trailing newline
string ( JSON TEMP SET "{}" "${TEMP}" "0" ) # Encode raw strings using JSON_SET
string ( REGEX REPLACE "^\\{[ \t\r\n]*" "" TEMP "${TEMP}" ) # Remove JSON braces
string ( REGEX REPLACE "[ \t\r\n]*:[ \t\r\n]*0[ \t\r\n]*\\}$" "" TEMP "${TEMP}" ) # Remove trailing ` : 0 }`
if ( NOT "${TEMP}" MATCHES "^\" [^\n]*\ "" )
message ( FATAL_ERROR "Internal error: unexpected output: '${TEMP}'" )
endif ()
set ( ${ OUTVAR } "${TEMP}" PARENT_SCOPE )
endfunction ( fastfetch_load_raw_text )
file ( GLOB LOGO_FILES "src/logo/ascii/*.txt" )
2023-07-29 20:47:02 +08:00
set ( LOGO_BUILTIN_H "#pragma once\n\n" )
2023-07-28 14:12:48 +08:00
foreach ( file ${ LOGO_FILES } )
fastfetch_load_raw_text ( "${file}" content )
get_filename_component ( file "${file}" NAME_WLE )
string ( TOUPPER "${file}" file )
2023-07-29 20:47:02 +08:00
string ( REGEX REPLACE "\\$\\{c([0-9]+)\\}" "$\\1" content "${content}" )
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
2022-11-20 18:14:32 +01:00
src/common/bar.c
2023-08-17 16:00:24 +08:00
src/common/commandoption.c
2022-04-08 15:50:49 +02:00
src/common/font.c
2022-02-09 15:20:07 +01:00
src/common/format.c
2022-11-20 18:14:32 +01:00
src/common/init.c
2023-03-15 15:24:40 +08:00
src/common/jsonconfig.c
2022-11-20 18:14:32 +01:00
src/common/library.c
2023-08-20 20:51:55 +08:00
src/common/modules.c
2023-09-26 21:49:01 +08:00
src/common/netif/netif.c
2023-03-07 14:56:13 +08:00
src/common/option.c
2022-02-09 15:20:07 +01:00
src/common/parsing.c
2022-11-20 18:14:32 +01:00
src/common/printing.c
src/common/properties.c
2022-02-09 15:20:07 +01:00
src/common/settings.c
2023-06-22 17:32:01 +08:00
src/detection/chassis/chassis.c
2022-09-04 22:20:12 +02:00
src/detection/cpu/cpu.c
2023-03-17 17:56:31 +08:00
src/detection/cpuusage/cpuusage.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
src/detection/font/font.c
2022-09-05 17:42:42 +02:00
src/detection/gpu/gpu.c
2022-12-16 11:21:14 +08:00
src/detection/locale/locale.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
2022-11-20 18:14:32 +01:00
src/detection/os/os.c
src/detection/packages/packages.c
2023-09-13 16:20:50 +08:00
src/detection/publicip/publicip.c
2022-09-18 15:53:51 +02:00
src/detection/terminalfont/terminalfont.c
2022-10-14 16:28:03 +08:00
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
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-10 17:49:03 +08:00
src/logo/option.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
2023-03-13 18:54:57 +08:00
src/modules/board/board.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
2023-06-09 10:08:04 +08:00
src/modules/chassis/chassis.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
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
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
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
2023-06-20 23:01:18 +08:00
src/modules/lm/lm.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
2023-05-11 21:07:04 +08:00
src/modules/memory/memory.c
2023-08-09 16:31:24 +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-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
2023-06-02 16:07:01 +08:00
src/modules/terminal/terminal.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
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
2023-08-08 20:23:26 +08:00
src/util/edidHelper.c
2022-11-20 18:14:32 +01:00
src/util/FFlist.c
src/util/FFstrbuf.c
2023-01-15 15:57:26 +01:00
src/util/platform/FFPlatform.c
2023-02-01 15:56:25 +01:00
src/util/stringUtils.c
2023-06-22 10:45:43 +00:00
src/util/smbiosHelper.c
2022-02-09 15:20:07 +01:00
)
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
2023-01-24 10:39:33 +01:00
src/common/dbus.c
2023-01-28 12:40:12 +01:00
src/common/io/io_unix.c
2023-09-26 16:26:15 +08:00
src/common/netif/netif_linux.c
2022-11-02 01:03:01 +08:00
src/common/networking_linux.c
2022-11-20 18:14:32 +01:00
src/common/processing_linux.c
src/detection/battery/battery_linux.c
src/detection/bios/bios_linux.c
src/detection/board/board_linux.c
2023-01-09 19:09:22 +08:00
src/detection/brightness/brightness_linux.c
2022-12-24 22:48:10 +08:00
src/detection/chassis/chassis_linux.c
2022-11-20 18:14:32 +01:00
src/detection/cpu/cpu_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
2022-11-20 18:14:32 +01:00
src/detection/disk/disk_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
src/detection/displayserver/linux/wayland.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_linux.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
2023-10-05 19:06:15 +08:00
src/detection/libc/libc_linux.c
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_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
2023-08-09 16:31:24 +08:00
src/detection/monitor/monitor_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/poweradapter/poweradapter_nosupport.c
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/temps/temps_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
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
2022-11-20 18:14:32 +01:00
src/detection/wmtheme/wmtheme_linux.c
2023-01-15 15:57:26 +01:00
src/util/platform/FFPlatform_unix.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
2023-01-28 12:40:12 +01:00
src/common/io/io_unix.c
2023-09-26 16:26:15 +08:00
src/common/netif/netif_linux.c
2022-11-20 18:14:32 +01:00
src/common/networking_linux.c
src/common/processing_linux.c
2023-01-21 14:45:36 +08:00
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
2023-07-27 19:47:26 +08:00
src/detection/board/board_android.c
2023-01-09 18:59:02 +08:00
src/detection/brightness/brightness_nosupport.c
2022-12-24 22:48:10 +08:00
src/detection/chassis/chassis_nosupport.c
2022-09-19 22:23:31 +02:00
src/detection/cpu/cpu_linux.c
2022-11-23 12:10:45 +08:00
src/detection/cursor/cursor_nosupport.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
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
2022-11-20 18:14:32 +01:00
src/detection/font/font_nosupport.c
src/detection/gpu/gpu_nosupport.c
src/detection/host/host_android.c
2023-06-06 11:26:29 +08:00
src/detection/icons/icons_nosupport.c
2023-10-05 19:06:15 +08:00
src/detection/libc/libc_android.c
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_nosupport.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
2022-11-20 18:14:32 +01:00
src/detection/media/media_nosupport.c
2022-09-19 22:23:31 +02:00
src/detection/memory/memory_linux.c
2023-08-09 16:31:24 +08:00
src/detection/monitor/monitor_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
src/detection/poweradapter/poweradapter_nosupport.c
2022-10-26 17:20:39 +08:00
src/detection/processes/processes_linux.c
2023-01-25 14:28:13 +08:00
src/detection/sound/sound_nosupport.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/temps/temps_linux.c
src/detection/terminalfont/terminalfont_android.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_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
2023-06-06 15:48:24 +08:00
src/detection/wallpaper/wallpaper_nosupport.c
2023-01-21 14:45:36 +08:00
src/detection/wifi/wifi_android.c
2022-11-20 18:14:32 +01:00
src/detection/wmtheme/wmtheme_nosupport.c
2023-01-15 15:57:26 +01:00
src/util/platform/FFPlatform_unix.c
2022-09-19 22:23:31 +02:00
)
2022-11-20 18:14:32 +01:00
elseif ( BSD )
2022-09-19 22:23:31 +02:00
list ( APPEND LIBFASTFETCH_SRC
2023-01-24 10:46:00 +01:00
src/common/dbus.c
2023-01-28 12:40:12 +01:00
src/common/io/io_unix.c
2023-09-26 16:26:15 +08:00
src/common/netif/netif_bsd.c
2022-11-20 18:14:32 +01:00
src/common/networking_linux.c
src/common/processing_linux.c
src/common/sysctl.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
2023-01-24 10:46:00 +01:00
src/detection/bluetooth/bluetooth_linux.c
2023-06-15 10:12:05 +08:00
src/detection/board/board_bsd.c
2023-06-24 06:26:55 +00:00
src/detection/brightness/brightness_bsd.c
2023-06-15 10:15:31 +08:00
src/detection/chassis/chassis_bsd.c
2022-11-20 18:14:32 +01:00
src/detection/cpu/cpu_bsd.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
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
src/detection/displayserver/linux/wayland.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_linux.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
2023-10-05 19:06:15 +08:00
src/detection/libc/libc_nosupport.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
2023-08-09 16:31:24 +08:00
src/detection/monitor/monitor_nosupport.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
2022-10-13 21:43:31 +02:00
src/detection/packages/packages_linux.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
2023-01-26 15:48:28 +01:00
src/detection/sound/sound_linux.c
2022-11-20 18:14:32 +01:00
src/detection/swap/swap_bsd.c
2023-06-22 04:06:08 +00:00
src/detection/temps/temps_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
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
2023-06-15 15:55:02 +00:00
src/detection/wifi/wifi_bsd.c
2022-11-24 18:54:52 +08:00
src/detection/wmtheme/wmtheme_linux.c
2023-01-15 15:57:26 +01:00
src/util/platform/FFPlatform_unix.c
2022-09-23 00:10:48 +02:00
)
2022-11-20 18:14:32 +01:00
elseif ( APPLE )
2022-10-27 10:46:33 +08:00
list ( APPEND LIBFASTFETCH_SRC
2023-01-28 12:40:12 +01:00
src/common/io/io_unix.c
2023-09-26 16:26:15 +08:00
src/common/netif/netif_bsd.c
2022-11-20 18:14:32 +01:00
src/common/networking_linux.c
src/common/processing_linux.c
src/common/sysctl.c
src/detection/battery/battery_apple.c
2022-12-29 01:24:34 +08:00
src/detection/bios/bios_apple.c
2023-01-24 22:13:53 +08:00
src/detection/bluetooth/bluetooth_apple.m
2022-11-20 18:14:32 +01:00
src/detection/board/board_nosupport.c
2023-01-09 18:59:02 +08:00
src/detection/brightness/brightness_apple.c
2022-12-24 22:48:10 +08:00
src/detection/chassis/chassis_nosupport.c
2022-11-20 18:14:32 +01:00
src/detection/cpu/cpu_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
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/host/host_apple.c
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_nosupport.c
2023-06-06 11:26:29 +08:00
src/detection/icons/icons_nosupport.c
2023-10-05 19:06:15 +08:00
src/detection/libc/libc_nosupport.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
2023-08-11 16:45:16 +08:00
src/detection/monitor/monitor_apple.m
2023-09-27 00:05:37 +08:00
src/detection/netio/netio_bsd.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/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/temps/temps_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
2023-06-08 14:32:15 +08:00
src/detection/theme/theme_nosupport.c
2022-11-20 18:14:32 +01:00
src/detection/uptime/uptime_bsd.c
src/detection/users/users_linux.c
2023-06-06 18:34:54 +08:00
src/detection/wallpaper/wallpaper_apple.c
2022-11-28 16:34:56 +08:00
src/detection/wifi/wifi_apple.m
2022-11-20 18:14:32 +01:00
src/detection/wmtheme/wmtheme_apple.m
src/util/apple/cf_helpers.c
src/util/apple/osascript.m
2023-01-15 15:57:26 +01:00
src/util/platform/FFPlatform_unix.c
2022-10-27 10:46:33 +08:00
)
2022-11-20 18:14:32 +01:00
elseif ( WIN32 )
2022-10-05 00:41:43 +08:00
list ( APPEND LIBFASTFETCH_SRC
2023-01-28 12:40:12 +01:00
src/common/io/io_windows.c
2023-09-26 16:26:15 +08:00
src/common/netif/netif_windows.c
2022-11-02 01:03:01 +08:00
src/common/networking_windows.c
2022-11-20 18:14:32 +01:00
src/common/processing_windows.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
2022-11-21 17:34:54 +08:00
src/detection/board/board_windows.c
2023-01-09 19:24:19 +08:00
src/detection/brightness/brightness_windows.cpp
2023-06-23 11:41:22 +08:00
src/detection/chassis/chassis_windows.cpp
2022-11-21 22:26:50 +08:00
src/detection/cpu/cpu_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-10-07 16:21:26 +08:00
src/detection/diskio/diskio_windows.c
2023-01-09 19:53:41 +08:00
src/detection/displayserver/displayserver_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
2022-11-21 17:45:47 +08:00
src/detection/host/host_windows.c
2023-06-06 14:47:51 +08:00
src/detection/icons/icons_windows.c
2023-10-05 19:06:15 +08:00
src/detection/libc/libc_windows.cpp
2023-06-20 23:01:18 +08:00
src/detection/lm/lm_nosupport.c
2022-11-20 18:14:32 +01:00
src/detection/localip/localip_windows.c
2023-03-24 23:38:29 +08:00
src/detection/gamepad/gamepad_windows.c
2022-11-20 18:14:32 +01:00
src/detection/media/media_nosupport.c
2022-11-21 12:18:36 +08:00
src/detection/memory/memory_windows.c
2023-08-09 16:31:24 +08:00
src/detection/monitor/monitor_windows.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
2022-10-06 20:01:42 +08:00
src/detection/os/os_windows.cpp
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
2022-10-12 20:40:38 +08:00
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
2023-02-23 21:31:33 +08:00
src/detection/temps/temps_windows.cpp
2023-06-08 14:32:15 +08:00
src/detection/theme/theme_nosupport.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
2022-11-20 18:14:32 +01:00
src/detection/wmtheme/wmtheme_windows.c
2022-10-13 18:12:54 +08:00
src/util/windows/getline.c
2023-01-25 15:49:31 +08:00
src/util/windows/com.cpp
2022-11-26 12:55:48 +08:00
src/util/windows/registry.c
2022-11-22 01:33:22 +08:00
src/util/windows/unicode.c
2022-11-20 18:14:32 +01:00
src/util/windows/wmi.cpp
2023-01-15 15:57:26 +01:00
src/util/platform/FFPlatform_windows.c
2022-09-04 12:43:30 +02:00
)
endif ()
2023-09-20 23:55:36 +08:00
if ( ENABLE_DIRECTX_HEADERS )
message ( STATUS "Enabling DirectX headers for WSL" )
list ( APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_wsl.cpp )
endif ()
2023-07-31 14:10:53 +08:00
include ( CheckFunctionExists )
check_function_exists ( wcwidth HAVE_WCWIDTH )
if ( NOT HAVE_WCWIDTH )
2023-08-14 20:19:23 +08:00
list ( APPEND LIBFASTFETCH_SRC src/3rdparty/mk_wcwidch/wcwidth.c )
2023-07-31 14:10:53 +08:00
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 }
)
2023-09-20 23:55:36 +08:00
2023-08-19 11:10:14 +08:00
if ( yyjson_FOUND )
target_compile_definitions ( libfastfetch PRIVATE FF_USE_SYSTEM_YYJSON )
target_link_libraries ( libfastfetch PRIVATE yyjson )
endif ()
2022-09-04 12:43:30 +02:00
2023-10-08 21:03:10 +08:00
if ( LINUX AND EXISTS "/lib/ld-musl-x86_64.so.1" )
execute_process ( COMMAND "/lib/ld-musl-x86_64.so.1"
ERROR_VARIABLE LD_MUSL_VERSION )
string ( REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LD_MUSL_VERSION "${LD_MUSL_VERSION}" )
if ( NOT LD_MUSL_VERSION STREQUAL "" )
target_compile_definitions ( libfastfetch PUBLIC FF_MUSL_VERSION= "${LD_MUSL_VERSION}" )
endif ()
endif ()
2023-09-12 15:53:58 +08:00
target_compile_definitions ( libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__=1 )
2023-03-24 23:21:39 +08:00
if ( WIN32 )
target_compile_definitions ( libfastfetch PUBLIC WIN32_LEAN_AND_MEAN=1 )
2023-09-19 14:43:55 +08:00
elseif ( APPLE )
target_compile_definitions ( libfastfetch PUBLIC _DARWIN_C_SOURCE )
2023-03-24 23:21:39 +08:00
endif ()
2022-09-29 14:22:56 +08:00
2023-07-31 14:10:53 +08:00
if ( HAVE_WCWIDTH )
target_compile_definitions ( libfastfetch PRIVATE FF_HAVE_WCWIDTH )
endif ()
2022-11-24 18:10:49 +01:00
function ( ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME )
2022-09-05 19:56:00 +02:00
if ( NOT ENABLE_ ${ VARNAME } )
return ()
2022-04-13 23:13:25 +02:00
endif ()
2022-04-11 16:19:02 +02:00
2022-11-24 18:10:49 +01:00
if ( PKG_CONFIG_FOUND )
pkg_search_module ( ${ VARNAME } QUIET ${ PKGCONFIG_NAMES } )
endif ()
if ( NOT ${ VARNAME } _FOUND )
find_package ( ${ CMAKE_NAME } QUIET )
set ( ${ VARNAME } _FOUND ${ ${CMAKE_NAME } _FOUND} )
set ( ${ VARNAME } _INCLUDE_DIRS ${ ${CMAKE_NAME } _INCLUDE_DIRS} )
set ( ${ VARNAME } _LIBRARIES ${ ${CMAKE_NAME } _LIBRARIES} )
set ( ${ VARNAME } _CFLAGS_OTHER ${ ${CMAKE_NAME } _CFLAGS_OTHER} )
endif ()
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 ()
2022-11-24 18:10:49 +01:00
message ( STATUS "Library: found ${VARNAME}" )
2022-09-19 18:30:00 +02:00
target_compile_definitions ( libfastfetch PRIVATE FF_HAVE_ ${ VARNAME } =1 )
target_include_directories ( libfastfetch PRIVATE ${ ${VARNAME } _INCLUDE_DIRS} )
foreach ( FLAG ${ ${VARNAME } _CFLAGS_OTHER} )
if ( FLAG MATCHES "-D.*" )
string ( SUBSTRING ${ FLAG } 2 -1 FLAG )
target_compile_definitions ( libfastfetch PRIVATE ${ 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 ( LIBPCI
"libpci"
"Pci"
)
ff_lib_enable ( VULKAN
"vulkan"
"Vulkan"
)
ff_lib_enable ( WAYLAND
"wayland-client"
"WaylandClient"
)
ff_lib_enable ( XCB_RANDR
"xcb-randr"
"XcbRandr"
)
ff_lib_enable ( XCB
"xcb"
"Xcb"
)
ff_lib_enable ( XRANDR
"xrandr"
"XRandr"
)
ff_lib_enable ( X11
"x11"
"X11"
)
ff_lib_enable ( GIO
"gio-2.0"
"GIO"
)
ff_lib_enable ( DCONF
"dconf"
"DConf"
)
ff_lib_enable ( DBUS
"dbus-1"
"DBus"
)
ff_lib_enable ( XFCONF
"libxfconf-0"
"XFConf"
)
ff_lib_enable ( SQLITE3
"sqlite3"
"SQLite3"
)
ff_lib_enable ( RPM
"rpm"
"RPM"
)
ff_lib_enable ( IMAGEMAGICK7
"MagickCore-7.Q16HDRI;MagickCore-7.Q16;MagickCore-7;/usr/lib/imagemagick7/pkgconfig/MagickCore-7.Q16HDRI.pc;/usr/lib/imagemagick7/pkgconfig/MagickCore-7.Q16.pc;/usr/lib/imagemagick7/pkgconfig/MagickCore-7.pc"
"ImageMagick7"
)
ff_lib_enable ( IMAGEMAGICK6
"MagickCore-6.Q16HDRI;MagickCore-6.Q16;MagickCore-6;/usr/lib/imagemagick6/pkgconfig/MagickCore-6.Q16HDRI.pc;/usr/lib/imagemagick6/pkgconfig/MagickCore-6.Q16.pc;/usr/lib/imagemagick6/pkgconfig/MagickCore-6.pc"
"ImageMagick6"
)
ff_lib_enable ( ZLIB
"zlib"
"ZLIB"
)
ff_lib_enable ( CHAFA
"chafa>=1.10"
"Chafa"
)
ff_lib_enable ( EGL
"egl"
"EGL"
)
ff_lib_enable ( GLX
"glx"
"GLX"
)
ff_lib_enable ( OSMESA
"osmesa"
"OSMesa"
)
ff_lib_enable ( OPENCL
"OpenCL"
"OpenCL"
)
2023-01-17 12:45:26 +08:00
ff_lib_enable ( LIBNM
"libnm"
"libnm"
)
2022-11-24 18:10:49 +01:00
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
)
2023-07-09 17:22:04 +08:00
ff_lib_enable ( DDCUTIL
"ddcutil"
"Ddcutil"
)
2023-09-20 23:55:36 +08:00
ff_lib_enable ( DIRECTX_HEADERS
"DirectX-Headers"
"DirectX-Headers"
)
2022-06-05 00:18:40 +02:00
2022-10-12 14:13:20 +08:00
if ( ENABLE_THREADS )
target_compile_definitions ( libfastfetch PRIVATE FF_HAVE_THREADS )
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 ()
2022-10-12 14:13:20 +08:00
endif ()
2023-07-13 09:53:31 +08:00
if ( ENABLE_PCI_MEMORY )
target_compile_definitions ( libfastfetch PRIVATE FF_USE_PCI_MEMORY )
endif ()
2023-08-09 16:07:01 +08:00
if ( LINUX )
target_link_libraries ( libfastfetch
PRIVATE "m"
)
elseif ( APPLE )
2022-09-14 09:51:08 -07:00
target_link_libraries ( libfastfetch
2022-09-17 15:39:07 +08:00
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"
2023-01-24 11:21:08 +08:00
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 OpenGL"
PRIVATE "-framework OpenCL"
2023-04-18 14:57:25 +08:00
PRIVATE "-framework SystemConfiguration"
2023-03-01 15:40:18 +08:00
PRIVATE "-weak_framework CoreDisplay"
2023-01-07 19:46:56 +08:00
PRIVATE "-weak_framework DisplayServices -F /System/Library/PrivateFrameworks"
2023-03-01 15:40:18 +08:00
PRIVATE "-weak_framework MediaRemote -F /System/Library/PrivateFrameworks"
2022-09-14 09:51:08 -07:00
)
2022-10-14 16:39:48 +08:00
elseif ( WIN32 )
2022-12-31 17:35:25 +08:00
target_compile_definitions ( libfastfetch PRIVATE -D_WIN32_WINNT=0x0601 )
2022-10-05 00:41:43 +08:00
target_link_libraries ( libfastfetch
2023-01-24 21:01:21 +08:00
PRIVATE "bthprops"
2022-10-09 23:23:46 +08:00
PRIVATE "dwmapi"
PRIVATE "gdi32"
PRIVATE "iphlpapi"
2022-10-14 16:39:48 +08:00
PRIVATE "ole32"
PRIVATE "oleaut32"
PRIVATE "opengl32"
2022-10-12 19:35:23 +08:00
PRIVATE "ws2_32"
2022-10-15 19:51:33 +08:00
PRIVATE "ntdll"
2022-10-15 22:35:04 +08:00
PRIVATE "version"
2022-11-22 01:33:22 +08:00
PRIVATE "setupapi"
2023-03-24 23:38:29 +08:00
PRIVATE "hid"
2022-11-23 19:11:10 +08:00
PRIVATE "wtsapi32"
2023-07-08 10:28:39 +08:00
PRIVATE "dxva2"
2022-10-05 00:41:43 +08:00
)
2023-06-15 14:22:47 +00:00
elseif ( BSD )
target_link_libraries ( libfastfetch
2023-08-22 16:14:24 +08:00
PRIVATE "m"
2023-06-15 14:22:47 +00:00
PRIVATE "usbhid"
)
2023-08-14 10:33:11 +08:00
elseif ( ANDROID )
2023-08-14 10:51:54 +08:00
CHECK_LIBRARY_EXISTS ( -l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC )
if ( HAVE_LIBANDROID_WORDEXP_STATIC )
2023-08-14 10:33:11 +08:00
target_link_libraries ( libfastfetch
2023-08-14 10:51:54 +08:00
PRIVATE -l:libandroid-wordexp.a
2023-08-14 10:33:11 +08:00
)
2023-08-14 10:51:54 +08:00
else ()
CHECK_LIBRARY_EXISTS ( android-wordexp wordexp "" HAVE_LIBANDROID_WORDEXP )
if ( HAVE_LIBANDROID_WORDEXP )
target_link_libraries ( libfastfetch
PRIVATE android-wordexp
)
endif ()
2023-08-14 10:33:11 +08:00
endif ()
2022-09-14 09:51:08 -07:00
endif ()
2022-09-14 14:55:28 +02:00
2022-02-09 15:20:07 +01:00
target_include_directories ( libfastfetch
PUBLIC ${ PROJECT_BINARY_DIR }
PUBLIC ${ PROJECT_SOURCE_DIR } /src
2021-04-09 14:07:05 +02:00
)
2022-02-09 15:20:07 +01:00
target_link_libraries ( libfastfetch
PRIVATE ${ CMAKE_DL_LIBS }
2021-02-18 22:25:36 +01:00
)
2022-06-08 16:25:14 +02:00
######################
# Executable targets #
######################
2022-02-09 15:20:07 +01:00
2021-02-27 18:30:05 +01:00
add_executable ( fastfetch
src/fastfetch.c
2022-02-09 15:20:07 +01:00
)
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
)
2022-02-09 15:20:07 +01:00
target_link_libraries ( fastfetch
PRIVATE libfastfetch
2021-02-27 18:30:05 +01:00
)
add_executable ( flashfetch
src/flashfetch.c
)
2022-12-08 18:33:43 +08:00
target_compile_definitions ( flashfetch
2022-12-10 13:10:06 +08:00
PRIVATE FASTFETCH_TARGET_BINARY_NAME=flashfetch
2022-12-08 18:33:43 +08:00
)
2022-02-09 15:20:07 +01:00
target_link_libraries ( flashfetch
PRIVATE libfastfetch
2021-02-27 18:30:05 +01:00
)
2023-09-20 23:55:36 +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 )
set_target_properties ( flashfetch PROPERTIES LINKER_LANGUAGE C )
2022-11-06 01:33:06 +08:00
if ( WIN32 )
set ( TARGET_NAME fastfetch )
target_sources ( fastfetch
2022-12-08 18:33:43 +08:00
PRIVATE src/util/windows/version.rc
2022-11-06 01:33:06 +08:00
)
set ( TARGET_NAME flashfetch )
target_sources ( flashfetch
2022-12-08 18:33:43 +08:00
PRIVATE src/util/windows/version.rc
2022-11-06 01:33:06 +08:00
)
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
)
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 )
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 (
2022-07-21 14:37:13 +02:00
TARGETS fastfetch flashfetch
2022-07-27 21:56:28 +02:00
DESTINATION "${CMAKE_INSTALL_BINDIR}"
2022-03-08 11:59:06 +01:00
)
2022-02-21 11:40:33 +05:00
2022-03-08 11:59:06 +01:00
install (
2022-07-27 21:56:28 +02:00
FILES "${CMAKE_SOURCE_DIR}/completions/bash"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions"
RENAME "${CMAKE_PROJECT_NAME}"
2022-02-21 11:40:33 +05:00
)
2022-03-08 11:59:06 +01:00
install (
2022-08-12 21:39:27 +03:00
DIRECTORY "${CMAKE_SOURCE_DIR}/presets"
2022-07-27 21:56:28 +02:00
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_PROJECT_NAME}"
2022-03-08 11:59:06 +01:00
)
install (
2022-07-27 21:56:28 +02:00
FILES "${CMAKE_SOURCE_DIR}/LICENSE"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}"
2022-02-21 11:40:33 +05:00
)
2022-03-25 11:57:58 +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 ( LINUX )
set ( CPACK_GENERATOR "${CPACK_GENERATOR};DEB;RPM" )
set ( CPACK_DEBIAN_PACKAGE_SECTION, "utils" )
set ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "libc6" )
set ( CPACK_RPM_PACKAGE_LICENSE "MIT" )
endif ()
2022-07-26 22:13:09 +02:00
set ( CPACK_SET_DESTDIR ON )
2022-03-25 11:57:58 +01:00
set ( CPACK_PACKAGE_CONTACT "Linus Dierheimer <Linus@Dierheimer.de>" )
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 in c to achieve much better performance.\
2022-03-25 11:57:58 +01:00
" )
include ( CPack )