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
35 changes: 30 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,43 @@ set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})

# Additional Fortran compiler flags.
#
# -fno-automatic: this was set in the original make_environment_gfortran_UBC file.
# To set additional compiler flags, you can set CMAKE_Fortran_FLAGS when invoking CMake.
# For example
#
# Note: optimization should be enabled on the Release target automatically.
# cmake -DCMAKE_Fortran_FLAGS="-fconvert=big-endian" ..
#
# If need be, you can also set up linker flags. E.g.:
# Note: there is no need to pass optimization flags explicitly (e.g. -O2) -- CMake enables
# -O2 automatically on the Release target. Similarly, -g is automatically set for the Debug
# target.
#
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgfortran")
# Similarly, additional linker options can be passed via CMAKE_EXE_LINKER_FLAGS, e.g.
#
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-automatic")
# cmake -DCMAKE_EXE_LINKER_FLAGS="-static-libgfortran" ..
#
# Default flags (in addition to CMake defaults):
#
# -fno-automatic / -save: these were set in the original Makefiles
#
# To disable GRASP-specific default flags, you can set GRASP_DEFAULT_FLAGS=FALSE when
# calling CMake with
#
# cmake -DGRASP_DEFAULT_FLAGS=FALSE ..
#
set(GRASP_DEFAULT_FLAGS TRUE CACHE BOOL "If TRUE (default), -fno-automatic (gfortran) or -save (ifort) is automatically set in CMAKE_Fortran_FLAGS.")
if(GRASP_DEFAULT_FLAGS)
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-automatic")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -save -mkl")
else()
message(WARNING "GRASP requires -fno-automatic or -save or equivalent, but is unable to determine the correct argument for this compiler (${CMAKE_Fortran_COMPILER_ID})")
endif()
endif()

message("Compiler flags etc. for this GRASP build:")
message("* GRASP_DEFAULT_FLAGS: ${GRASP_DEFAULT_FLAGS}")
message("* CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message("* CMAKE_Fortran_COMPILER_ID: ${CMAKE_Fortran_COMPILER_ID}")
message("* CMAKE_Fortran_COMPILER: ${CMAKE_Fortran_COMPILER}")
message("* CMAKE_Fortran_COMPILER_VERSION: ${CMAKE_Fortran_COMPILER_VERSION}")
message("* CMAKE_Fortran_FLAGS: ${CMAKE_Fortran_FLAGS}")
Expand Down
19 changes: 3 additions & 16 deletions src/lib/mpi90/sys_mkdir.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ subroutine sys_mkdir (dir, lendir, ierr)
!...Modified by Charlotte Froese Fischer
! Gediminas Gaigalas 10/05/17
!
! function 'system' and execute_command_line commented out
!cjb Jacek Bieron 2018 June 18
!
!-----------------------------------------------
! M o d u l e s
!-----------------------------------------------
Expand All @@ -28,25 +25,15 @@ subroutine sys_mkdir (dir, lendir, ierr)
integer, intent(in):: lendir
integer, intent(out):: ierr
character(len=255) mkdir_error_message
! character(len=*), parameter::iam = 'SUN' ! soly for machine
! character(len=len_trim (iam)), optional, intent(out):: machine

! integer system

mkdir_error_message = " no message passed from the shell "
ierr = -999

!cjb
! print*, dir(1:lendir)
! print*, dir(1:lendir)
!
ierr = system ('mkdir -p -m 775 ' // dir(1:lendir))
!cjb use EXECUTE_COMMAND_LINE if function 'system' is not supported
! call execute_command_line ('mkdir -p -m 775 ' // dir(1:lendir), &
! exitstat=ierr, cmdmsg=mkdir_error_message)
! ierr = system ('mkdir -p -m 775 ' // dir(1:lendir))
call execute_command_line ('mkdir -p -m 775 ' // dir(1:lendir), &
exitstat=ierr, cmdmsg=mkdir_error_message)
if (ierr.ne.0) then
print*, ' sys_mkdir error message = ', trim(mkdir_error_message)
! ' myid = ', myid
endif
return
end subroutine sys_mkdir