# Unofficial and incomplete build file using Boost build system.
# You should use make unless you know what you are doing.

import os ;

local boost_dir = [ os.environ BOOST_DIR ] ;
if ! $(boost_dir)
{
    boost_dir = "/usr/local" ;
}

#using clang : : ;

local cxx_std = [ os.environ CXX_STD ] ;
if ! $(cxx_std)
{
    cxx_std = c++11 ;
}

project mapbox_variant
    : requirements
      <cxxflags>-std=$(cxx_std)
      <include>$(boost_dir)/include
      <include>include
      <include>test/include
      <variant>release:<cxxflags>-march=native
      <threading>single:<define>SINGLE_THREADED
    : default-build
      <variant>release
      <optimization>speed
      <threading>single
    ;

rule exe-test ( name : reqs * : deps * )
{
    exe $(name)
        : test/$(name).cpp
        : $(reqs)
        : $(deps)
        ;
    explicit $(name) ;
}

exe-test bench_variant
    : <variant>release:<cxxflags>-Wweak-vtables
    ;

exe-test binary_visitor_test ;
exe-test recursive_wrapper_test ;
exe-test unique_ptr_test ;
exe-test reference_wrapper_test ;
exe-test lambda_overload_test ;
exe-test hashable_test ;

install out
    : bench_variant
      binary_visitor_test
      unique_ptr_test
      reference_wrapper_test
      lambda_overload_test
      hashable_test
    ;   
