Skip to content

Commit

Permalink
Merge pull request #4574 from jrw972/mpcopts-fix
Browse files Browse the repository at this point in the history
`--mpcopts` values are split on spaces
  • Loading branch information
jrw972 committed Apr 18, 2024
2 parents 270cae5 + 95ef01c commit 1a0528b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ jobs:
--tests \
--security \
--no-rapidjson \
--mpcopts="-features no_opendds_testing_features=0"
--features no_opendds_testing_features=0
- name: check build configuration
shell: bash
run: |
Expand Down Expand Up @@ -5103,7 +5103,7 @@ jobs:
- name: configure OpenDDS
run: |
cd OpenDDS
./configure --features=uses_wchar=1 "--mpcopts=-features dds_suppress_anys=0" --tests --security --rapidjson --ace=$GITHUB_WORKSPACE/ACE_TAO/ACE --mpc=$GITHUB_WORKSPACE/MPC
./configure --features=uses_wchar=1 --features dds_suppress_anys=0 --tests --security --rapidjson --ace=$GITHUB_WORKSPACE/ACE_TAO/ACE --mpc=$GITHUB_WORKSPACE/MPC
- name: check build configuration
shell: bash
run: |
Expand Down Expand Up @@ -11037,7 +11037,7 @@ jobs:
shell: cmd
run: |
cd /d C:\OpenDDS
configure --tests --java --no-built-in-topics --rapidjson --mpc=${{ github.workspace }}\MPC --xerces3="${{ env.VCPKG_INSTALLED_DIR }}\x86-windows" --mpcopts="-features no_opendds_testing_features=0"
configure --tests --java --no-built-in-topics --rapidjson --mpc=${{ github.workspace }}\MPC --xerces3="${{ env.VCPKG_INSTALLED_DIR }}\x86-windows" --features no_opendds_testing_features=0
- name: check build configuration
shell: cmd
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ishapes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ jobs:
cd OpenDDS
perl configure --optimize --no-debug --static --tests ^
"--qt=%VCPKG_INSTALLED_DIR%/x64-windows" ^
"--mpcopts=-value_template platforms=x64" ^
"--mpcopts=-value_template configurations=Release" ^
"--mpcopts=-value_template Release::runtime_library=MultiThreadedDLL"
"--mpc:value_template platforms=x64" ^
"--mpc:value_template configurations=Release" ^
"--mpc:value_template Release::runtime_library=MultiThreadedDLL"
tools\scripts\show_build_config.pl
- name: build
shell: cmd
Expand Down
38 changes: 33 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,13 @@ my @specs = # Array of array-refs, each inner array is an option group which
'configh=s@', 'Extra text for config.h',
'macros=s@', 'Extra text for platform_macros.GNU',
'features=s@', 'Extra text for default.features',
'mpcopts=s@', 'Extra command-line args for MPC',
'mpcopts=s@', 'Extra command-line args for MPC' .
$argIndent . 'This option can be given multiple times' .
$argIndent . 'Example: --mpcopts=-value_template --mpcopts=build_flags+="-Wall -Werror"',
'<usage>mpc:ARG VALUE', 'Extra command-line args for MPC' .
$argIndent . 'This option can be given multiple times' .
$argIndent . 'For example, --mpc:value_template build_flags+="-Wall -Werror" turns into' .
$argIndent . 'the following options for MPC: -value_template build_flags+="-Wall -Werror"',
'boottime!', 'Use CLOCK_BOOTTIME for timers (no)',
],
['Optional dependencies for OpenDDS (disabled by default unless noted otherwise):',
Expand Down Expand Up @@ -330,6 +336,9 @@ EOT
if ($optkey =~ /^\<hidden\>/) {
return;
}
if ($opt =~ /^\<usage\>(.*)$/) {
$optkey = $1;
}
$optkey =~ s/^\<default\>(.*)$/\[no-\]$1/g;
$optkey .= '...' if $opt =~ /s\@$/;
my $pad = $argPadding - length $optkey;
Expand All @@ -346,6 +355,9 @@ sub parseArgs {
my @default = ();
iterate(sub {
my ($group, $opt, $descr, $optkey) = @_;
if ($opt =~ /^\<usage\>/) {
return;
}
if ($opt =~ /^<default>(.*)$/) {
push @getopts, $1;
$optkey =~ /^<default>(.*)$/;
Expand All @@ -365,10 +377,28 @@ sub parseArgs {
}

my $opts = {};
Getopt::Long::Configure('pass_through');
GetOptions($opts, @getopts) or usage(1);
usage(0) if $opts->{'help'};
targetUsage(0) if $opts->{'target-help'};

while (@ARGV != 0) {
my $arg = shift(@ARGV);
if ($arg =~ /^--mpc:(.*)$/) {
my $key = $1;
if (@ARGV != 0) {
my $value = shift(@ARGV);
push(@{$opts->{'mpcopts'}}, '-' . $key, $value);
} else {
print "ERROR: $arg requires a value\n";
usage(1);
}
} else {
print "ERROR: unknown argument $arg\n";
usage(1);
}
}

if ($opts->{'verbose'}) {
print "Options:\n";
new Dumpvalue()->dumpValue($opts);
Expand Down Expand Up @@ -744,7 +774,7 @@ EOF
}
if ($opts{'std'}) {
my $std = "stdcpp$cxx_std";
push(@{$opts{'mpcopts'}}, "-value_template LanguageStandard=$std");
push(@{$opts{'mpcopts'}}, '-value_template', "LanguageStandard=$std");
print "Setting Visual C++ LanguageStandard to $std\n" if $opts{'verbose'};
if ($opts{'std'} eq 'latest' || $cxx_std >= 17) {
push(@{$opts{'features'}}, 'no_cxx17=0');
Expand Down Expand Up @@ -2421,9 +2451,7 @@ EOT
push(@mwc_common_args, '-static');
}
if (defined $opts{'mpcopts'}) {
for my $i (@{$opts{'mpcopts'}}) {
push(@mwc_common_args, split(/ /, $i));
}
push(@mwc_common_args, @{$opts{'mpcopts'}});
}

my @feature_opts = ();
Expand Down
13 changes: 13 additions & 0 deletions docs/news.d/mpcopts.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. news-prs: 4574
.. news-start-section: Removals
- Values passed to the configure script via ``--mpcopts`` are no longer split on spaces.

- For example, ``./configure --mpcopts="-value_template build_flags+=-Wall -Werror"`` must now be written as ``./configure --mpcopts=-value_template --mpcopts="build_flags+=-Wall -Werror"``.
.. news-end-section
.. news-start-section: Additions
- Add a ``configure`` script option for MPC options requiring a value.

- For example, ``./configure --mpc:value_template build_flags+="-Wall -Werror"``.
.. news-end-section

0 comments on commit 1a0528b

Please sign in to comment.