Skip to content

Commit b19bea3

Browse files
committed
Always use Clang to build our third-party libraries.
Indeed, to build LLVM+Clang on Windows ARM is not possible using MSVC.
1 parent bd8cd70 commit b19bea3

2 files changed

Lines changed: 18 additions & 32 deletions

File tree

.github/workflows/buildThirdPartyLibrary.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ jobs:
2121
include:
2222
- name: 'Windows release (Intel)'
2323
os: windows-latest
24-
arch: amd64
24+
target_architecture: Intel
2525
build_type: Release
2626
- name: 'Windows debug (Intel)'
2727
os: windows-latest
28-
arch: amd64
28+
target_architecture: Intel
2929
build_type: Debug
3030
- name: 'Windows release (ARM)'
3131
os: windows-latest
32-
arch: amd64_arm64
32+
target_architecture: ARM
3333
build_type: Release
3434
- name: 'Windows debug (ARM)'
3535
os: windows-latest
36-
arch: amd64_arm64
36+
target_architecture: ARM
3737
build_type: Debug
3838
- name: 'Linux (Intel)'
3939
os: ubuntu-20.04
@@ -43,60 +43,42 @@ jobs:
4343
# our Python wheels on Linux, we have no choice but to use manylinux_2_28, which relies on a version
4444
# of glibc with libpthread, hence getting various messages about __libc_single_threaded being
4545
# undefined when trying to build our Python wheels using third-party libraries built on ubuntu-22.04.
46+
target_architecture: Intel
4647
build_type: Release
4748
- name: 'Linux (ARM)'
4849
os: ubuntu-latest
49-
arch: arm
50-
cmake_prereqs: CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
50+
target_architecture: ARM
5151
build_type: Release
5252
- name: 'macOS (Intel)'
53-
os: macos-13
53+
os: macos-latest
54+
target_architecture: Intel
5455
build_type: Release
5556
- name: 'macOS (ARM)'
5657
os: macos-latest
58+
target_architecture: ARM
5759
build_type: Release
5860
env:
5961
BUILDCACHE_ACCURACY: STRICT
6062
BUILDCACHE_COMPRESS_FORMAT: ZSTD
6163
BUILDCACHE_DEBUG: -1
6264
BUILDCACHE_LOG_FILE: ""
6365
steps:
66+
- name: Check the version of Clang
67+
run: clang --version
6468
- name: Check out libOpenCOR
6569
uses: actions/checkout@v4
66-
- name: Install ARM compiler
67-
if: ${{ matrix.arch == 'arm' }}
68-
run: |
69-
sudo apt update
70-
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
7170
- name: Install CMake and Ninja
7271
uses: lukka/get-cmake@latest
7372
- name: Install buildcache
7473
uses: cscouto/buildcache-action@v1
7574
with:
7675
cache_key: libraries-${{ matrix.os }}-${{ matrix.shared_libs }}
77-
- name: Configure MSVC (to build an Intel-based version of llvm-tblgen and clang-tblgen)
78-
if: ${{ (runner.os == 'Windows') && (matrix.arch == 'amd64_arm64') }}
79-
uses: ilammy/msvc-dev-cmd@v1
80-
with:
81-
arch: amd64
82-
- name: Build llvm-tblgen and clang-tblgen
83-
if: ${{ (((runner.os == 'Windows') && (matrix.arch == 'amd64_arm64')) || ((runner.os == 'Linux') && (matrix.arch == 'arm'))) }}
84-
shell: bash
85-
run: |
86-
source src/3rdparty/LLVMClang/scripts/buildllvmclangtblgen ${{ runner.os == 'Windows' }}
87-
echo "DLLVMCLANG_LLVM_TABLEGEN=$DLLVMCLANG_LLVM_TABLEGEN" >> $GITHUB_ENV
88-
echo "DLLVMCLANG_CLANG_TABLEGEN=$DLLVMCLANG_CLANG_TABLEGEN" >> $GITHUB_ENV
89-
- name: Configure MSVC
90-
if: ${{ runner.os == 'Windows' }}
91-
uses: ilammy/msvc-dev-cmd@v1
92-
with:
93-
arch: ${{ matrix.arch }}
9476
- name: Configure libOpenCOR
9577
shell: bash
9678
run: |
9779
mkdir build
9880
cd build
99-
${{ matrix.cmake_prereqs }} cmake -G Ninja -DBUILD_TYPE=${{ matrix.build_type }} -DONLY_BUILD_THIRD_PARTY_LIBRARIES=ON -DPREBUILT_${{ inputs.third_party_library_name }}=OFF ${{ env.DLLVMCLANG_LLVM_TABLEGEN }} ${{ env.DLLVMCLANG_CLANG_TABLEGEN }} ..
81+
cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DTARGET_ARCHITECTURE=${{ matrix.target_architecture }} -DBUILD_TYPE=${{ matrix.build_type }} -DONLY_BUILD_THIRD_PARTY_LIBRARIES=ON -DPREBUILT_${{ inputs.third_party_library_name }}=OFF ${{ env.DLLVMCLANG_LLVM_TABLEGEN }} ${{ env.DLLVMCLANG_CLANG_TABLEGEN }} ..
10082
- name: Upload library artifact
10183
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
10284
uses: actions/upload-artifact@v4

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,17 @@ else()
524524
if("${LIBOPENCOR_TARGET_ARCHITECTURE}" STREQUAL "Intel")
525525
set(INTEL_MODE TRUE)
526526

527-
if(APPLE)
527+
if(WIN32)
528+
set(CMAKE_SYSTEM_PROCESSOR AMD64)
529+
elseif(APPLE)
528530
set(CMAKE_OSX_ARCHITECTURES x86_64)
529531
else()
530532
set(CMAKE_SYSTEM_PROCESSOR x86_64)
531533
endif()
532534
else()
533-
if(APPLE)
535+
if(WIN32)
536+
set(CMAKE_SYSTEM_PROCESSOR ARM64)
537+
elseif(APPLE)
534538
set(CMAKE_OSX_ARCHITECTURES arm64)
535539
else()
536540
set(CMAKE_SYSTEM_PROCESSOR arm64)

0 commit comments

Comments
 (0)