#******************************************************************
#
# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# 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.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

##
# liboc_logger examples build script
##

Import('env')

lib_env = env.Clone()
SConscript('#resource/third_party_libs.scons', 'lib_env')

examples_env = lib_env.Clone()
######################################################################
# Build flags
######################################################################
examples_env.PrependUnique(CPPPATH = ['../include'])
examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
examples_env.AppendUnique(LIBS = ['oc_logger'])
examples_env.Append(LIBS = ['c_common'])

compiler = env.get('CC')
if compiler != 'cl':
	examples_env.AppendUnique(LIBS = ['stdc++'])

target_os = env.get('TARGET_OS')
if target_os == 'android':
	examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
	examples_env.AppendUnique(LIBS = ['gnustl_shared'])

if target_os not in ['arduino', 'windows']:
	examples_env.AppendUnique(CFLAGS = Split('-Wall -std=c99 -Werror'))
	examples_env.AppendUnique(CXXFLAGS = Split('-Wall -std=c++0x'))

######################################################################
# Source files and Targets
######################################################################
examples_c = examples_env.Program('examples_c', 'test_logging.c', OBJPREFIX='c_')
examples_cpp = examples_env.Program('examples_cpp', 'test_logging.cpp')

Alias('liboc_logger_examples', [examples_c, examples_cpp])
examples_env.AppendTarget('liboc_logger_examples')

