Address some feedbacks

This commit is contained in:
李通洲
2022-10-09 23:23:46 +08:00
parent 643aa7c156
commit f2540f00a5
12 changed files with 45 additions and 63 deletions
+37 -34
View File
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs
project(fastfetch
VERSION 1.7.2
LANGUAGES C CXX # Windows part requires C++ compiler
LANGUAGES C
DESCRIPTION "Fast system information tool"
HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch"
)
@@ -13,14 +13,16 @@ project(fastfetch
if("${CMAKE_SYSTEM_NAME}" MATCHES ".*[Ll]inux.*")
set(LINUX TRUE CACHE BOOL "..." FORCE) # LINUX means GNU/Linux, not just the kernel
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "MSYS|Windows")
set(WIN_MSYS TRUE CACHE BOOL "..." FORCE) # Windows on msys2
elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*[Bb][Ss][Dd].*")
set(BSD TRUE CACHE BOOL "..." FORCE)
elseif(NOT APPLE AND NOT ANDROID)
elseif(NOT APPLE AND NOT ANDROID AND NOT MSYS)
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
if(MSYS)
enable_language(CXX)
endif()
#####################
# Configure options #
#####################
@@ -28,7 +30,7 @@ endif()
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIBPCI "Enable libpci" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR WIN_MSYS" OFF)
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR BSD OR MSYS" OFF)
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)
@@ -47,8 +49,8 @@ cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENAB
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)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN_MSYS" OFF)
cmake_dependent_option(ENABLE_LIBCJSON "Enable libcjson" ON "LINUX OR WIN_MSYS" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR MSYS" OFF)
cmake_dependent_option(ENABLE_LIBCJSON "Enable libcjson" ON "LINUX OR MSYS" OFF)
cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
@@ -78,7 +80,7 @@ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion")
if(WIN_MSYS)
if(MSYS)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wconversion -fno-exceptions -fno-rtti")
endif()
@@ -90,7 +92,7 @@ if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX})
endif()
set(FASTFETCH_FLAGS_DEBUG "-fno-omit-frame-pointer")
if(NOT WIN_MSYS)
if(NOT MSYS)
set(FASTFETCH_FLAGS_DEBUG "${FASTFETCH_FLAGS_DEBUG} -fsanitize=address -fsanitize=undefined")
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}")
@@ -298,10 +300,11 @@ if(LINUX OR ANDROID OR BSD)
list(APPEND LIBFASTFETCH_SRC
src/detection/cpuUsage/cpuUsage_linux.c
src/detection/disk/disk_linux.c
src/detection/poweradapter/poweradapter_linux.c
src/detection/temps/temps_linux.c
src/detection/opengl/opengl_linux.c
src/detection/processes/processes_linux.c
src/detection/poweradapter/poweradapter_nosupport.c
)
endif()
@@ -327,7 +330,7 @@ if(LINUX OR BSD)
)
endif()
if(WIN_MSYS)
if(MSYS)
list(APPEND LIBFASTFETCH_SRC
src/common/processing_linux.c
src/detection/host/host_windows.cpp
@@ -349,17 +352,15 @@ if(WIN_MSYS)
src/detection/font/font_windows.cpp
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalshell/terminalshell_windows.cpp
src/detection/terminalfont/terminalfont_linux.c
src/detection/packages/packages_linux.c
src/detection/packages/packages_windows.c
src/detection/kernel/kernel_windows.cpp
src/detection/localip/localip_windows.c
src/util/windows/wmi.cpp
# Shared
src/detection/terminalfont/terminalfont_linux.c
src/detection/poweradapter/poweradapter_linux.c
src/detection/media/media_linux.c
src/detection/temps/temps_linux.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/media/media_nosupport.c
)
endif()
@@ -369,8 +370,6 @@ if(APPLE)
src/util/apple/cf_helpers.c
src/util/apple/osascript.m
src/detection/host/host_apple.c
src/detection/bios/bios_apple.c
src/detection/board/board_apple.c
src/detection/os/os_apple.m
src/detection/cpu/cpu_apple.c
src/detection/gpu/gpu_apple.c
@@ -386,6 +385,9 @@ if(APPLE)
src/detection/font/font_apple.m
src/detection/opengl/opengl_apple.c
src/detection/processes/processes_apple.c
src/detection/bios/bios_nosupport.c
src/detection/board/board_nosupport.c
)
endif()
@@ -399,16 +401,17 @@ endif()
if(ANDROID)
list(APPEND LIBFASTFETCH_SRC
src/detection/host/host_android.c
src/detection/bios/bios_android.c
src/detection/board/board_android.c
src/detection/os/os_android.c
src/detection/gpu/gpu_android.c
src/detection/battery/battery_android.c
src/detection/displayserver/displayserver_android.c
src/detection/terminalfont/terminalfont_android.c
src/detection/media/media_android.c
src/detection/wmtheme/wmtheme_android.c
src/detection/font/font_android.c
src/detection/bios/bios_nosupport.c
src/detection/board/board_nosupport.c
src/detection/displayserver/displayserver_nosupport.c
src/detection/battery/battery_nosupport.c
src/detection/gpu/gpu_nosupport.c
src/detection/font/font_nosupport.c
src/detection/media/media_nosupport.c
src/detection/wmtheme/wmtheme_nosupport.c
)
endif()
@@ -486,15 +489,15 @@ if(APPLE)
PRIVATE "-framework Cocoa"
PRIVATE "-weak_framework MediaRemote -F /System/Library/PrivateFrameworks"
)
elseif(WIN_MSYS)
elseif(MSYS)
target_link_libraries(libfastfetch
PRIVATE "-lwbemuuid"
PRIVATE "-lole32"
PRIVATE "-loleaut32"
PRIVATE "-ldwmapi"
PRIVATE "-lopengl32"
PRIVATE "-lgdi32"
PRIVATE "-liphlpapi"
PRIVATE "wbemuuid"
PRIVATE "ole32"
PRIVATE "oleaut32"
PRIVATE "dwmapi"
PRIVATE "opengl32"
PRIVATE "gdi32"
PRIVATE "iphlpapi"
)
endif()