Skip to content

Commit 69fce21

Browse files
committed
wip
1 parent d06c892 commit 69fce21

File tree

5 files changed

+201
-25
lines changed

5 files changed

+201
-25
lines changed

.github/workflows/linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7+
if: false
78
name: ${{matrix.os}}-GCC-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.gpu}}-${{matrix.metis}}
89
runs-on: ${{matrix.os}}
910
defaults:

.github/workflows/macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7+
if: false
78
name: ${{matrix.os}}-AppleClang-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
89
runs-on: ${{matrix.os}}
910
defaults:

.github/workflows/windows.yml

Lines changed: 92 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ on: [push, pull_request]
44

55
jobs:
66
build-mingw:
7-
name: ${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
8-
runs-on: windows-latest
7+
if: false
8+
name: mingw64-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
9+
runs-on: ${{matrix.os}}
910
defaults:
1011
run:
1112
shell: msys2 {0}
@@ -14,24 +15,36 @@ jobs:
1415
strategy:
1516
fail-fast: true
1617
matrix:
18+
os:
19+
- windows-11-arm
20+
- windows-2022
1721
build_type: [Release, Debug]
18-
sys: [mingw64]
1922
lib: [shared, static]
23+
arch:
24+
- arm64
25+
- x64
2026
components: [minimal, lgpl, gpl]
2127
metis: [no-metis, metis]
2228
exclude:
2329
# METIS is only usable if CHOLMOD is compiled
2430
- components: minimal
2531
metis: metis
2632
include:
27-
- sys: mingw64
33+
- x64:
34+
os: windows-2022
2835
env: x86_64
36+
sys: mingw64
37+
- arm64:
38+
os: windows-11-arm
39+
env: clang-aarch64
40+
sys: clangarm64
2941

3042
steps:
3143
- uses: actions/checkout@v4
3244

33-
- name: Setup Dependencies
45+
- name: Setup Dependencies (x86_64)
3446
uses: msys2/setup-msys2@v2
47+
if: ${{matrix.sys == 'mingw64'}}
3548
with:
3649
msystem: ${{matrix.sys}}
3750
install: >-
@@ -47,6 +60,25 @@ jobs:
4760
unzip
4861
wget
4962
63+
- name: Setup Dependencies (clang-aarch64)
64+
uses: msys2/setup-msys2@v2
65+
if: ${{matrix.sys == 'clangarm64'}}
66+
with:
67+
msystem: ${{matrix.sys}}
68+
install: >-
69+
mingw-w64-${{matrix.env}}-ccache
70+
mingw-w64-${{matrix.env}}-clang
71+
mingw-w64-${{matrix.env}}-cmake
72+
mingw-w64-${{matrix.env}}-flang
73+
mingw-w64-${{matrix.env}}-intel-tbb
74+
mingw-w64-${{matrix.env}}-lapack
75+
mingw-w64-${{matrix.env}}-ninja
76+
mingw-w64-${{matrix.env}}-openblas
77+
mingw-w64-${{matrix.env}}-openmp
78+
unzip
79+
wget
80+
81+
5082
- name: Setup METIS Dependencies
5183
if: ${{matrix.metis == 'metis'}}
5284
run: >-
@@ -94,7 +126,7 @@ jobs:
94126
--target install
95127
96128
build-msvc:
97-
name: ${{matrix.msvc}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
129+
name: ${{matrix.msvc}}-${{matrix.arch}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
98130
runs-on: ${{matrix.os}}
99131
env:
100132
CCACHE_DIR: ${{github.workspace}}/ccache
@@ -105,9 +137,13 @@ jobs:
105137
strategy:
106138
fail-fast: true
107139
matrix:
140+
os:
141+
- windows-11-arm
108142
build_type: [Release, Debug]
109-
msvc: [VS-16-2019, VS-17-2022]
110-
sys: [mingw64]
143+
msvc: [VS-17-2022]
144+
arch:
145+
- arm64
146+
- x64
111147
lib: [shared, static]
112148
components: [minimal, lgpl, gpl]
113149
metis: [no-metis, metis]
@@ -116,17 +152,19 @@ jobs:
116152
- components: minimal
117153
metis: metis
118154
include:
119-
- sys: mingw64
120-
env: x86_64
121-
system: Win64
122-
- msvc: VS-16-2019
123-
generator: "Visual Studio 16 2019"
124-
os: windows-2019
125-
marker: vc16
126155
- msvc: VS-17-2022
127156
generator: "Visual Studio 17 2022"
128-
os: windows-2022
129157
marker: vc17
158+
- x64:
159+
env: x86_64
160+
os: windows-2022
161+
sys: mingw64
162+
system: Win64
163+
- arm64:
164+
env: clang-aarch64
165+
os: windows-11-arm
166+
sys: clangarm64
167+
system: arm64
130168

131169
steps:
132170
- uses: actions/checkout@v4
@@ -137,7 +175,7 @@ jobs:
137175
uses: actions/cache@v4
138176
with:
139177
path: metis/
140-
key: ${{matrix.msvc}}-metis-5.1.0-${{matrix.build_type}}-shared
178+
key: ${{matrix.msvc}}-${{matrix.arch}}-metis-5.1.0-${{matrix.build_type}}-shared
141179

142180
- name: Download METIS
143181
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true'
@@ -160,7 +198,7 @@ jobs:
160198
Pop-Location
161199
162200
cmake -S metis-5.1.0 -B build-metis `
163-
-A x64 `
201+
-A ${{matrix.arch}} `
164202
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/metis `
165203
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON `
166204
-DMETIS_INSTALL:BOOL=ON `
@@ -170,9 +208,9 @@ jobs:
170208
--config ${{matrix.build_type}} `
171209
--target install
172210
173-
174-
- name: Setup MSYS2
211+
- name: Setup MSYS2 (x86_64)
175212
uses: msys2/setup-msys2@v2
213+
if: ${{matrix.sys == 'mingw64'}}
176214
with:
177215
msystem: ${{matrix.sys}}
178216
path-type: inherit
@@ -182,14 +220,26 @@ jobs:
182220
mingw-w64-${{matrix.env}}-gcc-fortran
183221
mingw-w64-${{matrix.env}}-ninja
184222
223+
- name: Setup MSYS2 (aarch64)
224+
uses: msys2/setup-msys2@v2
225+
if: ${{matrix.sys == 'clangarm64'}}
226+
with:
227+
msystem: ${{matrix.sys}}
228+
path-type: inherit
229+
install: >-
230+
wget
231+
mingw-w64-${{matrix.env}}-ccache
232+
mingw-w64-${{matrix.env}}-flang
233+
mingw-w64-${{matrix.env}}-ninja
234+
185235
- name: Cache LAPACK
186236
id: cache-lapack
187237
uses: actions/cache@v4
188238
with:
189239
path: |
190240
${{env.CCACHE_DIR}}
191241
${{github.workspace}}/install
192-
key: ${{matrix.msvc}}-lapack-3.12.0-${{matrix.build_type}}
242+
key: ${{matrix.msvc}}-${{matrix.arch}}-lapack-3.12.0-${{matrix.build_type}}
193243

194244
- name: Download LAPACK
195245
if: steps.cache-lapack.outputs.cache-hit != 'true'
@@ -198,10 +248,28 @@ jobs:
198248
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.12.0.tar.gz
199249
tar xvf v3.12.0.tar.gz
200250
201-
- name: Build LAPACK
202-
if: steps.cache-lapack.outputs.cache-hit != 'true'
251+
- name: Build LAPACK (x86_64)
252+
if: matrix.arch == 'x64' && steps.cache-lapack.outputs.cache-hit != 'true'
253+
shell: msys2 {0}
254+
run: |
255+
cmake -S lapack-3.12.0 -B build_lapack_${{matrix.build_type}}/ \
256+
-DBUILD_SHARED_LIBS=ON \
257+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
258+
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
259+
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
260+
-DCMAKE_GNUtoMS=ON \
261+
-DCMAKE_INSTALL_PREFIX=./install \
262+
-G Ninja
263+
264+
cmake --build build_lapack_${{matrix.build_type}}/ \
265+
--config ${{matrix.build_type}} \
266+
--target install
267+
268+
- name: Build LAPACK (aarch64)
269+
if: matrix.arch == 'arm64' && steps.cache-lapack.outputs.cache-hit != 'true'
203270
shell: msys2 {0}
204271
run: |
272+
cat ./cmake/Flang.cmake >> lapack-3.12.0/CMakeLists.txt
205273
cmake -S lapack-3.12.0 -B build_lapack_${{matrix.build_type}}/ \
206274
-DBUILD_SHARED_LIBS=ON \
207275
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
@@ -229,7 +297,7 @@ jobs:
229297
- name: Configure
230298
run: |
231299
cmake -S . -B build_${{matrix.build_type}}/ `
232-
-A x64 `
300+
-A ${{matrix.arch}} `
233301
-DBLAS_blas_LIBRARY=${{github.workspace}}/install/lib/libblas.lib `
234302
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
235303
-DCMAKE_Fortran_COMPILER= `

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# CMake support layer for SuiteSparse
33
#
4-
# Copyright 2023 Sergiu Deitsch <sergiu.deitsch@gmail.com>
4+
# Copyright 2025 Sergiu Deitsch <sergiu.deitsch@gmail.com>
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

cmake/Flang.cmake

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
macro(windows_compiler_clang_abi lang)
2+
if(CMAKE_NO_GNUtoMS)
3+
set(CMAKE_GNUtoMS 0)
4+
else()
5+
option(CMAKE_GNUtoMS "Convert GNU import libraries to MS format (requires Visual Studio)" OFF)
6+
endif()
7+
8+
if(CMAKE_GNUtoMS AND NOT CMAKE_GNUtoMS_LIB)
9+
# Find MS development environment setup script for this architecture.
10+
# We need to use the MS Librarian tool (lib.exe).
11+
# Find the most recent version available.
12+
13+
# Query the VS Installer tool for locations of VS 2017 and above.
14+
set(_vs_installer_paths "")
15+
foreach(vs RANGE 17 15 -1) # change the first number to the largest supported version
16+
cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR)
17+
if(_vs_dir)
18+
list(APPEND _vs_installer_paths "${_vs_dir}/VC/Auxiliary/Build")
19+
endif()
20+
endforeach()
21+
22+
if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
23+
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
24+
DOC "Visual Studio vcvars32.bat"
25+
PATHS
26+
${_vs_installer_paths}
27+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin"
28+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin"
29+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin"
30+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin"
31+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin"
32+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin"
33+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir]/bin"
34+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++;ProductDir]/bin"
35+
)
36+
set(CMAKE_GNUtoMS_ARCH x86)
37+
elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
38+
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL AMD64)
39+
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars64.bat vcvarsamd64.bat
40+
DOC "Visual Studio vcvarsamd64.bat"
41+
PATHS
42+
${_vs_installer_paths}
43+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin/amd64"
44+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/amd64"
45+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64"
46+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64"
47+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64"
48+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/amd64"
49+
)
50+
set(CMAKE_GNUtoMS_ARCH amd64)
51+
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL ARM64)
52+
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvarsamd64_arm.bat
53+
DOC "Visual Studio vcvarsamd64_arm.bat"
54+
PATHS
55+
${_vs_installer_paths}
56+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin/arm64"
57+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/arm64"
58+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/arm64"
59+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/arm64"
60+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/arm64"
61+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/arm64"
62+
)
63+
set(CMAKE_GNUtoMS_ARCH arm64)
64+
endif()
65+
endif()
66+
unset(_vs_installer_paths)
67+
set_property(CACHE CMAKE_GNUtoMS_VCVARS PROPERTY ADVANCED 1)
68+
if(CMAKE_GNUtoMS_VCVARS)
69+
# Create helper script to run lib.exe from MS environment.
70+
string(REPLACE "/" "\\" CMAKE_GNUtoMS_BAT "${CMAKE_GNUtoMS_VCVARS}")
71+
set(CMAKE_GNUtoMS_LIB ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeGNUtoMS_lib.bat)
72+
configure_file(${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.bat.in ${CMAKE_GNUtoMS_LIB})
73+
else()
74+
message(WARNING "Disabling CMAKE_GNUtoMS option because CMAKE_GNUtoMS_VCVARS is not set.")
75+
set(CMAKE_GNUtoMS 0)
76+
endif()
77+
endif()
78+
79+
if(CMAKE_GNUtoMS)
80+
# Teach CMake how to create a MS import library at link time.
81+
set(CMAKE_${lang}_GNUtoMS_RULE " -Wl,--output-def,<TARGET_NAME>.def"
82+
"<CMAKE_COMMAND> -Dlib=\"${CMAKE_GNUtoMS_LIB}\" -Ddef=<TARGET_NAME>.def -Ddll=<TARGET> -Dimp=<TARGET_IMPLIB> -P \"${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.cmake\""
83+
)
84+
endif()
85+
endmacro()
86+
87+
if (WIN32)
88+
if (CMAKE_C_COMPILER_LOADED)
89+
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
90+
windows_compiler_clang_abi (C)
91+
endif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
92+
endif (CMAKE_C_COMPILER_LOADED)
93+
94+
if (CMAKE_CXX_COMPILER_LOADED)
95+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
96+
windows_compiler_clang_abi (CXX)
97+
endif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
98+
endif (CMAKE_CXX_COMPILER_LOADED)
99+
100+
if (CMAKE_Fortran_COMPILER_LOADED)
101+
if (CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
102+
windows_compiler_clang_abi (Fortran)
103+
endif (CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
104+
endif (CMAKE_Fortran_COMPILER_LOADED)
105+
endif (WIN32)
106+

0 commit comments

Comments
 (0)