Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
103 lines (88 loc) · 5.27 KB
/
Copy pathCMakeLists.txt
File metadata and controls
103 lines (88 loc) · 5.27 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# ! //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// !
# !
# ! Maintainers : support@fluidnumerics.com
# ! Official Repository : https://github.com/FluidNumerics/feq-parse/
# !
# ! Copyright © 2024 Fluid Numerics LLC
# !
# ! Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# !
# ! 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
# !
# ! 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
# ! the documentation and/or other materials provided with the distribution.
# !
# ! 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from
# ! this software without specific prior written permission.
# !
# ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# ! HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# ! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# ! THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# !
# ! //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// !
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
set(CMAKE_VERBOSE_MAKEFILE ON)
PROJECT(feqparse Fortran C)
SET(VERSION 0.0.0)
INCLUDE(FortranCInterface)
FortranCInterface_VERIFY()
IF(NOT FortranCInterface_VERIFIED_C)
MESSAGE(FATAL_ERROR "Fortran compiler must support C Interface")
ENDIF(NOT FortranCInterface_VERIFIED_C)
IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90)
MESSAGE(FATAL_ERROR "Fortran compiler does not support F90")
ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90)
# Default Fortran compiler flags
# Fortran compiler flags
message(CMAKE_Fortran_COMPILER_ID="${CMAKE_Fortran_COMPILER_ID}")
if( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" )
set( CMAKE_Fortran_FLAGS "-cpp -ffree-line-length-512" )
set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -C -Wall -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" )
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG} --coverage")
set( CMAKE_Fortran_FLAGS_PROFILE "-pg -O3")
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )
set( CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage")
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Intel" )
set( CMAKE_Fortran_FLAGS "-fpp" )
set( CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -debug all -check all -traceback" )
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG} -prof-gen=srcpos")
set( CMAKE_Fortran_FLAGS_PROFILE "-O3")
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "IntelLLVM" )
set( CMAKE_Fortran_FLAGS "-fpp" )
set( CMAKE_Fortran_FLAGS_DEBUG "-debug all -check all,nouninit -traceback" )
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available with ifx
set( CMAKE_Fortran_FLAGS_PROFILE "-O3")
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Flang" )
# Classic Flang (PGI-derived)
set( CMAKE_Fortran_FLAGS "-Mpreprocess" )
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -O0 -g -Wall -pedantic" )
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available
set( CMAKE_Fortran_FLAGS_PROFILE "-O3")
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "LLVMFlang" )
# LLVM Flang (flang-new, LLVM-based) - uses GCC-style flags
set( CMAKE_Fortran_FLAGS "-cpp" )
set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -Wall -pedantic" )
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available
set( CMAKE_Fortran_FLAGS_PROFILE "-O3")
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "NVHPC" )
set( CMAKE_Fortran_FLAGS "-Mpreprocess" )
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -O0 -Wall -C -g -traceback" )
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available with ifx
set( CMAKE_Fortran_FLAGS_PROFILE "-O3 -Mstack_arrays -Minfo")
set( CMAKE_Fortran_FLAGS_RELEASE "-O3 -Mstack_arrays -Minfo" )
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
endif()
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/src)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/test)
message("-- FEQPARSE ------------- cmake DONE --------------------")