Changeset 3628 for palm/trunk


Ignore:
Timestamp:
Dec 12, 2018 6:24:13 PM (6 years ago)
Author:
knoop
Message:

Added RRTMG installation capability to automatic installer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/INSTALL/palm_installer_components

    r3506 r3628  
    2525palm_installer_build() {
    2626   printf "%s\n" "${program_name} installer is configuring using cmake..."
     27   if [[ "$palm_installer_build_rrtmg" == "true" ]]; then
     28      if [[ "$RRTMG_ROOT" == "" ]]; then
     29         RRTMG_ROOT=${install_prefix}/rrtmg
     30      fi
     31   fi
    2732   palm_installer_create_files
    2833   rm -rf ${build_dir}
     
    3338         ${NETCDF_C_ROOT:+-DNETCDF_C_ROOT=}${NETCDF_C_ROOT} \
    3439         ${NETCDF_FORTRAN_ROOT:+-DNETCDF_FORTRAN_ROOT=}${NETCDF_FORTRAN_ROOT} \
     40         ${RRTMG_ROOT:+-DRRTMG_ROOT=}${RRTMG_ROOT} \
    3541         -DPALM_CORES=$NUM_PROC_BUILD \
    3642         -DCMAKE_BUILD_TYPE=Release \
     
    5359      palm_installer_abort_message
    5460   fi
     61   if [[ "$palm_installer_build_rrtmg" == "true" ]]; then
     62       palm_installer_build_rrtmg
     63   fi
    5564   cd ${install_prefix}
    5665   rm -rf ${source_dir}
    5766   rm -rf MAKE_DEPOSITORY_parallel
    5867   bash ${trunk_dir}/SCRIPTS/palmbuild -v -c "default"
     68}
     69
     70palm_installer_build_rrtmg() {
     71   printf "%s\n" "${program_name} installer is building the RRTMG library..."
     72   local version="1.0"
     73   local prog="librrtmg"
     74   build_dir_rrtmg=${source_dir}/rrtmg
     75   mkdir -p ${build_dir_rrtmg}
     76   cp ${trunk_dir}/LIB/rrtmg/*.f90  ${build_dir_rrtmg}/
     77   cp ${trunk_dir}/LIB/rrtmg/Makefile  ${build_dir_rrtmg}/
     78   cd ${build_dir_rrtmg}
     79   bash ${build_dir_rrtmg}/build_rrtmg
     80   mkdir -p ${build_dir_rrtmg}/lib
     81   mkdir -p ${build_dir_rrtmg}/include
     82   cp ${build_dir_rrtmg}/$prog.so ${build_dir_rrtmg}/lib/$prog.so.$version
     83   cp ${build_dir_rrtmg}/*.mod    ${build_dir_rrtmg}/include/
     84   mkdir -p ${RRTMG_ROOT}/lib
     85   mkdir -p ${RRTMG_ROOT}/include
     86   cp ${build_dir_rrtmg}/lib/$prog.so.$version ${RRTMG_ROOT}/lib/
     87   cp ${build_dir_rrtmg}/include/*.mod ${RRTMG_ROOT}/include/
     88   if [ -f ${RRTMG_ROOT}/lib/$prog.so.1 ]
     89   then
     90       rm ${RRTMG_ROOT}/lib/$prog.so.1
     91   fi
     92   ln -s ${RRTMG_ROOT}/lib/$prog.so.$version ${RRTMG_ROOT}/lib/$prog.so.1
     93   if [ -f ${RRTMG_ROOT}/lib/$prog.so ]
     94   then
     95       rm ${RRTMG_ROOT}/lib/$prog.so
     96   fi
     97   ln -s ${RRTMG_ROOT}/lib/$prog.so.1 ${RRTMG_ROOT}/lib/$prog.so
    5998}
    6099
     
    186225set(config \${CMAKE_INSTALL_PREFIX}/.palm.config.default)
    187226
     227# palmtest.yml locations
     228set(palmtest_in \${CMAKE_CURRENT_SOURCE_DIR}/.palmtest.yml.in)
     229set(palmtest \${CMAKE_INSTALL_PREFIX}/palmtest.yml)
     230
     231# build_rrtmg locations
     232set(build_rrtmg_in \${CMAKE_CURRENT_SOURCE_DIR}/build_rrtmg.in)
     233set(build_rrtmg \${CMAKE_CURRENT_SOURCE_DIR}/rrtmg/build_rrtmg)
     234
    188235# include local cmake files
    189236set(PALM_CMAKE_FILES \${CMAKE_CURRENT_SOURCE_DIR})
     
    254301   set(PALM_COMPILER_OPTIONS "\${PALM_COMPILER_OPTIONS} -I \${NETCDF_INCLUDES}")
    255302   set(PALM_LINKER_OPTIONS "\${PALM_LINKER_OPTIONS} \${NETCDF_LIBRARIES}")
     303   set(PALMTEST_NETCDF_INCLUDES "netcdf: \"-I \${NETCDF_INCLUDES}\"")
     304   set(PALMTEST_NETCDF_LIBRARIES "netcdf: \"\${NETCDF_LIBRARIES}\"")
    256305endif()
    257306
     
    259308   set(PALM_COMPILER_OPTIONS "\${PALM_COMPILER_OPTIONS} -I \${FFTW_INCLUDES}")
    260309   set(PALM_LINKER_OPTIONS "\${PALM_LINKER_OPTIONS} \${FFTW_LIBRARIES}")
     310   set(PALMTEST_FFTW_INCLUDES "fftw: \"-I \${FFTW_INCLUDES}\"")
     311   set(PALMTEST_FFTW_LIBRARIES "fftw: \"\${FFTW_LIBRARIES}\"")
     312endif()
     313
     314if(RRTMG_ROOT)
     315   set(PALMTEST_RRTMG_INCLUDES "rrtmg: \"-I \${RRTMG_ROOT}/include\"")
     316   set(PALMTEST_RRTMG_LIBRARIES "rrtmg: \"\${RRTMG_ROOT}/lib/librrtmg.so\"")
    261317endif()
    262318
     
    267323configure_file(\${config_in} \${config} @ONLY)
    268324
     325# configuring the palmtest.yml
     326configure_file(\${palmtest_in} \${palmtest} @ONLY)
     327
     328if(RRTMG_ROOT)
     329   # configuring the build_rrtmg
     330   configure_file(\${build_rrtmg_in} \${build_rrtmg} @ONLY)
     331endif()
    269332
    270333EOF
     
    532595
    533596EOF
     597
     598   cat > ${source_dir}/.palmtest.yml.in << EOF
     599---
     600# this is a palmtest environments file
     601
     602palm_config_template:
     603
     604environments:
     605
     606  @CMAKE_Fortran_COMPILER_ID@:
     607    executable: @CMAKE_Fortran_COMPILER@
     608    mpi_wrapper: @MPI_Fortran_COMPILER@
     609    include:
     610      @PALMTEST_NETCDF_INCLUDES@
     611      @PALMTEST_FFTW_INCLUDES@
     612      @PALMTEST_RRTMG_INCLUDES@
     613    lib:
     614      @PALMTEST_NETCDF_LIBRARIES@
     615      @PALMTEST_FFTW_LIBRARIES@
     616      @PALMTEST_RRTMG_LIBRARIES@
     617
     618EOF
     619
     620   cat > ${source_dir}/build_rrtmg.in << EOF
     621#!/usr/bin/env bash
     622
     623make -f Makefile F90=@MPI_Fortran_COMPILER@  PROG=librrtmg F90FLAGS="@PALM_COMPILER_OPTIONS@"
     624
     625EOF
     626
     627
    534628}
    535629
Note: See TracChangeset for help on using the changeset viewer.