Skip to content

Commit 9864697

Browse files
committed
wip
1 parent d06c892 commit 9864697

File tree

5 files changed

+220
-25
lines changed

5 files changed

+220
-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: 89 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}
@@ -15,23 +16,32 @@ jobs:
1516
fail-fast: true
1617
matrix:
1718
build_type: [Release, Debug]
18-
sys: [mingw64]
1919
lib: [shared, static]
20+
arch:
21+
- arm64
22+
- x64
2023
components: [minimal, lgpl, gpl]
2124
metis: [no-metis, metis]
2225
exclude:
2326
# METIS is only usable if CHOLMOD is compiled
2427
- components: minimal
2528
metis: metis
2629
include:
27-
- sys: mingw64
30+
- arch: x64
31+
os: windows-2022
2832
env: x86_64
33+
sys: mingw64
34+
- arch: arm64
35+
os: windows-11-arm
36+
env: clang-aarch64
37+
sys: clangarm64
2938

3039
steps:
3140
- uses: actions/checkout@v4
3241

33-
- name: Setup Dependencies
42+
- name: Setup Dependencies (x86_64)
3443
uses: msys2/setup-msys2@v2
44+
if: ${{matrix.sys == 'mingw64'}}
3545
with:
3646
msystem: ${{matrix.sys}}
3747
install: >-
@@ -47,6 +57,25 @@ jobs:
4757
unzip
4858
wget
4959
60+
- name: Setup Dependencies (clang-aarch64)
61+
uses: msys2/setup-msys2@v2
62+
if: ${{matrix.sys == 'clangarm64'}}
63+
with:
64+
msystem: ${{matrix.sys}}
65+
install: >-
66+
mingw-w64-${{matrix.env}}-ccache
67+
mingw-w64-${{matrix.env}}-clang
68+
mingw-w64-${{matrix.env}}-cmake
69+
mingw-w64-${{matrix.env}}-flang
70+
mingw-w64-${{matrix.env}}-intel-tbb
71+
mingw-w64-${{matrix.env}}-lapack
72+
mingw-w64-${{matrix.env}}-ninja
73+
mingw-w64-${{matrix.env}}-openblas
74+
mingw-w64-${{matrix.env}}-openmp
75+
unzip
76+
wget
77+
78+
5079
- name: Setup METIS Dependencies
5180
if: ${{matrix.metis == 'metis'}}
5281
run: >-
@@ -94,7 +123,7 @@ jobs:
94123
--target install
95124
96125
build-msvc:
97-
name: ${{matrix.msvc}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
126+
name: ${{matrix.msvc}}-${{matrix.arch}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
98127
runs-on: ${{matrix.os}}
99128
env:
100129
CCACHE_DIR: ${{github.workspace}}/ccache
@@ -106,8 +135,10 @@ jobs:
106135
fail-fast: true
107136
matrix:
108137
build_type: [Release, Debug]
109-
msvc: [VS-16-2019, VS-17-2022]
110-
sys: [mingw64]
138+
msvc: [VS-17-2022]
139+
arch:
140+
- arm64
141+
- x64
111142
lib: [shared, static]
112143
components: [minimal, lgpl, gpl]
113144
metis: [no-metis, metis]
@@ -116,17 +147,19 @@ jobs:
116147
- components: minimal
117148
metis: metis
118149
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
126150
- msvc: VS-17-2022
127151
generator: "Visual Studio 17 2022"
128-
os: windows-2022
129152
marker: vc17
153+
- arch: x64
154+
env: x86_64
155+
os: windows-2022
156+
sys: mingw64
157+
system: Win64
158+
- arch: arm64
159+
env: clang-aarch64
160+
os: windows-11-arm
161+
sys: clangarm64
162+
system: arm64
130163

131164
steps:
132165
- uses: actions/checkout@v4
@@ -137,7 +170,7 @@ jobs:
137170
uses: actions/cache@v4
138171
with:
139172
path: metis/
140-
key: ${{matrix.msvc}}-metis-5.1.0-${{matrix.build_type}}-shared
173+
key: ${{matrix.msvc}}-${{matrix.arch}}-metis-5.1.0-${{matrix.build_type}}-shared
141174

142175
- name: Download METIS
143176
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true'
@@ -160,7 +193,7 @@ jobs:
160193
Pop-Location
161194
162195
cmake -S metis-5.1.0 -B build-metis `
163-
-A x64 `
196+
-A ${{matrix.arch}} `
164197
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/metis `
165198
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON `
166199
-DMETIS_INSTALL:BOOL=ON `
@@ -170,26 +203,40 @@ jobs:
170203
--config ${{matrix.build_type}} `
171204
--target install
172205
173-
174-
- name: Setup MSYS2
206+
- name: Setup MSYS2 (x86_64)
175207
uses: msys2/setup-msys2@v2
208+
if: ${{matrix.sys == 'mingw64'}}
176209
with:
177210
msystem: ${{matrix.sys}}
178211
path-type: inherit
179212
install: >-
180213
wget
181214
mingw-w64-${{matrix.env}}-ccache
215+
mingw-w64-${{matrix.env}}-cmake
182216
mingw-w64-${{matrix.env}}-gcc-fortran
183217
mingw-w64-${{matrix.env}}-ninja
184218
219+
- name: Setup MSYS2 (aarch64)
220+
uses: msys2/setup-msys2@v2
221+
if: ${{matrix.sys == 'clangarm64'}}
222+
with:
223+
msystem: ${{matrix.sys}}
224+
path-type: inherit
225+
install: >-
226+
wget
227+
mingw-w64-${{matrix.env}}-ccache
228+
mingw-w64-${{matrix.env}}-cmake
229+
mingw-w64-${{matrix.env}}-flang
230+
mingw-w64-${{matrix.env}}-ninja
231+
185232
- name: Cache LAPACK
186233
id: cache-lapack
187234
uses: actions/cache@v4
188235
with:
189236
path: |
190237
${{env.CCACHE_DIR}}
191238
${{github.workspace}}/install
192-
key: ${{matrix.msvc}}-lapack-3.12.0-${{matrix.build_type}}
239+
key: ${{matrix.msvc}}-${{matrix.arch}}-lapack-3.12.0-${{matrix.build_type}}
193240

194241
- name: Download LAPACK
195242
if: steps.cache-lapack.outputs.cache-hit != 'true'
@@ -198,10 +245,28 @@ jobs:
198245
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.12.0.tar.gz
199246
tar xvf v3.12.0.tar.gz
200247
201-
- name: Build LAPACK
202-
if: steps.cache-lapack.outputs.cache-hit != 'true'
248+
- name: Build LAPACK (x86_64)
249+
if: matrix.arch == 'x64' && steps.cache-lapack.outputs.cache-hit != 'true'
250+
shell: msys2 {0}
251+
run: |
252+
cmake -S lapack-3.12.0 -B build_lapack_${{matrix.build_type}}/ \
253+
-DBUILD_SHARED_LIBS=ON \
254+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
255+
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
256+
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
257+
-DCMAKE_GNUtoMS=ON \
258+
-DCMAKE_INSTALL_PREFIX=./install \
259+
-G Ninja
260+
261+
cmake --build build_lapack_${{matrix.build_type}}/ \
262+
--config ${{matrix.build_type}} \
263+
--target install
264+
265+
- name: Build LAPACK (aarch64)
266+
if: matrix.arch == 'arm64' && steps.cache-lapack.outputs.cache-hit != 'true'
203267
shell: msys2 {0}
204268
run: |
269+
cat ./cmake/Flang.cmake >> lapack-3.12.0/CMakeLists.txt
205270
cmake -S lapack-3.12.0 -B build_lapack_${{matrix.build_type}}/ \
206271
-DBUILD_SHARED_LIBS=ON \
207272
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
@@ -229,7 +294,7 @@ jobs:
229294
- name: Configure
230295
run: |
231296
cmake -S . -B build_${{matrix.build_type}}/ `
232-
-A x64 `
297+
-A ${{matrix.arch}} `
233298
-DBLAS_blas_LIBRARY=${{github.workspace}}/install/lib/libblas.lib `
234299
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
235300
-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: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
message (STATUS "FOO: ${CMAKE_SYSTEM_PROCESSOR}")
9+
10+
unset (CMAKE_GNUtoMS_VCVARS CACHE)
11+
set (CMAKE_GNUtoMS 1)
12+
13+
if(CMAKE_GNUtoMS AND NOT CMAKE_GNUtoMS_LIB)
14+
# Find MS development environment setup script for this architecture.
15+
# We need to use the MS Librarian tool (lib.exe).
16+
# Find the most recent version available.
17+
18+
# Query the VS Installer tool for locations of VS 2017 and above.
19+
set(_vs_installer_paths "")
20+
foreach(vs RANGE 17 15 -1) # change the first number to the largest supported version
21+
cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR)
22+
if(_vs_dir)
23+
list(APPEND _vs_installer_paths "${_vs_dir}/VC/Auxiliary/Build")
24+
25+
file (GLOB _vcvars "${_vs_dir}/VC/Auxiliary/Build/*.bat")
26+
27+
foreach (vc IN LISTS _vcvars)
28+
message (STATUS "VC: ${vc}")
29+
endforeach (vc)
30+
endif()
31+
endforeach()
32+
33+
message (STATUS "${CMAKE_SIZEOF_VOID_P}")
34+
if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
35+
message (STATUS "x86")
36+
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
37+
DOC "Visual Studio vcvars32.bat"
38+
PATHS
39+
${_vs_installer_paths}
40+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin"
41+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin"
42+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin"
43+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin"
44+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin"
45+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin"
46+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir]/bin"
47+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++;ProductDir]/bin"
48+
)
49+
set(CMAKE_GNUtoMS_ARCH x86)
50+
elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
51+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
52+
message (STATUS "AMD64")
53+
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars64.bat vcvarsamd64.bat
54+
DOC "Visual Studio vcvarsamd64.bat"
55+
PATHS
56+
${_vs_installer_paths}
57+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin/amd64"
58+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/amd64"
59+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64"
60+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64"
61+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64"
62+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/amd64"
63+
)
64+
set(CMAKE_GNUtoMS_ARCH amd64)
65+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL ARM64)
66+
message (STATUS "ARM64")
67+
find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvarsarm64.bat
68+
DOC "Visual Studio vcvarsarm64.bat"
69+
PATHS
70+
${_vs_installer_paths}
71+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC;ProductDir]/bin/arm64"
72+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC;ProductDir]/bin/arm64"
73+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/arm64"
74+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/arm64"
75+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/arm64"
76+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/arm64"
77+
)
78+
set(CMAKE_GNUtoMS_ARCH arm64)
79+
endif()
80+
endif()
81+
unset(_vs_installer_paths)
82+
set_property(CACHE CMAKE_GNUtoMS_VCVARS PROPERTY ADVANCED 1)
83+
if(CMAKE_GNUtoMS_VCVARS)
84+
# Create helper script to run lib.exe from MS environment.
85+
string(REPLACE "/" "\\" CMAKE_GNUtoMS_BAT "${CMAKE_GNUtoMS_VCVARS}")
86+
set(CMAKE_GNUtoMS_LIB ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeGNUtoMS_lib.bat)
87+
configure_file(${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.bat.in ${CMAKE_GNUtoMS_LIB})
88+
else()
89+
message(WARNING "Disabling CMAKE_GNUtoMS option because CMAKE_GNUtoMS_VCVARS is not set.")
90+
set(CMAKE_GNUtoMS 0)
91+
endif()
92+
endif()
93+
94+
message (STATUS "VCVARS: ${CMAKE_GNUtoMS_VCVARS} ${CMAKE_GNUtoMS_ARCH}")
95+
message (STATUS "RULE: ${CMAKE_${lang}_GNUtoMS_RULE}")
96+
97+
if(CMAKE_GNUtoMS)
98+
# Teach CMake how to create a MS import library at link time.
99+
set(CMAKE_${lang}_GNUtoMS_RULE " -Wl,--output-def,<TARGET_NAME>.def"
100+
"<CMAKE_COMMAND> -Dlib=\"${CMAKE_GNUtoMS_LIB}\" -Ddef=<TARGET_NAME>.def -Ddll=<TARGET> -Dimp=<TARGET_IMPLIB> -P \"${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.cmake\""
101+
)
102+
endif()
103+
execute_process (COMMAND ${CMAKE_GNUtoMS_VCVARS})
104+
105+
endmacro()
106+
107+
if (WIN32)
108+
if (CMAKE_C_COMPILER_LOADED)
109+
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
110+
windows_compiler_clang_abi (C)
111+
endif (CMAKE_C_COMPILER_ID MATCHES "Clang")
112+
endif (CMAKE_C_COMPILER_LOADED)
113+
114+
if (CMAKE_CXX_COMPILER_LOADED)
115+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
116+
windows_compiler_clang_abi (CXX)
117+
endif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
118+
endif (CMAKE_CXX_COMPILER_LOADED)
119+
120+
if (CMAKE_Fortran_COMPILER_LOADED)
121+
message (STATUS "Compiler: ${CMAKE_Fortran_COMPILER_ID}")
122+
123+
if (CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
124+
windows_compiler_clang_abi (Fortran)
125+
endif (CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
126+
endif (CMAKE_Fortran_COMPILER_LOADED)
127+
endif (WIN32)
128+

0 commit comments

Comments
 (0)