From 88e075ad9dbb03bb4b5c8b8b756461441bc469db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 22 Jun 2024 22:03:28 +0800 Subject: [PATCH] CMake: remove option `ENABLE_PROPRIETARY_GPU_DRIVER_API` --- CHANGELOG.md | 7 +++++++ CMakeLists.txt | 21 +++++++-------------- src/common/init.c | 3 --- src/detection/gpu/gpu_bsd.c | 2 -- src/detection/gpu/gpu_linux.c | 7 +------ src/detection/gpu/gpu_windows.c | 9 +-------- src/detection/gpu/gpu_wsl.cpp | 2 -- 7 files changed, 16 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f5a55cee..e87fe6a59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 2.17.0 + +Changes: +* CMake option `ENABLE_PROPRIETARY_GPU_DRIVER_API` is removed. The GPU driver APIs are now enabled by default. + * The option was introduced to reduce the license concerns. Since all non MIT proprietary code has been rewritten manually from scratch, it is no longer necessary. + * See for detail + # 2.16.0 This release added basic support for SunOS (Solaris, illumos). The binaries provided in the release lack a few useful features (such as Display detection). People who use SunOS should consider building fastfetch themselves. diff --git a/CMakeLists.txt b/CMakeLists.txt index fa526f990..ff5632707 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,6 @@ cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF) option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF) -option(ENABLE_PROPRIETARY_GPU_DRIVER_API "Enable proprietary GPU driver API (NVML, IGCL and AGS)" ON) 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 option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions @@ -813,15 +812,13 @@ if(ENABLE_DIRECTX_HEADERS) list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_wsl.cpp) endif() -if(ENABLE_PROPRIETARY_GPU_DRIVER_API AND (LINUX OR BSD OR WIN32)) - message(STATUS "Enabling proprietary GPU driver API") - if(LINUX OR BSD OR WIN32) - list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_nvidia.c) - endif() - if(WIN32) - list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_intel.c) - list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_amd.c) - endif() +# Proprietary GPU driver APIs +if(LINUX OR BSD OR WIN32) + list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_nvidia.c) +endif() +if(WIN32) + list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_intel.c) + list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_amd.c) endif() include(CheckFunctionExists) @@ -850,10 +847,6 @@ add_library(libfastfetch OBJECT ${LIBFASTFETCH_SRC} ) -if(ENABLE_PROPRIETARY_GPU_DRIVER_API AND (LINUX OR BSD OR WIN32)) - target_compile_definitions(libfastfetch PRIVATE FF_USE_PROPRIETARY_GPU_DRIVER_API) -endif() - if(yyjson_FOUND) target_compile_definitions(libfastfetch PRIVATE FF_USE_SYSTEM_YYJSON) target_link_libraries(libfastfetch PRIVATE yyjson::yyjson) diff --git a/src/common/init.c b/src/common/init.c index 1898de1c7..13d6f4468 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -254,9 +254,6 @@ void ffListFeatures(void) #ifdef FF_HAVE_DIRECTX_HEADERS "Directx Headers\n" #endif - #ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API - "Proprietary GPU driver API\n" - #endif #ifdef FF_USE_SYSTEM_YYJSON "System yyjson\n" #endif diff --git a/src/detection/gpu/gpu_bsd.c b/src/detection/gpu/gpu_bsd.c index 8beef72a9..7bc22b485 100644 --- a/src/detection/gpu/gpu_bsd.c +++ b/src/detection/gpu/gpu_bsd.c @@ -76,7 +76,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu); } - #ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific)) { ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) { @@ -98,7 +97,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET) gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED; } - #endif // FF_USE_PROPRIETARY_GPU_DRIVER_API } return NULL; diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index a924a114f..28b33f38c 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -2,14 +2,11 @@ #include "detection/vulkan/vulkan.h" #include "detection/temps/temps_linux.h" #include "detection/cpu/cpu.h" +#include "detection/gpu/gpu_driver_specific.h" #include "common/io/io.h" #include "common/properties.h" #include "util/stringUtils.h" -#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API - #include "detection/gpu/gpu_driver_specific.h" -#endif - #define FF_STR_INDIR(x) #x #define FF_STR(x) FF_STR_INDIR(x) @@ -261,7 +258,6 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf } else if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA) { - #ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API if (options->temp || options->driverSpecific) { ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) { @@ -280,7 +276,6 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf .frequency = &gpu->frequency, }, "libnvidia-ml.so"); } - #endif // FF_USE_PROPRIETARY_GPU_DRIVER_API if (gpu->type == FF_GPU_TYPE_UNKNOWN) { diff --git a/src/detection/gpu/gpu_windows.c b/src/detection/gpu/gpu_windows.c index dc809727f..b2e4b8d83 100644 --- a/src/detection/gpu/gpu_windows.c +++ b/src/detection/gpu/gpu_windows.c @@ -1,11 +1,8 @@ #include "gpu.h" +#include "detection/gpu/gpu_driver_specific.h" #include "util/windows/unicode.h" #include "util/windows/registry.h" -#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API - #include "detection/gpu/gpu_driver_specific.h" -#endif - #include static int isGpuNameEqual(const FFGPUResult* gpu, const FFstrbuf* name) @@ -13,7 +10,6 @@ static int isGpuNameEqual(const FFGPUResult* gpu, const FFstrbuf* name) return ffStrbufEqual(&gpu->name, name); } -#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName) { if (vendor == FF_GPU_VENDOR_NAME_NVIDIA) @@ -48,7 +44,6 @@ static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(& return true; } -#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* gpus) { @@ -144,7 +139,6 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* } } -#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API __typeof__(&ffDetectNvidiaGpuInfo) detectFn; const char* dllName; @@ -174,7 +168,6 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* ); } } -#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API } return NULL; diff --git a/src/detection/gpu/gpu_wsl.cpp b/src/detection/gpu/gpu_wsl.cpp index eb7ed5b17..e4ef8e4ff 100644 --- a/src/detection/gpu/gpu_wsl.cpp +++ b/src/detection/gpu/gpu_wsl.cpp @@ -104,7 +104,6 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF const char* vendorStr = ffGetGPUVendorString((unsigned) hardwareId.vendorID); ffStrbufSetStatic(&gpu->vendor, vendorStr); - #ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA && (options->driverSpecific || options->temp)) { FFGpuDriverCondition cond = { @@ -124,7 +123,6 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF .frequency = &gpu->frequency, }, "/usr/lib/wsl/lib/libnvidia-ml.so"); } - #endif } }