failed approach
This commit is contained in:
109
gomspace/libutil/wscript
Normal file
109
gomspace/libutil/wscript
Normal file
@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# Copyright (c) 2013-2017 GomSpace A/S. All rights reserved.
|
||||
|
||||
import gs_gcc
|
||||
import gs_doc
|
||||
import gs_dist
|
||||
from waflib.Build import BuildContext
|
||||
|
||||
APPNAME = 'util'
|
||||
|
||||
|
||||
def options(ctx):
|
||||
ctx.load('gs_gcc gs_doc')
|
||||
gs_gcc.gs_recurse(ctx)
|
||||
|
||||
gr = ctx.add_option_group('libutil options')
|
||||
gr.add_option('--console-history-len', metavar='LEN', default=10, type=int, help='Command history length, 0=none')
|
||||
gr.add_option('--console-input-len', metavar='LEN', default=100, type=int, help='Command input length')
|
||||
gr.add_option('--util-enable-isr-logs', action='store_true', help='Enable ISR logs')
|
||||
|
||||
|
||||
def configure(ctx):
|
||||
ctx.load('gs_gcc gs_doc')
|
||||
|
||||
ctx.env.append_unique('FILES_LIBUTIL', ['src/*.c',
|
||||
'src/gosh/**/*.c',
|
||||
'src/log/**/*.c',
|
||||
'src/vmem/**/*.c',
|
||||
'src/watchdog/**/*.c',
|
||||
'src/drivers/**/*.c'])
|
||||
|
||||
if ctx.env.GS_ARCH not in ['avr8']:
|
||||
ctx.env.append_unique('FILES_LIBUTIL', ['src/zip/**/*.c'])
|
||||
|
||||
if ctx.gs_is_linux():
|
||||
ctx.env.append_unique('FILES_LIBUTIL', ['src/linux/**/*.c'])
|
||||
|
||||
ctx.env.GS_UTIL_CMOCKA = ctx.check_cfg(package='cmocka', args='--cflags --libs',
|
||||
atleast_version='1.0.1', mandatory=False)
|
||||
|
||||
# Check compiler endianness - avr32 GCC doesn't support endian defines
|
||||
endianness = ctx.check_endianness()
|
||||
ctx.define_cond('UTIL_LITTLE_ENDIAN', endianness == 'little')
|
||||
ctx.define_cond('UTIL_BIG_ENDIAN', endianness == 'big')
|
||||
|
||||
ctx.define('GS_CONSOLE_HISTORY_LEN', ctx.options.console_history_len)
|
||||
ctx.define('GS_CONSOLE_INPUT_LEN', ctx.options.console_input_len)
|
||||
ctx.define_cond('GS_LOG_ENABLE_ISR_LOGS', ctx.options.util_enable_isr_logs)
|
||||
|
||||
ctx.gs_write_config_header('include/conf_util.h', remove=True)
|
||||
|
||||
ctx.gs_add_doxygen(example=['tst'], exclude=['*/include/gs/uthash/*',
|
||||
'*/include/gs/util/zip/*',
|
||||
'*/include/deprecated/util/*',
|
||||
'*/include/deprecated/gs/gosh/*'])
|
||||
|
||||
ctx.gs_register_handler(function='command_gen_4_0', filepath='./tools/waf_command.py')
|
||||
|
||||
gs_gcc.gs_recurse(ctx)
|
||||
|
||||
|
||||
def build(ctx):
|
||||
gs_gcc.gs_recurse(ctx)
|
||||
|
||||
public_include = ctx.gs_include(name=APPNAME,
|
||||
includes=['include', 'include/gs',
|
||||
'include/deprecated', 'include/deprecated/gs/gosh/'],
|
||||
config_header=['include/conf_util.h'])
|
||||
|
||||
ctx.gs_objects(source=ctx.path.ant_glob(ctx.env.FILES_LIBUTIL),
|
||||
target=APPNAME,
|
||||
includes=['src'],
|
||||
use=ctx.env.USE_LIBUTIL + [public_include])
|
||||
|
||||
ctx.gs_shlib(source=ctx.path.ant_glob(ctx.env.FILES_LIBUTIL),
|
||||
target=APPNAME,
|
||||
includes=['src'],
|
||||
gs_use_shlib=ctx.env.USE_LIBUTIL,
|
||||
use=[public_include],
|
||||
lib=['pthread'])
|
||||
|
||||
ctx.gs_python_bindings(source=ctx.path.ant_glob('src/bindings/python/*.c'),
|
||||
target=APPNAME,
|
||||
gs_use_shlib=ctx.env.USE_LIBUTIL + [APPNAME],
|
||||
use=[public_include],
|
||||
package='libutil')
|
||||
|
||||
if ctx.env.GS_UTIL_CMOCKA:
|
||||
ctx.gs_stlib(source=ctx.path.ant_glob('src/test/*.c'),
|
||||
name=APPNAME + '_cmocka', # overwrite default naming
|
||||
target=APPNAME + '_cmocka',
|
||||
includes=['include'])
|
||||
|
||||
|
||||
def doc(ctx):
|
||||
gs_doc.gs_library_doc(ctx, keyvalues={
|
||||
'gs_prod_name': 'lib'+APPNAME,
|
||||
'gs_prod_desc': 'Low level APIs and utilities',
|
||||
'gs_sphinx_exclude': ['CHANGELOG.rst'],
|
||||
})
|
||||
|
||||
|
||||
class Doc(BuildContext):
|
||||
cmd = fun = 'doc'
|
||||
|
||||
|
||||
def gs_dist(ctx):
|
||||
ctx.add_default_files(source_module=True)
|
Reference in New Issue
Block a user