[libgee/meson: 15/21] Meson: benchmarks ported to Meson




commit b54ff0c20f0ecdd070605127da600c5fcef38a58
Author: Daniel Espinosa <daniel espinosa pwmc mx>
Date:   Tue May 16 11:13:03 2017 -0500

    Meson: benchmarks ported to Meson
    
    This needs:
    
    https://github.com/mesonbuild/meson/pull/1780
    
    to be merge before, because it adds internal VAPI and header
    generation suport to Meson.
    
    Now you can run:
    
    ninja benchmark
    
    in order to run Gee's benchmarks.

 benchmark/meson.build | 31 +++++++++++++++++++++++++++++++
 gee/meson.build       |  5 ++++-
 meson.build           | 12 +++++++++---
 meson_options.txt     |  1 +
 utils/meson.build     |  3 +++
 5 files changed, 48 insertions(+), 4 deletions(-)
---
diff --git a/benchmark/meson.build b/benchmark/meson.build
new file mode 100644
index 0000000..dd5ca03
--- /dev/null
+++ b/benchmark/meson.build
@@ -0,0 +1,31 @@
+bsources = files([
+       'benchmark.vala',
+       'benchmarksorts.vala'
+])
+
+c = meson.get_compiler ('c')
+lm = c.find_library ('m', required : false)
+
+
+touch = find_program ('touch')
+fakevapi = custom_target ('fake_internal_vapi',
+       output : 'fake.vapi',
+       command : [
+               touch,
+               '@OUTPUT@'
+       ],
+       depends : gee)
+fakevapi_dep = declare_dependency (sources : fakevapi)
+
+gee_objects = gee.extract_all_objects ()
+
+benchmarks = executable('benchmarks',
+       bsources,
+       vala_args : [
+               join_paths (meson.build_root (), 'gee', 'gee-internals-0.8.vapi')
+       ],
+       objects : gee_objects,
+       dependencies : [ gio, include_utils_h_dir_dep, includehdir_dep, lm, fakevapi_dep ],
+)
+
+benchmark ('benchmarks', benchmarks)
diff --git a/gee/meson.build b/gee/meson.build
index 39dd46e..2132047 100644
--- a/gee/meson.build
+++ b/gee/meson.build
@@ -12,7 +12,6 @@
 #configure_file(output : 'config.h',
 #      configuration : confh)
 
-
 valasources = files ([
        'assemblyinfo.vala',
        'abstractbidirlist.vala',
@@ -101,6 +100,8 @@ gee = library('gee-@0@'.format(API_VERSION),
        vala_vapi : 'gee-@0@.vapi'.format(API_VERSION),
        vala_gir : 'Gee-@0@.gir'.format(API_VERSION),
        vala_args : [ '--pkg', 'geeutils'],
+       vala_internal_header : 'gee-internals.h',
+       vala_internal_vapi : 'gee-internals-0.8.vapi',
        dependencies : [ gio, include_utils_h_dir_dep ],
        install : true,
        install_dir : [
@@ -108,6 +109,8 @@ gee = library('gee-@0@'.format(API_VERSION),
                join_paths (get_option('includedir'),'gee-@0@'.format (API_VERSION)),
                true,
                true,
+               false,
+               false
        ])
 
 g_ir_compiler = find_program('g-ir-compiler')
diff --git a/meson.build b/meson.build
index 51d7a08..97ecec1 100644
--- a/meson.build
+++ b/meson.build
@@ -1,8 +1,5 @@
 project('libgee', [ 'vala', 'c'])
 
-add_project_arguments (['--vapidir', join_paths (meson.source_root (),'utils')],
-       language: 'vala')
-
 gio = dependency('gio-2.0')
 
 VALADEPS = 'gio-2.0'
@@ -37,8 +34,17 @@ configure_file(input : 'gee.deps.in',
        install : true,
        install_dir : vapidir)
 
+# Coverage is supported in Meson, so no code is added to libgee
+# for coverage how-to, go to: http://mesonbuild.com/howtox.html#producing-a-coverage-report
+
+
 
 subdir('utils')
 subdir('gee')
 subdir('doc')
 subdir('tests')
+
+benchmarks_opt = get_option ('enable-benchmark')
+if benchmarks_opt
+       subdir('benchmark')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..e165239
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('enable-benchmark', type : 'boolean', value : false, description : 'Enable benchmark')
diff --git a/utils/meson.build b/utils/meson.build
index 91d9a4a..c092348 100644
--- a/utils/meson.build
+++ b/utils/meson.build
@@ -9,3 +9,6 @@ utilsvapi = files (['geeutils.vapi'])
 include_utils_h_dir = include_directories ('.')
 
 include_utils_h_dir_dep = declare_dependency (include_directories : include_utils_h_dir)
+
+add_project_arguments (['--vapidir', join_paths (meson.current_source_dir ())],
+       language: 'vala')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]