|
1 | 1 | cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url |
2 | 2 |
|
3 | 3 | project(fastfetch |
4 | | - VERSION 2.22.0 |
| 4 | + VERSION 2.23.0 |
5 | 5 | LANGUAGES C |
6 | 6 | DESCRIPTION "Fast neofetch-like system information tool" |
7 | 7 | HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" |
@@ -71,6 +71,7 @@ cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF) |
71 | 71 | cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF) |
72 | 72 | cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR FreeBSD OR ANDROID" OFF) |
73 | 73 | cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF) |
| 74 | +cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF) |
74 | 75 |
|
75 | 76 | option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF) |
76 | 77 | option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF) |
@@ -392,6 +393,7 @@ set(LIBFASTFETCH_SRC |
392 | 393 | src/modules/wifi/wifi.c |
393 | 394 | src/modules/wm/wm.c |
394 | 395 | src/modules/wmtheme/wmtheme.c |
| 396 | + src/modules/zpool/zpool.c |
395 | 397 | src/options/display.c |
396 | 398 | src/options/modules.c |
397 | 399 | src/options/logo.c |
@@ -481,6 +483,7 @@ if(LINUX) |
481 | 483 | src/detection/de/de_linux.c |
482 | 484 | src/detection/wmtheme/wmtheme_linux.c |
483 | 485 | src/detection/camera/camera_linux.c |
| 486 | + src/detection/zpool/zpool_linux.c |
484 | 487 | src/util/platform/FFPlatform_unix.c |
485 | 488 | src/util/binary_linux.c |
486 | 489 | ) |
@@ -543,6 +546,7 @@ elseif(ANDROID) |
543 | 546 | src/detection/de/de_nosupport.c |
544 | 547 | src/detection/wmtheme/wmtheme_nosupport.c |
545 | 548 | src/detection/camera/camera_android.c |
| 549 | + src/detection/zpool/zpool_nosupport.c |
546 | 550 | src/util/platform/FFPlatform_unix.c |
547 | 551 | src/util/binary_linux.c |
548 | 552 | ) |
@@ -622,6 +626,7 @@ elseif(FreeBSD) |
622 | 626 | src/detection/de/de_linux.c |
623 | 627 | src/detection/wmtheme/wmtheme_linux.c |
624 | 628 | src/detection/camera/camera_linux.c |
| 629 | + src/detection/zpool/zpool_linux.c |
625 | 630 | src/util/platform/FFPlatform_unix.c |
626 | 631 | src/util/binary_linux.c |
627 | 632 | ) |
@@ -686,6 +691,7 @@ elseif(APPLE) |
686 | 691 | src/detection/de/de_nosupport.c |
687 | 692 | src/detection/wmtheme/wmtheme_apple.m |
688 | 693 | src/detection/camera/camera_apple.m |
| 694 | + src/detection/zpool/zpool_nosupport.c |
689 | 695 | src/util/apple/cf_helpers.c |
690 | 696 | src/util/apple/osascript.m |
691 | 697 | src/util/platform/FFPlatform_unix.c |
@@ -750,6 +756,7 @@ elseif(WIN32) |
750 | 756 | src/detection/de/de_nosupport.c |
751 | 757 | src/detection/wmtheme/wmtheme_windows.c |
752 | 758 | src/detection/camera/camera_windows.cpp |
| 759 | + src/detection/zpool/zpool_nosupport.c |
753 | 760 | src/util/windows/getline.c |
754 | 761 | src/util/windows/com.cpp |
755 | 762 | src/util/windows/registry.c |
@@ -832,6 +839,7 @@ elseif(SunOS) |
832 | 839 | src/detection/de/de_linux.c |
833 | 840 | src/detection/wmtheme/wmtheme_linux.c |
834 | 841 | src/detection/camera/camera_nosupport.c |
| 842 | + src/detection/zpool/zpool_linux.c |
835 | 843 | src/util/platform/FFPlatform_unix.c |
836 | 844 | src/util/binary_linux.c |
837 | 845 | ) |
@@ -1091,6 +1099,25 @@ ff_lib_enable(DIRECTX_HEADERS |
1091 | 1099 | "DirectX-Headers" |
1092 | 1100 | "DirectX-Headers" |
1093 | 1101 | ) |
| 1102 | +# The system <libzfs.h> is only usable on SunOS. We provide our local copy of it so it's always available. |
| 1103 | +if(ENABLE_LIBZFS) |
| 1104 | + if(BINARY_LINK_TYPE STREQUAL "dlopen") |
| 1105 | + target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1) |
| 1106 | + else() |
| 1107 | + set(CMAKE_REQUIRED_LIBRARIES_BACKUP ${CMAKE_REQUIRED_LIBRARIES}) |
| 1108 | + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} zfs) |
| 1109 | + check_function_exists("libzfs_init" LIBZFS_FOUND) |
| 1110 | + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACKUP}) |
| 1111 | + if(NOT LIBZFS_FOUND) |
| 1112 | + message(STATUS "Library: missing: LIBZFS") |
| 1113 | + else() |
| 1114 | + message(STATUS "Library: found LIBZFS") |
| 1115 | + target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1) |
| 1116 | + target_link_libraries(libfastfetch PRIVATE zfs) |
| 1117 | + endif() |
| 1118 | + endif() |
| 1119 | +endif() |
| 1120 | + |
1094 | 1121 |
|
1095 | 1122 | if(ENABLE_THREADS) |
1096 | 1123 | target_compile_definitions(libfastfetch PRIVATE FF_HAVE_THREADS) |
@@ -1153,6 +1180,8 @@ elseif(SunOS) |
1153 | 1180 | PRIVATE "socket" |
1154 | 1181 | PRIVATE "kstat" |
1155 | 1182 | PRIVATE "proc" |
| 1183 | + PRIVATE "zfs" |
| 1184 | + PRIVATE "nvpair" |
1156 | 1185 | ) |
1157 | 1186 | elseif(ANDROID) |
1158 | 1187 | CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC) |
@@ -1196,11 +1225,16 @@ if(WIN32) |
1196 | 1225 | endif() |
1197 | 1226 | set(CMAKE_CXX_STANDARD 17) |
1198 | 1227 | endif() |
1199 | | -if(LINUX) |
| 1228 | +if(FreeBSD) |
| 1229 | + set(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include") |
| 1230 | +endif() |
| 1231 | +if(LINUX OR FreeBSD) |
1200 | 1232 | CHECK_INCLUDE_FILE("linux/videodev2.h" HAVE_LINUX_VIDEODEV2) |
1201 | 1233 | if(HAVE_LINUX_VIDEODEV2) |
1202 | 1234 | target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_VIDEODEV2=1) |
1203 | 1235 | endif() |
| 1236 | +endif() |
| 1237 | +if(LINUX) |
1204 | 1238 | CHECK_INCLUDE_FILE("linux/wireless.h" HAVE_LINUX_WIRELESS) |
1205 | 1239 | if(HAVE_LINUX_WIRELESS) |
1206 | 1240 | target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LINUX_WIRELESS=1) |
@@ -1308,9 +1342,17 @@ if (BUILD_TESTS) |
1308 | 1342 | PRIVATE libfastfetch |
1309 | 1343 | ) |
1310 | 1344 |
|
| 1345 | + add_executable(fastfetch-test-format |
| 1346 | + tests/format.c |
| 1347 | + ) |
| 1348 | + target_link_libraries(fastfetch-test-format |
| 1349 | + PRIVATE libfastfetch |
| 1350 | + ) |
| 1351 | + |
1311 | 1352 | enable_testing() |
1312 | 1353 | add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf) |
1313 | 1354 | add_test(NAME test-list COMMAND fastfetch-test-list) |
| 1355 | + add_test(NAME test-format COMMAND fastfetch-test-format) |
1314 | 1356 | endif() |
1315 | 1357 |
|
1316 | 1358 | ################## |
|
0 commit comments