2012-07-03 06:59:59 +08:00
|
|
|
#Minimum required CMake Version
|
2012-07-19 05:12:58 +08:00
|
|
|
cmake_minimum_required(VERSION 2.8.8)
|
2012-07-03 06:59:59 +08:00
|
|
|
|
|
|
|
#Project Name
|
2012-08-03 06:56:57 +08:00
|
|
|
project(NetCDF C)
|
|
|
|
SET(NetCDF_VERSION 4.2.1)
|
2012-08-04 06:24:29 +08:00
|
|
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT")
|
|
|
|
SET(CPACK_PACKAGE_VERSION "4.3")
|
2012-08-07 04:53:34 +08:00
|
|
|
ENABLE_TESTING()
|
|
|
|
INCLUDE(CTest)
|
|
|
|
# CTest/CDash configuration
|
|
|
|
SET (CTEST_DROP_METHOD http CACHE STRING "")
|
|
|
|
SET (CTEST_DROP_SITE "yakov.unidata.ucar.edu/~wfisher/cdash/" CACHE STRING "")
|
|
|
|
SET (CTEST_DROP_LOCATION "/submit.php?project=WinNETCDF" CACHE STRING "")
|
|
|
|
SET (CTEST_DROP_SITE_CDASH TRUE CACHE BOOL "")
|
2012-08-08 05:34:55 +08:00
|
|
|
SET (CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "")
|
2012-08-07 04:53:34 +08:00
|
|
|
|
2012-07-11 01:41:05 +08:00
|
|
|
ADD_DEFINITIONS()
|
2012-07-18 04:50:43 +08:00
|
|
|
|
|
|
|
### Verbose make, for debugging.
|
|
|
|
#SET(CMAKE_VERBOSE_MAKEFILE ON)
|
|
|
|
|
2012-07-20 06:11:10 +08:00
|
|
|
#Add custom CMake Module
|
2012-07-11 01:41:05 +08:00
|
|
|
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
|
|
|
|
CACHE INTERNAL "Location of our custom CMake modules.")
|
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# Configure-type checks
|
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
|
2012-07-11 01:41:05 +08:00
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
|
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
|
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
|
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
|
2012-07-26 06:09:19 +08:00
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/FindPkgConfig.cmake)
|
2012-07-11 01:41:05 +08:00
|
|
|
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
2012-08-03 06:56:57 +08:00
|
|
|
IF(APPLE)
|
|
|
|
SET(CPACK_BINARY_DRAGNDROP ON CACHE BOOL "")
|
|
|
|
SET(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-24 03:40:08 +08:00
|
|
|
#####
|
|
|
|
# Option checks
|
|
|
|
#####
|
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# HDF5 cache variables.
|
2012-07-24 03:40:08 +08:00
|
|
|
SET (DEFAULT_CHUNK_SIZE 4194304 CACHE STRING "Default Chunk Cache Size.")
|
|
|
|
SET (DEFAULT_CHUNKS_IN_CACHE 10 CACHE STRING "Default number of chunks in cache.")
|
|
|
|
SET (CHUNK_CACHE_SIZE 4194304 CACHE STRING "Default Chunk Cache Size.")
|
|
|
|
SET (CHUNK_CACHE_NELEMS 1009 CACHE STRING "Default maximum number of elements in cache.")
|
|
|
|
SET (CHUNK_CACHE_PREEMPTION 0.75 CACHE STRING "Default file chunk cache preemption policy for HDf5 files (a number between 0 and 1, inclusive.")
|
|
|
|
SET (MAX_DEFAULT_CACHE_SIZE 67108864 CACHE STRING "Default maximum cache size.")
|
|
|
|
|
2012-08-11 06:59:40 +08:00
|
|
|
IF(NOT BUILD_SHARED_LIBS)
|
|
|
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
|
|
SET(CMAKE_FIND_PACKAGE_SUFFIXES .a ${CMAKE_FIND_PACKAGE_SUFFIXES})
|
|
|
|
ENDIF()
|
2012-07-11 01:41:05 +08:00
|
|
|
|
2012-07-18 05:44:41 +08:00
|
|
|
# Set the appropriate compiler/architecture for universal OSX binaries.
|
|
|
|
IF(${CMAKE_SYSTEM_NAME} EQUAL "Darwin")
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
|
|
|
ENDIF(${CMAKE_SYSTEM_NAME} EQUAL "Darwin")
|
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
# Option to build NetCDF Version 2
|
|
|
|
OPTION (BUILD_V2 "Build NetCDF Version 2." ON)
|
|
|
|
|
|
|
|
# Option to build utilities
|
|
|
|
OPTION (BUILD_UTILITIES "Build ncgen, ncgen3, ncdump." ON)
|
2012-07-21 05:16:27 +08:00
|
|
|
|
2012-07-14 00:49:20 +08:00
|
|
|
# Option to use MMAP
|
|
|
|
OPTION (BUILD_MMAP "Use MMAP." OFF)
|
|
|
|
|
|
|
|
# Option to use Diskless
|
2012-08-11 04:55:07 +08:00
|
|
|
OPTION (ENABLE_DISKLESS "Build Diskless." OFF)
|
|
|
|
IF(ENABLE_DISKLESS)
|
|
|
|
SET(BUILD_DISKLESS ON)
|
|
|
|
ENDIF()
|
2012-07-18 04:50:43 +08:00
|
|
|
# Option Logging, only valid for netcdf4.
|
2012-08-10 02:40:41 +08:00
|
|
|
# For some reason, these appear to need to be set in each folder.
|
|
|
|
IF(ENABLE_COVERAGE_TESTS)
|
|
|
|
SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wun used-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecate d -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage")
|
|
|
|
SET(CMAKE_C_FLAGS "-g -O0 -Wall -W -fprofile-arcs -ftest-coverage")
|
|
|
|
SET(CMAKE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage")
|
|
|
|
ENDIF()
|
2012-08-11 04:55:07 +08:00
|
|
|
OPTION (ENABLE_LOGGING "Enable Logging." OFF)
|
2012-07-14 00:49:20 +08:00
|
|
|
|
2012-08-07 01:23:23 +08:00
|
|
|
# Option to use HDF4
|
2012-07-11 01:41:05 +08:00
|
|
|
OPTION (USE_HDF4 "Use HDF4." OFF)
|
|
|
|
IF (USE_HDF4)
|
|
|
|
FIND_PACKAGE(HDF4)
|
2012-07-18 04:50:43 +08:00
|
|
|
IF(NOT HDF4_FOUND)
|
|
|
|
MESSAGE(FATAL_ERROR "HDF4 Support specified, but HDF4 libraries were not found.")
|
|
|
|
ENDIF(NOT HDF4_FOUND)
|
|
|
|
CHECK_INCLUDE_FILE("mfhdf.h" HAVE_MFHDF_H)
|
|
|
|
IF(NOT HAVE_MFHDF_H)
|
|
|
|
MESSAGE(FATAL_ERROR "HDF4 Support specified, cannot find file mfhdf.h")
|
|
|
|
ENDIF(NOT HAVE_MFHDF_H)
|
2012-07-26 06:09:19 +08:00
|
|
|
|
|
|
|
|
2012-07-11 01:41:05 +08:00
|
|
|
ENDIF (USE_HDF4)
|
|
|
|
|
2012-07-24 03:40:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
# Option to Build DLL
|
2012-07-25 06:53:58 +08:00
|
|
|
OPTION (BUILD_DLL "Build a Windows DLL." OFF)
|
|
|
|
IF (BUILD_DLL)
|
2012-08-07 01:23:23 +08:00
|
|
|
ADD_DEFINITIONS(-DDLL_NETCDF)
|
|
|
|
ADD_DEFINITIONS(-DDLL_EXPORT)
|
2012-07-25 06:53:58 +08:00
|
|
|
ENDIF ()
|
2012-07-24 03:40:08 +08:00
|
|
|
|
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
# Build NetCDF4
|
|
|
|
OPTION (ENABLE_NETCDF_4 "Enable NetCDF-4" ON)
|
2012-08-09 00:04:11 +08:00
|
|
|
IF(ENABLE_NETCDF_4)
|
2012-07-26 06:09:19 +08:00
|
|
|
SET(USE_NETCDF4 ON CACHE BOOL "")
|
2012-08-08 04:21:44 +08:00
|
|
|
SET(ENABLE_NETCDF_4 ON CACHE BOOL "")
|
2012-07-25 06:53:58 +08:00
|
|
|
SET(ENABLE_NETCDF4 ON CACHE BOOL "")
|
2012-07-24 03:40:08 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
# Option for cdmremote support.
|
2012-07-24 03:40:08 +08:00
|
|
|
OPTION (ENABLE_CDMREMOTE OFF "Build with cdmremote client support.")
|
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# Option to Enable HDF5
|
2012-07-25 06:53:58 +08:00
|
|
|
OPTION (USE_HDF5 "Use HDF5." ${ENABLE_NETCDF_4})
|
|
|
|
IF (USE_HDF5 OR ENABLE_NETCDF_4)
|
2012-08-01 06:04:25 +08:00
|
|
|
SET(USE_HDF5 ON)
|
|
|
|
SET(USE_NETCDF4 ON)
|
2012-08-11 06:59:40 +08:00
|
|
|
|
|
|
|
#FIND_PACKAGE(HDF5)
|
2012-08-01 06:04:25 +08:00
|
|
|
IF(NOT HDF5_FOUND)
|
2012-08-11 06:59:40 +08:00
|
|
|
FIND_LIBRARY(HDF5_FOUND NAMES hdf5 libhdf5 libhdf5dll)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF(NOT HDF5_FOUND)
|
2012-08-01 06:04:25 +08:00
|
|
|
MESSAGE(FATAL_ERROR "HDF5 Not Found")
|
2012-08-11 04:55:07 +08:00
|
|
|
ENDIF(NOT HDF5_FOUND)
|
2012-08-11 06:59:40 +08:00
|
|
|
SET(HDF5_LIBRARIES ${HDF5_FOUND})
|
2012-08-11 04:55:07 +08:00
|
|
|
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
CHECK_INCLUDE_FILE("hdf5.h" HAVE_HDF5_H)
|
|
|
|
IF(NOT HAVE_HDF5_H)
|
2012-07-18 04:50:43 +08:00
|
|
|
MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find hdf5.h")
|
2012-08-11 04:55:07 +08:00
|
|
|
ENDIF(NOT HAVE_HDF5_H)
|
2012-08-09 06:31:28 +08:00
|
|
|
|
2012-08-11 04:55:07 +08:00
|
|
|
FIND_LIBRARY(HDF5_HL_LIBRARY NAMES hdf5_hl libhdf5_hl hdf5_hldll)
|
|
|
|
IF(NOT HDF5_HL_LIBRARY)
|
2012-07-21 05:16:27 +08:00
|
|
|
MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find hdf5_hl")
|
2012-08-11 04:55:07 +08:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
|
2012-08-11 05:44:00 +08:00
|
|
|
#CHECK_LIBRARY_EXISTS(${HDF5_LIBRARIES} H5Z_SZIP "" USE_SZIP)
|
2012-08-11 05:45:06 +08:00
|
|
|
IF(USE_SZIP)
|
2012-08-11 05:44:00 +08:00
|
|
|
FIND_PACKAGE(SZIP)
|
|
|
|
#FIND_LIBRARY(SZIP_LIBRARY NAMES szip sz)
|
2012-08-11 04:55:07 +08:00
|
|
|
IF(NOT SZIP_LIBRARY)
|
|
|
|
MESSAGE(FATAL_ERROR "HDF5 compiled with szip, but cannot find local szip libraries.")
|
|
|
|
ELSE()
|
|
|
|
MESSAGE(STATUS "Found SZip: ${SZIP_LIBRARY}")
|
|
|
|
ENDIF()
|
2012-08-11 05:45:06 +08:00
|
|
|
ENDIF()
|
2012-08-11 04:55:07 +08:00
|
|
|
|
|
|
|
FIND_LIBRARY(ZLIB_LIBRARY NAMES zlibwapi zlibstat zlib zlib1 z)
|
|
|
|
IF(NOT ZLIB_LIBRARY)
|
2012-08-09 06:46:28 +08:00
|
|
|
MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find ZLib.")
|
2012-08-11 04:55:07 +08:00
|
|
|
ELSE()
|
2012-08-09 06:46:28 +08:00
|
|
|
MESSAGE(STATUS "Found ZLib: ${ZLIB_LIBRARY}")
|
2012-08-11 04:55:07 +08:00
|
|
|
ENDIF()
|
2012-08-09 06:46:28 +08:00
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
SET(H5_USE_16_API 1)
|
2012-08-09 06:31:28 +08:00
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
|
2012-07-21 05:16:27 +08:00
|
|
|
ENDIF ()
|
2012-07-11 01:41:05 +08:00
|
|
|
|
2012-07-20 06:11:10 +08:00
|
|
|
|
2012-07-25 06:53:58 +08:00
|
|
|
# Option to Build DAP Client
|
2012-08-11 04:55:07 +08:00
|
|
|
OPTION (ENABLE_DAP "Enable DAP Client." ON)
|
|
|
|
IF (ENABLE_DAP)
|
|
|
|
SET(USE_DAP ON)
|
2012-07-26 06:09:19 +08:00
|
|
|
FIND_PACKAGE(CURL)
|
|
|
|
#FIND_LIBRARY(CURL NAMES curl libcurl)
|
|
|
|
IF(NOT CURL_FOUND)
|
2012-07-25 06:53:58 +08:00
|
|
|
MESSAGE(FATAL_ERROR "DAP Support specified, CURL libraries are not found.")
|
2012-07-26 06:09:19 +08:00
|
|
|
ENDIF(NOT CURL_FOUND)
|
|
|
|
#MESSAGE("Looking for libcurl: ${CURL}")
|
2012-07-25 06:53:58 +08:00
|
|
|
|
2012-08-11 04:55:07 +08:00
|
|
|
ENDIF()
|
2012-07-25 06:53:58 +08:00
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
# If NetCDF4 and DAP, Option for DAP groups.
|
2012-07-26 06:09:19 +08:00
|
|
|
IF(ENABLE_NETCDF4 AND USE_DAP)
|
2012-07-25 06:53:58 +08:00
|
|
|
OPTION(ENABLE_DAP_GROUPS "Whether netcdf4 group names should be enabled." ON)
|
|
|
|
ELSE()
|
|
|
|
SET(ENABLE_DAP_GROUPS OFF CACHE BOOL "Whether netcdf4 group names should be enabled.")
|
|
|
|
ENDIF()
|
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
|
2012-07-25 06:53:58 +08:00
|
|
|
|
2012-07-24 03:40:08 +08:00
|
|
|
# Does the user want to turn on PNETCDF read ability?
|
|
|
|
OPTION (ENABLE_PNETCDF "Enable parallel I/O for classic and 64-bit offset files using parallel-netcdf." OFF)
|
2012-07-26 06:09:19 +08:00
|
|
|
IF(ENABLE_PNETCDF)
|
|
|
|
FIND_LIBRARY(PNETCDF NAMES pnetcdf)
|
|
|
|
IF(NOT PNETCDF)
|
|
|
|
MESSAGE(FATAL_ERROR "Cannot find pnetcdf library, yet pnetcdf support was requested.")
|
|
|
|
ENDIF()
|
|
|
|
SET(USE_PNETCDF ON CACHE BOOL "")
|
|
|
|
ENDIF()
|
|
|
|
|
2012-08-09 00:04:11 +08:00
|
|
|
SET(MATH "")
|
|
|
|
IF(NOT WIN32)
|
2012-08-08 04:21:44 +08:00
|
|
|
# FFIO insteaad of PosixIO
|
2012-07-26 06:09:19 +08:00
|
|
|
OPTION(USE_FFIO "If true, use ffio instead of posixio" OFF)
|
2012-08-09 00:04:11 +08:00
|
|
|
ENDIF()
|
2012-07-26 06:09:19 +08:00
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
# Enable Tests
|
|
|
|
OPTION (ENABLE_TESTS "Enable basic tests, run with 'make test'." ON)
|
2012-08-10 06:54:19 +08:00
|
|
|
IF(ENABLE_TESTS)
|
|
|
|
SET(BUILD_TESTSETS ON CACHE BOOL "")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
# Enable Large file tests
|
|
|
|
OPTION (ENABLE_LARGE_FILE_TESTS "Enable large file tests." OFF)
|
|
|
|
IF(ENABLE_LARGE_FILE_TESTS)
|
|
|
|
SET(LARGE_FILE_TESTS ON)
|
|
|
|
ENDIF()
|
2012-08-08 04:21:44 +08:00
|
|
|
|
|
|
|
# Other misc. options, not detailed for now.
|
|
|
|
OPTION (ENABLE_DOXYGEN "Enable generation of documentation" OFF)
|
2012-08-11 04:55:07 +08:00
|
|
|
IF(ENABLE_DOXYGEN)
|
|
|
|
SET(BUILD_DOCS ON)
|
|
|
|
ENDIF()
|
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
OPTION (ENABLE_INTERNAL_DOCS "Enable documentation of library internals. This is of interest only to those developing the netCDF library." OFF)
|
2012-08-11 04:55:07 +08:00
|
|
|
IF(ENABLE_INTERNAL_DOCS)
|
|
|
|
SET(BUILD_INTERNAL_DOCS ON)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
OPTION (ENABLE_FSYNC "Enable experimental fsync code." OFF)
|
|
|
|
IF(ENABLE_FSYNC)
|
|
|
|
SET(USE_FSYNC ON)
|
|
|
|
ENDIF()
|
2012-07-25 06:53:58 +08:00
|
|
|
|
2012-08-10 00:06:02 +08:00
|
|
|
# Provide the option to perform coverage tests.
|
|
|
|
OPTION (ENABLE_COVERAGE_TESTS "Enable compiler flags needed to perform coverage tests." OFF)
|
|
|
|
IF(ENABLE_COVERAGE_TESTS)
|
2012-08-11 04:55:07 +08:00
|
|
|
#SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage")
|
|
|
|
SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -W -profile-arcs -ftest-coverage")
|
2012-08-10 02:40:41 +08:00
|
|
|
SET(CMAKE_C_FLAGS "-g -O0 -Wall -W -fprofile-arcs -ftest-coverage")
|
|
|
|
SET(CMAKE_EXE_LINKER_FLAGSx "-fprofile-arcs -ftest-coverage")
|
2012-08-10 00:39:13 +08:00
|
|
|
MESSAGE(STATUS "Coverage Tests: On.")
|
2012-08-10 00:06:02 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2012-08-11 04:55:07 +08:00
|
|
|
OPTION (ENABLE_EXAMPLE_TESTS "Run extra example tests. Requires GNU Sed. Ignored if NetCDF-4 is not Enabled")
|
|
|
|
IF(NOT ENABLE_NETCDF_4 AND ENABLE_EXAMPLE_TESTS)
|
|
|
|
SET (ENABLE_EXAMPLE_TESTS OFF)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
OPTION (ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Ignored if NetCDF4 is not enabled, or if there is no parallel I/O Support." OFF)
|
|
|
|
|
|
|
|
|
2012-08-10 02:40:41 +08:00
|
|
|
# Set some of the options as advanced.
|
2012-08-10 00:06:02 +08:00
|
|
|
MARK_AS_ADVANCED(ENABLE_DOXYGEN ENABLE_INTERNAL_DOCS VALGRIND_TESTS ENABLE_PNETCDF BUILD_CDMREMOTE ENABLE_COVERAGE_TESTS)
|
2012-07-11 01:41:05 +08:00
|
|
|
|
2012-07-24 03:40:08 +08:00
|
|
|
#####
|
|
|
|
# End option checks.
|
|
|
|
#####
|
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
#####
|
|
|
|
# System inspection checks
|
|
|
|
#####
|
|
|
|
|
|
|
|
# Library include checks
|
2012-08-07 01:23:23 +08:00
|
|
|
CHECK_INCLUDE_FILE("math.h" HAVE_MATH_H)
|
2012-07-11 01:41:05 +08:00
|
|
|
CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H)
|
|
|
|
CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H)
|
|
|
|
CHECK_INCLUDE_FILE("dirent.h" HAVE_DIRENT_H)
|
|
|
|
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
|
|
|
|
CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
|
|
|
|
CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
|
|
|
|
CHECK_INCLUDE_FILE("getopt.h" HAVE_GETOPT_H)
|
2012-07-11 01:58:53 +08:00
|
|
|
CHECK_INCLUDE_FILE("stdbool.h" HAVE_STDBOOL_H)
|
2012-07-11 01:41:05 +08:00
|
|
|
CHECK_INCLUDE_FILE("locale.h" HAVE_LOCAL_H)
|
|
|
|
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
|
|
|
CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
|
|
|
|
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
|
|
|
|
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
|
|
|
CHECK_INCLUDE_FILE("sys/dir.h" HAVE_SYS_DIR_H)
|
|
|
|
CHECK_INCLUDE_FILE("sys/ndir.h" HAVE_SYS_NDIR_H)
|
|
|
|
CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
|
|
|
|
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
|
|
|
CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
|
|
|
|
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
|
|
|
CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H)
|
2012-07-21 01:53:53 +08:00
|
|
|
CHECK_INCLUDE_FILE("sys/resource.h" HAVE_SYS_RESOURCE_H)
|
|
|
|
CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
|
2012-07-18 04:50:43 +08:00
|
|
|
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
2012-07-20 06:30:05 +08:00
|
|
|
CHECK_INCLUDE_FILE("curl.h" HAVE_CURL_H)
|
2012-07-24 04:09:26 +08:00
|
|
|
CHECK_INCLUDE_FILE("pstdint.h" HAVE_PSTDINT_H)
|
2012-07-25 06:53:58 +08:00
|
|
|
CHECK_INCLUDE_FILE("endian.h" HAVE_ENDIAN_H)
|
2012-07-21 01:53:53 +08:00
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# Type checks
|
2012-07-11 01:41:05 +08:00
|
|
|
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
|
|
|
|
CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
|
|
|
|
CHECK_TYPE_SIZE("int" SIZEOF_INT)
|
|
|
|
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
|
|
|
|
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
|
|
|
CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T)
|
|
|
|
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
|
|
|
|
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
|
|
|
|
CHECK_TYPE_SIZE("uchar" SIZEOF_UCHAR)
|
|
|
|
|
2012-07-20 06:11:10 +08:00
|
|
|
# Check for various functions.
|
2012-07-24 03:40:08 +08:00
|
|
|
CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
|
2012-07-20 06:11:10 +08:00
|
|
|
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
|
|
|
|
CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
|
|
|
|
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
|
|
|
|
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
|
|
|
|
CHECK_FUNCTION_EXISTS(strchr HAVE_STRCHR)
|
|
|
|
CHECK_FUNCTION_EXISTS(strrchr HAVE_STRRCHR)
|
|
|
|
CHECK_FUNCTION_EXISTS(strcat HAVE_STRCAT)
|
|
|
|
CHECK_FUNCTION_EXISTS(strcpy HAVE_STRCPY)
|
|
|
|
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
|
|
|
|
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
|
|
|
CHECK_FUNCTION_EXISTS(strtod HAVE_STRTOD)
|
|
|
|
CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL)
|
|
|
|
CHECK_FUNCTION_EXISTS(strtoull HAVE_STROULL)
|
|
|
|
CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
|
|
|
|
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
|
|
|
|
CHECK_FUNCTION_EXISTS(rand HAVE_RAND)
|
|
|
|
CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT)
|
|
|
|
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
|
|
|
|
CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
|
|
|
|
CHECK_FUNCTION_EXISTS(MPI_Comm_f2C HAVE_MPI_COMM_F2C)
|
|
|
|
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
|
|
|
|
CHECK_FUNCTION_EXISTS(getpagesize HAVE_GETPAGESIZE)
|
|
|
|
CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
|
|
|
|
CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
|
2012-08-08 04:21:44 +08:00
|
|
|
CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT)
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
#####
|
|
|
|
# End system inspection checks.
|
|
|
|
#####
|
2012-08-04 06:24:29 +08:00
|
|
|
|
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
# Check for the math library so it can be explicitely linked.
|
2012-08-09 00:04:11 +08:00
|
|
|
IF(NOT WIN32)
|
2012-08-11 04:55:07 +08:00
|
|
|
FIND_LIBRARY(HAVE_LIBM NAMES math m libm)
|
|
|
|
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
|
|
|
|
IF(NOT HAVE_LIBM)
|
2012-08-09 00:04:11 +08:00
|
|
|
MESSAGE(FATAL_ERROR "Unable to find the math library.")
|
|
|
|
ENDIF()
|
2012-08-08 04:21:44 +08:00
|
|
|
ENDIF()
|
2012-07-11 01:41:05 +08:00
|
|
|
|
2012-07-24 03:40:08 +08:00
|
|
|
|
2012-07-11 01:41:05 +08:00
|
|
|
# Create config.h file
|
2012-08-03 06:56:57 +08:00
|
|
|
configure_file("${NetCDF_SOURCE_DIR}/cmake_config.h.in"
|
|
|
|
"${NetCDF_BINARY_DIR}/config.h")
|
|
|
|
configure_file("${NetCDF_SOURCE_DIR}/cmake_nc-config.in"
|
2012-08-07 07:07:40 +08:00
|
|
|
"${NetCDF_SOURCE_DIR}/nc-config")
|
|
|
|
FILE(COPY "${NetCDF_SOURCE_DIR}/nc-config"
|
|
|
|
DESTINATION "${NetCDF_BINARY_DIR}"
|
|
|
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
|
|
|
EXECUTE_PROCESS(COMMAND "chmod 755 ${NetCDF_BINARY_DIR}/nc-config")
|
|
|
|
|
2012-08-07 04:53:34 +08:00
|
|
|
INSTALL(PROGRAMS ${NetCDF_BINARY_DIR}/nc-config DESTINATION bin)
|
2012-08-03 06:56:57 +08:00
|
|
|
INCLUDE_DIRECTORIES(${NetCDF_BINARY_DIR})
|
2012-08-08 04:21:44 +08:00
|
|
|
# End autotools-style checs for config.h
|
2012-07-11 01:41:05 +08:00
|
|
|
|
2012-07-03 06:59:59 +08:00
|
|
|
|
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
#####
|
2012-07-03 06:59:59 +08:00
|
|
|
# Set core names of the libraries.
|
2012-08-08 04:21:44 +08:00
|
|
|
#####
|
2012-08-03 06:56:57 +08:00
|
|
|
SET (NetCDF_LIB_CORENAME "netcdf")
|
2012-07-03 06:59:59 +08:00
|
|
|
|
2012-08-08 04:21:44 +08:00
|
|
|
#####
|
2012-07-03 06:59:59 +08:00
|
|
|
# Set the true names of all the libraries, if customized by external project
|
2012-08-08 04:21:44 +08:00
|
|
|
#####
|
2012-08-03 06:56:57 +08:00
|
|
|
INCLUDE_DIRECTORIES(${NetCDF_SOURCE_DIR}/include)
|
|
|
|
INCLUDE_DIRECTORIES(${NetCDF_SOURCE_DIR}/oc2)
|
2012-07-03 06:59:59 +08:00
|
|
|
|
|
|
|
# Recurse into other subdirectories.
|
2012-07-11 01:41:05 +08:00
|
|
|
#add_subdirectory(h5_test)
|
|
|
|
#add_subdirectory(man4)
|
|
|
|
#add_subdirectory(man4/images)
|
2012-07-18 04:50:43 +08:00
|
|
|
add_subdirectory(libdispatch)
|
2012-07-03 06:59:59 +08:00
|
|
|
add_subdirectory(libsrc)
|
2012-07-18 04:50:43 +08:00
|
|
|
|
|
|
|
IF (USE_HDF5)
|
2012-07-17 06:31:35 +08:00
|
|
|
add_subdirectory(libsrc4)
|
2012-07-18 04:50:43 +08:00
|
|
|
ENDIF (USE_HDF5)
|
|
|
|
|
2012-07-26 06:09:19 +08:00
|
|
|
IF (USE_DAP)
|
2012-08-01 06:04:25 +08:00
|
|
|
ADD_SUBDIRECTORY(oc2)
|
2012-07-25 06:53:58 +08:00
|
|
|
ADD_SUBDIRECTORY(libdap2)
|
2012-07-20 06:11:10 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2012-07-25 06:53:58 +08:00
|
|
|
IF (BUILD_CDMREMOTE)
|
|
|
|
ADD_SUBDIRECTORY(libcdmr)
|
|
|
|
ENDIF()
|
2012-07-20 06:11:10 +08:00
|
|
|
|
2012-07-18 05:44:41 +08:00
|
|
|
add_subdirectory(liblib)
|
2012-08-03 06:56:57 +08:00
|
|
|
|
2012-08-08 06:42:42 +08:00
|
|
|
# Enable Utilities.
|
2012-08-11 05:44:00 +08:00
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
IF (BUILD_UTILITIES)
|
2012-08-11 05:44:00 +08:00
|
|
|
MESSAGE(STATUS "ALL_TLL_LIBS: ${ALL_TLL_LIBS}")
|
2012-08-04 06:24:29 +08:00
|
|
|
ADD_SUBDIRECTORY(ncgen)
|
2012-08-11 05:44:00 +08:00
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
ADD_SUBDIRECTORY(ncgen3)
|
2012-08-10 06:54:19 +08:00
|
|
|
ADD_SUBDIRECTORY(ncdump)
|
2012-08-04 06:24:29 +08:00
|
|
|
ENDIF()
|
|
|
|
|
2012-08-08 06:42:42 +08:00
|
|
|
# Enable tests.
|
2012-08-08 04:21:44 +08:00
|
|
|
IF(ENABLE_TESTS)
|
|
|
|
ADD_SUBDIRECTORY(nctest)
|
|
|
|
ADD_SUBDIRECTORY(nc_test)
|
|
|
|
IF(USE_NETCDF4)
|
|
|
|
ADD_SUBDIRECTORY(nc_test4)
|
2012-08-08 06:42:42 +08:00
|
|
|
ADD_SUBDIRECTORY(h5_test)
|
2012-08-08 04:21:44 +08:00
|
|
|
ENDIF()
|
2012-08-07 07:07:40 +08:00
|
|
|
ENDIF()
|
2012-08-08 04:21:44 +08:00
|
|
|
|
2012-08-10 02:40:41 +08:00
|
|
|
|
|
|
|
|
2012-08-03 06:56:57 +08:00
|
|
|
#####
|
|
|
|
# Moving on to CPack, install packages.
|
|
|
|
#####
|
2012-08-07 00:57:29 +08:00
|
|
|
INSTALL(FILES ${NetCDF_BINARY_DIR}/config.h
|
2012-08-04 06:24:29 +08:00
|
|
|
DESTINATION include)
|
2012-08-07 04:53:34 +08:00
|
|
|
INSTALL(FILES ${NetCDF_SOURCE_DIR}/include/netcdf.h
|
|
|
|
DESTINATION include)
|
|
|
|
|
|
|
|
# Subdirectory CMakeLists.txt files should specify their own
|
|
|
|
# 'install' files.
|
|
|
|
# Including 'CPack' kicks everything off.
|
|
|
|
INCLUDE(InstallRequiredSystemLibraries)
|
|
|
|
CONFIGURE_FILE(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/FixBundle.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
|
|
|
SET (CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES};/${CMAKE_CURRENT_BINARY_DIR}/;~$")
|
|
|
|
|
|
|
|
# CPack inclusion must come last.
|
2012-08-04 06:24:29 +08:00
|
|
|
INCLUDE(CPack)
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-03 06:56:57 +08:00
|
|
|
|