Skip to content

Commit bf50aff

Browse files
Adds test in the CI for the installation of CBLAS and LAPACKE without Fortran compiler
1 parent 981af11 commit bf50aff

File tree

2 files changed

+52
-11
lines changed

2 files changed

+52
-11
lines changed

.github/workflows/cmake.yml

+31
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,34 @@ jobs:
151151
echo "Coverage"
152152
cmake --build build --target coverage
153153
bash <(curl -s https://codecov.io/bash) -X gcov
154+
155+
test-install-cblas-lapacke-without-fortran-compiler:
156+
runs-on: ubuntu-latest
157+
steps:
158+
- name: Checkout LAPACK
159+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
160+
161+
- name: Install ninja-build tool
162+
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3
163+
164+
- name: Install basics
165+
run: |
166+
sudo apt update
167+
sudo apt install -y cmake liblapack-dev libblas-dev
168+
sudo apt purge gfortran
169+
170+
- name: Configure CMake
171+
run: >
172+
cmake -B build -G Ninja
173+
-D CMAKE_BUILD_TYPE=Release
174+
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/lapack_install
175+
-D CBLAS:BOOL=ON
176+
-D LAPACKE:BOOL=ON
177+
-D USE_OPTIMIZED_BLAS:BOOL=ON
178+
-D USE_OPTIMIZED_LAPACK:BOOL=ON
179+
-D BUILD_TESTING:BOOL=OFF
180+
-D LAPACKE_WITH_TMG:BOOL=OFF
181+
-D BUILD_SHARED_LIBS:BOOL=ON
182+
183+
- name: Install
184+
run: cmake --build build --target install -j2

CMakeLists.txt

+21-11
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,27 @@ endif()
278278

279279
# Check the usage of the user provided or automatically found LAPACK libraries
280280
if(LAPACK_LIBRARIES)
281-
include(CheckFortranFunctionExists)
282-
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
283-
# Check if new routine of 3.4.0 is in LAPACK_LIBRARIES
284-
CHECK_FORTRAN_FUNCTION_EXISTS("dgeqrt" LATESTLAPACK_FOUND)
285-
unset(CMAKE_REQUIRED_LIBRARIES)
286-
if(LATESTLAPACK_FOUND)
287-
message(STATUS "--> LAPACK supplied by user is WORKING, will use ${LAPACK_LIBRARIES}.")
281+
include(CheckLanguage)
282+
check_language(Fortran)
283+
if(CMAKE_Fortran_COMPILER)
284+
enable_language(Fortran)
285+
include(CheckFortranFunctionExists)
286+
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
287+
# Check if new routine of 3.4.0 is in LAPACK_LIBRARIES
288+
CHECK_FORTRAN_FUNCTION_EXISTS("dgeqrt" LATESTLAPACK_FOUND)
289+
unset(CMAKE_REQUIRED_LIBRARIES)
290+
if(LATESTLAPACK_FOUND)
291+
message(STATUS "--> LAPACK supplied by user is WORKING, will use ${LAPACK_LIBRARIES}.")
292+
else()
293+
message(ERROR "--> LAPACK supplied by user is not WORKING or is older than LAPACK 3.4.0, CANNOT USE ${LAPACK_LIBRARIES}.")
294+
message(ERROR "--> Will use REFERENCE LAPACK (by default)")
295+
message(ERROR "--> Or Correct your LAPACK_LIBRARIES entry ")
296+
message(ERROR "--> Or Consider checking USE_OPTIMIZED_LAPACK")
297+
endif()
288298
else()
289-
message(ERROR "--> LAPACK supplied by user is not WORKING or is older than LAPACK 3.4.0, CANNOT USE ${LAPACK_LIBRARIES}.")
290-
message(ERROR "--> Will use REFERENCE LAPACK (by default)")
291-
message(ERROR "--> Or Correct your LAPACK_LIBRARIES entry ")
292-
message(ERROR "--> Or Consider checking USE_OPTIMIZED_LAPACK")
299+
message(STATUS "--> LAPACK supplied by user is ${LAPACK_LIBRARIES}.")
300+
message(STATUS "--> CMake couldn't find a Fortran compiler, so it cannot check if the provided LAPACK library works.")
301+
set(LATESTLAPACK_FOUND TRUE)
293302
endif()
294303
endif()
295304

@@ -350,6 +359,7 @@ endif()
350359
# Cache export target
351360
set(LAPACK_INSTALL_EXPORT_NAME_CACHE ${LAPACK_INSTALL_EXPORT_NAME})
352361
if(BUILD_TESTING OR LAPACKE_WITH_TMG)
362+
enable_language(Fortran)
353363
if(LATESTLAPACK_FOUND AND LAPACKE_WITH_TMG)
354364
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
355365
# Check if dlatms (part of tmg) is found

0 commit comments

Comments
 (0)