#---------------------------------------------------------------
#    Copyright 2006 - 2013 Sandia Corporation.
#    Under the terms of Contract DE-AC04-94AL85000, there is a
#    non-exclusive license for use of this work by or on behalf
#    of the U.S. Government.  Export of this program may require
#    a license from the United States Government.
#---------------------------------------------------------------
#
# http://www.boost.org/doc/libs/1_47_0/doc/html/bbv2/overview.html#bbv2.overview.targets
#
#function-name main-target-name
#    : sources
#    : requirements
#    : default-build
#    : usage-requirements
#    ;
#
#    * "main-target-name" is the name used to request the target
#            on command line and to use it from other main targets.
#            Main target name may contain alphanumeric characters and symbols '-' and '_';
#    * "sources" is the list of source files and other main targets that must be combined.
#    * "requirements" is the list of properties that must always be present
#            when this main target is built.
#    * "default-build" is the list of properties that will be used unless
#            some other value of the same feature is already specified.
#    * "usage-requirements" is the list of properties that will be propagated
#            to all main targets that use this one, i.e. to all dependedents.
#
#
# SECTION 1: Project definition
#

import set ;
import path ;

local stk_transfer-root-inc ;
if $(RTenv-arg) = "user" {
  stk_transfer-root-inc = $(stk_transfer-root)/include ;
} else {
  stk_transfer-root-inc = $(stk_transfer-root) ;
}

project votd
  : requirements
    $(sierra-warnings)
    <define>STK_BUILT_IN_SIERRA
    <include>$(stk_transfer-root-inc)
  : usage-requirements
    <include>$(stk_transfer-root-inc)
  : build-dir $(stk_transfer-builddir)
  ;

#
# SECTION 2: Development install
#
explicit install-serial-targets ;
alias install-serial-targets ;

explicit install-targets ;
alias install-targets
  : stk_transfer_utest
  ;

#
# SECTION 3: End-user install
#
explicit install-user-env ;
alias install-user-env : install-user-jamfile
                          install-user-include install-user-lib ;

# This rule copies build-system related files for this product to the install-root.
explicit install-user-jamfile ;
install install-user-jamfile
  : [ glob $(stk_transfer-root)/Jamfile ]
  : <location>$(install-root)/stk/stk_transfer
    <install-source-root>$(stk_transfer-root)
  ;


explicit install-user-include ;
install install-user-include
  : [ path.glob-tree $(stk_transfer-root) : *.h *.hpp ]
  : <location>$(install-root)/stk/stk_transfer/include <install-source-root>$(stk_transfer-root)
  ;

explicit install-user-lib ;
install install-user-lib
  : stk_transfer_impl
  : <location>$(install-root)/stk/stk_transfer/lib
  ;

explicit install-exe-targets ;
alias install-exe-targets : ;

#
# SECTION 4: Build configuration
#

local xml-files =
  ;

# This is currently a header-only library, so it must not use the lib rule.
# http://www.boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.html
# If sources are added to this library change this target to use the lib rule instead.
alias stk_transfer
  : # No sources defined for header-only libraries.
  : # No build requirements
  : # No default build
  : <include>$(stk_transfer-root-inc)
  ;

lib stk_transfer_impl
  :
    [ ifdevbuild
      [ glob 
        $(stk_transfer-root)/stk_transfer/copy_by_id/*.cpp 
      ]
    ]
    /sierra/stk_search//stk_search
    /sierra/stk_util//stk_util_parallel
    /mpi//mpi
  :
    [ ifuserbuild
        <file>$(stk_transfer-root)/lib/libstk_transfer_impl.a
    ]
  ;

exe stk_transfer_utest
  :
    [ glob 
      $(stk_transfer-root)/../stk_unit_tests/stk_transfer/*.cpp 
     ]
    /sierra/stk_unit_test_utils//stk_unit_main
    stk_transfer_impl
  : <tag>@sierra-exec-tag
    <include>$(stk_transfer-root-inc)
  ;

