#---------------------------------------------------------------
#    Copyright 2006 - 2009 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.
#---------------------------------------------------------------

#
# The signature for Boost.build rules is described here:
#
# http://www.boost.org/build/doc/html/bbv2/overview/targets.html
#
#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 ;

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

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

explicit install-targets ;
alias install-targets
  : stk_app_driver
    stk_usecases_app
    stk_usecases_mesh
    stk_transfer_use_cases
    stk_usecases_edge_face_skin
  ;

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

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


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

#
# SECTION 4: Build configuration
#
# Note: if you un-comment (activate) the GNU_MALLOC_HOOKS macro, you also need
# to un-comment 'common_lib' below.

local xml-files =
  ;

local use-case-util-files = [ set.difference
  [ glob $(stk_usecases-root)/util/*.cpp ]
  :
  [ glob $(stk_usecases-root)/util/UtilUseCaseMain.cpp ]
  ]
  ;

local use-case-mesh-files = [ set.difference
  [ glob $(stk_usecases-root)/mesh/*.cpp ]
  :
  [ glob $(stk_usecases-root)/mesh/MeshUseCaseMain.cpp ]
  ]
  ;

lib stk_usecases_mesh_lib
  :
    $(use-case-mesh-files)
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_mesh//stk_mesh_fixtures
    /sierra/stk_io//stk_io
    /sierra/stk_io//stk_io_util
  ;

exe stk_usecases_edge_face_skin
  :
    $(stk_usecases-root)/app/create_edge_face_skin/create_edge_face_skin.cpp
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_util//stk_util_environment
    /sierra/stk_util//stk_util_parallel
    /sierra/stk_util//stk_util_util
    /sierra/stk_io//stk_io
    /tpl/boost-program-options//boost_program_options
  : <tag>@sierra-exec-tag
  ;


exe stk_usecases_app
  :
    [ glob $(stk_usecases-root)/app/*.cpp ]
    [ glob $(stk_usecases-root)/app/*.F ]
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_util//stk_util_use_case
    /sierra/stk_util//stk_util_parallel
    /sierra/stk_util//stk_util_util
    /sierra/stk_io//stk_io
    /sierra/stk_io//stk_io_util
    /sierra/seacas//ioss
    /sierra/seacas//ioinit
    /sierra/framework//etet
    /tpl/trilinos//shards
    /tpl/boost-program-options//boost_program_options
  : <tag>@sierra-exec-tag
    <tbb>on,<threading>multi,<toolset>gcc-3.4.3,<target-os>linux,<address-model>32:<linkflags>"-L/usr/sharelan/tbb21_20080605oss/build/linux_ia32_gcc_cc3.4.3_libc2.3.4_kernel2.6.9_release -ltbb"
    <tbb>on,<threading>multi,<toolset>gcc-4.2.4,<target-os>linux,<address-model>64:<linkflags>"-L/usr/sharelan/tbb21_20080605oss/build/linux_em64t_gcc_cc4.2.4_libc2.3.4_kernel2.6.9_release -ltbb"
    <tbb>on,<threading>multi,<toolset>intel-10.1,<target-os>linux,<address-model>64:<linkflags>"-L/usr/sharelan/tbb21_20080605oss/build/linux_em64t_icc_cc3.4.5_libc2.3.4_kernel2.6.9_release -ltbb"
  ;

exe stk_usecases_mesh
  :
    $(stk_usecases-root)/mesh/MeshUseCaseMain.cpp
    stk_usecases_mesh_lib
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_mesh//stk_mesh_fixtures
    /sierra/stk_util//stk_util_use_case
    /sierra/stk_util//stk_util_environment
    /sierra/stk_util//stk_util_util
    /tpl/boost-program-options//boost_program_options
  : <tag>@sierra-exec-tag
  ;

exe stk_transfer_use_cases
  :
    $(stk_usecases-root)/transfer/UseCaseMain.cpp
    [ glob $(stk_usecases-root)/transfer/*.cpp ]
    /sierra/stk_transfer//stk_transfer
    /tpl/operating_system//pthread
    /sierra/stk_io//stk_io
    /sierra/stk_io//stk_io_util
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_util//stk_util_use_case
    /sierra/stk_util//stk_util_diag
    /tpl/operating_system//pthread
    /tpl/trilinos//shards
    /tpl/trilinos//intrepid
  : <tag>@sierra-exec-tag
  ;

exe stk_app_driver
  :
    [ glob $(stk_usecases-root)/app/examples/*.cpp ]
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_util//stk_util_parallel
    /sierra/stk_util//stk_util_util
    /sierra/stk_io//stk_io_util
    /sierra/stk_io//stk_io
    /sierra/seacas//ioss
    /sierra/seacas//ioinit
    /tpl/trilinos//shards
    /tpl/boost-program-options//boost_program_options
  : <tag>@sierra-exec-tag
  ;

