diff --git a/examples/benchmarks/Makefile b/examples/benchmarks/Makefile deleted file mode 100644 index de0fad1..0000000 --- a/examples/benchmarks/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -#******************************************************** -# MAKEFILE for BUILDING EXAMPLES FOR HIPO4 LIBRARY -# AUTHOR: GAVALIAN DATE: 10/24/2018 -#******************************************************** -HIPOCFLAGS := -I../../hipo4 -HIPOLIBS := -L../../lib -lhipo4 - -LZ4LIBS := -L../../lz4/lib -llz4 -LZ4INCLUDES := -I../../lz4/lib - -CXX := g++ -CXXFLAGS += -Wall -fPIC -std=c++11 -LD := g++ -LDFLAGS := - - -all: map - -map: map_benchmark.o - $(CXX) -o map_benchmark.exe $< $(HIPOLIBS) $(LZ4LIBS) - -ana: ana_benchmark.o - $(CXX) -o ana_benchmark.exe $< $(HIPOLIBS) $(LZ4LIBS) -#analysis: analysis.o -# $(CXX) -o analysis $< $(HIPOLIBS) $(LZ4LIBS) - -#clas12event_example: clas12event_example.o -# $(CXX) -o clas12event_example $< $(HIPOLIBS) $(LZ4LIBS) - -clean: - @echo 'Removing all build files' - @rm -rf *.o *~ *.exe - -%.o: %.cc - $(CXX) -O2 -c $< $(CXXFLAGS) $(HIPOCFLAGS) $(LZ4INCLUDES) diff --git a/examples/benchmarks/ana_benchmark.cc b/examples/benchmarks/ana_benchmark.cc index e5c0ca4..995790c 100644 --- a/examples/benchmarks/ana_benchmark.cc +++ b/examples/benchmarks/ana_benchmark.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include "utils.h" #include "reader.h" @@ -85,7 +86,7 @@ int main(int argc, char** argv) { float px = particles.getFloat(1,row); float py = particles.getFloat(2,row); float pz = particles.getFloat(3,row); - double p = sqrt(px*px+py*py+pz*pz); + double p = std::sqrt(px*px+py*py+pz*pz); double energy = 0.0; if(responses.count(row)>0){ c3++; diff --git a/examples/fortran/meson.build b/examples/fortran/meson.build deleted file mode 100644 index c3e1f28..0000000 --- a/examples/fortran/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -fortran_example_exe = executable( - 'hipo_freader', - 'freader.F', - link_with: project_libs, - install: get_option('install_examples'), - # cpp_args: [ '-Wno-sign-compare' ], # FIXME: fix the warnings; they are suppressed by these args -) - -if(have_external_test_file) - test( - 'hipo_freader', - fortran_example_exe, - suite: [ 'example' ], - args: [ external_test_file ], - ) -endif diff --git a/examples/meson.build b/examples/meson.build index 367407a..fcb6b97 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,5 +1,5 @@ external_test_file = get_option('test_file') -have_external_test_file = external_test_file != '' # true if a user specified a test file +test_external = external_test_file != '' # true if a user specified a test file example_sources = [ # { @@ -7,46 +7,54 @@ example_sources = [ # 'test_this': boolean, whether or not to run this example as a test # 'test_args': list of arguments for this example, used for testing # 'first': boolean, whether this test should be run before any others (default = false) + # 'build_this': whether or not to build this (default = true) # }, - { 'sources': [ 'bankRowList.cc' ], 'test_this': have_external_test_file, 'test_args': [ external_test_file ] }, - { 'sources': [ 'builder.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'dataframe.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'histograms.cc' ], 'test_this': have_external_test_file, 'test_args': [ external_test_file ] }, - { 'sources': [ 'multithread.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'readEvents.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'readFile.cc' ], 'test_this': true, 'test_args': [ 'example_output.hipo' ] }, - { 'sources': [ 'readFileDebug.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'readFileTags.cc' ], 'test_this': true, 'test_args': [] }, - { 'sources': [ 'readFusion.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'readHist.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'readJson.cc' ], 'test_this': have_external_test_file, 'test_args': [ external_test_file ] }, - { 'sources': [ 'schema.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': [ 'showFile.cc' ], 'test_this': true, 'test_args': [ 'example_output.hipo', 'event::particle' ] }, - { 'sources': [ 'tupleFile.cc' ], 'test_this': true, 'test_args': [] }, - { 'sources': [ 'writeEvents.cc' ], 'test_this': false, 'test_args': [] }, - { 'sources': ['writeFile.cc' ], 'test_this': true, 'test_args': [], 'first': true }, - # { 'sources': [ 'writeFileComposite.cc' ], 'test_this': false, 'test_args': [] }, # FIXME: does not compile - { 'sources': [ 'writeUserHeader.cc' ], 'test_this': true, 'test_args': [] }, + { 'sources': [ 'bankRowList.cc' ], 'test_this': test_external, 'test_args': [ external_test_file ] }, + { 'sources': [ 'builder.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'dataframe.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'histograms.cc' ], 'test_this': test_external, 'test_args': [ external_test_file ] }, + { 'sources': [ 'multithread.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'readEvents.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'readFile.cc' ], 'test_this': true, 'test_args': [ 'example_output.hipo' ] }, + { 'sources': [ 'readFileDebug.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'readFileTags.cc' ], 'test_this': true, 'test_args': [] }, + { 'sources': [ 'readFusion.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'readHist.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'readJson.cc' ], 'test_this': test_external, 'test_args': [ external_test_file ] }, + { 'sources': [ 'schema.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'showFile.cc' ], 'test_this': true, 'test_args': [ 'example_output.hipo', 'event::particle' ] }, + { 'sources': [ 'tupleFile.cc' ], 'test_this': true, 'test_args': [] }, + { 'sources': [ 'writeEvents.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': ['writeFile.cc' ], 'test_this': true, 'test_args': [], 'first': true }, + # { 'sources': [ 'writeFileComposite.cc' ], 'test_this': false, 'test_args': [] }, # FIXME: does not compile + { 'sources': [ 'writeUserHeader.cc' ], 'test_this': true, 'test_args': [] }, + ##### benchmarks/ + { 'sources': [ 'benchmarks/ana_benchmark.cc' ], 'test_this': false, 'test_args': [] }, + { 'sources': [ 'benchmarks/map_benchmark.cc' ], 'test_this': false, 'test_args': [] }, + ##### fortran/ + { 'sources': [ 'fortran/freader.F' ], 'test_this': test_external, 'test_args': [ external_test_file ], 'build_this': get_option('test_fortran') }, ] foreach ex : example_sources example_name = 'hipo_' + fs.stem(ex['sources'][0]) - example_exe = executable( - example_name, - sources: ex['sources'], - include_directories: [ hipo_inc ], - link_with: project_libs, - install: get_option('install_examples'), - cpp_args: [ '-Wno-sign-compare' ], # FIXME: fix the warnings; they are suppressed by these args - ) - if(ex.get('test_this', true)) - test( + if(ex.get('build_this', true)) + example_exe = executable( example_name, - example_exe, - suite: [ 'example' ], - args: ex.get('test_args', []), - priority: ex.get('first', false) ? 1 : 0, # make sure 'first' tests start before any other - is_parallel: ex.get('first', false) ? false : true, # make sure 'first' tests finish before any other + sources: ex['sources'], + include_directories: [ hipo_inc ], + link_with: project_libs, + install: get_option('install_examples'), + cpp_args: [ '-Wno-sign-compare' ], # FIXME: fix the warnings; they are suppressed by these args ) + if(ex.get('test_this', true)) + test( + example_name, + example_exe, + suite: [ 'example' ], + args: ex.get('test_args', []), + priority: ex.get('first', false) ? 1 : 0, # make sure 'first' tests start before any other + is_parallel: ex.get('first', false) ? false : true, # make sure 'first' tests finish before any other + ) + endif endif endforeach diff --git a/meson.build b/meson.build index 42977d8..7f06fd9 100644 --- a/meson.build +++ b/meson.build @@ -49,9 +49,6 @@ subdir('hipo4') # build examples subdir('examples') -if(get_option('test_fortran')) - subdir('examples/fortran') -endif if(ROOT_dep.found()) subdir('examples/root') endif