############################################################################
# Copyright 2017 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("3.0.3")
env.PartName("argtable3")

# sourcefiles
src_files = Pattern(src_dir='.',
                    includes=['argtable3.c']).files()

#includes to install
install_headers = Pattern(src_dir='.',
                          includes=['argtable3.h']).files()

parts_file = ['argtable3.parts']
license_file = ['LICENSE']
makefile = ['Makefile']

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

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

    env.SdkInclude(install_headers)