diff options
author | Thomas White <taw@physics.org> | 2019-09-11 17:14:05 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:45 +0200 |
commit | baa140938c9915842a526473d5bbde81cbcaae23 (patch) | |
tree | 3ea7ed7ebd2f020803bf140bd65b7efc7c3f10a7 | |
parent | 4f8360cd0980f4bafadafc0ddf3f120f10813856 (diff) |
Initial Meson conversion
-rw-r--r-- | config.h.in | 23 | ||||
-rw-r--r-- | meson.build | 313 |
2 files changed, 336 insertions, 0 deletions
diff --git a/config.h.in b/config.h.in new file mode 100644 index 00000000..c1cd0ecb --- /dev/null +++ b/config.h.in @@ -0,0 +1,23 @@ +/* config.h for CrystFEL main programs */ + +#mesondefine HAVE_GTK +#mesondefine HAVE_GDKPIXBUF +#mesondefine HAVE_GDK +#mesondefine HAVE_TIFF +#mesondefine HAVE_CAIRO +#mesondefine HAVE_OPENCL +#mesondefine HAVE_CL_CL_H +#mesondefine HAVE_CLOCK_GETTIME +#mesondefine HAVE_MSGPACK +#mesondefine HAVE_ZMQ +#mesondefine HAVE_FFTW + +#define PACKAGE_VERSION "@CRYSTFEL_VERSION@" + +#define CRYSTFEL_VERSIONSTRING "@CRYSTFEL_VERSION@" + +#define CRYSTFEL_BOILERPLATE "License GPLv3+: GNU GPL version 3 or later"\ + " <http://gnu.org/licenses/gpl.html>.\n"\ + "This is free software: you are free to change and redistribute it.\n"\ + "There is NO WARRANTY, to the extent permitted by law.\n\n"\ + "Written by Thomas White and others." diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..ac9dbf3f --- /dev/null +++ b/meson.build @@ -0,0 +1,313 @@ +# Meson file for CrystFEL +project('crystfel', 'c', + version : '0.8.0', + license : 'GPL3+', + default_options : ['buildtype=debugoptimized']) + +add_project_arguments('-DHAVE_CONFIG_H', language : 'c') + +# FIXME: Possibly Git SHA1 +conf_data = configuration_data() +conf_data.set('CRYSTFEL_VERSION', meson.project_version()) + +# Mandatory dependencies +cc = meson.get_compiler('c') +mdep = cc.find_library('m', required : true) +gsldep = dependency('gsl', required : true) +zlibdep = dependency('zlib', required : true) +pthreaddep = dependency('threads', required : true) + +# HDF5 >= 1.8.21 and >= 1.10.2 has a pkg-config file: +hdf5dep = dependency('hdf5', language : 'c', required : false) + +# Otherwise, try finding it ourselves: +if not hdf5dep.found() + hdf5dep = cc.find_library('hdf5', required : false) +endif + +if not hdf5dep.found() + error('Couldn\'t find HDF5') +endif + +# "Optional" dependencies +fftwdep = dependency('fftw3', required : false) +if fftwdep.found() + conf_data.set10('HAVE_FFTW', 1) +endif + +tiffdep = dependency('libtiff-4', required : false) +if tiffdep.found() + conf_data.set10('HAVE_TIFF', 1) +endif + +gtkdep = dependency('gtk+-3.0', required : false) +if not gtkdep.found() + gtkdep = dependency('gtk+-2.0', required : false) +else + add_project_arguments('-Wno-deprecated-declarations', language : 'c') +endif + +if gtkdep.found() + conf_data.set10('HAVE_GTK', 1) +endif + +gdkdep = dependency('gdk-3.0', required : false) +if not gdkdep.found() + gdkdep = dependency('gdk-2.0', required : false) +endif +if gdkdep.found() + conf_data.set10('HAVE_GDK', 1) +endif + +gdkpixbufdep = dependency('gdk-pixbuf-2.0', required : false) +if gdkpixbufdep.found() + conf_data.set10('HAVE_GDKPIXBUF', 1) +endif + +cairodep = dependency('cairo', required : false) +if cairodep.found() + conf_data.set10('HAVE_CAIRO', 1) +endif + +opencldep = dependency('OpenCL', required : false) +if opencldep.found() + conf_data.set10('HAVE_OPENCL', 1) +endif +if cc.has_header('CL/cl.h') + conf_data.set10('HAVE_CL_CL_H', 1) +endif + +zmqdep = dependency('libzmq', required : false) +if zmqdep.found() + conf_data.set10('HAVE_ZMQ', 1) +endif + +msgpackdep = dependency('msgpack', required : false) +if msgpackdep.found() + conf_data.set10('HAVE_MSGPACK', 1) +endif + +if cc.has_function('clock_gettime', prefix : '#include <time.h>') + conf_data.set10('HAVE_CLOCK_GETTIME', 1) +endif + +# FIXME: Curses, Xgandalf, pinkindexer, FDIP + + +# libcrystfel +libcrystfel_includes = include_directories('libcrystfel/src') + +# Find forkpty() +utildep = cc.find_library('util', required : true) +if cc.has_function('forkpty', dependencies : utildep, prefix : '#include <pty.h>') + add_project_arguments('-DHAVE_FORKPTY_PTY_H', language : 'c') +elif cc.has_function('forkpty', dependencies : utildep, prefix : '#include <util.h>') + add_project_arguments('-DHAVE_FORKPTY_UTIL_H', language : 'c') +else + error('Couldn\'t find forkpty()') +endif + + + +# Symmetry operation parser Flex/Bison stuff +flex = find_program('flex') +bison = find_program('bison') + +flex_gen = generator(flex, + output : ['@BASENAME@-lex.c', '@BASENAME@-lex.h'], + arguments : ['--outfile=@OUTPUT0@', + '--header-file=@OUTPUT1@', + '@INPUT@']) + +bison_gen = generator(bison, + output : ['@BASENAME@-parse.c', '@BASENAME@-parse.h'], + arguments : ['--output=@OUTPUT0@', + '--defines=@OUTPUT1@', + '--report=all', + '@INPUT@']) + +symop_parse_ch = bison_gen.process('libcrystfel/src/symop.y') +symop_lex_ch = flex_gen.process('libcrystfel/src/symop.l') + + +libcrystfel_sources = ['libcrystfel/src/image.c', + 'libcrystfel/src/render.c', + 'libcrystfel/src/cell.c', + 'libcrystfel/src/index.c', + 'libcrystfel/src/spectrum.c', + 'libcrystfel/src/cell-utils.c', + 'libcrystfel/src/integer_matrix.c', + 'libcrystfel/src/stream.c', + 'libcrystfel/src/crystal.c', + 'libcrystfel/src/integration.c', + 'libcrystfel/src/symmetry.c', + 'libcrystfel/src/detector.c', + 'libcrystfel/src/mosflm.c', + 'libcrystfel/src/taketwo.c', + 'libcrystfel/src/dirax.c', + 'libcrystfel/src/peakfinder8.c', + 'libcrystfel/src/thread-pool.c', + 'libcrystfel/src/events.c', + 'libcrystfel/src/peaks.c', + 'libcrystfel/src/utils.c', + 'libcrystfel/src/felix.c', + 'libcrystfel/src/predict-refine.c', + 'libcrystfel/src/xds.c', + 'libcrystfel/src/filters.c', + 'libcrystfel/src/rational.c', + 'libcrystfel/src/xgandalf.c', + 'libcrystfel/src/geometry.c', + 'libcrystfel/src/reflist.c', + 'libcrystfel/src/hdf5-file.c', + 'libcrystfel/src/reflist-utils.c', + symop_lex_ch, + symop_parse_ch, + ] + +if fftwdep.found() + libcrystfel_sources += 'libcrystfel/src/asdf.c' +endif + +configure_file(input : 'config.h.in', + output : 'config.h', + configuration : conf_data) +conf_inc = include_directories('.') + +libcrystfel = library('crystfel', libcrystfel_sources, + include_directories : [libcrystfel_includes, conf_inc], + dependencies : [mdep, utildep, fftwdep, gsldep, zlibdep, + hdf5dep, pthreaddep], + install : true) + +libcrystfeldep = declare_dependency(include_directories : libcrystfel_includes, + link_with : libcrystfel) + + +# cell_tool +executable('cell_tool', + ['src/cell_tool.c'], + dependencies : [mdep, libcrystfeldep], + install : true) + +# partial_sim +executable('partial_sim', + ['src/partial_sim.c'], + dependencies : [mdep, libcrystfeldep, gsldep, pthreaddep], + install : true) + +# process_hkl +executable('process_hkl', + ['src/process_hkl.c'], + dependencies : [mdep, libcrystfeldep], + install : true) + +# list_events +executable('list_events', + ['src/list_events.c'], + dependencies : [mdep, libcrystfeldep], + install : true) + +# get_hkl +executable('get_hkl', + ['src/get_hkl.c'], + dependencies : [mdep, libcrystfeldep, gsldep], + install : true) + +# compare_hkl +executable('compare_hkl', + ['src/compare_hkl.c'], + dependencies : [mdep, libcrystfeldep, gsldep], + install : true) + +# check_hkl +executable('check_hkl', + ['src/check_hkl.c'], + dependencies : [mdep, libcrystfeldep, gsldep], + install : true) + +# partialator +executable('partialator', + ['src/partialator.c', + 'src/post-refinement.c', + 'src/merge.c', + 'src/rejection.c', + 'src/scaling.c'], + dependencies : [mdep, libcrystfeldep, gsldep, pthreaddep], + install : true) + +# ambigator +executable('ambigator', + ['src/ambigator.c'], + dependencies : [mdep, libcrystfeldep, gsldep, hdf5dep], + install : true) + +# whirligig +executable('whirligig', + ['src/whirligig.c'], + dependencies : [mdep, libcrystfeldep], + install : true) + +# indexamajig +indexamajig_sources = ['src/indexamajig.c', 'src/im-sandbox.c', + 'src/process_image.c', 'src/time-accounts.c'] +if zmqdep.found() and msgpackdep.found() + indexamajig_sources += ['src/im-zmq.c'] +endif + +executable('indexamajig', indexamajig_sources, + dependencies : [mdep, libcrystfeldep, gsldep, pthreaddep, zmqdep, + msgpackdep], + install : true) + +# make_pixelmap +executable('make_pixelmap', + ['src/make_pixelmap.c'], + dependencies : [mdep, libcrystfeldep, hdf5dep], + install : true) + +# geoptimiser +executable('geoptimiser', + ['src/geoptimiser.c', 'src/hdfsee-render.c'], + dependencies : [mdep, libcrystfeldep, gsldep, gdkpixbufdep, gdkdep, + tiffdep], + install : true) + +# hdfsee +if gtkdep.found() + executable('hdfsee', + ['src/hdfsee.c', 'src/dw-hdfsee.c', 'src/hdfsee-render.c'], + dependencies : [mdep, libcrystfeldep, gtkdep, gsldep, gdkpixbufdep, + tiffdep], + install : true) +endif + +# render_hkl +executable('render_hkl', + ['src/render_hkl.c'], + dependencies : [mdep, libcrystfeldep, cairodep, gsldep], + install : true) + +# cell_explorer +if gtkdep.found() + executable('cell_explorer', + ['src/cell_explorer.c', 'src/multihistogram.c'], + dependencies : [mdep, libcrystfeldep, gtkdep, gsldep], + install : true) +endif + +# pattern_sim +pattern_sim_sources = ['src/pattern_sim.c', 'src/diffraction.c'] +if opencldep.found() + pattern_sim_sources += ['src/diffraction-gpu.c', 'src/cl-utils.c'] +endif +executable('pattern_sim', pattern_sim_sources, + dependencies : [mdep, libcrystfeldep, gsldep, hdf5dep, opencldep], + install : true) + +# FIXME: Install manual pages + +# FIXME: API documents (Doxygen) + +# FIXME: Tests + +# FIXME: pkgconfig file |