#!/usr/bin/env python
Import('mlib_tests_env', 'user_options_dict', 'UnitTest')

lib_mlib_tests_env = mlib_tests_env.Clone()
bin_mlib_tests_env = mlib_tests_env.Clone()

lib_path  = user_options_dict['LIB_BUILD_DIR']
#bin_path  = user_options_dict['BIN_BUILD_DIR']

######
# lib
mlib_tests_lib_name = 'mlib_tests'
lib_src_files = [
                 'test_common.cpp',
                ]

# Precompiled header install
# :ATTENTION: if you use precompiled header in another project then point it out in
# SetPCH() function' argument 'additional_envs', like [bin_mlib_tests_env] here!
user_options_dict['SetPCH'](lib_mlib_tests_env, '_pc_.h', [bin_mlib_tests_env])

lib_mlib_tests_env.Library( target = lib_path +'/'+mlib_tests_lib_name, source = lib_src_files )

######
# bin
source_files = [
                'test_dataware.cpp',
                'test_main.cpp',
                'test_ptr.cpp',
                'test_stream.cpp',
                'test_tech.cpp',
                'test_utils.cpp',
               ]

bin_mlib_tests_env.Prepend( LIBS = [mlib_tests_lib_name, 'MdLib'] )

test_prg_name = 'mlib_tests'
bin_mlib_tests_env.Program( target = test_prg_name, source = source_files )

UnitTest(test_prg_name, bin_mlib_tests_env)


