#--------------------------------------------------------------- #    Copyright 2008 - 2008 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 ;

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

project votd
  : requirements
    $(sierra-warnings)
    <define>STK_BUILT_IN_SIERRA
    <include>$(stk_learning-root-inc)
  : usage-requirements
    <include>$(stk_learning-root-inc)
    <define>STK_BUILT_IN_SIERRA
  : build-dir $(stk_learning-builddir)
  ;
#
# SECTION 2: Development install
#
explicit install-serial-targets ;
alias install-serial-targets ;

explicit install-targets ;
alias install-targets
  :
    stk_learning_dgelement_utest
    stk_learning_openmp_utest
    stk_learning_mpi_openmp_utest
    stk_learning_kokkos_utest
    stk_learning_game_of_life_utest
    stk_learning_mesh_builder_utest
    stk_learning_imbalance_utest
    stk_learning_code_katas
#    stk_learning_sphere_utest
;

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

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


explicit install-user-bin ;
install install-user-bin
  :
  : <location>$(install-bin-dir)
  ;

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

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

#
# SECTION 4: Build configuration
#

exe stk_learning_dgelement_utest
  :
    [ glob $(stk_learning-root)/DGElement/*.cpp ]
    /sierra/stk_unit_test_utils//stk_unit_main
    /sierra/stk_tools//stk_tools_lib
  :
    <tag>@sierra-exec-tag
  ;

exe stk_learning_openmp_utest
  :
    $(gtest-root)/gtest/src/gtest_main.cc
    [ glob $(stk_learning-root)/OpenMP/*.C ]
    /sierra/stk_unit_test_utils//stk_unit_test_utils
  :
    <tag>@sierra-exec-tag
  ;

exe stk_learning_mpi_openmp_utest
  :
    [ glob $(stk_learning-root)/MpiPlusOpenMp/*.C ]
    [ glob $(stk_learning-root)/ForEachEntityLoops/*.cpp ]
    /sierra/stk_unit_test_utils//stk_unit_main
  :
    <tag>@sierra-exec-tag
  ;

lib stk_learning_game_of_life
  :
    [ ifdevbuild
    # Any parameters within this 'ifdevbuild' block apply to development
    # builds only and will not be present for user builds.
        [ glob $(stk_learning-root)/GameOfLife/*.cpp ]
    ]
    /sierra/stk_unit_test_utils//stk_unit_test_utils
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_topology//stk_topology
    /sierra/stk_util//stk_util_environment
  :
    [ ifuserbuild
    # Any parameters within this 'ifuserbuild' block apply to user
    # builds only and will not be present for developer builds.
        <file>$(stk_learning-root)/lib/libstk_learning_game_of_life.a
    ]
  ;

exe stk_learning_game_of_life_utest
  :
    [ glob $(stk_learning-root)/GameOfLife/UnitTest/*.cpp ]
    /sierra/stk_unit_test_utils//stk_unit_main
    stk_learning_game_of_life
  :
    <tag>@sierra-exec-tag
  ;

lib stk_learning_mesh_builder
  :
    [ ifdevbuild
    # Any parameters within this 'ifdevbuild' block apply to development
    # builds only and will not be present for user builds.
        [ glob $(stk_learning-root)/MeshBuilder/*.cpp ]
    ]
    /sierra/stk_unit_test_utils//stk_unit_test_utils
    /sierra/stk_mesh//stk_mesh_base
    /sierra/stk_topology//stk_topology
    /sierra/stk_util//stk_util_environment
  :
    [ ifuserbuild
    # Any parameters within this 'ifuserbuild' block apply to user
    # builds only and will not be present for developer builds.
        <file>$(stk_learning-root)/lib/libstk_learning_mesh_builder.a
    ]
  ;

exe stk_learning_imbalance_utest
  :
    [ glob $(stk_learning-root)/LoadImbalanceTimer/*.cpp ]
    /sierra/stk_unit_test_utils//stk_unit_main
  :
    <tag>@sierra-exec-tag
  ;

exe stk_learning_mesh_builder_utest
  :
    [ glob $(stk_learning-root)/MeshBuilder/UnitTest/*.cpp ]
    /sierra/stk_unit_test_utils//stk_unit_main
    stk_learning_game_of_life
    stk_learning_mesh_builder
  :
    <tag>@sierra-exec-tag
  ;

exe stk_learning_kokkos_utest 
  :
    [ glob $(stk_learning-root)/Kokkos/*.C ]
    /sierra/stk_unit_test_utils//stk_unit_main
    /sierra/stk_ngp//stk_ngp
  :
    <tag>@sierra-exec-tag
  ;

exe stk_learning_code_katas
  :
    [ glob $(stk_learning-root)/CodeKatas/*.C ]
    /sierra/stk_unit_test_utils//stk_unit_main
    /tpl/scalapack//scalapack
  :
    <tag>@sierra-exec-tag
  ;

