3 log_level = env.get('LOG_LEVEL')
5 env.AppendUnique(CPPPATH = [os.path.join(Dir('.').abspath, 'include'),
9 if env.get('TARGET_OS') in ['arduino']:
10 env.AppendUnique(CPPPATH = [os.path.join(env.get('BUILD_DIR'), 'resource/c_common/oic_string/include')])
11 if env.get('TARGET_OS') == 'tizen':
12 env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
14 env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk', 'logger')])
16 if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True':
17 env.AppendUnique(CPPDEFINES = ['OIC_SUPPORT_TIZEN_TRACE'])
19 if not env.get('RELEASE'):
20 env.PrependUnique(LIBS = ['gcov'])
21 env.AppendUnique(CCFLAGS = ['--coverage'])
23 env.PrependUnique(LIBS = ['logger'])
25 local_env = env.Clone()
27 ######################################################################
28 # Source files and Targets
29 ######################################################################
31 #TODO work-around: at the moment if an Arduino build is done the logger.c file
32 # ends up using C++ such as for the arduino Time Library, Serial, etc.
33 # Therefore we copy it to a .cpp name so it is compiled correctly.
35 if env.get('TARGET_OS') in ['arduino']:
36 Command("./src/logger.cpp", "./src/logger.c", Copy("$TARGET", "$SOURCE"))
37 logger_src = ['./src/logger.cpp']
39 logger_src = ['./src/logger.c', './src/trace.c']
41 if log_level == 'DEBUG':
42 env.AppendUnique(CPPDEFINES = ['SET_LOG_DEBUG'])
44 if log_level == 'INFO':
45 env.AppendUnique(CPPDEFINES = ['SET_LOG_INFO'])
47 if log_level == 'ERROR':
48 env.AppendUnique(CPPDEFINES = ['SET_LOG_ERROR'])
50 if log_level == 'WARNING':
51 env.AppendUnique(CPPDEFINES = ['SET_LOG_WARNING'])
52 print "SET_LOG_WARNING"
53 if log_level == 'FATAL':
54 env.AppendUnique(CPPDEFINES = ['SET_LOG_FATAL'])
57 loggerlib = local_env.StaticLibrary('logger', logger_src)
58 local_env.InstallTarget(loggerlib, 'logger')