-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
28 lines (24 loc) · 1.05 KB
/
Copy pathCMakeLists.txt
File metadata and controls
28 lines (24 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# References:
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/languages/fortran/ForFortranExample
# https://fortranwiki.org/fortran/show/Build+tools
cmake_minimum_required (VERSION 3.12)
project (els)
enable_language (Fortran)
if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set (dialect "-ffree-form -std=f2008 -fimplicit-none -fopenmp -O3 -ffast-math")
set (extras "-fcheck=all -Wall -ggdb -O0")
endif ()
if (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set (dialect "-stand f08 -free -implicitnone -qopenmp -O3")
set (extras "-check bounds -O0")
endif ()
if (CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
set (dialect "-Minfo=accel -O3 -mp=multicore -Mnoopenmp -acc=gpu -fast")
set (extras "-Minfo=accel -O0 -Mbounds -mp=multicore")
add_compile_definitions(OPENACC)
endif ()
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${extras}")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}")
file (GLOB_RECURSE sources src/*.f90 src/*.F90)
add_executable(els.x ${sources})
target_link_libraries (els.x -lopenblas)