diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-07 21:21:49 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-07 21:21:49 +0000 |
| commit | 6c2e8c4812a80ac6052da8ff82b49bb8f97cfb43 (patch) | |
| tree | c54d2d1fe323d8d2897b24ec113ef4c6573a2a94 | |
| parent | 7e0ebcd1f19c8365d16a5fb5a42907867d15cb20 (diff) | |
Allow static builds.
| -rw-r--r-- | asdcplib/src/wscript | 20 | ||||
| -rw-r--r-- | examples/wscript | 1 | ||||
| -rw-r--r-- | libdcp.pc.in | 2 | ||||
| -rw-r--r-- | src/wscript | 10 | ||||
| -rw-r--r-- | test/wscript | 2 | ||||
| -rw-r--r-- | tools/wscript | 2 | ||||
| -rw-r--r-- | wscript | 26 |
7 files changed, 48 insertions, 15 deletions
diff --git a/asdcplib/src/wscript b/asdcplib/src/wscript index e079fa2f..ad6cfbab 100644 --- a/asdcplib/src/wscript +++ b/asdcplib/src/wscript @@ -8,7 +8,11 @@ def configure(conf): conf.env.append_value('CXXFLAGS', '-DASDCP_PLATFORM="linux"') def build(bld): - obj = bld(features = 'cxx cxxshlib') + if bld.env.STATIC_LIBDCP: + obj = bld(features = 'cxx cxxstlib') + else: + obj = bld(features = 'cxx cxxshlib') + obj.name = 'libkumu-libdcp' obj.target = 'kumu-libdcp' obj.uselib = 'OPENSSL BOOST_FILESYSTEM' @@ -23,7 +27,11 @@ def build(bld): KM_prng.cpp """ - obj = bld(features = 'cxx cxxshlib') + if bld.env.STATIC_LIBDCP: + obj = bld(features = 'cxx cxxstlib') + else: + obj = bld(features = 'cxx cxxshlib') + obj.name = 'libasdcp-libdcp' obj.target = 'asdcp-libdcp' obj.uselib = 'OPENSSL' @@ -57,4 +65,10 @@ def build(bld): PCMParserList.cpp MDD.cpp """ - + + if bld.env.STATIC_LIBDCP: + bld.install_files('${PREFIX}/lib', 'libkumu-libdcp.a') + bld.install_files('${PREFIX}/lib', 'libasdcp-libdcp.a') + else: + bld.install_files('${PREFIX}/lib', 'libkumu-libdcp.so') + bld.install_files('${PREFIX}/lib', 'libasdcp-libdcp.so') diff --git a/examples/wscript b/examples/wscript index b6b28653..46d3287b 100644 --- a/examples/wscript +++ b/examples/wscript @@ -2,6 +2,7 @@ def build(bld): obj = bld(features = 'cxx cxxprogram') obj.name = 'examples' obj.use = 'libdcp' + obj.uselib = 'OPENJPEG' obj.source = 'make_dcp.cc' obj.target = 'make_dcp' obj.install_path = '' diff --git a/libdcp.pc.in b/libdcp.pc.in index 9584970a..5d69c0d3 100644 --- a/libdcp.pc.in +++ b/libdcp.pc.in @@ -5,6 +5,6 @@ includedir=@includedir@ Name: libdcp Description: DCP creation library Version: @version@ -Requires: sigc++-2.0 openssl +Requires: sigc++-2.0 openssl libxml++-2.6 Libs: @libs@ Cflags: -I${includedir} diff --git a/src/wscript b/src/wscript index 6c7f2392..9fb6a7e7 100644 --- a/src/wscript +++ b/src/wscript @@ -1,5 +1,9 @@ def build(bld): - obj = bld(features = 'cxx cxxshlib') + if bld.env.STATIC_LIBDCP: + obj = bld(features = 'cxx cxxstlib') + else: + obj = bld(features = 'cxx cxxshlib') + obj.name = 'libdcp' obj.target = 'dcp' obj.export_includes = ['.'] @@ -50,3 +54,7 @@ def build(bld): """ bld.install_files('${PREFIX}/include/libdcp', headers) + if bld.env.STATIC_LIBDCP: + bld.install_files('${PREFIX}/lib', 'libdcp.a') + else: + bld.install_files('${PREFIX}/lib', 'libdcp.so') diff --git a/test/wscript b/test/wscript index 08e83d6d..14534bd9 100644 --- a/test/wscript +++ b/test/wscript @@ -18,7 +18,7 @@ def configure(conf): def build(bld): obj = bld(features = 'cxx cxxprogram') obj.name = 'tests' - obj.uselib = 'BOOST_TEST' + obj.uselib = 'BOOST_TEST OPENJPEG' obj.use = 'libdcp' obj.source = 'tests.cc' obj.target = 'tests' diff --git a/tools/wscript b/tools/wscript index d9ed0419..a79b3c9d 100644 --- a/tools/wscript +++ b/tools/wscript @@ -1,11 +1,13 @@ def build(bld): obj = bld(features = 'cxx cxxprogram') obj.use = ['libdcp'] + obj.uselib = 'OPENJPEG' obj.source = 'dcpdiff.cc' obj.target = 'dcpdiff' obj = bld(features = 'cxx cxxprogram') obj.use = ['libdcp'] + obj.uselib = 'OPENJPEG' obj.source = 'dcpinfo.cc' obj.target = 'dcpinfo' @@ -9,6 +9,8 @@ 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('--enable-debug', action='store_true', default = False, help = 'build with debugging information and without optimisation') + opt.add_option('--static-openjpeg', action='store_true', default = False, help = 'link statically to openjpeg') + opt.add_option('--static-libdcp', action='store_true', default = False, help = 'build libdcp and in-tree dependencies statically') def configure(conf): conf.load('compiler_cxx') @@ -16,6 +18,8 @@ def configure(conf): conf.env.append_value('CXXFLAGS', ['-DLIBDCP_VERSION="%s"' % VERSION]) conf.env.TARGET_WINDOWS = conf.options.target_windows + conf.env.STATIC_OPENJPEG = conf.options.static_openjpeg + conf.env.STATIC_LIBDCP = conf.options.static_libdcp if conf.options.target_windows: conf.env.append_value('CXXFLAGS', '-DLIBDCP_WINDOWS') @@ -25,14 +29,18 @@ def configure(conf): conf.check_cfg(package = 'openssl', args = '--cflags --libs', uselib_store = 'OPENSSL', mandatory = True) conf.check_cfg(package = 'libxml++-2.6', args = '--cflags --libs', uselib_store = 'LIBXML++', mandatory = True) - conf.check_cc(fragment = """ - #include <stdio.h>\n - #include <openjpeg.h>\n - int main () {\n - void* p = (void *) opj_image_create;\n - return 0;\n - } - """, msg = 'Checking for library openjpeg', lib = 'openjpeg', uselib_store = 'OPENJPEG') + openjpeg_fragment = """ + #include <stdio.h>\n + #include <openjpeg.h>\n + int main () {\n + void* p = (void *) opj_image_create;\n + return 0;\n + } + """ + if conf.options.static_openjpeg: + conf.check_cc(fragment = openjpeg_fragment, msg = 'Checking for library openjpeg', stlib = 'openjpeg', uselib_store = 'OPENJPEG') + else: + conf.check_cc(fragment = openjpeg_fragment, msg = 'Checking for library openjpeg', lib = 'openjpeg', uselib_store = 'OPENJPEG') if conf.options.target_windows: boost_lib_suffix = '-mt' @@ -76,7 +84,7 @@ def build(bld): bld(source = 'libdcp.pc.in', version = VERSION, includedir = '%s/include' % bld.env.PREFIX, - libs = "-L${libdir} -ldcp -lkumu-libdcp -lasdcp-libdcp -lboost_system%s" % boost_lib_suffix, + libs = "-L${libdir} -ldcp -lasdcp-libdcp -lkumu-libdcp -lboost_system%s" % boost_lib_suffix, install_path = '${LIBDIR}/pkgconfig') bld.recurse('src') |
