diff options
| author | Emmanuele Bassi <ebassi@gnome.org> | 2016-12-09 12:43:01 +0000 |
|---|---|---|
| committer | Emmanuele Bassi <ebassi@gnome.org> | 2017-01-25 12:28:29 +0000 |
| commit | e2e2fedbdb6cbf4155919c548545956dd6cacc4c (patch) | |
| tree | 60493d1eb5cbc8a81e810319e031fd1acfcba57f /src | |
| parent | 4fe238e023d152e55c7aac210be2e930b06b412c (diff) | |
| download | libepoxy-e2e2fedbdb6cbf4155919c548545956dd6cacc4c.tar.gz | |
build: Split arguments for dispatch generator
The gen_dispatch.py script relies on the source and include directories
to exist before dumping the files in there, split by type, in order to
sustain the split of the headers existing in a separate root from the
source files. This causes a spooky-action-at-a-distance scenario where
headers are generated by rules inside the source directory but influence
the contents of a separate directory — and require a separate set of
rules to install those headers.
Different build systems would require either splitting the generation in
to two separate passes (which is more expensive and time consuming), or
generate the header and source files in the same directory, and just
tweak the inclusion paths accordingly.
Since we want to maintain this fiction for the autotools build, but
ignore it for different build systems, let's add a separate set of
arguments for gen_dispatch.py that make the rules inside Makefile.am
work appropriately.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.am | 20 | ||||
| -rwxr-xr-x | src/gen_dispatch.py | 22 |
2 files changed, 33 insertions, 9 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index c2967d4..419fbb4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -153,19 +153,31 @@ $(GENERATED_WGL_INCLUDES): $(GENERATED_WGL_SOURCE) $(GENERATED_GL_SOURCE): $(srcdir)/gen_dispatch.py $(top_srcdir)/registry/gl.xml @$(MKDIR_P) $(top_builddir)/include/epoxy - $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py --dir $(top_builddir) $(top_srcdir)/registry/gl.xml + $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py \ + --srcdir $(top_builddir)/src \ + --includedir $(top_builddir)/include/epoxy \ + $(top_srcdir)/registry/gl.xml $(GENERATED_GLX_SOURCE): $(srcdir)/gen_dispatch.py $(top_srcdir)/registry/glx.xml @$(MKDIR_P) $(top_builddir)/include/epoxy - $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py --dir $(top_builddir) $(top_srcdir)/registry/glx.xml + $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py \ + --srcdir $(top_builddir)/src \ + --includedir $(top_builddir)/include/epoxy \ + $(top_srcdir)/registry/glx.xml $(GENERATED_EGL_SOURCE): $(srcdir)/gen_dispatch.py $(top_srcdir)/registry/egl.xml @$(MKDIR_P) $(top_builddir)/include/epoxy - $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py --dir $(top_builddir) $(top_srcdir)/registry/egl.xml + $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py \ + --srcdir $(top_builddir)/src \ + --includedir $(top_builddir)/include/epoxy \ + $(top_srcdir)/registry/egl.xml $(GENERATED_WGL_SOURCE): $(srcdir)/gen_dispatch.py $(top_srcdir)/registry/wgl.xml @$(MKDIR_P) $(top_builddir)/include/epoxy - $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py --dir $(top_builddir) $(top_srcdir)/registry/wgl.xml + $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_dispatch.py \ + --srcdir $(top_builddir)/src \ + --includedir $(top_builddir)/include/epoxy \ + $(top_srcdir)/registry/wgl.xml EXTRA_DIST = \ gen_dispatch.py \ diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index dfce596..283d965 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -836,11 +836,23 @@ class Generator(object): argparser = argparse.ArgumentParser(description='Generate GL dispatch wrappers.') argparser.add_argument('files', metavar='file.xml', nargs='+', help='GL API XML files to be parsed') -argparser.add_argument('--dir', metavar='dir', required=True, help='Destination directory') +argparser.add_argument('--srcdir', metavar='srcdir', required=False, help='Destination directory for source files') +argparser.add_argument('--includedir', metavar='incdir', required=False, help='Destination director for header files') +argparser.add_argument('--dir', metavar='dir', required=False, help='Destination directory') args = argparser.parse_args() -srcdir = args.dir + '/src/' -incdir = args.dir + '/include/epoxy/' +if args.dir: + srcdir = args.dir + incdir = args.dir +else: + srcdir = args.srcdir + incdir = args.includedir + +if not srcdir: + srcdir = os.getcwd() + +if not incdir: + incdir = os.getcwd() for file in args.files: name = os.path.basename(file).split('.xml')[0] @@ -869,5 +881,5 @@ for file in args.files: generator.prepare_provider_enum() - generator.write_header(incdir + name + '_generated.h') - generator.write_source(srcdir + name + '_generated_dispatch.c') + generator.write_header(os.path.join(incdir, name + '_generated.h')) + generator.write_source(os.path.join(srcdir, name + '_generated_dispatch.c')) |
