wscript improvements for Windows

pull/9/head
bebopagogo 2020-02-29 18:52:06 -05:00
parent 417d26eb55
commit 42ef30aecd
1 changed files with 19 additions and 23 deletions

40
wscript
View File

@ -57,8 +57,8 @@ def configure(ctx):
if system in ('linux', 'darwin', 'freebsd', 'gnu', 'gnu/kfreebsd'): if system in ('linux', 'darwin', 'freebsd', 'gnu', 'gnu/kfreebsd'):
ctx.env.DEFINES_BUILD_NORM += ['ECN_SUPPORT'] ctx.env.DEFINES_BUILD_NORM += ['ECN_SUPPORT']
if system == 'windows': #if system == 'windows':
ctx.env.DEFINES_BUILD_NORM += ['NORM_USE_DLL'] # ctx.env.DEFINES_BUILD_NORM += ['NORM_USE_DLL']
if ctx.env.COMPILER_CXX == 'g++' or ctx.env.COMPILER_CXX == 'clang++': if ctx.env.COMPILER_CXX == 'g++' or ctx.env.COMPILER_CXX == 'clang++':
ctx.env.CFLAGS += ['-fvisibility=hidden', '-Wno-attributes'] ctx.env.CFLAGS += ['-fvisibility=hidden', '-Wno-attributes']
@ -75,13 +75,7 @@ def build(ctx):
# Setup to install NORM header file # Setup to install NORM header file
ctx.install_files("${PREFIX}/include/", "include/normApi.h") ctx.install_files("${PREFIX}/include/", "include/normApi.h")
obj = ctx.objects( normSrc = ['src/common/{0}.cpp'.format(x) for x in [
target = 'norm_objs',
includes = ['include'],
export_includes = ['include'],
use = ctx.env.USE_BUILD_NORM + ['protolib_st'],
#stlib = ["protokit"],
source = ['src/common/{0}.cpp'.format(x) for x in [
'galois', 'galois',
'normApi', 'normApi',
'normEncoder', 'normEncoder',
@ -94,8 +88,7 @@ def build(ctx):
'normObject', 'normObject',
'normSegment', 'normSegment',
'normSession', 'normSession',
]], ]]
)
# Use static lib for Unix examples for convenience # Use static lib for Unix examples for convenience
# (so we don't have to worry about LD_LIBRARY_PATH) # (so we don't have to worry about LD_LIBRARY_PATH)
@ -104,30 +97,29 @@ def build(ctx):
name = 'norm_shlib', name = 'norm_shlib',
includes = ['include'], includes = ['include'],
export_includes = ['include'], export_includes = ['include'],
use = ctx.env.USE_BUILD_NORM + ['protolib_st'],
defines = ['NORM_USE_DLL'] if 'windows' == system else [],
vnum = VERSION, vnum = VERSION,
stlib = ["protokit"], source = normSrc,
use = ['norm_objs'],
source = [],
features = 'cxx cxxshlib', features = 'cxx cxxshlib',
install_path = '${LIBDIR}', install_path = '${LIBDIR}',
) )
ctx.stlib( ctx.stlib(
target = 'norm', target = 'norm' if 'windows' != system else 'norm_static',
name = 'norm_stlib', name = 'norm_stlib',
includes = ['include'], includes = ['include'],
export_includes = ['include'], export_includes = ['include'],
use = ctx.env.USE_BUILD_NORM + ['protolib_st'],
vnum = VERSION, vnum = VERSION,
stlib = ["protokit"], source = normSrc,
use = ['norm_objs'],
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(
use = ['norm_shlib'],
features='py', features='py',
source=ctx.path.ant_glob('src/pynorm/**/*.py'), source=ctx.path.ant_glob('src/pynorm/**/*.py'),
install_from='src', install_from='src',
@ -139,6 +131,7 @@ def build(ctx):
includes = ['include'], includes = ['include'],
use = ['norm_shlib', 'JAVA'], use = ['norm_shlib', 'JAVA'],
vnum = VERSION, vnum = VERSION,
defines = ['NORM_USE_DLL'] if 'windows' == system else [],
source = ['src/java/jni/{0}.cpp'.format(x) for x in [ source = ['src/java/jni/{0}.cpp'.format(x) for x in [
'normJni', 'normJni',
'normInstanceJni', 'normInstanceJni',
@ -165,8 +158,8 @@ def build(ctx):
# the library is also named "norm" # the library is also named "norm"
name = 'normapp', name = 'normapp',
target = 'normapp', target = 'normapp',
includes = ['include'], #includes = ['include'],
use = ['protokit', 'norm_stlib'], use = ['protolib_st', 'norm_stlib'],
defines = [], defines = [],
source = ['src/common/{0}.cpp'.format(x) for x in [ source = ['src/common/{0}.cpp'.format(x) for x in [
'normPostProcess', 'normPostProcess',
@ -249,8 +242,11 @@ def _make_simple_example(ctx, name, path='examples'):
# Don't install examples # Don't install examples
install_path = False, install_path = False,
) )
# TBD - figure out how build NORM DLL and stil
# enable Windows examples to link against static lib
if 'windows' == system: if 'windows' == system:
example.use.append('norm_shlib') example.use.append('norm_stlib')
example.defines.append('_CONSOLE') example.defines.append('_CONSOLE')
else: else:
example.use.append('norm_stlib') example.use.append('norm_stlib')