Skip to content

Commit 007b25c

Browse files
committed
improve install
1 parent e6ca8b0 commit 007b25c

File tree

10 files changed

+27
-41
lines changed

10 files changed

+27
-41
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
asset_content_type: application/zip
7070

7171

72-
linuxCmake313:
72+
linuxCmake314:
7373
runs-on: ubuntu-latest
7474
timeout-minutes: 15
7575
env:
@@ -83,11 +83,11 @@ jobs:
8383
sudo apt update -yq
8484
sudo apt install -yq --no-install-recommends gfortran libnetcdff-dev
8585
86-
- name: get CMake 3.13
86+
- name: get CMake 3.14
8787
run: |
88-
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.13.5/cmake-3.13.5-Linux-x86_64.tar.gz
89-
tar xf cmake-3.13.5-Linux-x86_64.tar.gz
90-
echo "${GITHUB_WORKSPACE}/cmake-3.13.5-Linux-x86_64/bin" >> $GITHUB_PATH
88+
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.14.7/cmake-3.14.7-Linux-x86_64.tar.gz
89+
tar xf cmake-3.14.7-Linux-x86_64.tar.gz
90+
echo "${GITHUB_WORKSPACE}/cmake-3.14.7-Linux-x86_64/bin" >> $GITHUB_PATH
9191
9292
- run: cmake -B build
9393
- run: cmake --build build --parallel
@@ -110,12 +110,12 @@ jobs:
110110

111111
- run: brew install netcdf ninja
112112

113-
- run: cmake --preset gcc10 -DCMAKE_INSTALL_PREFIX=~
113+
- run: cmake --preset default -DCMAKE_INSTALL_PREFIX=~
114114
- run: cmake --build --preset default
115115
- run: ctest --preset default
116116
- run: cmake --install build
117117

118-
- run: cmake -S Examples -B Examples/build -Dh5fortran_ROOT=~
118+
- run: cmake -S Examples -B Examples/build -Dnc4fortran_ROOT=~
119119
- run: cmake --build Examples/build --parallel
120120
- run: ctest --parallel 2 --output-on-failure
121121
working-directory: Examples/build

CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.13...3.20)
1+
cmake_minimum_required(VERSION 3.14...3.20)
22

33
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/VERSION PROJECT_VERSION
44
REGEX "^([0-9]+\.[0-9]+\.[0-9]+)" LIMIT_INPUT 16 LENGTH_MAXIMUM 16 LIMIT_COUNT 1)
@@ -50,10 +50,7 @@ target_link_libraries(nc4fortran::nc4fortran INTERFACE nc4fortran)
5050
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/nc4fortran.mod
5151
DESTINATION include)
5252

53-
install(TARGETS nc4fortran
54-
EXPORT ${PROJECT_NAME}Targets
55-
ARCHIVE DESTINATION lib
56-
LIBRARY DESTINATION lib)
53+
install(TARGETS nc4fortran EXPORT ${PROJECT_NAME}Targets)
5754

5855
# additional Find*.cmake necesary
5956
install(FILES

CMakePresets.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@
2626
"netcdf_external": "on"
2727
}
2828
},
29-
{
30-
"name": "gcc10", "inherits": "default",
31-
"displayName": "GCC-10",
32-
"description": "specify GCC-10 -- helpful for MacOS Homebrew to avoid Clang /usr/bin/gcc",
33-
"environment": {
34-
"CC": "gcc-10",
35-
"CXX": "g++-10",
36-
"FC": "gfortran-10"
37-
}
38-
},
3929
{
4030
"name": "make", "inherits": "default",
4131
"displayName": "build with GNU Make",

Examples/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ include(CTest)
66

77
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake/Modules)
88

9-
if(NOT nc4fortran_ROOT AND NOT DEFINED ENV{nc4fortran_ROOT})
10-
set(nc4fortran_ROOT ${PROJECT_SOURCE_DIR}/../build)
11-
endif()
12-
139
find_package(nc4fortran REQUIRED)
1410

1511
# --- Fortran interface for examples

VERSION

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

cmake/Config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ include(CMakeFindDependencyMacro)
55
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../Modules)
66
find_dependency(NetCDF COMPONENTS Fortran)
77

8-
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
8+
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake)
99

1010
check_required_components(@PROJECT_NAME@)

cmake/Modules/FindHDF5.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Components
3030
3131
``Fortran``
3232
33+
The ``HL`` component is implied and silently accepted to keep
34+
compatibility with factory FindHDF5
35+
3336
3437
Targets
3538
^^^^^^^
@@ -81,7 +84,7 @@ if( "${_def}" MATCHES
8184
set(HDF5_VERSION ${HDF5_VERSION} PARENT_SCOPE)
8285
endif()
8386

84-
# this help avoid picking up miniconda zlib over the desired zlib
87+
# this helps avoid picking up miniconda zlib over the desired zlib
8588
get_filename_component(_hint ${HDF5_C_LIBRARY} DIRECTORY)
8689
if(NOT ZLIB_ROOT)
8790
set(ZLIB_ROOT "${_hint}/..;${_hint}/../..")

cmake/compilers.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ endif()
1818
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
1919
if(WIN32)
2020
# add_compile_options(/Qdiag-error-limit:3)
21-
string(APPEND CMAKE_Fortran_FLAGS " /traceback /warn /heap-arrays")
22-
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " /check:bounds /debug:all")
21+
string(APPEND CMAKE_Fortran_FLAGS " /warn /heap-arrays")
22+
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " /traceback /check:bounds /debug:all")
2323
else()
2424
# add_compile_options(-diag-error-limit=3)
25-
string(APPEND CMAKE_Fortran_FLAGS " -traceback -warn -heap-arrays")
26-
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -check all -debug extended")
25+
string(APPEND CMAKE_Fortran_FLAGS " -warn -heap-arrays")
26+
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -traceback -check all -debug extended")
2727
endif()
2828
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
2929
string(APPEND CMAKE_Fortran_FLAGS " -mtune=native -Wall -fimplicit-none")
30-
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -Wno-maybe-uninitialized")
30+
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -fno-backtrace -Wno-maybe-uninitialized")
3131
string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO " -Wno-maybe-uninitialized")
3232
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -Wextra -fcheck=all -Werror=array-bounds")
3333
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)

cmake/install.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ install(FILES
1919
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
2020
DESTINATION lib/cmake/${PROJECT_NAME})
2121

22-
export(EXPORT ${PROJECT_NAME}Targets
23-
FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Targets.cmake
24-
NAMESPACE ${PROJECT_NAME}::)
25-
2622
# --- CPack
2723

2824
set(CPACK_GENERATOR "TZST")

cmake/netcdf.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ find_package(HDF5 COMPONENTS C Fortran REQUIRED)
77

88
set(netcdf_external true CACHE BOOL "autobuild NetCDF")
99

10-
if(NOT DEFINED NetCDF_ROOT)
11-
set(NetCDF_ROOT ${CMAKE_INSTALL_PREFIX})
10+
# need to be sure _ROOT isn't empty, defined is not enough
11+
if(NOT NetCDF_ROOT)
12+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
13+
set(NetCDF_ROOT ${PROJECT_BINARY_DIR})
14+
else()
15+
set(NetCDF_ROOT ${CMAKE_INSTALL_PREFIX})
16+
endif()
1217
endif()
1318

1419
set(NetCDF_INCLUDE_DIRS ${NetCDF_ROOT}/include)
@@ -53,7 +58,6 @@ ExternalProject_Add(NETCDF_FORTRAN
5358
URL https://github.com/Unidata/netcdf-fortran/archive/v4.5.3.zip
5459
URL_HASH SHA256=a2b9395622ba7411037ca153ad3a6d0824f445b238f1f5c3d3352f8ab7f3117b
5560
UPDATE_DISCONNECTED ${EP_UPDATE_DISCONNECTED}
56-
TLS_VERIFY ON
5761
CONFIGURE_HANDLED_BY_BUILD ON
5862
INACTIVITY_TIMEOUT 30
5963
# Shared_libs=on for netcdf-fortran symbol finding bug

0 commit comments

Comments
 (0)