Skip to content

Commit d3007ee

Browse files
committed
wip
1 parent d06c892 commit d3007ee

File tree

5 files changed

+203
-23
lines changed

5 files changed

+203
-23
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: 94 additions & 22 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.env == 'x86_64'}}
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.env == 'clang-aarch64'}}
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,14 @@ jobs:
105137
strategy:
106138
fail-fast: true
107139
matrix:
140+
os:
141+
- windows-11-arm
142+
- windows-2022
108143
build_type: [Release, Debug]
109-
msvc: [VS-16-2019, VS-17-2022]
110-
sys: [mingw64]
144+
msvc: [VS-17-2022]
145+
arch:
146+
- arm64
147+
- x64
111148
lib: [shared, static]
112149
components: [minimal, lgpl, gpl]
113150
metis: [no-metis, metis]
@@ -116,17 +153,21 @@ jobs:
116153
- components: minimal
117154
metis: metis
118155
include:
119-
- sys: mingw64
120-
env: x86_64
156+
- os: windows-2022
121157
system: Win64
122-
- msvc: VS-16-2019
123-
generator: "Visual Studio 16 2019"
124-
os: windows-2019
125-
marker: vc16
158+
- os: windows-11-arm
159+
system: arm64
126160
- msvc: VS-17-2022
127161
generator: "Visual Studio 17 2022"
128-
os: windows-2022
129162
marker: vc17
163+
- x64:
164+
os: windows-2022
165+
env: x86_64
166+
sys: mingw64
167+
- arm64:
168+
os: windows-11-arm
169+
env: clang-aarch64
170+
sys: clangarm64
130171

131172
steps:
132173
- uses: actions/checkout@v4
@@ -137,7 +178,7 @@ jobs:
137178
uses: actions/cache@v4
138179
with:
139180
path: metis/
140-
key: ${{matrix.msvc}}-metis-5.1.0-${{matrix.build_type}}-shared
181+
key: ${{matrix.msvc}}-${{matrix.arch}}-metis-5.1.0-${{matrix.build_type}}-shared
141182

142183
- name: Download METIS
143184
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true'
@@ -160,7 +201,7 @@ jobs:
160201
Pop-Location
161202
162203
cmake -S metis-5.1.0 -B build-metis `
163-
-A x64 `
204+
-A ${{matrix.arch}} `
164205
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/metis `
165206
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON `
166207
-DMETIS_INSTALL:BOOL=ON `
@@ -171,8 +212,9 @@ jobs:
171212
--target install
172213
173214
174-
- name: Setup MSYS2
215+
- name: Setup MSYS2 (x86_64)
175216
uses: msys2/setup-msys2@v2
217+
if: ${{matrix.env == 'x86_64'}}
176218
with:
177219
msystem: ${{matrix.sys}}
178220
path-type: inherit
@@ -182,14 +224,26 @@ jobs:
182224
mingw-w64-${{matrix.env}}-gcc-fortran
183225
mingw-w64-${{matrix.env}}-ninja
184226
227+
- name: Setup MSYS2 (aarch64)
228+
uses: msys2/setup-msys2@v2
229+
if: ${{matrix.env == 'clang-aarch64'}}
230+
with:
231+
msystem: ${{matrix.sys}}
232+
path-type: inherit
233+
install: >-
234+
wget
235+
mingw-w64-${{matrix.env}}-ccache
236+
mingw-w64-${{matrix.env}}-flang
237+
mingw-w64-${{matrix.env}}-ninja
238+
185239
- name: Cache LAPACK
186240
id: cache-lapack
187241
uses: actions/cache@v4
188242
with:
189243
path: |
190244
${{env.CCACHE_DIR}}
191245
${{github.workspace}}/install
192-
key: ${{matrix.msvc}}-lapack-3.12.0-${{matrix.build_type}}
246+
key: ${{matrix.msvc}}-${{matrix.arch}}-lapack-3.12.0-${{matrix.build_type}}
193247

194248
- name: Download LAPACK
195249
if: steps.cache-lapack.outputs.cache-hit != 'true'
@@ -198,10 +252,28 @@ jobs:
198252
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.12.0.tar.gz
199253
tar xvf v3.12.0.tar.gz
200254
201-
- name: Build LAPACK
202-
if: steps.cache-lapack.outputs.cache-hit != 'true'
255+
- name: Build LAPACK (x86_64)
256+
if: matrix.arch == 'x64' && steps.cache-lapack.outputs.cache-hit != 'true'
257+
shell: msys2 {0}
258+
run: |
259+
cmake -S lapack-3.12.0 -B build_lapack_${{matrix.build_type}}/ \
260+
-DBUILD_SHARED_LIBS=ON \
261+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
262+
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
263+
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
264+
-DCMAKE_GNUtoMS=ON \
265+
-DCMAKE_INSTALL_PREFIX=./install \
266+
-G Ninja
267+
268+
cmake --build build_lapack_${{matrix.build_type}}/ \
269+
--config ${{matrix.build_type}} \
270+
--target install
271+
272+
- name: Build LAPACK (aarch64)
273+
if: matrix.arch == 'arm64' && steps.cache-lapack.outputs.cache-hit != 'true'
203274
shell: msys2 {0}
204275
run: |
276+
cat ./cmake/Flang.cmake >> lapack-3.12.0/CMakeLists.txt
205277
cmake -S lapack-3.12.0 -B build_lapack_${{matrix.build_type}}/ \
206278
-DBUILD_SHARED_LIBS=ON \
207279
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
@@ -229,7 +301,7 @@ jobs:
229301
- name: Configure
230302
run: |
231303
cmake -S . -B build_${{matrix.build_type}}/ `
232-
-A x64 `
304+
-A ${{matrix.arch}} `
233305
-DBLAS_blas_LIBRARY=${{github.workspace}}/install/lib/libblas.lib `
234306
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
235307
-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 vcvars64.bat vcvarsarm64.bat
53+
DOC "Visual Studio vcvarsarm64.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)