Skip to content

Commit 02aff16

Browse files
committed
fix: Windows build configuration with Ninja and Clang
- Add Ninja build system installation for Windows runners - Configure CMake to use Ninja generator with Clang from LLVM - Improve LLVM detection with detailed diagnostic messages - Add explicit LLVM library directory linking for Windows This fixes the CMake configuration errors on Windows CI builds.
1 parent 5eed595 commit 02aff16

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ jobs:
7777
exit 1
7878
}
7979
80+
- name: Install Ninja (Windows)
81+
if: matrix.os == 'windows-latest'
82+
run: choco install ninja -y
83+
8084
- name: Configure (Unix)
8185
if: matrix.os != 'windows-latest'
8286
shell: bash
@@ -91,9 +95,12 @@ jobs:
9195
shell: pwsh
9296
run: |
9397
cmake -S . -B build `
98+
-G "Ninja" `
9499
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
95100
-DBUILD_TESTS=OFF `
96101
-DBUILD_BENCH=OFF `
102+
-DCMAKE_C_COMPILER="$env:LLVM_ROOT/bin/clang.exe" `
103+
-DCMAKE_CXX_COMPILER="$env:LLVM_ROOT/bin/clang++.exe" `
97104
-DLLVM_DIR="$env:LLVM_DIR" `
98105
-DCMAKE_PREFIX_PATH="$env:LLVM_ROOT"
99106

CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
2020
# --- LLVM Configuration ---
2121
find_package(LLVM CONFIG REQUIRED)
2222

23+
if(NOT LLVM_FOUND)
24+
message(FATAL_ERROR "LLVM not found! Please install LLVM and set LLVM_DIR.")
25+
endif()
26+
27+
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
28+
message(STATUS "LLVM Include Dirs: ${LLVM_INCLUDE_DIRS}")
29+
message(STATUS "LLVM Library Dirs: ${LLVM_LIBRARY_DIRS}")
30+
message(STATUS "LLVM Definitions: ${LLVM_DEFINITIONS}")
31+
2332
# --- LibFFI Configuration ---
2433
# specialized find_package might be needed if not in standard path, but let's try standard first
2534
find_package(PkgConfig QUIET)
@@ -44,11 +53,17 @@ else()
4453
message(WARNING "LibFFI not found. FFI features will be disabled.")
4554
endif()
4655

47-
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
4856
include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
4957
add_definitions(${LLVM_DEFINITIONS})
58+
59+
# Explicitly add LLVM library directories
5060
link_directories(${LLVM_LIBRARY_DIRS})
5161

62+
if(WIN32)
63+
# Additional linking configuration for Windows
64+
link_directories(${LLVM_LIBRARY_DIRS})
65+
endif()
66+
5267
# Map generic components to specific libs
5368
llvm_map_components_to_libnames(llvm_libs core support executionengine native ipo analysis transformutils bitwriter)
5469

0 commit comments

Comments
 (0)