From 3dd12104d9c021a10ba92680896edb777ae852d3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 10 Feb 2014 21:25:22 +0100 Subject: build: add option to build a library This library will export the client API functions. Note that this doesn't allow compiling the command line player to link against this library yet. The reason is that there's lots of weird stuff required to setup the execution environment (mostly Windows and OSX specifics), as well as things which are out of scope of the client API and every application has to do on its own. However, since the mpv command line player basically reuses functions from the mpv core to implement these things, it's not very easy to separate the command line player form the mpv core. --- wscript_build.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'wscript_build.py') diff --git a/wscript_build.py b/wscript_build.py index 164fc553d6..83d1444a9c 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -426,7 +426,7 @@ def build(ctx): ctx( target = "mpv", - source = ctx.filtered_sources(sources), + source = ctx.filtered_sources(sources) + ["player/main_fn.c"], use = ctx.dependencies_use(), includes = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \ ctx.dependencies_includes(), @@ -435,6 +435,23 @@ def build(ctx): **cprog_kwargs ) + if ctx.dependency_satisfied('shared'): + ctx.load("syms") + ctx( + target = "mpv", + source = ctx.filtered_sources(sources), + use = ctx.dependencies_use(), + includes = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \ + ctx.dependencies_includes(), + features = "c cshlib syms", + export_symbols_regex = 'mpv_.*', + install_path = ctx.env.LIBDIR, + ) + + headers = ["client.h"] + for f in headers: + ctx.install_as(ctx.env.INCDIR + '/libmpv/' + f, 'libmpv/' + f) + if ctx.env.DEST_OS == 'win32': wrapctx = ctx( target = "mpv", -- cgit v1.2.3