Skip to content

Commit

Permalink
Simplify build files
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Aug 14, 2018
1 parent 1b90f9a commit 8444c31
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 136 deletions.
76 changes: 19 additions & 57 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -1,68 +1,30 @@
executable(
examples = [
'distributions_example',
'distributions_example.cpp',
include_directories : incdir
)

executable(
'helper_example',
'helper_example.cpp',
include_directories : incdir
)

executable(
'multi_channel_disabled_channels',
'multi_channel_disabled_channels.cpp',
include_directories : incdir
)

executable(
'multi_channel_example',
'multi_channel_example.cpp',
include_directories : incdir
)

executable(
'vegas_example',
'vegas_example.cpp',
include_directories : incdir
)

executable(
'vegas_read_pdf',
'vegas_read_pdf.cpp',
include_directories : incdir
)

executable(
'vegas_write_pdf',
'vegas_write_pdf.cpp',
include_directories : incdir
)

executable(
'vegas_stop_after_precision',
'vegas_stop_after_precision.cpp',
include_directories : incdir
)

if get_option('mpi')
]

mpi = dependency('mpi', language : 'cpp')

executable(
'mpi_vegas_example',
'mpi_vegas_example.cpp',
include_directories : incdir,
dependencies : mpi
)

executable(
'mpi_multi_channel_example',
'multi_channel_example.cpp',
cpp_args : '-DUSE_MPI',
include_directories : incdir,
dependencies : mpi
)
foreach e : examples
exe = executable(e, e + '.cpp', dependencies : hep_mc_dep)
endforeach

if get_option('mpi')
executable(
'mpi_vegas_example',
'mpi_vegas_example.cpp',
include_directories : incdir,
dependencies : [ hep_mc_dep, mpi_dep ]
)

executable(
'mpi_multi_channel_example',
'multi_channel_example.cpp',
cpp_args : '-DUSE_MPI',
dependencies : [ hep_mc_dep, mpi_dep ]
)
endif
18 changes: 11 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(
version : '0.7',
license : 'GPL3',
default_options : 'cpp_std=c++11',
meson_version : '>=0.42'
meson_version : '>=0.40'
)

# must be before `doc` because doxygen depends on the headers
Expand All @@ -14,12 +14,6 @@ if get_option('doxygen')
subdir('doc')
endif

if get_option('examples')
subdir('examples')
endif

subdir('tests')

pkg = import('pkgconfig')
pkg.generate(
description : 'A C++ Template Library for Monte Carlo Integration',
Expand All @@ -28,3 +22,13 @@ pkg.generate(
)

hep_mc_dep = declare_dependency(include_directories : incdir)

if get_option('mpi')
mpi_dep = dependency('mpi', language : 'cpp')
endif

if get_option('examples')
subdir('examples')
endif

subdir('tests')
95 changes: 23 additions & 72 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,92 +19,53 @@ libgtest_main = static_library(
cpp_args : '-DGTEST_HAS_PTHREAD=0'
)

test_discrete_distribution = executable(
programs = [
'test_discrete_distribution',
'test_discrete_distribution.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)

test_distributions = executable(
'test_distributions',
'test_distributions.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)

test_genz_integrand = executable(
'test_genz_integrand',
'test_genz_integrand.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgenz, libgtest, libgtest_main ]
)

test_mc_helper = executable(
'test_mc_helper',
'test_mc_helper.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)

test_mc_point = executable(
'test_mc_point',
'test_mc_point.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)

test_mc_result = executable(
'test_mc_result',
'test_mc_result.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)

test_numerical_results = executable(
'test_numerical_results',
'test_numerical_results.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)

test_vegas_icdf_bug = executable(
'test_vegas_icdf_bug',
'test_vegas_icdf_bug.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)
'test_vegas_pdf'
]

test_vegas_pdf = executable(
'test_vegas_pdf',
'test_vegas_pdf.cpp',
foreach p : programs
exe = executable(
p,
p + '.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
)

test(p, exe)
endforeach

test_genz_integrand = executable(
'test_genz_integrand',
'test_genz_integrand.cpp',
cpp_args : '-DGTEST_HAS_THREAD=0',
include_directories : incdir,
link_with : [ libgtest, libgtest_main ]
link_with : [ libgenz, libgtest, libgtest_main ]
)

test('test_genz_integrand', test_genz_integrand, timeout : 120)

if get_option('mpi')
libgtest_mpi_main = static_library(
'gtest-mpi-main',
'gtest/gtest.h',
'gtest_mpi_main.cpp',
cpp_args : '-DGTEST_HAS_PTHREAD=0',
dependencies : mpi
dependencies : mpi_dep
)

test_mpi_numerical_results = executable(
'test_mpi_numerical_results',
'test_numerical_results.cpp',
cpp_args : [ '-DGTEST_HAS_THREAD=0', '-DHEP_USE_MPI' ],
dependencies : mpi,
dependencies : mpi_dep,
include_directories : incdir,
link_with : [ libgtest, libgtest_mpi_main ]
)
Expand All @@ -113,13 +74,3 @@ if get_option('mpi')
test('test_mpi_numerical_results', mpiexec,
args : [ '-np', '2', test_mpi_numerical_results])
endif

test('test_discrete_distribution', test_discrete_distribution)
test('test_distributions', test_distributions)
test('test_genz_integrand', test_genz_integrand, timeout : 120)
test('test_mc_helper', test_mc_helper)
test('test_mc_point', test_mc_point)
test('test_mc_result', test_mc_result)
test('test_numerical_results', test_numerical_results)
test('test_vegas_icdf_bug', test_vegas_icdf_bug)
test('test_vegas_pdf', test_vegas_pdf)

0 comments on commit 8444c31

Please sign in to comment.