Skip to content

Commit 6df18dd

Browse files
authored
The Windows version of Intel ifx does not add trailing underlines to symbols
1 parent eab9a77 commit 6df18dd

File tree

1 file changed

+74
-70
lines changed

1 file changed

+74
-70
lines changed

cmake/f_check.cmake

Lines changed: 74 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,74 @@
1-
##
2-
## Author: Hank Anderson <[email protected]>
3-
## Copyright: (c) Stat-Ease, Inc.
4-
## Created: 12/29/14
5-
## Last Modified: 12/29/14
6-
## Description: Ported from the OpenBLAS/f_check perl script.
7-
## This is triggered by prebuild.cmake and runs before any of the code is built.
8-
## Appends Fortran information to config.h and Makefile.conf.
9-
10-
# CMake vars set by this file:
11-
# F_COMPILER
12-
# FC
13-
# BU
14-
# NOFORTRAN
15-
# NEED2UNDERSCORES
16-
# FEXTRALIB
17-
18-
# Defines set by this file:
19-
# BUNDERSCORE
20-
# NEEDBUNDERSCORE
21-
# NEED2UNDERSCORES
22-
23-
include(CheckLanguage)
24-
check_language(Fortran)
25-
if(CMAKE_Fortran_COMPILER)
26-
enable_language(Fortran)
27-
else()
28-
set (NOFORTRAN 1)
29-
if (NOT NO_LAPACK)
30-
if (NOT XXXXX)
31-
message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK")
32-
set(C_LAPACK 1)
33-
if (INTERFACE64)
34-
set (CCOMMON_OPT "${CCOMMON_OPT} -DLAPACK_ILP64")
35-
endif ()
36-
set(TIMER "NONE")
37-
else ()
38-
message(STATUS "No Fortran compiler found, can build only BLAS")
39-
endif()
40-
endif()
41-
endif()
42-
43-
if (NOT ONLY_CBLAS)
44-
# run f_check (appends to TARGET files)
45-
46-
# TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
47-
# TODO: set FEXTRALIB flags a la f_check?
48-
49-
set(BU "_")
50-
file(APPEND ${TARGET_CONF_TEMP}
51-
"#define BUNDERSCORE _\n"
52-
"#define NEEDBUNDERSCORE 1\n"
53-
"#define NEED2UNDERSCORES 0\n")
54-
55-
else ()
56-
57-
#When we only build CBLAS, we set NOFORTRAN=2
58-
set(NOFORTRAN 2)
59-
set(NO_FBLAS 1)
60-
#set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
61-
set(BU "_")
62-
file(APPEND ${TARGET_CONF_TEMP}
63-
"#define BUNDERSCORE _\n"
64-
"#define NEEDBUNDERSCORE 1\n")
65-
endif()
66-
67-
if (CMAKE_Fortran_COMPILER)
68-
get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
69-
string(TOUPPER ${F_COMPILER} F_COMPILER)
70-
endif()
1+
##
2+
## Author: Hank Anderson <[email protected]>
3+
## Copyright: (c) Stat-Ease, Inc.
4+
## Created: 12/29/14
5+
## Last Modified: 12/29/14
6+
## Description: Ported from the OpenBLAS/f_check perl script.
7+
## This is triggered by prebuild.cmake and runs before any of the code is built.
8+
## Appends Fortran information to config.h and Makefile.conf.
9+
10+
# CMake vars set by this file:
11+
# F_COMPILER
12+
# FC
13+
# BU
14+
# NOFORTRAN
15+
# NEED2UNDERSCORES
16+
# FEXTRALIB
17+
18+
# Defines set by this file:
19+
# BUNDERSCORE
20+
# NEEDBUNDERSCORE
21+
# NEED2UNDERSCORES
22+
23+
include(CheckLanguage)
24+
check_language(Fortran)
25+
if(CMAKE_Fortran_COMPILER)
26+
enable_language(Fortran)
27+
else()
28+
set (NOFORTRAN 1)
29+
if (NOT NO_LAPACK)
30+
if (NOT XXXXX)
31+
message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK")
32+
set(C_LAPACK 1)
33+
if (INTERFACE64)
34+
set (CCOMMON_OPT "${CCOMMON_OPT} -DLAPACK_ILP64")
35+
endif ()
36+
set(TIMER "NONE")
37+
else ()
38+
message(STATUS "No Fortran compiler found, can build only BLAS")
39+
endif()
40+
endif()
41+
endif()
42+
43+
if (NOT ONLY_CBLAS)
44+
# run f_check (appends to TARGET files)
45+
46+
# TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
47+
# TODO: set FEXTRALIB flags a la f_check?
48+
if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND ${CMAKE_Fortran_COMPILER_ID} MATCHES "IntelLLVM"))
49+
set(BU "_")
50+
file(APPEND ${TARGET_CONF_TEMP}
51+
"#define BUNDERSCORE _\n"
52+
"#define NEEDBUNDERSCORE 1\n"
53+
"#define NEED2UNDERSCORES 0\n")
54+
else ()
55+
file(APPEND ${TARGET_CONF_TEMP}
56+
"#define NEEDBUNDERSCORE 0\n"
57+
"#define NEED2UNDERSCORES 0\n")
58+
endif()
59+
else ()
60+
61+
#When we only build CBLAS, we set NOFORTRAN=2
62+
set(NOFORTRAN 2)
63+
set(NO_FBLAS 1)
64+
#set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
65+
set(BU "_")
66+
file(APPEND ${TARGET_CONF_TEMP}
67+
"#define BUNDERSCORE _\n"
68+
"#define NEEDBUNDERSCORE 1\n")
69+
endif()
70+
71+
if (CMAKE_Fortran_COMPILER)
72+
get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
73+
string(TOUPPER ${F_COMPILER} F_COMPILER)
74+
endif()

0 commit comments

Comments
 (0)