Enable static build.
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Apr 2013 11:58:45 +0000 (12:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 11 Apr 2013 11:58:45 +0000 (12:58 +0100)
src/wscript
wscript

index e1c405ab3b2e6819dca1b4545bc8755b382cc51a..70f4b27b32a542dafd80290fef7afb5a95a4ff23 100644 (file)
@@ -1,5 +1,8 @@
 def build(bld):
-    obj = bld(features = 'cxx cxxshlib')
+    if bld.env.STATIC:
+        obj = bld(features = 'cxx cxxstlib')
+    else:
+        obj = bld(features = 'cxx cxxshlib')
     obj.name = 'libcxml'
     obj.target = 'cxml'
     obj.export_includes = ['.']
@@ -7,3 +10,6 @@ def build(bld):
     obj.source = "cxml.cc"
 
     bld.install_files('${PREFIX}/include/libcxml', "cxml.h")
+    if bld.env.STATIC:
+        bld.install_files('${PREFIX}/lib', 'libcxml.a')
+
diff --git a/wscript b/wscript
index d3d276451057df09fcf01adf64054a7a81aeb7e9..fda4bac772b881b561a31b8d4dcf5952ef33ef49 100644 (file)
--- a/wscript
+++ b/wscript
@@ -4,12 +4,14 @@ VERSION = '0.04pre'
 def options(opt):
     opt.load('compiler_cxx')
     opt.add_option('--target-windows', action='store_true', default = False, help = 'set up to do a cross-compile to Windows')
+    opt.add_option('--static', action='store_true', default = False, help = 'build statically')
 
 def configure(conf):
     conf.load('compiler_cxx')
     conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-O2'])
 
     conf.env.TARGET_WINDOWS = conf.options.target_windows
+    conf.env.STATIC = conf.options.static
 
     if conf.options.target_windows:
         boost_lib_suffix = '-mt'