Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 51 additions & 3 deletions cmake/OpenfastFortranOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
# - set_fast_intel_fortran
# - set_fast_intel_fortran_posix
# - set_fast_intel_fortran_windows
# - set_fast_flang
# - set_fast_llvm_flang
#
################################################################################

Expand All @@ -40,10 +42,13 @@
macro(set_fast_fortran)
get_filename_component(FCNAME "${CMAKE_Fortran_COMPILER}" NAME)

# Abort if we do not have gfortran or Intel Fortran Compiler.
# Abort if we do not have gfortran, Intel Fortran, or a Flang compiler.
# Note: CMake reports Classic Flang (and Classic-based ROCm Flang) as "Flang",
# and the modern LLVM Flang (flang-new / flang) as "LLVMFlang" (CMake >= 3.24).
if (NOT (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" OR
${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel" OR
${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang"))
${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang" OR
${CMAKE_Fortran_COMPILER_ID} STREQUAL "LLVMFlang"))
message(FATAL_ERROR "OpenFAST requires GFortran, Intel, or Flang Compiler. Compiler detected by CMake: ${FCNAME}.")
endif()

Expand All @@ -52,13 +57,17 @@ macro(set_fast_fortran)
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
if("${CMAKE_Fortran_COMPILER_VERSION}" STREQUAL "")
message(WARNING "A version of GNU GFortran greater than 4.6.0 is required but CMake could not detect your GFortran version.")
elseif("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "4.6.0")
elseif("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "4.6.0")
message(FATAL_ERROR "A version of GNU GFortran greater than 4.6.0 is required. GFortran version detected by CMake: ${CMAKE_Fortran_COMPILER_VERSION}.")
endif()
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
if("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "11")
message(FATAL_ERROR "A version of Intel ifort greater than 11 is required. ifort version detected by CMake: ${CMAKE_Fortran_COMPILER_VERSION}.")
endif()
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "LLVMFlang")
if("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_LESS "20")
message(WARNING "LLVM Flang ${CMAKE_Fortran_COMPILER_VERSION} detected. OpenFAST has only been tested with LLVM Flang 23 and newer.")
endif()
endif()

# Force all .mod files to be stored in a single directory
Expand All @@ -73,6 +82,8 @@ macro(set_fast_fortran)
set_fast_intel_fortran()
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang")
set_fast_flang()
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "LLVMFlang")
set_fast_llvm_flang()
endif()

# If double precision option enabled, set preprocessor define to use
Expand Down Expand Up @@ -256,3 +267,40 @@ macro(set_fast_flang)

check_f2008_features()
endmacro(set_fast_flang)

#
# set_fast_llvm_flang - Customizations for the modern LLVM Flang compiler
#
macro(set_fast_llvm_flang)

set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-backslash -cpp -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

# LLVM Flang fuses multiply-adds (FMA) by default on targets that support them (e.g. arm64).
# Several OpenFAST time-step consistency checks (e.g. Conv_Rdtn_UpdateDiscState in HydroDyn)
# compare `Time - n*DT` against EPSILON and fail when the product is not rounded separately;
# disabling contraction also keeps results consistent with the regression-test baselines.
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffp-contract=off")

# On macOS, CMake's Darwin platform module gives Fortran the clang-style shared library
# flags (-dynamiclib, -install_name), which the flang driver rejects. Use the equivalent
# driver/linker spellings instead.
if(APPLE)
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS "-Wl,-bundle -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Xlinker -install_name -Xlinker")
endif()

# If double precision, make default reals 8 bytes. As with gfortran, LLVM Flang's
# -fdefault-real-8 on its own promotes DOUBLE PRECISION to REAL(16), which breaks the
# interfaces to the F77 NetLib routines (and REAL(16) is not available on all targets,
# e.g. arm64 macOS), so -fdefault-double-8 is required to keep DOUBLE PRECISION at 8 bytes.
# LLVM Flang has no -fno-default-real-8, so sources that must not be promoted (FFTPACK)
# are handled in modules/nwtc-library by stripping these flags in a separate directory scope.
if (DOUBLE_PRECISION)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8")
endif()

check_f2008_features()
endmacro(set_fast_llvm_flang)
18 changes: 9 additions & 9 deletions glue-codes/labview/src/WaveTank.f90
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ subroutine WaveTank_Init( &

! return rootname
RootName_C = c_null_char
RootName_C = transfer(trim(SimSettings%Sim%OutRootName),RootName_C)
RootName_C = transfer(trim(SimSettings%Sim%OutRootName)//c_null_char, RootName_C, size(RootName_C))

! If SendScreenToFile - send to file <OutRootName>.screen.log if true
if (SimSettings%Outs%SendScreenToFile) then
Expand All @@ -173,7 +173,7 @@ subroutine WaveTank_Init( &

! VTK directory
WrVTK_Dir_C = c_null_char
WrVTK_Dir_C = transfer( trim(SimSettings%Viz%WrVTK_Dir), WrVTK_Dir_C )
WrVTK_Dir_C = transfer( trim(SimSettings%Viz%WrVTK_Dir)//c_null_char, WrVTK_Dir_C, size(WrVTK_Dir_C) )
! return VTKdir
VTKdir_C = c_null_char
if (SimSettings%Viz%WrVTK > 0_c_int) VTKdir_C = WrVTK_Dir_C
Expand Down Expand Up @@ -224,8 +224,8 @@ subroutine WaveTank_Init( &
if (Failed_c('SeaSt_C_PreInit')) return

SS_InputFile_C = c_null_char
SS_InputFile_C = transfer(trim(SimSettings%ModSettings%SS_InputFile ), SS_InputFile_C )
OutRootName_C = transfer(trim(SimSettings%Sim%OutRootName)//'.SeaSt'//c_null_char, OutRootName_C)
SS_InputFile_C = transfer(trim(SimSettings%ModSettings%SS_InputFile )//c_null_char, SS_InputFile_C, size(SS_InputFile_C) )
OutRootName_C = transfer(trim(SimSettings%Sim%OutRootName)//'.SeaSt'//c_null_char, OutRootName_C, size(OutRootName_C))
call SeaSt_C_Init( &
SS_InputFile_C, &
OutRootName_C, &
Expand Down Expand Up @@ -259,8 +259,8 @@ subroutine WaveTank_Init( &
!FIXME: this interface will change!!! -- Split with PreInit
!FIXME: add WrVTK_Dir_C, SimSettings%Viz%WrVTK, SimSettings%Viz%WrVTK_DT
MD_InputFile_C = c_null_char
MD_InputFile_C = transfer(trim(SimSettings%ModSettings%MD_InputFile ), MD_InputFile_C )
OutRootName_C = transfer(trim(SimSettings%Sim%OutRootName)//'.MD'//c_null_char, OutRootName_C)
MD_InputFile_C = transfer(trim(SimSettings%ModSettings%MD_InputFile )//c_null_char, MD_InputFile_C, size(MD_InputFile_C) )
OutRootName_C = transfer(trim(SimSettings%Sim%OutRootName)//'.MD'//c_null_char, OutRootName_C, size(OutRootName_C))
call MD_C_Init( &
0_c_int, & !< InputFilePassed: 0 for file, 1 for string
c_loc(MD_InputFile_C(1)), &
Expand Down Expand Up @@ -346,10 +346,10 @@ subroutine WaveTank_Init( &
if (Failed_c('ADI_C_SetupRotor')) return

AD_InputFile_C = c_null_char
AD_InputFile_C = transfer(trim(SimSettings%ModSettings%AD_InputFile ), AD_InputFile_C )
AD_InputFile_C = transfer(trim(SimSettings%ModSettings%AD_InputFile )//c_null_char, AD_InputFile_C, size(AD_InputFile_C) )
IfW_InputFile_C = c_null_char
IfW_InputFile_C = transfer(trim(SimSettings%ModSettings%IfW_InputFile), IfW_InputFile_C)
OutRootName_C = transfer(trim(SimSettings%Sim%OutRootName)//'.ADI'//c_null_char, OutRootName_C)
IfW_InputFile_C = transfer(trim(SimSettings%ModSettings%IfW_InputFile)//c_null_char, IfW_InputFile_C, size(IfW_InputFile_C))
OutRootName_C = transfer(trim(SimSettings%Sim%OutRootName)//'.ADI'//c_null_char, OutRootName_C, size(OutRootName_C))
call ADI_C_Init( &
0, & ! ADinputFilePassed; 0 for file, 1 for string
c_loc(AD_InputFile_C(1)), & ! ADinputFileString_C; Input file as a single string with lines delineated by C_NULL_CHAR
Expand Down
2 changes: 1 addition & 1 deletion modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7365,7 +7365,7 @@ subroutine AD_InitVars(iR, u, p, x, z, OtherState, y, m, InitOut, InputFileData,
Flags=VF_Linearize + VF_RotFrame, &
Num=p%NumBlNds, &
Perturb=Perturb, &
LinNames=[('User property on blade '//trim(Num2LStr(j))//', node '//trim(Num2LStr(i))//', -', i = 1, p%NumBlNds)])
LinNames=[(MV_LinName('User property on blade '//trim(Num2LStr(j))//', node '//trim(Num2LStr(i))//', -'), i = 1, p%NumBlNds)])
end do

! Extended inputs
Expand Down
4 changes: 3 additions & 1 deletion modules/aerodyn/src/FVW.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ module FVW
!! The parameters are set here and not changed during the simulation.
!! The initial states and initial guess for the input are defined.
subroutine FVW_Init(AFInfo, InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat, ErrMsg )
use OMP_LIB ! wrap with #ifdef _OPENMP if this causes an issue
#ifdef _OPENMP
use OMP_LIB
#endif
type(AFI_ParameterType), intent(in ) :: AFInfo(:) !< The airfoil parameter data, temporary, for UA..
type(FVW_InitInputType), intent(inout) :: InitInp !< Input data for initialization routine (inout so we can use MOVE_ALLOC)
type(FVW_InputType), intent( out) :: u !< An initial guess for the input; input mesh must be defined
Expand Down
2 changes: 2 additions & 0 deletions modules/aerodyn/src/FVW_BiotSavart.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
module FVW_BiotSavart

use NWTC_Library, only: ReKi, IntKi, Pi, EqualRealNos
#ifdef _OPENMP
use OMP_LIB
#endif

implicit none

Expand Down
4 changes: 2 additions & 2 deletions modules/awae/src/AWAE_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ subroutine ReadLowResWindVTK(n, p, Vamb_Low, errStat, errMsg)
errStat = ErrID_None
errMsg = ""

FileName = transfer(trim(p%WindFilePath)//trim(PathSep)//"Low"//trim(PathSep)//"Amb.t"//trim(Num2LStr(n))//".vtk"//c_null_char, FileName)
FileName = transfer(trim(p%WindFilePath)//trim(PathSep)//"Low"//trim(PathSep)//"Amb.t"//trim(Num2LStr(n))//".vtk"//c_null_char, FileName, size(FileName))
call ReadVTK_inflow_info(FileName, desc, dims, origin, gridSpacing, vecLabel, Vamb_Low, 1, ErrStat, ErrMsg)
if (ErrStat /= ErrID_None) ErrMsg = "ReadLowResWindVTK:"//trim(ErrMsg)

Expand All @@ -152,7 +152,7 @@ subroutine ReadHighResWindVTK(nt, n, p, Vamb_high, errStat, errMsg)
errStat = ErrID_None
errMsg = ""

FileName = transfer(trim(p%WindFilePath)//trim(PathSep)//"HighT"//trim(num2lstr(nt))//trim(PathSep)//"Amb.t"//trim(num2lstr(n))//".vtk"//c_null_char, FileName)
FileName = transfer(trim(p%WindFilePath)//trim(PathSep)//"HighT"//trim(num2lstr(nt))//trim(PathSep)//"Amb.t"//trim(num2lstr(n))//".vtk"//c_null_char, FileName, size(FileName))
call ReadVTK_inflow_info(FileName, desc, dims, origin, gridSpacing, vecLabel, Vamb_high, 1, ErrStat, ErrMsg)
if (ErrStat /= ErrID_None) ErrMsg = "ReadHighResWindVTK:"//trim(ErrMsg)

Expand Down
8 changes: 4 additions & 4 deletions modules/elastodyn/src/ElastoDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11263,14 +11263,14 @@ subroutine ED_InitVars(u, p, x, y, m, Vars, InputFileData, Linearize, ErrStat, E
Num=p%NumBl, &
Flags=VF_RotFrame + VF_Linearize + VF_2PI, &
Perturb=2.0_R8Ki * D2R_D, &
LinNames=[('Blade '//trim(num2lstr(i))//' pitch command, rad', i=1,p%NumBl)])
LinNames=[(MV_LinName('Blade '//trim(num2lstr(i))//' pitch command, rad'), i=1,p%NumBl)])

call MV_AddVar(Vars%u, "BlPitchMom", FieldScalar, &
DL=DatLoc(ED_u_BlPitchMom), iAry=1, &
Num=p%NumBl, &
Flags=VF_RotFrame + VF_Linearize, &
Perturb=MaxTorque / 100.0_R8Ki, &
LinNames=[('Blade '//trim(num2lstr(i))//' pitch moment, Nm', i=1,p%NumBl)])
LinNames=[(MV_LinName('Blade '//trim(num2lstr(i))//' pitch moment, Nm'), i=1,p%NumBl)])

call MV_AddVar(Vars%u, "YawMom", FieldScalar, &
DL=DatLoc(ED_u_YawMom), &
Expand Down Expand Up @@ -11334,12 +11334,12 @@ subroutine ED_InitVars(u, p, x, y, m, Vars, InputFileData, Linearize, ErrStat, E
call MV_AddVar(Vars%y, 'BlPitch', FieldScalar, &
DatLoc(ED_y_BlPitch), &
Num=p%NumBl, &
LinNames=[('Blade '//trim(num2lstr(i))//' pitch angle, rad', i=1,p%NumBl)])
LinNames=[(MV_LinName('Blade '//trim(num2lstr(i))//' pitch angle, rad'), i=1,p%NumBl)])

call MV_AddVar(Vars%y, 'BlPRate', FieldScalar, &
DatLoc(ED_y_BlPRate), &
Num=p%NumBl, &
LinNames=[('Blade '//trim(num2lstr(i))//' pitch rate, rad/s', i=1,p%NumBl)])
LinNames=[(MV_LinName('Blade '//trim(num2lstr(i))//' pitch rate, rad/s'), i=1,p%NumBl)])

call MV_AddMeshVar(Vars%y, 'Nacelle', MotionFields, &
DatLoc(ED_y_NacelleMotion), &
Expand Down
8 changes: 4 additions & 4 deletions modules/extptfm/src/ExtPtfm_MCKF.f90
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ subroutine ExtPtfm_InitVars(u, p, x, y, m, Vars, InputFileData, Linearize, ErrSt
Num=size(u%Fm), &
Flags = ior(VF_Linearize,VF_Solve), &
Perturb = 2.0_R8Ki*D2R_D, & ! The inertias of Craig-Bampton modes are normalized to O(1)
LinNames=[('Follower mode '//trim(num2lstr(i))//' forcing, -', i=1,size(u%Fm))])
LinNames=[(MV_LinName('Follower mode '//trim(num2lstr(i))//' forcing, -'), i=1,size(u%Fm))])
end if

!---------------------------------------------------------------------------
Expand All @@ -346,19 +346,19 @@ subroutine ExtPtfm_InitVars(u, p, x, y, m, Vars, InputFileData, Linearize, ErrSt
DL=DatLoc(ExtPtfm_y_qm), &
Num=size(y%qm), &
Flags=VF_Solve, &
LinNames=[('Follower mode '//trim(num2lstr(i))//' displacement, -', i=1,size(y%qm))])
LinNames=[(MV_LinName('Follower mode '//trim(num2lstr(i))//' displacement, -'), i=1,size(y%qm))])

call MV_AddVar(Vars%y, "qmdot", FieldScalar, &
DL=DatLoc(ExtPtfm_y_qmdot), &
Num=size(y%qmdot), &
Flags=VF_Solve, &
LinNames=[('Follower mode '//trim(num2lstr(i))//' velocity, -/s', i=1,size(y%qmdot))])
LinNames=[(MV_LinName('Follower mode '//trim(num2lstr(i))//' velocity, -/s'), i=1,size(y%qmdot))])

call MV_AddVar(Vars%y, "qmdotdot", FieldScalar, &
DL=DatLoc(ExtPtfm_y_qmdotdot), &
Num=size(y%qmdotdot), &
Flags=VF_Solve, &
LinNames=[('Follower mode '//trim(num2lstr(i))//' acceleration, -/s^2', i=1,size(y%qmdotdot))])
LinNames=[(MV_LinName('Follower mode '//trim(num2lstr(i))//' acceleration, -/s^2'), i=1,size(y%qmdotdot))])
end if

if ( p%NumOuts > 0_IntKi ) then
Expand Down
12 changes: 6 additions & 6 deletions modules/hydrodyn/src/HydroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ subroutine HydroDyn_InitVars(Vars, u, p, x, y, m, InitOut, InputFileData, Linear
Flags=VF_DerivOrder1, &
Num=p%WAMIT(k)%SS_Exctn%numStates, &
Perturb=20000.0_R8Ki * D2R_D, &
LinNames=[((trim(BodyDesc)//'Exctn'//trim(dofLabels(j))//Num2LStr(i), i = 1, p%WAMIT(k)%SS_Exctn%spDOF(j)), j = 1, 6)])
LinNames=[((MV_LinName(trim(BodyDesc)//'Exctn'//trim(dofLabels(j))//Num2LStr(i)), i = 1, p%WAMIT(k)%SS_Exctn%spDOF(j)), j = 1, 6)])
end do

do k = 1, p%nWAMITObj
Expand All @@ -1060,7 +1060,7 @@ subroutine HydroDyn_InitVars(Vars, u, p, x, y, m, InitOut, InputFileData, Linear
Flags=VF_DerivOrder1, &
Num=p%WAMIT(k)%SS_Rdtn%numStates, &
Perturb=2.0_R8Ki * D2R_D , &
LinNames=[((trim(BodyDesc)//'Rdtn'//trim(dofLabels(j))//Num2LStr(i), i = 1, p%WAMIT(k)%SS_Rdtn%spDOF(j)), j = 1, 6)])
LinNames=[((MV_LinName(trim(BodyDesc)//'Rdtn'//trim(dofLabels(j))//Num2LStr(i)), i = 1, p%WAMIT(k)%SS_Rdtn%spDOF(j)), j = 1, 6)])
end do

!----------------------------------------------------------------------------
Expand Down Expand Up @@ -1094,21 +1094,21 @@ subroutine HydroDyn_InitVars(Vars, u, p, x, y, m, InitOut, InputFileData, Linear
Num=size(u%qAddDOF), &
Flags = ior(VF_Linearize,VF_Solve), &
Perturb = PerturbRot, &
LinNames=[('Generalized DOF '//trim(num2lstr(i))//' displacement, -', i=1,size(u%qAddDOF))])
LinNames=[(MV_LinName('Generalized DOF '//trim(num2lstr(i))//' displacement, -'), i=1,size(u%qAddDOF))])

call MV_AddVar(Vars%u, "qAddDOFDot", FieldScalar, &
DL=DatLoc(HydroDyn_u_qAddDOFDot), &
Num=size(u%qAddDOFDot), &
Flags = ior(VF_Linearize,VF_Solve), &
Perturb = PerturbRot, &
LinNames=[('Generalized DOF '//trim(num2lstr(i))//' velocity, -/s', i=1,size(u%qAddDOFDot))])
LinNames=[(MV_LinName('Generalized DOF '//trim(num2lstr(i))//' velocity, -/s'), i=1,size(u%qAddDOFDot))])

call MV_AddVar(Vars%u, "qAddDOFDotDot", FieldScalar, &
DL=DatLoc(HydroDyn_u_qAddDOFDotDot), &
Num=size(u%qAddDOFDotDot), &
Flags = ior(VF_Linearize,VF_Solve), &
Perturb = PerturbRot, &
LinNames=[('Generalized DOF '//trim(num2lstr(i))//' acceleration, -/s^2', i=1,size(u%qAddDOFDotDot))])
LinNames=[(MV_LinName('Generalized DOF '//trim(num2lstr(i))//' acceleration, -/s^2'), i=1,size(u%qAddDOFDotDot))])
end if

call MV_AddVar(Vars%u, "WaveElev0", FieldScalar, DatLoc(HydroDyn_u_WaveElev0), &
Expand Down Expand Up @@ -1140,7 +1140,7 @@ subroutine HydroDyn_InitVars(Vars, u, p, x, y, m, InitOut, InputFileData, Linear
DL=DatLoc(HydroDyn_y_FAddDOF), &
Num=size(y%FAddDOF), &
Flags=VF_Solve, &
LinNames=[('Generalized DOF '//trim(num2lstr(i))//' force, -', i=1,size(y%FAddDOF))])
LinNames=[(MV_LinName('Generalized DOF '//trim(num2lstr(i))//' force, -'), i=1,size(y%FAddDOF))])
end if

call MV_AddVar(Vars%y, "WriteOutput", FieldScalar, DatLoc(HydroDyn_y_WriteOutput), &
Expand Down
4 changes: 2 additions & 2 deletions modules/hydrodyn/src/HydroDyn_C_Binding.f90
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ subroutine SetErr(ErrStat, ErrMsg, ErrStat_C, ErrMsg_C)
integer :: i
ErrStat_C = ErrStat ! We will send back the same error status that is used in OpenFAST
if (ErrMsgLen > ErrMsgLen_C-1) then ! If ErrMsgLen is > the space in ErrMsg_C, do not copy everything over
ErrMsg_C = TRANSFER( trim(ErrMsg(1:ErrMsgLen_C-1))//C_NULL_CHAR, ErrMsg_C )
ErrMsg_C = TRANSFER( trim(ErrMsg(1:ErrMsgLen_C-1))//C_NULL_CHAR, ErrMsg_C, SIZE(ErrMsg_C) )
else
ErrMsg_C = TRANSFER( trim(ErrMsg)//C_NULL_CHAR, ErrMsg_C )
ErrMsg_C = TRANSFER( trim(ErrMsg)//C_NULL_CHAR, ErrMsg_C, SIZE(ErrMsg_C) )
endif
end subroutine SetErr

Expand Down
12 changes: 12 additions & 0 deletions modules/nwtc-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang")
if(APPLE OR UNIX)
set(NWTC_SYS_FILE src/SysFlangLinux.f90)
endif()
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "LLVMFlang")
# SysGnuLinux.f90 can't be used: LLVM Flang does not provide the FSTAT extension
if(APPLE OR UNIX)
set(NWTC_SYS_FILE src/SysFlangLinux.f90)
endif()
endif ()

# System file
Expand Down Expand Up @@ -170,6 +175,13 @@ elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "^Intel")
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang")
set_source_files_properties(${FFTPACK_SOURCES} PROPERTIES COMPILE_FLAGS
"-fno-default-real-8")
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "LLVMFlang")
# LLVM Flang has no -fno-default-real-8 (and per-source flags cannot remove a global
# flag), so FFTPACK is compiled as an object library in its own directory scope with
# -fdefault-real-8/-fdefault-double-8 stripped from CMAKE_Fortran_FLAGS.
add_subdirectory(src/NetLib/fftpack)
list(REMOVE_ITEM NWTCLIBS_SOURCES ${FFTPACK_SOURCES})
list(APPEND NWTCLIBS_SOURCES $<TARGET_OBJECTS:nwtc_fftpack_r4>)
endif()

# Recursive use of routine in qk61/dqk61 will trigger errors in debug
Expand Down
Loading
Loading