-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from c-dilks/meson
build: switch to Meson
- Loading branch information
Showing
5 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
dataframe_headers = files('RHipoDS.hxx') | ||
dataframe_sources = files('RHipoDS.cxx') | ||
dataframe_linkdef = files('RHipoDS_LinkDef.h') | ||
|
||
# ROOT stuff | ||
ROOT_config = find_program('root-config') | ||
ROOT_cling = find_program('rootcling') | ||
ROOT_libdir = run_command(ROOT_config, '--libdir', check: true).stdout().strip() | ||
ROOT_incdir = run_command(ROOT_config, '--incdir', check: true).stdout().strip() | ||
ROOT_inc = include_directories(ROOT_incdir) | ||
|
||
# generate ROOT dictionary | ||
dataframe_dict = 'HipoDataFrame_Dict.cxx' | ||
dataframe_lib_file = meson.current_build_dir() / 'libHipoDataFrame.so' # FIXME: file extension is platform dependent | ||
dataframe_dict_tgt = custom_target( | ||
'HipoDataFrameDict', | ||
input: dataframe_headers + hipo_headers + hipo_sources + [ dataframe_linkdef ], | ||
output: [ dataframe_dict ], | ||
command: [ | ||
ROOT_cling, | ||
'-v2', | ||
'-f', meson.current_build_dir() / dataframe_dict, | ||
'-s', dataframe_lib_file, | ||
'-rml', fs.name(dataframe_lib_file), | ||
'-rmf', fs.parent(dataframe_lib_file) / fs.stem(dataframe_lib_file) + '.rootmap', | ||
lz4_preproc_def, | ||
'-I' + ROOT_incdir, | ||
'-I' + hipo_incdir, | ||
] + dataframe_sources + dataframe_linkdef, | ||
) | ||
|
||
# library | ||
dataframe_lib = library( | ||
'HipoDataFrame', | ||
dataframe_sources + [ dataframe_dict_tgt[0] ], | ||
include_directories: [ hipo_inc, ROOT_inc ], | ||
link_with: [ hipo_lib ], | ||
link_args: [ '-L' + ROOT_libdir, '-lCore', '-lROOTDataFrame', '-lROOTVecOps'], | ||
build_rpath: ROOT_libdir, | ||
cpp_args: [ '-Wno-sign-compare' ], # FIXME: fix these warnings | ||
install: true | ||
) | ||
install_headers(dataframe_headers, subdir: meson.project_name()) | ||
project_libs += dataframe_lib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
hipo_sources = files( | ||
'bank.cpp', | ||
'datastream.cpp', | ||
'dictionary.cpp', | ||
'event.cpp', | ||
'fusion.cpp', | ||
'node.cpp', | ||
'parser.cpp', | ||
'reader.cpp', | ||
'recordbuilder.cpp', | ||
'record.cpp', | ||
'tuple.cpp', | ||
'utils.cpp', | ||
'wrapper.cpp', | ||
'writer.cpp', | ||
) | ||
hipo_headers = files( | ||
'bank.h', | ||
'datastream.h', | ||
'dictionary.h', | ||
'event.h', | ||
'fizika.h', | ||
'fusion.h', | ||
'hipoexceptions.h', | ||
'json.h', | ||
'jsonutil.h', | ||
'node.h', | ||
'parser.h', | ||
'reaction.h', | ||
'reader.h', | ||
'recordbuilder.h', | ||
'record.h', | ||
'tuple.h', | ||
'twig.h', | ||
'utils.h', | ||
'writer.h', | ||
) | ||
|
||
hipo_lib = library( | ||
meson.project_name(), | ||
hipo_sources, | ||
dependencies: [lz4_dep], | ||
cpp_args: [ # FIXME: fix the warnings; they are suppressed by these args | ||
'-Wno-sign-compare', | ||
'-Wno-unused-variable', | ||
'-Wno-unused-but-set-variable', | ||
'-Wno-misleading-indentation', | ||
'-Wno-format', | ||
], | ||
install: true | ||
) | ||
|
||
install_headers(hipo_headers, subdir: meson.project_name()) | ||
project_libs += hipo_lib | ||
|
||
hipo_incdir = meson.current_source_dir() | ||
hipo_inc = include_directories('.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
project( | ||
'hipo4', | ||
'cpp', | ||
meson_version: '>=1.2', | ||
default_options: { | ||
'cpp_std': 'c++17', | ||
'buildtype': 'release', | ||
'libdir': 'lib', | ||
'default_library': 'both', | ||
'pkgconfig.relocatable': 'true', | ||
}, | ||
version: '4.2.0', | ||
) | ||
|
||
# modules | ||
fs = import('fs') | ||
pkg = import('pkgconfig') | ||
|
||
# dependencies | ||
lz4_dep = dependency('liblz4', method: 'pkg-config', version: '>=1.9', fallback: ['lz4', 'liblz4']) | ||
ROOT_dep = dependency('ROOT', method: 'cmake', version: '>=6.28', required: false) | ||
|
||
# preprocessor | ||
lz4_preproc_def = '-D__LZ4__' | ||
add_project_arguments(lz4_preproc_def, language: ['cpp']) | ||
|
||
# main project builds | ||
project_libs = [] | ||
subdir('hipo4') | ||
|
||
# extensions | ||
if(get_option('dataframes')) | ||
if(ROOT_dep.found()) | ||
subdir('extensions' / 'dataframes') | ||
else | ||
warning('ROOT dependency not found; dataframes extension will NOT be built') | ||
endif | ||
endif | ||
|
||
# packaging | ||
pkg.generate( | ||
name: meson.project_name(), | ||
description: 'High Performance Output Data format for experimental Physics', | ||
libraries: project_libs, | ||
requires: [ lz4_dep ], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
option('dataframes', type: 'boolean', value: true, description: 'install HIPO dataframes extension') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[wrap-file] | ||
directory = lz4-1.9.4 | ||
source_url = https://github.com/lz4/lz4/archive/v1.9.4.tar.gz | ||
source_filename = lz4-1.9.4.tgz | ||
source_hash = 0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b | ||
patch_filename = lz4_1.9.4-2_patch.zip | ||
patch_url = https://wrapdb.mesonbuild.com/v2/lz4_1.9.4-2/get_patch | ||
patch_hash = 4f33456cce986167d23faf5d28a128e773746c10789950475d2155a7914630fb | ||
wrapdb_version = 1.9.4-2 | ||
|
||
[provide] | ||
liblz4 = liblz4_dep |