Is there some way of marking these packages as "production only" so they aren't built or required except when a "production" flag is set?
No, there isn't.
What you could do is explicitly ask it to build only a subset of packages (which results in the same behaviour, but uses more appropriate ways to express your intention).
You'd want to use catkin_tools
for this though.
See catkin build: Build Packages - Building Subsets of Packages. To go beyond individual packages and use profiles with specific sets of packages (to ignore or to actually build), you can use white/black listing.
If you absolutely don't want to use catkin_tools
, you could look into the white/black listing functionality of catkin_make
. See the comments on #q54178 for an example and #q285341. It's much less convenient than the implementation in catkin_tools
though.
So this means every developer has to install all these SDKs for hardware they are never going to see.
But your description makes me ask: why do those developers have those packages in their workspace then?
Edit:
The project is a catkin workspace (in a git repo.), developers branch and merge the project in order to develop for it and test it. Is not a typical way to develop for ROS projects?
No. Not at all.
In fact, I would almost say: never version entire workspaces (by putting them in a single repository).
See also #q264600 (and the Q&As linked from that). And #q347421 for the ROS 2 version (which isn't really any different).
I'd recommend to take a look at tools like vcstool
, rosdep
, .rosinstall
files, rosinstall_generator
et al.
Suggestion: change the title of your question to the actual question (ie: how to build only a subset of packages), instead of mentioning a potential solution you came up with already.