tschw / AntTweakBar

Lightweight property editor GUI for with 3D graphics and APIs
Other
32 stars 17 forks source link

Compilation error with with BUILD_SHARED_LIBS=ON #4

Closed GalGR closed 4 years ago

GalGR commented 4 years ago

I tried to compile with GCC 7.5.0 with the shared library target on, but the build failed because building the shared object required the object files to be compiled with the position independent code flag. I searched in google on how to enable this flag in CMake, and found this workaround. I don't know if it's a good solution or not, because it also compiles the examples with this flag on, so please refactor that change if needed.

tschw commented 4 years ago

Cool, thanks!

Actually, only the renderer needs it because it's linked statically into the shared library. Shared libraries are compiled in a pointer-independent fashion by default (whether CMake instructs the compiler to do so is controlled by the target property POSITION_INDEPENDENT_CODE).