Giter VIP home page Giter VIP logo

Comments (7)

jacquelinekay avatar jacquelinekay commented on July 26, 2024

The second command (ament build_pkg . --cmake-args -DCMAKE_BUILD_TYPE=Debug -- --force-cmake-configure) is the "correct" way of entering an argument group to --cmake-args. It sounds like you're expecting extract_argument_group to find the next delimiter for you.

I think this convention for disambiguating arguments is fairly common, although I would ask @wjwwood for more information about why this method for argument parsing was chosen. I think the main reason for requiring the extra delimiter is if ament and CMake happen to accept some of the same flags, then it's ambiguous which flags after --cmake-args are being passed to ament and which are passed to CMake.

from ament_tools.

dirk-thomas avatar dirk-thomas commented on July 26, 2024

This is a common limitation of argparse. To avoid the extra delimiter you can pass all other arguments before "catch all" options like --cmake-args.

So in your case the following will work:

ament build . --force-cmake-configure --cmake-args -DCMAKE_BUILD_TYPE=Release

If nobody objects I would close this as wontfix since there is nothing we can do to change how argparse works.

from ament_tools.

dhood avatar dhood commented on July 26, 2024

Ok, thanks for the info
I guess it took me by surprise because the majority of time I had been passing multiple arguments without a problem.

I realise now that I must have just been 'lucky' in the sense that I wasn't using an argument that extract_argument_group ever detected, or that when I was, that argument group was at the end (indeed ament build . --force-cmake-configure --cmake-args -DCMAKE_BUILD_TYPE=Debug works fine).

Probably no need to keep this issue open then - documentation will explain it one day if not already and I just missed it. I might add a bit to the 'Tips' section of https://github.com/ros2/ros2/wiki/Ament-Tutorial if I've understood the situation correctly

from ament_tools.

dhood avatar dhood commented on July 26, 2024

thanks @dirk-thomas, didn't see that you had already replied. I've edited the tutorial.

from ament_tools.

wjwwood avatar wjwwood commented on July 26, 2024

Well we could change it so that ament build . --cmake-args -DCMAKE_BUILD_TYPE=Debug --force-cmake-configure would work, by closing the --cmake-args list of arguments whenever -- OR any known command line arguments are encountered, but that would make it impossible to pass --force-cmake-configure as an option to CMake via the --cmake-args, which is obviously not desired, but there are other less obvious arguments that might exist for both, e.g. -v or something like that.

I agree there's nothing to change here other than documentation.

from ament_tools.

wjwwood avatar wjwwood commented on July 26, 2024

For what it's worth this is mentioned in the -h:

  --cmake-args [CMAKE_ARGS [CMAKE_ARGS ...]]
                        Arbitrary arguments which are passed to all CMake
                        projects. Argument collection can be terminated with
                        '--'.

But I understand that it isn't immediately obvious.

from ament_tools.

wjwwood avatar wjwwood commented on July 26, 2024

The tutorial changes lgtm, thanks @dhood. I'll close this for now, but feel free to continue discussion and we can reopen if necessary.

from ament_tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.