From 2f3b075275b0550b62cd8ddf2dab315e425a794d Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Fri, 15 Jul 2022 11:15:08 +0200 Subject: [PATCH] introduce build_visualization option --- init.rb | 11 +++++++++++ overrides.rb | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/init.rb b/init.rb index b24de781..a126f471 100644 --- a/init.rb +++ b/init.rb @@ -170,3 +170,14 @@ def bundle_package(*args, &block) Autoproj.config.set 'syskit_use_bundles', true, true end +Autoproj.config.declare 'build_visualization', 'boolean', + default: true, + short_doc: 'Whether vizkit visualizaztion plugins in "viz" subfolders of packages should be built', + doc: ['Should the visualizations be built (viz subfolder of packages)?', + 'This will also evaluate the manifest.xml in the viz subfolder of a package', + 'and install them', + 'These dependencies will appear as dependencies of the main package'] + +unless Autoproj.config.has_value_for?('build_visualization') + Autoproj.config.set 'build_visualization', true, true +end diff --git a/overrides.rb b/overrides.rb index 70be966a..9ee0f72e 100644 --- a/overrides.rb +++ b/overrides.rb @@ -92,6 +92,29 @@ end if pkg.kind_of?(Autobuild::CMake) + if File.directory?(File.join(pkg.srcdir, 'viz')) + if Autoproj.config.has_value_for?('build_visualization') + if Autoproj.config.get 'build_visualization' + pkg.define 'ROCK_VIZ_ENABLED', 'OFF' + else + # load manifest.xml from viz folder + viz_manifest_file = File.join(pkg.srcdir, 'viz', 'manifest.xml') + if File.file?(viz_manifest_file) + manifest = Autoproj::PackageManifest.load(pkg, viz_manifest_file, ros_manifest: false) + if manifest + manifest.each_dependency do |name, is_optional| + if is_optional + pkg.optional_dependency name + else + pkg.depends_on name + end + end + end + end + end + end + end + pkg.post_import do Rock.update_cmake_build_type_from_tags(pkg)