alandefreitas / cpp-actions

GitHub Actions for C++ Libraries
https://alandefreitas.github.io/cpp-actions/
Boost Software License 1.0
19 stars 3 forks source link

`no-rtti` factor #6

Closed cmazakas closed 9 months ago

cmazakas commented 9 months ago

There should be a factor that adds -fno-rtti and /GR- for CMake builds and also rtti=off for the b2 workflow

Something like this seems to suffice:

B2_ARGS+=(${{ (inputs['no-rtti'] == 'true' && '"rtti=off"') || '' }})
cmazakas commented 9 months ago

I've also come to learn, /GR- on msvc toolchains seems to necessitate us explicitly passing /EHsc which I assumed it did by default but I guess it doesn't. Updating the code to appned entry['cxxflags'] += ' /GR- /EHsc' seems to work fine in practice.

alandefreitas commented 9 months ago

I've included the rtti option for the b2-workflow action. true adds rtti=on to the args, false adds rtti=on to the args, and everything else adds nothing. I'll convert this action to JavaScript at some point to make it easier to maintain.

About always recommending '/EHsc'` directly from the matrix, this should remain as the user's responsibility because it's not composable or generic enough and can minimize surprises because the convention in CMake is not to assume the user has to pass required flags manually: if only the user needs /EHsc, they can provide it via the command line. If the project always needs /EHsc with no exception on MSVC, then it should embed it in the (interface) target.