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-07-11 01:41:05 +08:00
|
|
|
project(NETCDF C)
|
2012-07-18 04:50:43 +08:00
|
|
|
SET(PACKAGE_VERSION 4.2.1-rc1)
|
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-11 01:41:05 +08:00
|
|
|
#Add custom CMake Modules
|
|
|
|
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)
|
|
|
|
|
|
|
|
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
2012-07-18 04:50:43 +08:00
|
|
|
# HDF5 cache variables.
|
|
|
|
SET (DEFAULT_CHUNK_SIZE 4194304)
|
|
|
|
SET (DEFAULT_CHUNKS_IN_CACHE 10)
|
|
|
|
SET (CHUNK_CACHE_SIZE 4194304)
|
|
|
|
SET (CHUNK_CACHE_NELEMS 1009)
|
|
|
|
SET (CHUNK_CACHE_PREEMPTION 0.75)
|
|
|
|
SET (MAX_DEFAULT_CACHE_SIZE 67108864)
|
|
|
|
#OPTION (DEFAULT_CHUNK_SIZE "Default Chunk Cache Size." 4194304)
|
|
|
|
#OPTION (CHUNK_CACHE_SIZE "Default Chunk Cache Size." 4194304)
|
|
|
|
#OPTION (CHUNK_CACHE_NELEMS "Default maximum number of elements in cache." 1009)
|
|
|
|
#OPTION (CHUNK_CACHE_PREEMPTION "Default file chunk cache preemption policy for HDF5 files (a number between 0 and 1, inclusive." 0.75)
|
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-07-11 01:41:05 +08:00
|
|
|
# Option to Build DLL
|
|
|
|
OPTION (DLL_NETCDF "Build a Windows DLL." OFF)
|
|
|
|
|
|
|
|
# Option to Build DAP Client
|
|
|
|
OPTION (ENABLE_DAP "Enable DAP Client." OFF)
|
|
|
|
|
2012-07-14 00:49:20 +08:00
|
|
|
# Option to use MMAP
|
|
|
|
OPTION (BUILD_MMAP "Use MMAP." OFF)
|
|
|
|
|
|
|
|
# Option to use Diskless
|
|
|
|
OPTION (BUILD_DISKLESS "Build Diskless." OFF)
|
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# Option Logging, only valid for netcdf4.
|
|
|
|
OPTION (LOGGING "Enable Logging." OFF)
|
2012-07-14 00:49:20 +08:00
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# Option to le 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-11 01:41:05 +08:00
|
|
|
ENDIF (USE_HDF4)
|
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# Option to Enable HDF5
|
|
|
|
OPTION (USE_HDF5 "Use HDF5." OFF)
|
|
|
|
IF (USE_HDF5)
|
|
|
|
FIND_PACKAGE(HDF5)
|
|
|
|
IF(NOT HDF5_FOUND)
|
|
|
|
MESSAGE(FATAL_ERROR "HDF5 Not Found")
|
|
|
|
ENDIF(NOT HDF5_FOUND)
|
|
|
|
CHECK_INCLUDE_FILE("hdf5.h" HAVE_HDF5_H)
|
|
|
|
IF(NOT HAVE_HDF5_H)
|
|
|
|
MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find hdf5.h")
|
|
|
|
ENDIF(NOT HAVE_HDF5_H)
|
|
|
|
|
|
|
|
CHECK_LIBRARY_EXISTS(hdf5_hl H5DSis_scale "" HAVE_HDF5_HL)
|
|
|
|
IF(NOT HAVE_HDF5_HL)
|
|
|
|
MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot link against hdf5_hl")
|
|
|
|
ENDIF(NOT HAVE_HDF5_HL)
|
|
|
|
|
|
|
|
SET(H5_USE_16_API 1)
|
|
|
|
|
|
|
|
ENDIF (USE_HDF5)
|
2012-07-11 01:41:05 +08:00
|
|
|
# Packages to include
|
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
#FIND_PACKAGE (CURL)
|
|
|
|
#FIND_PACKAGE (ZLIB)
|
2012-07-11 01:41:05 +08:00
|
|
|
|
2012-07-17 06:31:35 +08:00
|
|
|
# Enable some additional flags.
|
|
|
|
IF (DLL_NETCDF)
|
|
|
|
SET(BUILD_DLL ON)
|
2012-07-20 01:25:24 +08:00
|
|
|
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -DDLL_EXPORT)
|
|
|
|
#ADD_DEFINITION(-DDLL_EXPORT)
|
2012-07-17 06:31:35 +08:00
|
|
|
ENDIF (DLL_NETCDF)
|
|
|
|
|
2012-07-18 04:50:43 +08:00
|
|
|
# Library checks
|
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-18 04:50:43 +08:00
|
|
|
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
2012-07-11 01:41:05 +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-18 04:50:43 +08:00
|
|
|
# Option for file cache size for HDF5
|
2012-07-11 01:41:05 +08:00
|
|
|
|
|
|
|
# Create config.h file
|
|
|
|
configure_file("${NETCDF_SOURCE_DIR}/cmake_config.h.in"
|
|
|
|
"${NETCDF_BINARY_DIR}/config.h")
|
|
|
|
INCLUDE_DIRECTORIES(${NETCDF_BINARY_DIR})
|
|
|
|
## End autotools-style checs for config.h
|
|
|
|
|
2012-07-03 06:59:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
#----
|
|
|
|
# Set core names of the libraries.
|
|
|
|
#---
|
|
|
|
SET (NETCDF_LIB_CORENAME "netcdf")
|
|
|
|
|
|
|
|
#---
|
|
|
|
# Set the true names of all the libraries, if customized by external project
|
|
|
|
#---
|
2012-07-18 04:50:43 +08:00
|
|
|
INCLUDE_DIRECTORIES(${NETCDF_SOURCE_DIR}/include)
|
|
|
|
INCLUDE_DIRECTORIES(${NETCDF_SOURCE_DIR}/oc)
|
2012-07-03 06:59:59 +08:00
|
|
|
|
|
|
|
# Recurse into other subdirectories.
|
2012-07-11 01:41:05 +08:00
|
|
|
#add_subdirectory(include)
|
|
|
|
#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-18 05:44:41 +08:00
|
|
|
add_subdirectory(liblib)
|
2012-07-11 01:41:05 +08:00
|
|
|
#add_subdirectory(nc_test4)
|
|
|
|
#add_subdirectory(nc_test)
|
|
|
|
#add_subdirectory(ncdump)
|
|
|
|
#add_subdirectory(ncgen3)
|
|
|
|
#add_subdirectory(ncgen)
|
|
|
|
#add_subdirectory(examples)
|
|
|
|
#add_subdirectory(oc)
|
|
|
|
#add_subdirectory(libdap2)
|
|
|
|
#add_subdirectory(libcdmr)
|
|
|
|
#add_subdirectory(librpc)
|
|
|
|
#add_subdirectory(libdispatch)
|
|
|
|
#add_subdirectory(liblib)
|
|
|
|
#add_subdirectory(ncdump)
|
|
|
|
#add_subdirectory(ncdap_test)
|