Skip to content

Commit

Permalink
Merge pull request #170 from jwillemsen/jwi-openddsconfigfie
Browse files Browse the repository at this point in the history
Create OpenDDS dds/OpenDDSConfig.h file as part of configure step
  • Loading branch information
jwillemsen authored Jun 10, 2024
2 parents b1df7f9 + 429a6fb commit 2506a87
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 17 deletions.
14 changes: 14 additions & 0 deletions brix11/lib/brix11/brix/common/cmds/configure/ace_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module ACE_Config

DEFAULT_FEATURES = File.join('bin', 'MakeProjectCreator', 'config', 'default.features')

OPENDDSCONFIG_H = File.join('dds', 'OpenDDSConfig.h')

def self.config_include(opts)
opts[:platform][:config_include] || "config-#{opts[:platform][:os]}.h"
end
Expand Down Expand Up @@ -89,6 +91,18 @@ def self.create_config(cfg)
platform_macros_io.close unless cfg.dryrun?
end
end
if cfg.features.has_key?(:opendds) && cfg.features[:opendds].state
# generate OpenDDS dds/OpenDDSConfig.h OpenDDS enabled
opendds_folder = Exec.get_run_environment('DDS_ROOT')
openddsconfig_h = File.join(opendds_folder, OPENDDSCONFIG_H)
BRIX11.show_msg("Creating #{openddsconfig_h}")
begin
openddsconfig_h_io.puts("#----- #{OPENDDSCONFIG_H} -----") if cfg.dryrun?
openddsconfig_h_io = cfg.dryrun? ? STDOUT : File.new(openddsconfig_h, 'w')
ensure
openddsconfig_h_io.close unless cfg.dryrun?
end
end
BRIX11.show_msg("Creating #{default_features}")
begin
default_features_io = cfg.dryrun? ? STDOUT : File.new(default_features, 'w')
Expand Down
38 changes: 21 additions & 17 deletions brix11/lib/brix11/brix/common/cmds/configure/configurator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ def get_test_config_from(features_cfg_file)
end

def self.print_config(workspace)
# printing the configuration requires an existing ACE_ROOT and config files
# printing the configuration as available on disk
_test_configs = nil
if Exec.get_run_environment('ACE_ROOT') && File.exist?(File.join(Exec.get_run_environment('ACE_ROOT'), 'ace', 'config.h'))
_test_configs = nil
_ace_root = Exec.get_run_environment('ACE_ROOT')
print_file(File.join(_ace_root, 'ace', 'config.h'), 'config.h')
_cfg_file = File.join(_ace_root, 'include', 'makeinclude', 'platform_macros.GNU')
Expand All @@ -442,22 +442,26 @@ def self.print_config(workspace)
print_file(_cfg_file, 'default.features')
_test_configs = get_test_config_from(_cfg_file)
end
if Exec.get_run_environment('TAOX11_ROOT')
_cfg_file = File.join(Exec.get_run_environment('TAOX11_ROOT'), 'bin', 'MPC', 'config', 'MPC.cfg')
print_file(_cfg_file, 'MPC.cfg') if File.exist?(_cfg_file)
end
_cfg_file = File.join(Configurator::ROOT, '.ridlrc')
print_file(_cfg_file, '.ridlrc') if File.exist?(_cfg_file)
_cfg_file = File.join(Configurator::ROOT, '.brix11rc')
print_file(_cfg_file, '.brix11rc') if File.exist?(_cfg_file)
_cfg_file = File.join(Configurator::ROOT, (workspace || 'workspace') + '.mwc')
print_file(_cfg_file, (workspace || 'workspace') + '.mwc') if File.exist?(_cfg_file)
STDOUT.puts('=' * 60)
STDOUT.puts("Test config: #{_test_configs.join(' ')}") if _test_configs
STDOUT.puts
else
BRIX11.log_fatal("Cannot find an existing configuration.")
end
BRIX11.log_error("ACE_ROOT has not been defined.")
end
if Exec.get_run_environment('TAOX11_ROOT')
_cfg_file = File.join(Exec.get_run_environment('TAOX11_ROOT'), 'bin', 'MPC', 'config', 'MPC.cfg')
print_file(_cfg_file, 'MPC.cfg') if File.exist?(_cfg_file)
end
if Exec.get_run_environment('DDS_ROOT')
_cfg_file = File.join(Exec.get_run_environment('DDS_ROOT'), 'dds', 'OpenDDSConfig.h')
print_file(_cfg_file, 'OpenDDSConfig.h') if File.exist?(_cfg_file)
end
_cfg_file = File.join(Configurator::ROOT, '.ridlrc')
print_file(_cfg_file, '.ridlrc') if File.exist?(_cfg_file)
_cfg_file = File.join(Configurator::ROOT, '.brix11rc')
print_file(_cfg_file, '.brix11rc') if File.exist?(_cfg_file)
_cfg_file = File.join(Configurator::ROOT, (workspace || 'workspace') + '.mwc')
print_file(_cfg_file, (workspace || 'workspace') + '.mwc') if File.exist?(_cfg_file)
STDOUT.puts('=' * 60)
STDOUT.puts("Test config: #{_test_configs.join(' ')}") if _test_configs
STDOUT.puts
end

def self.get_test_config
Expand Down
13 changes: 13 additions & 0 deletions brix11/lib/brix11/brix/common/cmds/configure/hostsetup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module HostSetup
'ace/config.h',
'bin/MakeProjectCreator/config/default.features',
'include/makeinclude/platform_macros.GNU',
'dds/OpenDDSConfig.h',
/.*\.so.*/,
]

Expand Down Expand Up @@ -104,6 +105,8 @@ def create_build_config(x11_host_root, cfg)
ace_config = File.join(x11_host_root, 'ACE', ACE_Config::CONFIG_H)
platform_macros = File.join(x11_host_root, 'ACE', ACE_Config::PLATFORM_MACROS)
default_features = File.join(x11_host_root, 'ACE', ACE_Config::DEFAULT_FEATURES)
openddsconfig_h = File.join(x11_host_root, 'DDS', ACE_Config::OPENDDSCONFIG_H)

begin
config_h_io = cfg.dryrun? ? STDOUT : File.new(ace_config, 'w')
config_h_io.puts("//----- HOST #{ACE_Config::CONFIG_H} -----") if cfg.dryrun?
Expand Down Expand Up @@ -143,6 +146,16 @@ def create_build_config(x11_host_root, cfg)
ensure
default_features_io.close unless cfg.dryrun?
end

if cfg.features.has_key?(:opendds) && cfg.features[:opendds].state
# generate OpenDDS dds/OpenDDSConfig.h OpenDDS enabled
begin
openddsconfig_h_io = cfg.dryrun? ? STDOUT : File.new(openddsconfig_h, 'w')
openddsconfig_h_io.puts("#----- HOST #{ACE_Config::OPENDDSCONFIG_H} -----") if cfg.dryrun?
ensure
openddsconfig_h_io.close unless cfg.dryrun?
end
end
end

def create_mwc_config(x11_host_root, cfg)
Expand Down

0 comments on commit 2506a87

Please sign in to comment.