godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Add visibility-hidden to CMake build

Open APokorny opened this issue 1 year ago • 3 comments
trafficstars

This should make all symbols that are not marked otherwise have hidden visibility. There still may be exposed symbols if marked with respective attributes.

APokorny avatar Aug 26 '24 11:08 APokorny

This is to avoid symbol clashes when multiple versions of godot-cpp are loaded through different plugins. Scons seems to do something similar already,

APokorny avatar Aug 26 '24 11:08 APokorny

Thanks!

With scons, visibility hidden is the default, but there is an option to change it. Would it be possible to add an option for cmake as well?

dsnopek avatar Aug 26 '24 15:08 dsnopek

You can change the behavior later - even in downstream projects via set_target_properties(<targets...> PROPERTIES CXX_VISIBILITY_PRESET default )

APokorny avatar Aug 27 '24 19:08 APokorny

I think this should be merged. Even though we're aiming for feature and interface parity, even without the option displayed it still adds something missing from the cmake build that is in the scons one. Perfect is the enemy of the good and all. it's trivial to add a cache entry which will show up in 'cmake -LH'

enetheru avatar Sep 11 '24 09:09 enetheru

Ok, let's merge this and then add an option in a follow-up

dsnopek avatar Sep 11 '24 15:09 dsnopek

Cherry-picked for 4.2 in PR https://github.com/godotengine/godot-cpp/pull/1631

dsnopek avatar Oct 28 '24 21:10 dsnopek

Cherry-picked for 4.3 in PR https://github.com/godotengine/godot-cpp/pull/1632

dsnopek avatar Oct 28 '24 21:10 dsnopek