fix to wscript so all targets build. Made build of both static and dynamic NORM libraries default

pull/9/head
Brian Adamson 2019-10-16 14:29:36 -04:00
parent baa04b9406
commit 1c3283fd3b
3 changed files with 26 additions and 23 deletions

View File

@ -3,7 +3,7 @@
// The "data" sent and received are simple text messages // The "data" sent and received are simple text messages
// of randomly-varying length. // of randomly-varying length.
XXXX - THIS CODE IS NOT YET COMPLETE !!!!! XXX - THIS CODE IS NOT YET A COMPLETE EXAMPLE !!!!!
#include <normApi.h> #include <normApi.h>
@ -12,6 +12,8 @@ XXXX - THIS CODE IS NOT YET COMPLETE !!!!!
#include <protoDebug.h> #include <protoDebug.h>
#include <protoTime.h> #include <protoTime.h>
#include <stdlib.h> // for rand(), srand()
void Usage() void Usage()
{ {
fprintf(stderr, "Usage: normDataExample [send][recv]\n"); fprintf(stderr, "Usage: normDataExample [send][recv]\n");

View File

@ -59,7 +59,7 @@ int main(int argc, char* argv[])
startTime.GetCurrentTime(); startTime.GetCurrentTime();
for (unsigned int i = 0; i < SHORT_DATA; i++) for (unsigned int i = 0; i < SHORT_DATA; i++)
{ {
encoder.Encode(txDataPtr[i], txDataPtr + SHORT_DATA); encoder.Encode(i, txDataPtr[i], txDataPtr + SHORT_DATA);
} }
stopTime.GetCurrentTime(); stopTime.GetCurrentTime();
double encodeTime = ProtoTime::Delta(stopTime, startTime); double encodeTime = ProtoTime::Delta(stopTime, startTime);

43
wscript
View File

@ -48,9 +48,6 @@ system = platform.system().lower()
def options(ctx): def options(ctx):
ctx.recurse('protolib') ctx.recurse('protolib')
build_opts = ctx.parser.add_option_group('Compile/install Options', 'Use during build/install step.') build_opts = ctx.parser.add_option_group('Compile/install Options', 'Use during build/install step.')
build_opts.add_option('--enable-static-library', action='store_true',
help='Enable building and installing static library. [default:false]')
def configure(ctx): def configure(ctx):
ctx.recurse('protolib') ctx.recurse('protolib')
@ -103,6 +100,7 @@ def build(ctx):
# (so we don't have to worry about LD_LIBRARY_PATH) # (so we don't have to worry about LD_LIBRARY_PATH)
ctx.shlib( ctx.shlib(
target = 'norm', target = 'norm',
name = 'norm_shlib',
includes = ['include'], includes = ['include'],
export_includes = ['include'], export_includes = ['include'],
vnum = VERSION, vnum = VERSION,
@ -112,18 +110,18 @@ def build(ctx):
features = 'cxx cxxshlib', features = 'cxx cxxshlib',
) )
if ctx.options.enable_static_library: ctx.stlib(
ctx.stlib( target = 'norm',
target = 'norm', name = 'norm_stlib',
includes = ['include'], includes = ['include'],
export_includes = ['include'], export_includes = ['include'],
vnum = VERSION, vnum = VERSION,
stlib = ["protolib"], stlib = ["protolib"],
use = ['objs'] + ctx.env.USE_BUILD_NORM, use = ['objs'] + ctx.env.USE_BUILD_NORM,
source = [], source = [],
features = 'cxx cxxstlib', features = 'cxx cxxstlib',
install_path = '${LIBDIR}', install_path = '${LIBDIR}',
) )
if ctx.env.BUILD_PYTHON: if ctx.env.BUILD_PYTHON:
ctx( ctx(
@ -136,7 +134,7 @@ def build(ctx):
ctx.shlib( ctx.shlib(
target = 'mil_navy_nrl_norm', target = 'mil_navy_nrl_norm',
includes = ['include'], includes = ['include'],
use = ['norm', 'JAVA'], use = ['norm_shlib', 'JAVA'],
vnum = VERSION, vnum = VERSION,
source = ['src/java/jni/{0}.cpp'.format(x) for x in [ source = ['src/java/jni/{0}.cpp'.format(x) for x in [
'normJni', 'normJni',
@ -158,16 +156,18 @@ def build(ctx):
destfile = 'norm.jar', destfile = 'norm.jar',
) )
# Links to static library since it uses C++ objects directly instead of API
normapp = ctx.program( normapp = ctx.program(
# Need to explicitly set a different name, because # Need to explicitly set a different name, because
# the library is also named "norm" # the library is also named "norm"
name = 'normapp', name = 'normapp',
target = 'normapp', target = 'normapp',
includes = ['include'],
use = ['protolib', 'norm_stlib'], use = ['protolib', 'norm_stlib'],
defines = [], defines = [],
source = ['src/common/{0}'.format(x) for x in [ source = ['src/common/{0}.cpp'.format(x) for x in [
'normPostProcess.cpp', 'normPostProcess',
'normApp.cpp', 'normApp',
]], ]],
# Disabled by default # Disabled by default
posted = True, posted = True,
@ -182,7 +182,7 @@ def build(ctx):
normapp.stlib = (["Shell32"]); normapp.stlib = (["Shell32"]);
for example in ( for example in (
'normDataExample', #'normDataExample',
'normDataRecv', 'normDataRecv',
'normDataSend', 'normDataSend',
'normFileRecv', 'normFileRecv',
@ -193,7 +193,7 @@ def build(ctx):
'normStreamer', 'normStreamer',
'normClient', 'normClient',
'normServer', 'normServer',
'wintest' #'wintest' # Windows only (can uncomment on Windows)
): ):
_make_simple_example(ctx, example) _make_simple_example(ctx, example)
@ -229,6 +229,7 @@ def _make_simple_example(ctx, name, path='examples'):
source.append('%s/normSocket.cpp' % path) source.append('%s/normSocket.cpp' % path)
example = ctx.program( example = ctx.program(
target = name, target = name,
includes = ['include', 'protolib/include'],
use = ['protolib'], use = ['protolib'],
defines = [], defines = [],
source = source, source = source,