wdas / ptex

Per-Face Texture Mapping for Production Rendering https://wdas.github.io/ptex
https://www.disneyanimation.com/open-source/ptex/
Other
681 stars 140 forks source link

Mac/Linux builds don't support -fvisibility=hidden #48

Closed wayne-arnold-adsk closed 3 years ago

wayne-arnold-adsk commented 4 years ago

the use of PTEXAPI could be expanded to include both Mac and Linux builds with use of:

__attribute__ ((visibility("default")))

#if defined(_WIN32) || defined(_WINDOWS) || defined(_MSC_VER)
# ifndef PTEXAPI
#  ifndef PTEX_STATIC
#    ifdef PTEX_EXPORTS
#       define PTEXAPI __declspec(dllexport)
#    else
#       define PTEXAPI __declspec(dllimport)
#    endif
#  else
#    define PTEXAPI
#  endif
# endif
#else
#  ifndef PTEXAPI
#    define PTEXAPI  __attribute__ ((visibility("default")))
#  endif
#  ifndef DOXYGEN
#    define PTEX_USE_STDSTRING
#  endif
#endif
davvid commented 4 years ago

CMake has a built-in way to generate export headers:

https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html

Building upon that feature seems like a good way to go. 👍 thanks Wayne, this would be good to do.

davvid commented 3 years ago

Thanks Wayne, I think we have this working in https://github.com/wdas/ptex/pull/57

Could you please try out my visibilty branch from git://github.com/davvid/ptex.git and let me know if that looks good to you?

Thanks for the sug!

wayne-arnold-adsk commented 2 years ago

in reviewing the current code for Mac/Linux one would normally use the same

define PTEXAPI attribute ((visibility("default")))

for both cases, when defined PTEX_EXPORTS or not. else this can lead to different visibility warnings for different compile units