diff --git a/meson.build b/meson.build index e2ef1de82..393274422 100644 --- a/meson.build +++ b/meson.build @@ -21,6 +21,20 @@ project('nixl', 'CPP', version: '0.6.1', meson_version: '>= 0.64.0' ) +build_plugins_opt = get_option('build_plugins') +enabled_plugins = build_plugins_opt == '' ? [] : build_plugins_opt.split(',') + +should_build_plugin = {} +foreach plugin : ['UCX', 'UCX_MO', 'LIBFABRIC', 'POSIX', 'OBJ', 'GDS', 'GDS_MT', 'MOONCAKE', 'Mooncake', 'HF3FS', 'GUSLI', 'GPUNETIO'] + should_build_plugin += {plugin: enabled_plugins.length() == 0 or plugin in enabled_plugins} +endforeach + +if enabled_plugins.length() == 0 + message('Building all available plugins') +else + message('Building only selected plugins: ' + build_plugins_opt) +endif + # set up some global vars for compiler, platform, configuration, etc. cpp = meson.get_compiler('cpp') fs = import('fs') diff --git a/meson_options.txt b/meson_options.txt index fc28c08f2..a0b04c9ef 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,6 +25,7 @@ option('cudapath_inc', type: 'string', value: '', description: 'Include path for option('cudapath_lib', type: 'string', value: '', description: 'Library path for CUDA') option('cudapath_stub', type: 'string', value: '', description: 'Extra Stub path for CUDA') option('static_plugins', type: 'string', value: '', description: 'Plugins to be built-in, comma-separated') +option('build_plugins', type: 'string', value: '', description: 'List of plugins to build, comma-separated. Default (empty) builds all available plugins') option('build_docs', type: 'boolean', value: false, description: 'Build Doxygen documentation') option('log_level', type: 'combo', choices: ['trace', 'debug', 'info', 'warning', 'error', 'fatal', 'auto'], value: 'auto', description: 'Log Level (auto: auto-detect based on build type: trace for debug builds, info for release builds)') option('rust', type: 'boolean', value: false, description: 'Build Rust bindings') diff --git a/src/plugins/meson.build b/src/plugins/meson.build index 2a97127b4..b99be6708 100644 --- a/src/plugins/meson.build +++ b/src/plugins/meson.build @@ -13,48 +13,55 @@ # See the License for the specific language governing permissions and # limitations under the License. -ucx_backend_inc_dirs = include_directories('./ucx') - -if ucx_dep.found() +if ucx_dep.found() and should_build_plugin.get('UCX') subdir('ucx') +endif + +if ucx_dep.found() and should_build_plugin.get('UCX_MO') + ucx_backend_inc_dirs = include_directories('./ucx') subdir('ucx_mo') endif -subdir('posix') # Always try to build POSIX backend, it will handle its own dependencies -subdir('obj') # Always try to build Obj backend, it will handle its own dependencies +if should_build_plugin.get('POSIX') + subdir('posix') +endif + +if should_build_plugin.get('OBJ') + subdir('obj') +endif -if libfabric_dep.found() +if libfabric_dep.found() and should_build_plugin.get('LIBFABRIC') subdir('libfabric') endif disable_gds_backend = get_option('disable_gds_backend') -if not disable_gds_backend and cuda_dep.found() +if not disable_gds_backend and cuda_dep.found() and should_build_plugin.get('GDS') subdir('cuda_gds') endif -if taskflow_proj.found() and cuda_dep.found() and not disable_gds_backend +if taskflow_proj.found() and cuda_dep.found() and not disable_gds_backend and should_build_plugin.get('GDS_MT') subdir('gds_mt') endif cc = meson.get_compiler('cpp') libtransfer_engine = cc.find_library('transfer_engine', required: false) -if libtransfer_engine.found() and not get_option('disable_mooncake_backend') +if libtransfer_engine.found() and not get_option('disable_mooncake_backend') and (should_build_plugin.get('MOONCAKE') or should_build_plugin.get('Mooncake')) subdir('mooncake') endif hf3fs_lib_path = '/usr/lib/' hf3fs_lib_file = 'hf3fs_api_shared' hf3fs_lib_found = cc.find_library(hf3fs_lib_file, dirs: [hf3fs_lib_path], required: false) -if hf3fs_lib_found.found() +if hf3fs_lib_found.found() and should_build_plugin.get('HF3FS') subdir('hf3fs') endif gusli_lib_file = 'gusli_clnt' gusli_lib_found = cc.find_library(gusli_lib_file, required: false) -if gusli_lib_found.found() +if gusli_lib_found.found() and should_build_plugin.get('GUSLI') subdir('gusli') endif -if cuda_dep.found() and doca_gpunetio_dep.found() +if cuda_dep.found() and doca_gpunetio_dep.found() and should_build_plugin.get('GPUNETIO') subdir('gpunetio') endif diff --git a/test/gtest/plugins/meson.build b/test/gtest/plugins/meson.build index e9e11b4c4..61e2e8357 100644 --- a/test/gtest/plugins/meson.build +++ b/test/gtest/plugins/meson.build @@ -13,6 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +if not should_build_plugin.get('OBJ') + message('OBJ plugin not enabled, skipping plugins_gtest build') + subdir_done() +endif + aws_s3 = dependency('aws-cpp-sdk-s3', static: false, required: false) if not aws_s3.found() message('aws-cpp-sdk-s3 not found, skipping plugins_gtest build') diff --git a/test/unit/plugins/meson.build b/test/unit/plugins/meson.build index d1e554616..0a52d86ea 100644 --- a/test/unit/plugins/meson.build +++ b/test/unit/plugins/meson.build @@ -13,44 +13,48 @@ # See the License for the specific language governing permissions and # limitations under the License. -if ucx_dep.found() +if ucx_dep.found() and should_build_plugin.get('UCX') subdir('ucx') +endif + +if ucx_dep.found() and should_build_plugin.get('UCX_MO') subdir('ucx_mo') endif -subdir('posix') +if should_build_plugin.get('POSIX') + subdir('posix') +endif -if cuda_dep.found() and doca_gpunetio_dep.found() +if cuda_dep.found() and doca_gpunetio_dep.found() and should_build_plugin.get('GPUNETIO') subdir('gpunetio') endif - disable_gds_backend = get_option('disable_gds_backend') -if not disable_gds_backend +if not disable_gds_backend and should_build_plugin.get('GDS') subdir('cuda_gds') endif -if taskflow_proj.found() +if taskflow_proj.found() and should_build_plugin.get('GDS_MT') subdir('gds_mt') endif cc = meson.get_compiler('cpp') libtransfer_engine = cc.find_library('transfer_engine', required: false) disable_mooncake_backend = get_option('disable_mooncake_backend') -if libtransfer_engine.found() and not disable_mooncake_backend +if libtransfer_engine.found() and not disable_mooncake_backend and (should_build_plugin.get('MOONCAKE') or should_build_plugin.get('Mooncake')) subdir('mooncake') endif hf3fs_lib_path = '/usr/lib/' hf3fs_lib_file = 'hf3fs_api_shared' hf3fs_lib_found = cc.find_library(hf3fs_lib_file, dirs: [hf3fs_lib_path], required: false) -if hf3fs_lib_found.found() +if hf3fs_lib_found.found() and should_build_plugin.get('HF3FS') subdir('hf3fs') endif gusli_lib_path = '/usr/lib/' gusli_lib_file = 'gusli_clnt' gusli_lib_found = cc.find_library(gusli_lib_file, dirs: [gusli_lib_path], required: false) -if gusli_lib_found.found() +if gusli_lib_found.found() and should_build_plugin.get('GUSLI') subdir('gusli') endif \ No newline at end of file