Skip to content

Commit

Permalink
Better intel compiler detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ljacobson64 committed May 21, 2024
1 parent af1534a commit 90d8de4
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(MCNP)
cmake_minimum_required(VERSION 2.8)
project(MCNP)
enable_language(Fortran)

# Make the scripts in the "cmake" directory available to CMake
Expand Down
6 changes: 3 additions & 3 deletions MCNP514/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ else ()
endif ()

# C compiler flags
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (INTEL_C)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcmodel=medium")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pc64")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
endif ()

# Fortran compiler flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-vec")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 1024")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
Expand All @@ -49,7 +49,7 @@ add_definitions(-DTVERS="1.40")
add_definitions(-DLODDAT="${ENV_DATE}")
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
add_definitions(-DDIRACCESS_RECL_WORDS=ON)
else ()
Expand Down
6 changes: 3 additions & 3 deletions MCNP515/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ else ()
endif ()

# C compiler flags
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (INTEL_C)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcmodel=medium")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pc64")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
endif ()

# Fortran compiler flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-vec")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 1024")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
Expand All @@ -49,7 +49,7 @@ add_definitions(-DTVERS="1.51")
add_definitions(-DLODDAT="${ENV_DATE}")
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
add_definitions(-DDIRACCESS_RECL_WORDS=ON)
else ()
Expand Down
6 changes: 3 additions & 3 deletions MCNP516/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ else ()
endif ()

# C compiler flags
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (INTEL_C)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcmodel=medium")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pc64")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
endif ()

# Fortran compiler flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-vec")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 1024")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
Expand All @@ -49,7 +49,7 @@ add_definitions(-DTVERS="1.60")
add_definitions(-DLODDAT="${ENV_DATE}")
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
add_definitions(-DDIRACCESS_RECL_WORDS=ON)
else ()
Expand Down
6 changes: 3 additions & 3 deletions MCNP602/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ else ()
endif ()

# C compiler flags
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (INTEL_C)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcmodel=medium")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pc64")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
endif ()

# Fortran compiler flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-vec")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 1024")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
Expand Down Expand Up @@ -68,7 +68,7 @@ add_definitions(-DALPHA_VERSION=ON)
add_definitions(-DLANL=ON)
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
add_definitions(-DDIRACCESS_RECL_WORDS=ON)
else ()
Expand Down
6 changes: 3 additions & 3 deletions MCNP610/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ else ()
endif ()

# C compiler flags
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (INTEL_C)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcmodel=medium")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pc64")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
endif ()

# Fortran compiler flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-vec")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 1024")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
Expand All @@ -65,7 +65,7 @@ add_definitions(-DTVERS="1.0")
add_definitions(-DLODDAT="${ENV_DATE}")
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
add_definitions(-DDIRACCESS_RECL_WORDS=ON)
else ()
Expand Down
6 changes: 3 additions & 3 deletions MCNP611/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ else ()
endif ()

# C compiler flags
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (INTEL_C)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcmodel=medium")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pc64")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
endif ()

# Fortran compiler flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-vec")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 1024")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
Expand Down Expand Up @@ -67,7 +67,7 @@ add_definitions(-DTVERS="6.1.1b")
add_definitions(-DLODDAT="${ENV_DATE}")
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
add_definitions(-DDIRACCESS_RECL_WORDS=ON)
else ()
Expand Down
8 changes: 4 additions & 4 deletions MCNP620/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ endif ()

# C compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (NOT INTEL_C)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common")
endif ()

# CXX compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if (NOT INTEL_CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common")
endif ()

# Fortran compiler flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -free")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 1024")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
Expand Down Expand Up @@ -69,7 +69,7 @@ add_definitions(-DTVERS="6.2.0")
add_definitions(-DLODDAT="${ENV_DATE}")
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
else ()
add_definitions(-DGFORTRAN=ON)
Expand Down
2 changes: 1 addition & 1 deletion MCNPX27/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ add_definitions(-DNO_PAW=ON)
add_definitions(-DLINUX=ON)
add_definitions(-DUNIX=ON)
add_definitions(-DCHEAP=ON)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (INTEL_FORTRAN)
add_definitions(-DINTEL=ON)
else ()
add_definitions(-DGFORT=ON)
Expand Down
26 changes: 26 additions & 0 deletions cmake/mcnp_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,32 @@ macro (mcnp_setup_build)
execute_process(COMMAND uname -s OUTPUT_VARIABLE ENV_OS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND date +%m/%d/%y OUTPUT_VARIABLE ENV_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND date +%H:%M:%S OUTPUT_VARIABLE ENV_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)

# Determine if intel compilers are being used
if (CMAKE_C_COMPILER_ID STREQUAL "Intel" OR
CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
set(INTEL_C TRUE)
else ()
set(INTEL_C FALSE)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR
CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
set(INTEL_CXX TRUE)
else ()
set(INTEL_CXX FALSE)
endif ()
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR
CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
set(INTEL_FORTRAN TRUE)
else ()
set(INTEL_FORTRAN FALSE)
endif ()
message(STATUS "CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_Fortran_COMPILER_ID: ${CMAKE_Fortran_COMPILER_ID}")
message(STATUS "INTEL_C: ${INTEL_C}")
message(STATUS "INTEL_CXX: ${INTEL_CXX}")
message(STATUS "INTEL_FORTRAN: ${INTEL_FORTRAN}")
endmacro ()

macro (mcnp_setup_options)
Expand Down

0 comments on commit 90d8de4

Please sign in to comment.