From 7e312f165c5047d6e16680d1eebc83055e95c313 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Sat, 22 Apr 2023 16:18:20 +0800 Subject: [PATCH] cmake : fix build under Windows when enable BUILD_SHARED_LIBS (#1100) * Fix build under Windows when enable BUILD_SHARED_LIBS * Make AVX512 test on Windows to build the shared libs --- .github/workflows/build.yml | 2 +- CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e8a29b1e5fae..b2a35613e04b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -169,7 +169,7 @@ jobs: - build: 'avx' defines: '-DLLAMA_AVX2=OFF' - build: 'avx512' - defines: '-DLLAMA_AVX512=ON' + defines: '-DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON' steps: - name: Clone diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c3c60167fc5b..2d4e30e5a2dea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,10 @@ endif() if (MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) + + if (BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + endif() endif() if (LLAMA_LTO)