Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release/public-v2: turn option DEPLOY on by default, update documentation #80

Merged
Prev Previous commit
Next Next commit
Remove manual NCEPLIBS-external cmake config file (left from release/…
…public-v1), create libjpeg and jasper modules
  • Loading branch information
climbfuji committed Oct 27, 2020
commit a2816244eea20bd54a4d45e4586da55790e163c4
24 changes: 6 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -43,12 +43,6 @@ set(install_path ${CMAKE_INSTALL_PREFIX})
include(ExternalProject)
include(GNUInstallDirs)

if(NOT EXISTS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR})
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR})
endif()
set(CMAKE_CONFIG_FILE "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/nceplibs-external.cmake.config")
file(WRITE ${CMAKE_CONFIG_FILE} "# CMake configuration file for NCEPLIBS-external\n")

if(BUILD_MPI)
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER 9.9)
set(MPICH_FORTRAN_FLAGS "-w -fallow-argument-mismatch")
@@ -70,7 +64,6 @@ if(BUILD_MPI)
set(MPI_ROOT ${CMAKE_INSTALL_PREFIX})
set(MPI_C_LIBRARY_VERSION_STRING "MPICH")
set(MPI_C_VERSION_MAJOR "3")
file(APPEND ${CMAKE_CONFIG_FILE} "set(MPI_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
set(MPI_DETERMINE_LIBRARY_VERSION true)
find_package(MPI REQUIRED)
@@ -105,8 +98,6 @@ if(BUILD_NETCDF OR BUILD_PNG)
TEST_COMMAND cd ${PROJECT_BINARY_DIR}/zlib/build && make test
INSTALL_COMMAND $(MAKE) install
)

file(APPEND ${CMAKE_CONFIG_FILE} "set(ZLIB_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
endif()

if(BUILD_NETCDF)
@@ -186,9 +177,6 @@ if(BUILD_NETCDF)
TEST_COMMAND cd ${PROJECT_BINARY_DIR}/netcdf-fortran && $(MAKE) check
DEPENDS netcdf
)

file(APPEND ${CMAKE_CONFIG_FILE} "set(HDF5_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
file(APPEND ${CMAKE_CONFIG_FILE} "set(NETCDF \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
# Find NetCDF
add_custom_target(netcdf-fortran)
@@ -216,7 +204,6 @@ if(BUILD_PNG)
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
DEPENDS zlib
)
file(APPEND ${CMAKE_CONFIG_FILE} "set(PNG_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
# Find PNG
add_custom_target(libpng)
@@ -250,9 +237,6 @@ if(BUILD_JASPER)
INSTALL_COMMAND cd ${PROJECT_BINARY_DIR}/jasper && $(MAKE) install
DEPENDS libjpeg
)

file(APPEND ${CMAKE_CONFIG_FILE} "set(JPEG_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
file(APPEND ${CMAKE_CONFIG_FILE} "set(Jasper_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
# Find JPEG and Jasper
add_custom_target(libjpeg)
@@ -312,8 +296,6 @@ if(BUILD_ESMF)
#TEST_BEFORE_INSTALL TRUE
INSTALL_COMMAND ${CMAKE_COMMAND} -E env PATH=${ESMF_PATH} ESMF_DIR=${PROJECT_SOURCE_DIR}/esmf ESMF_COMM=${MPITYPE} ESMF_COMPILER=${comp} ESMF_NETCDF=1 ESMF_NETCDF_INCLUDE=${NETCDF_INCLUDE_DIRS} ESMF_NETCDF_LIBS=${NETCDF_LIBRARIES} ESMF_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ESMF_INSTALL_HEADERDIR=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} ESMF_INSTALL_MODDIR=${CMAKE_INSTALL_PREFIX}/mod ESMF_INSTALL_LIBDIR=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} ESMF_INSTALL_BINDIR=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} ESMF_BOPT=${ESMF_BOPT} ESMF_OPTLEVEL=${ESMF_OPTLEVEL} ESMF_F90COMPILEOPTS=${ESMF_F90COMPILEOPTS} ESMF_CXXCOMPILEOPTS=${ESMF_CXXCOMPILEOPTS} $(MAKE) install
DEPENDS mpi netcdf-fortran)

file(APPEND ${CMAKE_CONFIG_FILE} "set(ESMFMKFILE \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/esmf.mk\")\n")
endif()

# Install modules (if DEPLOY = ON)
@@ -323,6 +305,12 @@ if(DEPLOY)
set(PNG_VERSION "1.6.35")
configure_file(${PROJECT_SOURCE_DIR}/tmplModulefiles/libpng ${CMAKE_INSTALL_PREFIX}/modules/libpng/${PNG_VERSION})
endif()
if(BUILD_JASPER)
set(JPEG_VERSION "9.1.0")
configure_file(${PROJECT_SOURCE_DIR}/tmplModulefiles/libjpeg ${CMAKE_INSTALL_PREFIX}/modules/libjpeg/${JPEG_VERSION})
set(JASPER_VERSION "1.900.1")
configure_file(${PROJECT_SOURCE_DIR}/tmplModulefiles/jasper ${CMAKE_INSTALL_PREFIX}/modules/jasper/${JASPER_VERSION})
endif()
if(BUILD_NETCDF)
set(NETCDF_VERSION "4.7.4")
configure_file(${PROJECT_SOURCE_DIR}/tmplModulefiles/netcdf ${CMAKE_INSTALL_PREFIX}/modules/netcdf/${NETCDF_VERSION})
11 changes: 11 additions & 0 deletions tmplModulefiles/jasper
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#%Module######################################################################

proc ModulesHelp { } {
puts "Set environment variables for jasper-${JASPER_VERSION}"
}

# Make sure another version of the same package is not already loaded
conflict jasper

# Set environment variables
setenv JASPER_ROOT ${CMAKE_INSTALL_PREFIX}
11 changes: 11 additions & 0 deletions tmplModulefiles/libjpeg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#%Module######################################################################

proc ModulesHelp { } {
puts "Set environment variables for libjpeg-${JPEG_VERSION}"
}

# Make sure another version of the same package is not already loaded
conflict libjpeg

# Set environment variables
setenv JPEG_ROOT ${CMAKE_INSTALL_PREFIX}