############################################################################
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################
Import('*')

env.PartVersion("1.7.0")
env.PartName("gtest")

#files
cpp_files=[
    'gtest-all.cc'
    ]

#includes to install
install_headers = Glob('*.h')

parts_file = ['gtest.parts']
license_file = ['LICENSE']

if 'install_package' in env['MODE']:
    env.InstallTopLevel(cpp_files,sub_dir='ext/gtest')
    env.InstallTopLevel(install_headers,sub_dir='ext/gtest')
    env.InstallTopLevel(parts_file,sub_dir='ext/gtest')
    env.InstallTopLevel(license_file,sub_dir='ext/gtest')
else:
    env.Append(CPPPATH=[AbsDir('..')])
    

    #defines
    env.Append(CPPDEFINES = ['GTEST_HAS_PTHREAD=0',
                             '_VARIADIC_MAX=10'])
    env.ExportCPPDEFINES(['GTEST_HAS_PTHREAD=0',
                          '_VARIADIC_MAX=10'])

    outputs = env.Library('${PART_NAME}', cpp_files)
    sdk_outs = env.Sdk(outputs)

    env.SdkInclude(install_headers, sub_dir='${PART_NAME}')
