Skip to content

Commit e6ca8b0

Browse files
committed
update presets, install defaults
1 parent 4da9ec7 commit e6ca8b0

File tree

7 files changed

+70
-71
lines changed

7 files changed

+70
-71
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ on:
1414
jobs:
1515

1616
linux:
17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-latest
1818
timeout-minutes: 15
1919
env:
2020
CTEST_SITE: GitHub_Ubuntu
21+
CTEST_PARALLEL_LEVEL: 2
2122

2223
steps:
2324
- uses: actions/checkout@v2
@@ -27,16 +28,13 @@ jobs:
2728
sudo apt update -yq
2829
sudo apt install -yq --no-install-recommends ninja-build gfortran libnetcdff-dev
2930
30-
- name: CDash
31-
run: ctest -S ci.cmake -V
32-
33-
- name: Install package
34-
run: |
35-
cmake -B build -DCMAKE_INSTALL_PREFIX:PATH=~/nc4fortran
36-
cmake --install build
31+
- run: cmake --preset default -DCMAKE_INSTALL_PREFIX=~
32+
- run: cmake --build --preset default
33+
- run: ctest --preset default
34+
- run: cmake --install build
3735

3836
- name: configure examples
39-
run: cmake -S Examples -B Examples/build -Dnc4fortran_ROOT:PATH=~/nc4fortran
37+
run: cmake -S Examples -B Examples/build -Dnc4fortran_ROOT=~
4038
- name: build examples
4139
run: cmake --build Examples/build --parallel
4240
- name: Test examples
@@ -66,14 +64,16 @@ jobs:
6664
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6765
with:
6866
upload_url: ${{ github.event.release.upload_url }}
69-
asset_path: build/package/nc4fortran-${{ steps.get_version.outputs.VERSION }}-Linux.tar.gz
70-
asset_name: nc4fortran-${{ steps.get_version.outputs.VERSION }}-Linux.tar.gz
67+
asset_path: build/package/nc4fortran-${{ steps.get_version.outputs.VERSION }}-Linux.tar.zst
68+
asset_name: nc4fortran-${{ steps.get_version.outputs.VERSION }}-Linux.tar.zst
7169
asset_content_type: application/zip
7270

7371

7472
linuxCmake313:
7573
runs-on: ubuntu-latest
7674
timeout-minutes: 15
75+
env:
76+
CTEST_PARALLEL_LEVEL: 2
7777

7878
steps:
7979
- uses: actions/checkout@v2
@@ -91,7 +91,7 @@ jobs:
9191
9292
- run: cmake -B build
9393
- run: cmake --build build --parallel
94-
- run: ctest --parallel 2 --output-on-failure
94+
- run: ctest --output-on-failure
9595
working-directory: build
9696

9797

@@ -103,21 +103,19 @@ jobs:
103103
CC: gcc-10
104104
FC: gfortran-10
105105
CTEST_SITE: GitHub_MacOS
106+
CTEST_PARALLEL_LEVEL: 3
106107

107108
steps:
108109
- uses: actions/checkout@v2
109110

110111
- run: brew install netcdf ninja
111112

112-
- name: CDash
113-
run: ctest -S ci.cmake -V
114-
115-
- name: Install package
116-
run: |
117-
cmake -B build -DCMAKE_INSTALL_PREFIX:PATH=~/nc4fortran
118-
cmake --install build
113+
- run: cmake --preset gcc10 -DCMAKE_INSTALL_PREFIX=~
114+
- run: cmake --build --preset default
115+
- run: ctest --preset default
116+
- run: cmake --install build
119117

120-
- run: cmake -S Examples -B Examples/build -Dnc4fortran_ROOT:PATH=~/h5fortran
118+
- run: cmake -S Examples -B Examples/build -Dh5fortran_ROOT=~
121119
- run: cmake --build Examples/build --parallel
122120
- run: ctest --parallel 2 --output-on-failure
123121
working-directory: Examples/build
@@ -145,6 +143,6 @@ jobs:
145143
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146144
with:
147145
upload_url: ${{ github.event.release.upload_url }}
148-
asset_path: build/nc4fortran-${{ steps.get_version.outputs.VERSION }}-Darwin.tar.gz
149-
asset_name: nc4fortran-${{ steps.get_version.outputs.VERSION }}-Darwin.tar.gz
146+
asset_path: build/nc4fortran-${{ steps.get_version.outputs.VERSION }}-Darwin.tar.zst
147+
asset_name: nc4fortran-${{ steps.get_version.outputs.VERSION }}-Darwin.tar.zst
150148
asset_content_type: application/zip

CMakePresets.json

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
11
{
2-
"version": 1,
3-
"cmakeMinimumRequired": {
4-
"major": 3,
5-
"minor": 19,
6-
"patch": 0
2+
"version": 2,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 20,
6+
"patch": 0
77
},
88

99
"configurePresets": [
1010
{
11-
"name": "_default", "hidden": true,
11+
"name": "default",
1212
"binaryDir": "${sourceDir}/build",
13+
"generator": "Ninja",
1314
"cacheVariables": {"CMAKE_BUILD_TYPE": "Release"}
1415
},
1516
{
16-
"name": "ninja", "inherits": "_default",
17-
"displayName": "build with Ninja",
18-
"description": "Ninja is a faster alternative to Make",
19-
"generator": "Ninja"
20-
},
21-
{
22-
"name": "notest", "inherits": "ninja",
23-
"displayName": "build with Ninja, omitting self-tests",
17+
"name": "notest", "inherits": "default",
18+
"displayName": "omit self-tests",
2419
"cacheVariables": {"BUILD_TESTING": false}
2520
},
2621
{
27-
"name": "build", "inherits": "ninja",
22+
"name": "build", "inherits": "default",
2823
"displayName": "build all libraries",
2924
"description": "Build all external libraries without searching for existing libraries.",
3025
"cacheVariables": {
3126
"netcdf_external": "on"
3227
}
3328
},
3429
{
35-
"name": "gcc10", "inherits": "ninja",
30+
"name": "gcc10", "inherits": "default",
3631
"displayName": "GCC-10",
3732
"description": "specify GCC-10 -- helpful for MacOS Homebrew to avoid Clang /usr/bin/gcc",
3833
"environment": {
@@ -42,30 +37,18 @@
4237
}
4338
},
4439
{
45-
"name": "make", "inherits": "_default",
40+
"name": "make", "inherits": "default",
4641
"displayName": "build with GNU Make",
4742
"generator": "Unix Makefiles"
4843
},
4944
{
50-
"name": "makegcc10", "inherits": ["make", "gcc10"],
51-
"displayName": "build with GNU Make and GCC",
52-
"description": "build with GNU Make and GCC -- useful for MacOS"
53-
},
54-
{
55-
"name": "buildgcc10",
56-
"inherits": ["gcc10", "build"],
57-
"displayName": "build all libraries: GCC10",
58-
"description": "build all libraries with GCC10 to avoid Clang /usr/bin/gcc"
59-
},
60-
{
61-
"name": "makewin", "inherits": "_default",
45+
"name": "makewin", "inherits": "default",
6246
"displayName": "build with GNU Make: Windows",
6347
"generator": "MinGW Makefiles"
6448
},
6549
{
66-
"name": "intel", "inherits": "ninja",
50+
"name": "intel", "inherits": "default",
6751
"displayName": "Intel Classic compiler: Linux/MacOS",
68-
"description": "build with Intel Classic on Linux/MacOS",
6952
"environment": {
7053
"CC": "icc",
7154
"CXX": "icpc",
@@ -75,7 +58,6 @@
7558
{
7659
"name": "intelwin", "inherits": "intel",
7760
"displayName": "Intel Classic compiler: Windows",
78-
"description": "build with Intel Classic on Windows",
7961
"environment": {
8062
"CC": "icl",
8163
"CXX": "icl"
@@ -84,12 +66,30 @@
8466
{
8567
"name": "intelnext", "inherits": "intel",
8668
"displayName": "Intel oneAPI LLVM",
87-
"description": "build with Intel oneAPI NextGen LLVM",
8869
"environment": {
8970
"CC": "icx",
9071
"CXX": "icx",
9172
"FC": "ifx"
9273
}
9374
}
75+
],
76+
"buildPresets": [
77+
{
78+
"name": "default",
79+
"configurePreset": "default"
80+
}
81+
],
82+
"testPresets": [
83+
{
84+
"name": "default",
85+
"configurePreset": "default",
86+
"output": {
87+
"outputOnFailure": true,
88+
"verbosity": "default"
89+
},
90+
"execution": {
91+
"noTestsAction": "error",
92+
"stopOnFailure": false}
93+
}
9494
]
9595
}

Examples/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
cmake_minimum_required(VERSION 3.13...3.20)
1+
cmake_minimum_required(VERSION 3.13...${CMAKE_VERSION})
22

3-
project(nc4fortranExample
4-
LANGUAGES Fortran)
3+
project(nc4fortranExample LANGUAGES Fortran)
54

65
include(CTest)
76

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.3
1+
1.2.4

cmake/install.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in
88

99
write_basic_package_version_file(
1010
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
11-
VERSION ${${PROJECT_NAME}_VERSION}
1211
COMPATIBILITY SameMinorVersion)
1312

1413
install(EXPORT ${PROJECT_NAME}Targets
15-
FILE ${PROJECT_NAME}Targets.cmake
1614
NAMESPACE ${PROJECT_NAME}::
1715
DESTINATION lib/cmake/${PROJECT_NAME})
1816

@@ -27,12 +25,8 @@ export(EXPORT ${PROJECT_NAME}Targets
2725

2826
# --- CPack
2927

30-
set(_fmt TGZ)
31-
if(WIN32)
32-
set(_fmt ZIP)
33-
endif()
34-
set(CPACK_GENERATOR ${_fmt})
35-
set(CPACK_SOURCE_GENERATOR ${_fmt})
28+
set(CPACK_GENERATOR "TZST")
29+
set(CPACK_SOURCE_GENERATOR "TZST")
3630
set(CPACK_PACKAGE_VENDOR "Michael Hirsch")
3731
set(CPACK_PACKAGE_CONTACT "Michael Hirsch")
3832
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libnetcdff-dev")

cmake/netcdf.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ find_package(HDF5 COMPONENTS C Fortran REQUIRED)
88
set(netcdf_external true CACHE BOOL "autobuild NetCDF")
99

1010
if(NOT DEFINED NetCDF_ROOT)
11-
set(NetCDF_ROOT ${PROJECT_BINARY_DIR}/netcdf)
11+
set(NetCDF_ROOT ${CMAKE_INSTALL_PREFIX})
1212
endif()
1313

1414
set(NetCDF_INCLUDE_DIRS ${NetCDF_ROOT}/include)
@@ -27,7 +27,7 @@ endif()
2727
ExternalProject_Add(NETCDF_C
2828
URL https://github.com/Unidata/netcdf-c/archive/v4.7.4.zip
2929
URL_HASH SHA256=170c9c9020f8909811b06e1034d5ea9288b3d5bd90793e3dd27490191faa7566
30-
TLS_VERIFY ON
30+
UPDATE_DISCONNECTED ${EP_UPDATE_DISCONNECTED}
3131
CONFIGURE_HANDLED_BY_BUILD TRUE
3232
INACTIVITY_TIMEOUT 30
3333
# Shared_libs=on for netcdf-fortran symbol finding bug
@@ -52,6 +52,7 @@ target_link_libraries(NetCDF::NetCDF_C INTERFACE HDF5::HDF5)
5252
ExternalProject_Add(NETCDF_FORTRAN
5353
URL https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.zip
5454
URL_HASH SHA256=a2b9395622ba7411037ca153ad3a6d0824f445b238f1f5c3d3352f8ab7f3117b
55+
UPDATE_DISCONNECTED ${EP_UPDATE_DISCONNECTED}
5556
TLS_VERIFY ON
5657
CONFIGURE_HANDLED_BY_BUILD ON
5758
INACTIVITY_TIMEOUT 30

cmake/options.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
option(netcdf_external "Build HDF5 library")
33
option(dev "developer mode")
44

5-
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
5+
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
66

7-
if(NOT dev)
7+
set(CMAKE_TLS_VERIFY true)
8+
9+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
10+
set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR} CACHE PATH "top-level install path" FORCE)
11+
endif()
12+
13+
if(dev)
14+
else()
815
set(EP_UPDATE_DISCONNECTED true)
916
endif()
1017

0 commit comments

Comments
 (0)