From 9a7c73255516f612fa1b511af07378fab6e416b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 8 Feb 2023 21:07:36 +0800 Subject: [PATCH] OpenCL: fix Windows support They changed the dll file name in the latest release --- .github/workflows/push.yml | 36 ++---------------------------------- src/modules/opencl.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f5e2feeb5..f1bbf2b83 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -188,22 +188,6 @@ jobs: - name: print msys version run: uname -a - # https://github.com/msys2/MINGW-packages/issues/13524#event-7555720785 - - name: create OpenCL.pc - run: | - cat > /clang64/lib/pkgconfig/OpenCL.pc << EOF - prefix=/clang64 - exec_prefix=${prefix} - libdir=${exec_prefix}/lib - includedir=${prefix}/include - - Name: OpenCL - Description: Open Computing Language generic Installable Client Driver Loader - Version: 2022.09.30-1 - Libs: -L${libdir} -lOpenCL.dll - Cflags: -I${includedir} - EOF - - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: @@ -219,7 +203,7 @@ jobs: uses: github/codeql-action/analyze@v2 - name: copy necessary dlls - run: cp /clang64/bin/{libcjson,libOpenCL,vulkan-1}.dll . + run: cp /clang64/bin/{libcjson,OpenCL,vulkan-1}.dll . - name: list features run: ./fastfetch --list-features @@ -265,22 +249,6 @@ jobs: - name: print msys version run: uname -a - # https://github.com/msys2/MINGW-packages/issues/13524#event-7555720785 - - name: create OpenCL.pc - run: | - cat > /clang32/lib/pkgconfig/OpenCL.pc << EOF - prefix=/clang32 - exec_prefix=${prefix} - libdir=${exec_prefix}/lib - includedir=${prefix}/include - - Name: OpenCL - Description: Open Computing Language generic Installable Client Driver Loader - Version: 2022.09.30-1 - Libs: -L${libdir} -lOpenCL.dll - Cflags: -I${includedir} - EOF - - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: @@ -296,7 +264,7 @@ jobs: uses: github/codeql-action/analyze@v2 - name: copy necessary dlls - run: cp /clang32/bin/{libcjson,libOpenCL,vulkan-1}.dll . + run: cp /clang32/bin/{libcjson,OpenCL,vulkan-1}.dll . - name: run fastfetch run: time ./fastfetch --disable-linewrap false --hide-cursor false --show-errors true --load-config presets/all diff --git a/src/modules/opencl.c b/src/modules/opencl.c index 18e826317..60bcd2058 100644 --- a/src/modules/opencl.c +++ b/src/modules/opencl.c @@ -24,7 +24,7 @@ typedef struct OpenCLData FF_LIBRARY_SYMBOL(clGetDeviceInfo) } OpenCLData; -static const char* openCLHandelData(FFinstance* instance, OpenCLData* data) +static const char* openCLHandleData(FFinstance* instance, OpenCLData* data) { cl_platform_id platformID; cl_uint numPlatforms; @@ -84,12 +84,17 @@ static const char* printOpenCL(FFinstance* instance) { OpenCLData data; - FF_LIBRARY_LOAD(opencl, &instance->config.libOpenCL, "dlopen libOpenCL"FF_LIBRARY_EXTENSION" failed", "libOpenCL"FF_LIBRARY_EXTENSION, 1); + FF_LIBRARY_LOAD(opencl, &instance->config.libOpenCL, "dlopen libOpenCL"FF_LIBRARY_EXTENSION" failed", + #ifdef _WIN32 + "OpenCL"FF_LIBRARY_EXTENSION, -1, + #endif + "libOpenCL"FF_LIBRARY_EXTENSION, 1 + ); FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opencl, data, clGetPlatformIDs); FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opencl, data, clGetDeviceIDs); FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(opencl, data, clGetDeviceInfo); - const char* error = openCLHandelData(instance, &data); + const char* error = openCLHandleData(instance, &data); dlclose(opencl); return error; } @@ -103,7 +108,7 @@ static const char* printOpenCL(FFinstance* instance) data.ffclGetDeviceIDs = clGetDeviceIDs; data.ffclGetDeviceInfo = clGetDeviceInfo; - return openCLHandelData(instance, &data); + return openCLHandleData(instance, &data); } #endif // __APPLE__