Changeset 1497


Ignore:
Timestamp:
05/03/18 14:05:28 (2 years ago)
Author:
oabramkina
Message:

Adding the following compilation options in order to separate the build and the source directories:

--build_path : path to the build directory
--build_dir : name of the build directory
--build_suffixed : generate automatically suffixed name of the build directory.

By default the root directory of the build and the source is the same.
If both options, build_dir and build_suffixed, are specified, the suffixed name will be used.

For example, if XIOS is compiled with the following command:
./make_xios --arch GCC_LINUX --prod --build_path ~/toto --build_indexed

the build directory will be:

~/toto/config_GCC_LINUX_prod

Location:
XIOS/dev/XIOS_DEV_CMIP6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/bld.cfg

    r1449 r1497  
    88# ------------------------------------------------------------------------------ 
    99 
    10 inc arch.fcm 
    11 inc config.fcm 
     10# Specifying the build directory 
     11inc bld_dir.cfg 
    1212 
    1313%CFLAGS           %BASE_CFLAGS %COMPIL_CFLAGS 
     
    1515%LD_FLAGS         %ARCH_LD %BASE_LD 
    1616 
    17  
    18 dest::root   $PWD 
    19  
    2017bld::infile_ext::cpp   C::SOURCE 
    2118bld::infile_ext::conf  CPP::INCLUDE 
    2219bld::infile_ext::hpp   CPP::INCLUDE 
    2320 
     21# IMPORTANT: as the build directory may not necessarily coincide with the source directory,  
     22# each source subfolder should be declared individually 
     23search_src           false 
     24src::xios                               $PWD/src 
     25src::xios::config                       $PWD/src/config 
     26src::xios::date                         $PWD/src/date 
     27src::xios::filter                       $PWD/src/filter 
     28src::xios::functor                      $PWD/src/functor 
     29src::xios::interface::c                 $PWD/src/interface/c 
     30src::xios::interface::c_attr            $PWD/src/interface/c_attr 
     31src::xios::interface::fortran           $PWD/src/interface/fortran 
     32src::xios::interface::fortran_attr      $PWD/src/interface/fortran_attr 
     33src::xios::io                           $PWD/src/io 
     34src::xios::node                         $PWD/src/node 
     35src::xios::parse_expr                   $PWD/src/parse_expr 
     36src::xios::test                         $PWD/src/test 
     37src::xios::transformation               $PWD/src/transformation 
     38src::xios::transformation::Functions    $PWD/src/transformation/Functions 
     39src::xios::type                         $PWD/src/type 
    2440 
    25 search_src           true 
    26 src::zzz . 
     41 
    2742#src::date $PWD/extern/boost/src/date_time 
    2843src::blitz $PWD/extern/blitz/src 
     
    6075# Pre-process code before analysing dependencies 
    6176bld::pp    false           
    62 bld::pp::interface/fortran              true 
    63 bld::pp::interface/fortran_attr         true 
     77bld::pp::xios::interface::fortran              true 
     78bld::pp::xios::interface::fortran_attr         true 
    6479bld::excl_dep        use::mod_prism_get_comm 
    6580bld::excl_dep        use::mod_prism_get_localcomm_proto 
  • XIOS/dev/XIOS_DEV_CMIP6/make_xios

    r1458 r1497  
    55use_oasis="false" 
    66oasis="oasis3_mct" 
     7build_path="./" 
     8build_dir="./" 
     9build_suffixed="false" 
    710use_extern_boost="false" 
    811use_extern_blitz="false" 
     
    1114netcdf_lib="netcdf4_par" 
    1215compil_mode="prod" 
    13 arch_path="arch" 
    14 arch_default_path="arch" 
     16arch_path=$PWD/"arch" 
     17arch_default_path=$PWD/"arch" 
    1518arch_defined="FALSE" 
    1619arch_path_defined="FALSE" 
     
    3033            echo "       [--avail] : to know available target architectures " 
    3134            echo "       [--full] : to generate dependencies and recompile from scratch" 
    32             echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler"i 
     35            echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler" 
     36        echo "       [--build_path : absolute or relative path to the build directory" 
     37        echo "       [--build_dir : name of the build directory" 
     38        echo "       [--build_suffixed : generate automatically suffixed name of the build directory (e.g. config_X64_CURIE_prod)" 
    3339        echo "       [--use_extern_boost : to use external boost library" 
    3440        echo "       [--use_extern_blitz : to use external blitz library" 
     
    4854         "--full")  compil_full="true"  ; shift ;; 
    4955         "--use_oasis")  use_oasis="true" oasis=$2 ; shift ; shift  ;; 
     56         "--build_path")  build_path=$2     ; shift ; shift ;; 
     57         "--build_dir")  build_dir=$2     ; shift ; shift ;; 
     58         "--build_suffixed")  build_suffixed="true" ; shift  ;; 
    5059         "--use_extern_boost")  use_extern_boost="true" ; shift  ;; 
    5160         "--use_extern_blitz")  use_extern_blitz="true" ; shift  ;; 
     
    7382fi 
    7483 
     84# Definition of the root directory of the build  
     85if [[ "$build_suffixed" == "true" ]]; then 
     86    install_dir=$PWD/${build_path}/config_${arch}_${compil_mode} 
     87else 
     88    install_dir=$PWD/${build_path}/${build_dir} 
     89fi 
     90mkdir -p $install_dir 
     91 
     92rm -f ${PWD}/bld_dir.cfg 
     93echo "inc    ${install_dir}/arch.fcm" >> ${PWD}/bld_dir.cfg  
     94echo "inc    ${install_dir}/config.fcm" >> ${PWD}/bld_dir.cfg 
     95echo "dir::root  ${install_dir}"   >> ${PWD}/bld_dir.cfg 
     96 
    7597# Vérification de la présence d'un identifiant d'architecture. 
    7698 
     
    87109if [[ "$arch_defined" == "TRUE" ]] 
    88110then 
    89   rm -f arch.path 
    90   rm -f arch.fcm 
    91   rm -f arch.env 
     111  rm -f ${install_dir}/arch.path 
     112  rm -f ${install_dir}/arch.fcm 
     113  rm -f ${install_dir}/arch.env 
    92114 
    93115  if test -f $arch_path/arch-${arch}.path 
    94116  then 
    95     ln -s $arch_path/arch-${arch}.path arch.path 
     117    ln -s $arch_path/arch-${arch}.path ${install_dir}/arch.path 
    96118  elif test -f $arch_default_path/arch-${arch}.path 
    97119  then 
    98     ln -s $arch_default_path/arch-${arch}.path arch.path 
     120    ln -s $arch_default_path/arch-${arch}.path ${install_dir}/arch.path 
    99121  fi 
    100122         
    101123  if test -f $arch_path/arch-${arch}.fcm 
    102124  then 
    103     ln -s $arch_path/arch-${arch}.fcm arch.fcm 
     125    ln -s $arch_path/arch-${arch}.fcm ${install_dir}/arch.fcm 
    104126  elif test -f $arch_default_path/arch-${arch}.fcm 
    105127  then 
    106     ln -s $arch_default_path/arch-${arch}.fcm arch.fcm 
     128    ln -s $arch_default_path/arch-${arch}.fcm ${install_dir}/arch.fcm 
    107129  fi 
    108130 
    109131  if test -f $arch_path/arch-${arch}.env 
    110132  then 
    111     ln -s $arch_path/arch-${arch}.env arch.env 
     133    ln -s $arch_path/arch-${arch}.env ${install_dir}/arch.env 
    112134  elif test -f $arch_default_path/arch-${arch}.env 
    113135  then 
    114     ln -s $arch_default_path/arch-${arch}.env arch.env 
     136    ln -s $arch_default_path/arch-${arch}.env ${install_dir}/arch.env 
    115137  else 
    116     ln -s .void_file arch.env 
     138    ln -s .void_file ${install_dir}/arch.env 
    117139  fi 
    118   source arch.env 
    119   source arch.path 
     140  source ${install_dir}/arch.env 
     141  source ${install_dir}/arch.path 
    120142else 
    121143      echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!" 
     
    225247XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" 
    226248 
    227 rm -f config.fcm 
    228 echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm 
    229 echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm 
    230 echo "%CPP_KEY       $XIOS_CPPKEY"   >> config.fcm 
    231  
    232 echo "%CBASE_INC     $XIOS_CINCDIR" >> config.fcm      
    233 echo "%FBASE_INC     $XIOS_FINCDIR" >> config.fcm 
    234 echo "%ARCH_LD       $XIOS_LIB"     >> config.fcm  
     249rm -f ${install_dir}/config.fcm 
     250echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> ${install_dir}/config.fcm 
     251echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> ${install_dir}/config.fcm 
     252echo "%CPP_KEY       $XIOS_CPPKEY"   >> ${install_dir}/config.fcm 
     253 
     254echo "%CBASE_INC     $XIOS_CINCDIR" >> ${install_dir}/config.fcm      
     255echo "%FBASE_INC     $XIOS_FINCDIR" >> ${install_dir}/config.fcm 
     256echo "%ARCH_LD       $XIOS_LIB"     >> ${install_dir}/config.fcm  
    235257 
    236258echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !" 
Note: See TracChangeset for help on using the changeset viewer.