Skip to content

Commit d448582

Browse files
committed
use presets
1 parent c6bdfd2 commit d448582

6 files changed

Lines changed: 94 additions & 138 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
paths:
66
- "**/*.f90"
7-
- "**/*.F90"
87
- "**/*.cmake"
98
- "**/CMakeLists.txt"
109

@@ -31,13 +30,13 @@ jobs:
3130
steps:
3231
- uses: actions/checkout@v2
3332

34-
- run: cmake -B build -Drealbits=64
35-
- run: cmake --build build
33+
- run: cmake --preset=make -Drealbits=64
34+
- run: cmake --build build --parallel
3635
- run: ctest --output-on-failure
3736
working-directory: build
3837

39-
- run: cmake -B build -Drealbits=32
40-
- run: cmake --build build
38+
- run: cmake --preset=make -Drealbits=32
39+
- run: cmake --build build --parallel
4140
- run: ctest --output-on-failure
4241
working-directory: build
4342

@@ -48,4 +47,7 @@ jobs:
4847
steps:
4948
- uses: actions/checkout@v2
5049

51-
- run: ctest -S setup.cmake -VV
50+
- run: cmake --preset=makewin
51+
- run: cmake --build build --parallel
52+
- run: ctest --output-on-failure
53+
working-directory: build

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
2-
3-
if(NOT CMAKE_BUILD_TYPE)
4-
set(CMAKE_BUILD_TYPE Release CACHE STRING "default build type")
5-
endif()
1+
cmake_minimum_required(VERSION 3.14...3.20)
62

73
project(MapTran
84
LANGUAGES Fortran

CMakePresets.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"version": 1,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 19,
6+
"patch": 0
7+
},
8+
9+
"configurePresets": [
10+
{
11+
"name": "_default", "hidden": true,
12+
"binaryDir": "${sourceDir}/build",
13+
"cacheVariables": {"CMAKE_BUILD_TYPE": "Release"}
14+
},
15+
{
16+
"name": "ninja", "inherits": "_default",
17+
"displayName": "build with Ninja",
18+
"description": "Ninja is faster and more reliable than Make",
19+
"generator": "Ninja"
20+
},
21+
{
22+
"name": "notest", "inherits": "ninja",
23+
"displayName": "build with Ninja, omitting self-tests",
24+
"cacheVariables": {"BUILD_TESTING": false}
25+
},
26+
{
27+
"name": "gcc10", "inherits": "ninja",
28+
"displayName": "GCC-10",
29+
"description": "specify GCC-10 -- helpful for MacOS Homebrew to avoid Clang /usr/bin/gcc",
30+
"environment": {
31+
"CC": "gcc-10",
32+
"CXX": "g++-10",
33+
"FC": "gfortran-10"
34+
}
35+
},
36+
{
37+
"name": "make", "inherits": "_default",
38+
"displayName": "build with GNU Make: Linux/MacOS",
39+
"description": "build with GNU Make on Linux/MacOS",
40+
"generator": "Unix Makefiles"
41+
},
42+
{
43+
"name": "makegcc10", "inherits": ["make", "gcc10"],
44+
"displayName": "build with GNU Make and GCC",
45+
"description": "build with GNU Make and GCC -- useful for MacOS"
46+
},
47+
{
48+
"name": "makewin", "inherits": "_default",
49+
"displayName": "build with GNU Make: Windows",
50+
"description": "build with GNU Make on Windows",
51+
"generator": "MinGW Makefiles"
52+
},
53+
{
54+
"name": "intel", "inherits": "ninja",
55+
"displayName": "Intel Classic compiler: Linux/MacOS",
56+
"description": "build with Intel Classic on Linux/MacOS",
57+
"environment": {
58+
"CC": "icc",
59+
"CXX": "icpc",
60+
"FC": "ifort"
61+
}
62+
},
63+
{
64+
"name": "intelwin", "inherits": "intel",
65+
"displayName": "Intel Classic compiler: Windows",
66+
"description": "build with Intel Classic on Windows",
67+
"environment": {
68+
"CC": "icl",
69+
"CXX": "icl"
70+
}
71+
},
72+
{
73+
"name": "intelnext", "inherits": "intel",
74+
"displayName": "Intel oneAPI LLVM",
75+
"description": "build with Intel oneAPI NextGen LLVM",
76+
"environment": {
77+
"CC": "icx",
78+
"CXX": "icx",
79+
"FC": "ifx"
80+
}
81+
}
82+
]
83+
}

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,9 @@ Compile-time polymorphism enabled by configuring with one of:
2121
The large real values typical of map coordinates can lead to large error with 32-bit reals.
2222
64-bit real is the default.
2323

24-
### CMake
25-
26-
```sh
27-
ctest -S setup.cmake -VV
28-
```
29-
30-
### Meson
31-
3224
```sh
33-
meson build
34-
35-
meson test -C build
25+
cmake --preset=ninja
26+
cmake --build build
3627
```
3728

3829
## Usage

cmake/compilers.cmake

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
1111
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -fcheck=all -Werror=array-bounds")
1212
# -march=native is not for all CPU arches with GCC.
1313
add_compile_options(-mtune=native -Wall -Wextra)
14-
15-
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 8)
16-
string(APPEND CMAKE_Fortran_FLAGS " -std=f2018")
17-
endif()
1814
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)
1915
string(APPEND CMAKE_Fortran_FLAGS " -f2018 -C -colour -gline -nan -info -u")
2016
endif()
21-
22-
include(CheckFortranSourceCompiles)
23-
check_fortran_source_compiles("implicit none (type, external); end" f2018impnone SRC_EXT f90)
24-
if(NOT f2018impnone)
25-
message(FATAL_ERROR "Compiler does not support Fortran 2018 IMPLICIT NONE (type, external): ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION}")
26-
endif()

setup.cmake

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)