Skip to content

Commit

Permalink
Revert "Start to modernize Fortran CMake"
Browse files Browse the repository at this point in the history
This reverts commit 30b8df1.
  • Loading branch information
lefticus committed Dec 31, 2020
1 parent 54fc130 commit 1579be0
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 82 deletions.
30 changes: 14 additions & 16 deletions src/AppGPostProcess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,47 @@ set(SRC AppGPostProcess.f90)

set(STATIC_EXE FALSE)

add_library(AppGPostProcessOptions INTERFACE)
if(APPLE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(AppGPostProcessOptions INTERFACE -fpp)
target_compile_options(AppGPostProcessOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
else()
if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR})
target_compile_options(AppGPostProcessOptions INTERFACE -cpp)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
endif()
target_compile_options(AppGPostProcessOptions INTERFACE -ffree-line-length-200)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-200")
endif()
elseif(UNIX)
set(CMAKE_SKIP_RPATH TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(AppGPostProcessOptions INTERFACE -fpp)
target_compile_options(AppGPostProcessOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
else()
if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR})
target_compile_options(AppGPostProcessOptions INTERFACE -cpp)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
endif()
target_compile_options(AppGPostProcessOptions INTERFACE -static)
target_compile_options(AppGPostProcessOptions INTERFACE -ffree-line-length-200)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-200")
set(STATIC_EXE TRUE)
endif()
else() # Windows
set(STATIC_EXE TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
# Set release flags to be empty
set(CMAKE_Fortran_FLAGS_RELEASE "")
target_compile_options(AppGPostProcessOptions INTERFACE /libs:static)
target_compile_options(AppGPostProcessOptions INTERFACE /fpp)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /fpp")
else()
target_compile_options(AppGPostProcessOptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
if(NOT "Ninja" STREQUAL ${CMAKE_GENERATOR})
target_compile_options(AppGPostProcessOptions INTERFACE -cpp)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
endif()
target_compile_options(AppGPostProcessOptions INTERFACE -ffree-line-length-200)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-200")
endif()
endif()

set(SKIP_BUILD_RPATH TRUE)
add_executable(AppGPostProcess ${SRC})
target_link_libraries(AppGPostProcess PRIVATE AppGPostProcessOptions)
set_target_properties(AppGPostProcess PROPERTIES FOLDER Auxiliary)

install(TARGETS AppGPostProcess DESTINATION PostProcess)
Expand Down
48 changes: 12 additions & 36 deletions src/Basement/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,68 +21,44 @@ set(SRC

set(STATIC_EXE FALSE)

add_library(BasementOptions INTERFACE)
if(APPLE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(BasementOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
else()
target_compile_options(BasementOptions INTERFACE -ffloat-store)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffloat-store")
endif()
elseif(UNIX)
set(CMAKE_SKIP_RPATH TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(BasementOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
else()
target_compile_options(BasementOptions INTERFACE -ffloat-store)
target_compile_options(BasementOptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffloat-store")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
set(STATIC_EXE TRUE)
endif()
else() # Windows
set(STATIC_EXE TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
# Set release flags to be empty
set(CMAKE_Fortran_FLAGS_RELEASE "")
target_compile_options(
BasementOptions
INTERFACE /nologo
/debug:minimal
/O2
/Oy-
/assume:buffered_io
/noaltparam
/fpscomp:nolibs
/fpe:0
/fp:fast=2
/traceback
/check:uninit
/libs:static
/threads
/c
/assume:protect-parens
/Qprec-div
/Qprec-sqrt
/Qimf-precision:high
/Qimf-arch-consistency:true
/Qvec-)
set(CMAKE_Fortran_FLAGS
"/nologo /debug:minimal /O2 /Oy- /assume:buffered_io /noaltparam /fpscomp:nolibs /fpe:0 /fp:fast=2 /traceback /check:uninit /libs:static /threads /c /assume:protect-parens /Qprec-div /Qprec-sqrt /Qimf-precision:high /Qimf-arch-consistency:true /Qvec-"
)
else()
target_compile_options(BasementOptions INTERFACE -static)
target_compile_options(BasementOptions INTERFACE -ffloat-store)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffloat-store")
endif()
endif()

set(SKIP_BUILD_RPATH TRUE)
add_executable(Basement ${SRC})

set_target_properties(
Basement PROPERTIES COMPILE_FLAGS
"-O1 -ffree-line-length-200")
set_target_properties(Basement PROPERTIES COMPILE_FLAGS "-O1 -ffree-line-length-200 ${SHARED_FLAGS}")
set_target_properties(Basement PROPERTIES FOLDER Auxiliary)
target_link_libraries(Basement PRIVATE BasementOptions)

install(TARGETS Basement DESTINATION PreProcess/GrndTempCalc)
if(NOT ${STATIC_EXE})
include("${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ProjectMacros.cmake")
install_target_prereqs(Basement PreProcess/GrndTempCalc)
endif()
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../idd/BasementGHT.idd"
DESTINATION "PreProcess/GrndTempCalc/")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../idd/BasementGHT.idd" DESTINATION "PreProcess/GrndTempCalc/")
13 changes: 5 additions & 8 deletions src/ConvertESOMTR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,29 @@ set(STATIC_EXE FALSE)
set(SKIP_BUILD_RPATH TRUE)
add_executable(convertESOMTR ${SRC})
set_target_properties(convertESOMTR PROPERTIES FOLDER Auxiliary)
add_library(convertESOMTROptions INTERFACE)

if(APPLE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(convertESOMTROptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
endif()
elseif(UNIX)
set(CMAKE_SKIP_RPATH TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(convertESOMTROptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
else()
target_compile_options(convertESOMTROptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
set(STATIC_EXE TRUE)
endif()
else()
set(STATIC_EXE TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
# Set release flags to be empty
set(CMAKE_Fortran_FLAGS_RELEASE "")
target_compile_options(convertESOMTROptions INTERFACE /libs:static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static")
else()
target_compile_options(convertESOMTROptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
endif()
endif()
target_link_libraries(convertESOMTR PRIVATE convertESOMTROptions)


install(TARGETS convertESOMTR DESTINATION "PostProcess/convertESOMTRpgm/")
if(NOT ${STATIC_EXE})
Expand Down
16 changes: 6 additions & 10 deletions src/ParametricPreprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,36 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../Products")

set(SRC ParametricPreprocessor.f90)

add_library(ParametricPreprocessorOptions INTERFACE)

set(STATIC_EXE FALSE)

if(APPLE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(ParametricPreprocessorOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
endif()
elseif(UNIX)
set(CMAKE_SKIP_RPATH TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(ParametricPreprocessorOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
else()
target_compile_options(ParametricPreprocessorOptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
set(STATIC_EXE TRUE)
endif()
else()
set(STATIC_EXE TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
# Set release flags to be empty
set(CMAKE_Fortran_FLAGS_RELEASE "")
target_compile_options(ParametricPreprocessorOptions INTERFACE /libs:static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static")
else()
target_compile_options(ParametricPreprocessorOptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
endif()
endif()

set(SKIP_BUILD_RPATH true)
add_executable(ParametricPreprocessor ${SRC})
target_link_libraries(ParametricPreprocessor PRIVATE ParametricPreprocessorOptions)
set_target_properties(ParametricPreprocessor PROPERTIES FOLDER Auxiliary)

set_target_properties(ParametricPreprocessor PROPERTIES COMPILE_FLAGS -ffree-line-length-200)

set_target_properties(ParametricPreprocessor PROPERTIES COMPILE_FLAGS "-ffree-line-length-200 ${SHARED_FLAGS}")

install(TARGETS ParametricPreprocessor DESTINATION PreProcess/ParametricPreprocessor)
if(NOT ${STATIC_EXE})
Expand Down
14 changes: 5 additions & 9 deletions src/ReadVars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,32 @@ set(SRC ReadVarsESO.f90)

set(STATIC_EXE FALSE)

add_library(ReadVarsOptions INTERFACE)


if(APPLE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(ReadVarsOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
endif()
elseif(UNIX)
set(CMAKE_SKIP_RPATH TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
target_compile_options(ReadVarsOptions INTERFACE -static-intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static-intel")
else()
target_compile_options(ReadVarsOptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
set(STATIC_EXE TRUE)
endif()
else()
set(STATIC_EXE TRUE)
if(CMAKE_Fortran_COMPILER MATCHES "ifort")
# Set release flags to be empty
set(CMAKE_Fortran_FLAGS_RELEASE "")
target_compile_options(ReadVarsOptions INTERFACE /libs:static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static")
else()
target_compile_options(ReadVarsOptions INTERFACE -static)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -static")
endif()
endif()

set(SKIP_BUILD_RPATH true)
add_executable(ReadVarsESO ${SRC})
set_target_properties(ReadVarsESO PROPERTIES FOLDER Auxiliary)
target_link_libraries(ReadVarsESO PRIVATE ReadVarsOptions)

install(TARGETS ReadVarsESO DESTINATION PostProcess)
if(NOT ${STATIC_EXE})
Expand Down
2 changes: 1 addition & 1 deletion src/Slab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ add_executable(Slab ${SRC})
target_link_libraries(Slab PRIVATE SlabOptions)
set_target_properties(Slab PROPERTIES FOLDER Auxiliary)

set_target_properties(Slab PROPERTIES COMPILE_FLAGS "-ffree-line-length-200")
set_target_properties(Slab PROPERTIES COMPILE_FLAGS "-ffree-line-length-200 ${SHARED_FLAGS}")

install(TARGETS Slab DESTINATION PreProcess/GrndTempCalc)
if(NOT ${STATIC_EXE})
Expand Down
4 changes: 2 additions & 2 deletions src/Transition/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ else() # Windows
endif()
endif()

target_link_libraries(TransitionLib PRIVATE TransitionOptions)
target_compile_options(TransitionLib PUBLIC TransitionOptions)

list(LENGTH VERSIONS VERSIONS_SIZE)

Expand All @@ -138,7 +138,7 @@ foreach(i RANGE 1 ${end})
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LAST_NAME})
add_executable("${LAST_NAME}" ${SRC})
set_target_properties("${LAST_NAME}" PROPERTIES FOLDER Auxiliary)
target_link_libraries("${LAST_NAME}" PRIVATE TransitionLib TransitionOptions)
target_link_libraries("${LAST_NAME}" TransitionLib)

if("${i}" GREATER "22")
install(TARGETS "${LAST_NAME}" DESTINATION PreProcess/IDFVersionUpdater)
Expand Down

0 comments on commit 1579be0

Please sign in to comment.