-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
netcdf: apply patches to build system
The netCDF CMake build system does not use find_package in a way which is compatible to conan, so a couple of patches have been required to get the build running.
- Loading branch information
Showing
5 changed files
with
315 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -117,11 +117,6 @@ MACRO(CHECK_C_LINKER_FLAG M_FLAG M_RESULT) | ||
SET(CMAKE_REQUIRED_FLAGS "${T_REQ_FLAG}") | ||
ENDMACRO() | ||
|
||
-# Enable 'dist and distcheck'. | ||
-# File adapted from http://ensc.de/cmake/FindMakeDist.cmake | ||
-FIND_PACKAGE(MakeDist) | ||
-# End 'enable dist and distcheck' | ||
- | ||
# Set the build type. | ||
IF(NOT CMAKE_BUILD_TYPE) | ||
SET(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None, Debug, Release." | ||
@@ -1932,10 +1927,6 @@ INSTALL(PROGRAMS ${netCDF_BINARY_DIR}/nc-config | ||
## | ||
print_conf_summary() | ||
|
||
-# Enable Makedist files. | ||
-ADD_MAKEDIST() | ||
-ENABLE_MAKEDIST(README.md COPYRIGHT RELEASE_NOTES.md INSTALL INSTALL.cmake test_prog.c lib_flags.am cmake CMakeLists.txt COMPILE.cmake.txt config.h.cmake.in cmake_uninstall.cmake.in netcdf-config-version.cmake.in netcdf-config.cmake.in FixBundle.cmake.in nc-config.cmake.in configure configure.ac install-sh config.h.in config.sub CTestConfig.cmake.in) | ||
- | ||
##### | ||
# Configure and print the libnetcdf.settings file. | ||
##### |
22 changes: 22 additions & 0 deletions
22
recipes/netcdf/all/patches/use-CURL_LIBRARIES-in-stead-of-CURL_LIBRARY.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -854,7 +854,7 @@ ENDIF() | ||
# Option to support byte-range reading of remote datasets | ||
OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) | ||
|
||
-IF(NOT CURL_LIBRARY) | ||
+IF(NOT CURL_LIBRARIES) | ||
IF(ENABLE_BYTERANGE) | ||
MESSAGE(FATAL_ERROR "Byte-range support specified, CURL libraries are not found.") | ||
ENDIF() | ||
--- a/liblib/CMakeLists.txt | ||
+++ b/liblib/CMakeLists.txt | ||
@@ -88,7 +88,7 @@ IF(USE_HDF5 OR USE_NETCDF4) | ||
ENDIF() | ||
|
||
IF(USE_DAP) | ||
- SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY}) | ||
+ SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES}) | ||
ENDIF() | ||
|
||
IF(USE_HDF4) |
250 changes: 250 additions & 0 deletions
250
recipes/netcdf/all/patches/use-find_package-for-hdf5.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -571,175 +571,12 @@ OPTION(USE_HDF5 "Use HDF5." ${ENABLE_NETCDF_4}) | ||
IF(USE_HDF5 OR ENABLE_NETCDF_4) | ||
SET(USE_HDF5 ON) | ||
SET(USE_NETCDF4 ON) | ||
- ## | ||
- # Accommodate developers who have hdf5 libraries and | ||
- # headers on their system, but do not have a the hdf | ||
- # .cmake files. If this is the case, they should | ||
- # specify HDF5_HL_LIBRARY, HDF5_LIBRARY, HDF5_INCLUDE_DIR manually. | ||
- ## | ||
- IF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR) | ||
- SET(HDF5_LIBRARIES ${HDF5_C_LIBRARY} ${HDF5_HL_LIBRARY}) | ||
- SET(HDF5_C_LIBRARIES ${HDF5_C_LIBRARY}) | ||
- SET(HDF5_C_LIBRARY_hdf5 ${HDF5_C_LIBRARY}) | ||
- SET(HDF5_HL_LIBRARIES ${HDF5_HL_LIBRARY}) | ||
- INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR}) | ||
- MESSAGE(STATUS "Using HDF5 C Library: ${HDF5_C_LIBRARY}") | ||
- MESSAGE(STATUS "Using HDF5 HL LIbrary: ${HDF5_HL_LIBRARY}") | ||
- ELSE(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR) # We are seeking out HDF5 with Find Package. | ||
- ### | ||
- # For now we assume that if we are building netcdf | ||
- # as a shared library, we will use hdf5 as a shared | ||
- # library. If we are building netcdf statically, | ||
- # we will use a static library. This can be toggled | ||
- # by explicitly modifying NC_FIND_SHARED_LIBS. | ||
- ## | ||
- IF(NC_FIND_SHARED_LIBS) | ||
- SET(NC_HDF5_LINK_TYPE "shared") | ||
- SET(NC_HDF5_LINK_TYPE_UPPER "SHARED") | ||
- ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB) | ||
- ELSE(NC_FIND_SHARED_LIBS) | ||
- SET(NC_HDF5_LINK_TYPE "static") | ||
- SET(NC_HDF5_LINK_TYPE_UPPER "STATIC") | ||
- ADD_DEFINITIONS(-DH5_BUILT_AS_STATIC_LIB) | ||
- ENDIF(NC_FIND_SHARED_LIBS) | ||
- | ||
- ##### | ||
- # First, find the C and HL libraries. | ||
- # | ||
- # This has been updated to reflect what is in the hdf5 | ||
- # examples, even though the previous version of what we | ||
- # had worked. | ||
- ##### | ||
- IF(MSVC) | ||
- SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME}) | ||
- FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE}) | ||
- ELSE(MSVC) | ||
- FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED) | ||
- ENDIF(MSVC) | ||
- | ||
- ## | ||
- # Next, check the HDF5 version. This will inform which | ||
- # HDF5 variables we need to munge. | ||
- ## | ||
- | ||
- ## | ||
- # Assert HDF5 version meets minimum required version. | ||
- ## | ||
- SET(HDF5_VERSION_REQUIRED 1.8.10) | ||
- SET(HDF5_PAR_FILTER_VERSION 1.10.3) | ||
- | ||
- IF(HDF5_VERSION_STRING AND NOT HDF5_VERSION) | ||
- SET(HDF5_VERSION ${HDF5_VERSION_STRING}) | ||
- ENDIF() | ||
|
||
- IF("${HDF5_VERSION}" STREQUAL "") | ||
- MESSAGE(STATUS "Unable to determine hdf5 version. NetCDF requires at least version ${HDF5_VERSION_REQUIRED}") | ||
- ELSE() | ||
- IF(${HDF5_VERSION} VERSION_LESS ${HDF5_VERSION_REQUIRED}) | ||
- MESSAGE(FATAL_ERROR | ||
- "netCDF requires at least HDF5 ${HDF5_VERSION_REQUIRED}. Found ${HDF5_VERSION}.") | ||
- ELSE() | ||
- MESSAGE(STATUS "Found HDF5 libraries version ${HDF5_VERSION}") | ||
- ENDIF() | ||
- ENDIF() | ||
+ FIND_PACKAGE(HDF5 REQUIRED) | ||
+ INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS}) | ||
+ MESSAGE(STATUS "Using HDF5 Libraries: ${HDF5_LIBRARIES}") | ||
|
||
- # Determine whether parallel filter operation is supported. | ||
- IF(${HDF5_VERSION} VERSION_LESS ${HDF5_PAR_FILTER_VERSION}) | ||
- SET(HDF5_HAS_PAR_FILTERS, "no") | ||
- ELSE() | ||
- SET(HDF5_HAS_PAR_FILTERS, "yes") | ||
- ENDIF() | ||
- | ||
- ## | ||
- # Include the HDF5 include directory. | ||
- ## | ||
- IF(HDF5_INCLUDE_DIRS AND NOT HDF5_INCLUDE_DIR) | ||
- SET(HDF5_INCLUDE_DIR ${HDF5_INCLUDE_DIRS}) | ||
- ENDIF() | ||
- MESSAGE(STATUS "Using HDF5 include dir: ${HDF5_INCLUDE_DIR}") | ||
- INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR}) | ||
- | ||
- ### | ||
- # This is the block where we figure out what the appropriate | ||
- # variables are, and we ensure that we end up with | ||
- # HDF5_C_LIBRARY, HDF5_HL_LIBRARY and HDF5_LIBRARIES. | ||
- ### | ||
- IF(MSVC) | ||
- ## | ||
- # HDF5 1.8.15 defined HDF5_LIBRARIES. | ||
- ## | ||
- IF(${HDF5_VERSION} VERSION_LESS "1.8.16") | ||
- SET(HDF5_C_LIBRARY hdf5) | ||
- SET(HDF5_C_LIBRARY_hdf5 hdf5) | ||
- ENDIF(${HDF5_VERSION} VERSION_LESS "1.8.16") | ||
- | ||
- IF(${HDF5_VERSION} VERSION_GREATER "1.8.15") | ||
- IF(NOT HDF5_LIBRARIES AND HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY AND HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY) | ||
- SET(HDF5_C_LIBRARY ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY}) | ||
- SET(HDF5_C_LIBRARY_hdf5 ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY}) | ||
- SET(HDF5_HL_LIBRARY ${HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY}) | ||
- | ||
- SET(HDF5_LIBRARIES ${HDF5_C_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY} ${HDF5_HL_${NC_HDF5_LINK_TYPE_UPPER}_LIBRARY}) | ||
- ENDIF() | ||
- ENDIF(${HDF5_VERSION} VERSION_GREATER "1.8.15") | ||
- | ||
- ELSE(MSVC) | ||
- | ||
- # Depending on the install, either HDF5_hdf_library or | ||
- # HDF5_C_LIBRARIES may be defined. We must check for either. | ||
- IF(HDF5_C_LIBRARIES AND NOT HDF5_hdf5_LIBRARY) | ||
- SET(HDF5_hdf5_LIBRARY ${HDF5_C_LIBRARIES}) | ||
- ENDIF() | ||
- | ||
- ENDIF(MSVC) | ||
- IF(NOT HDF5_C_LIBRARY) | ||
- SET(HDF5_C_LIBRARY hdf5) | ||
- ENDIF() | ||
- ENDIF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR) | ||
- | ||
- FIND_PACKAGE(Threads) | ||
- | ||
- # There is a missing case in the above code so default it | ||
- IF(NOT HDF5_C_LIBRARY_HDF5 OR "${HDF5_C_LIBRARY_hdf5}" STREQUAL "" ) | ||
- SET(HDF5_C_LIBRARY_hdf5 "${HDF5_C_LIBRARY}") | ||
- ENDIF() | ||
- | ||
- # Find out if HDF5 was built with parallel support. | ||
- # Do that by checking for the targets H5Pget_fapl_mpiposx and | ||
- # H5Pget_fapl_mpio in ${HDF5_LIB}. | ||
- | ||
- # H5Pset_fapl_mpiposix and H5Pget_fapl_mpiposix have been removed since HDF5 1.8.12. | ||
- # Use H5Pset_fapl_mpio and H5Pget_fapl_mpio, instead. | ||
- # CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX) | ||
- | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO) | ||
- IF(HDF5_IS_PARALLEL_MPIO) | ||
- SET(HDF5_PARALLEL ON) | ||
- ELSE() | ||
- SET(HDF5_PARALLEL OFF) | ||
- ENDIF() | ||
- | ||
- #Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0) | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS) | ||
- | ||
- #Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip. | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Z_SZIP "" USE_SZIP) | ||
- IF(USE_SZIP) | ||
- FIND_LIBRARY(SZIP NAMES szip sz) | ||
- IF(SZIP) | ||
- SET(HAVE_H5Z_SZIP 1) | ||
- SET(SZIP_LIBRARY ${SZIP}) | ||
- SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SZIP}) | ||
- MESSAGE(STATUS "HDF5 has szip.") | ||
- ELSE() | ||
- MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.") | ||
- ENDIF() | ||
- ENDIF() | ||
- | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_libver_bounds "" HAVE_H5PSET_LIBVER_BOUNDS) | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HAVE_H5FREE_MEMORY) | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5allocate_memory "" HAVE_H5ALLOCATE_MEMORY) | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5resize_memory "" HAVE_H5RESIZE_MEMORY) | ||
+ SET(HDF5_PARALLEL OFF) | ||
|
||
IF(HDF5_PARALLEL) | ||
SET(HDF5_CC h5pcc) | ||
@@ -747,39 +584,13 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) | ||
SET(HDF5_CC h5cc) | ||
ENDIF() | ||
|
||
- # Check to see if this is hdf5-1.10.3 or later. | ||
- CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Dread_chunk "" HDF5_SUPPORTS_PAR_FILTERS) | ||
- | ||
- SET(H5_USE_16_API 1) | ||
- OPTION(NC_ENABLE_HDF_16_API "Enable HDF5 1.6.x Compatibility(Required)" ON) | ||
- IF(NOT NC_ENABLE_HDF_16_API) | ||
- SET(H5_USE_16_API 0) | ||
- ENDIF() | ||
+ SET(H5_USE_16_API 1) | ||
|
||
FIND_PATH(HAVE_HDF5_H hdf5.h PATHS ${HDF5_INCLUDE_DIR} NO_DEFAULT_PATH) | ||
- FIND_PATH(HAVE_HDF5_H hdf5.h) | ||
IF(NOT HAVE_HDF5_H) | ||
MESSAGE(FATAL_ERROR "Compiling a test with hdf5 failed. Either hdf5.h cannot be found, or the log messages should be checked for another reason.") | ||
- ELSE(NOT HAVE_HDF5_H) | ||
- INCLUDE_DIRECTORIES(${HAVE_HDF5_H}) | ||
ENDIF(NOT HAVE_HDF5_H) | ||
|
||
- # Check to ensure that HDF5 was built with zlib. | ||
- set (CMAKE_REQUIRED_INCLUDES ${HAVE_HDF5_H}) | ||
- CHECK_C_SOURCE_COMPILES("#include <H5pubconf.h> | ||
- #if !H5_HAVE_ZLIB_H | ||
- #error | ||
- #endif | ||
- int main() { | ||
- int x = 1;}" HAVE_HDF5_ZLIB) | ||
- IF(NOT HAVE_HDF5_ZLIB) | ||
- MESSAGE(FATAL_ERROR "HDF5 was built without zlib. Rebuild HDF5 with zlib.") | ||
- ENDIF() | ||
- | ||
- #option to include HDF5 High Level header file (hdf5_hl.h) in case we are not doing a make install | ||
- INCLUDE_DIRECTORIES(${HDF5_HL_INCLUDE_DIR}) | ||
- | ||
- | ||
ENDIF(USE_HDF5 OR ENABLE_NETCDF_4) | ||
|
||
# See if we have libcurl | ||
--- a/liblib/CMakeLists.txt | ||
+++ b/liblib/CMakeLists.txt | ||
@@ -68,23 +68,7 @@ IF(HAVE_LIBDL) | ||
ENDIF() | ||
|
||
IF(USE_HDF5 OR USE_NETCDF4) | ||
- IF(NOT MSVC) | ||
- # Some version of cmake define HDF5_hdf5_LIBRARY instead of | ||
- # HDF5_LIBRARY. Same with HDF5_HL_LIBRARIES | ||
- IF(HDF5_hdf5_LIBRARY AND NOT HDF5_C_LIBRARIES) | ||
- SET(HDF5_C_LIBRARIES ${HDF5_hdf5_LIBRARY}) | ||
- ENDIF() | ||
- IF(HDF5_hdf5_hl_LIBRARY AND NOT HDF5_HL_LIBRARIES) | ||
- SET(HDF5_HL_LIBRARIES ${HDF5_hdf5_hl_LIBRARY}) | ||
- ENDIF() | ||
- # The order of the libraries is important here for static | ||
- # builds: | ||
- # Make sure that HDF5_C_LIBRARY appears *after* | ||
- # HDF5_HL_LIBRARY. | ||
- SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) | ||
- ELSE() # Windows CMake defines HDF5_LIBRARIES. | ||
- SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) | ||
- ENDIF() | ||
+ SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) | ||
ENDIF() | ||
|
||
IF(USE_DAP) |