Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodesk: Enable -fvisibility=hidden and -fvisibility-inlines-hidden to hide symbols on Linux and macOS #3452

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions build_scripts/build_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
# Helpers for printing output
verbosity = 1

# Hide symbols
HIDDEN_SYMBOLS = ['-DCMAKE_CXX_VISIBILITY_PRESET=hidden',
'-DCMAKE_C_VISIBILITY_PRESET=hidden',
'-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON']

def Print(msg):
if verbosity > 0:
print(msg)
Expand Down Expand Up @@ -1801,6 +1806,8 @@ def InstallUSD(context, force, buildArgs):
# system installed boost
extraArgs.append('-DBoost_NO_BOOST_CMAKE=On')
extraArgs.append('-DBoost_NO_SYSTEM_PATHS=True')

extraArgs += HIDDEN_SYMBOLS
extraArgs += buildArgs

RunCMake(context, force, extraArgs)
Expand Down
2 changes: 1 addition & 1 deletion extras/imaging/examples/hdui/dataSourceTreeWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

PXR_NAMESPACE_OPEN_SCOPE

class HDUI_API_CLASS HduiDataSourceTreeWidget : public QTreeWidget
class ARCH_EXPORT_TYPE HduiDataSourceTreeWidget : public QTreeWidget
{
Q_OBJECT;

Expand Down
2 changes: 1 addition & 1 deletion extras/imaging/examples/hdui/dataSourceValueTreeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

PXR_NAMESPACE_OPEN_SCOPE

class HDUI_API_CLASS HduiDataSourceValueTreeView : public QTreeView
class ARCH_EXPORT_TYPE HduiDataSourceValueTreeView : public QTreeView
{
Q_OBJECT;
public:
Expand Down
2 changes: 1 addition & 1 deletion extras/imaging/examples/hdui/registeredSceneIndexChooser.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

PXR_NAMESPACE_OPEN_SCOPE

class HDUI_API_CLASS HduiRegisteredSceneIndexChooser : public QPushButton
class ARCH_EXPORT_TYPE HduiRegisteredSceneIndexChooser : public QPushButton
{
Q_OBJECT;
public:
Expand Down
2 changes: 1 addition & 1 deletion extras/imaging/examples/hdui/sceneIndexDebuggerWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class HduiDataSourceTreeWidget;
class HduiDataSourceValueTreeView;
class HduiRegisteredSceneIndexChooser;

class HDUI_API_CLASS HduiSceneIndexDebuggerWidget
class ARCH_EXPORT_TYPE HduiSceneIndexDebuggerWidget
: public QWidget, public TfWeakBase
{
Q_OBJECT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

PXR_NAMESPACE_OPEN_SCOPE

class HDUI_API_CLASS HduiSceneIndexObserverLoggingTreeView : public QTreeView
class ARCH_EXPORT_TYPE HduiSceneIndexObserverLoggingTreeView : public QTreeView
{
Q_OBJECT;
public:
Expand All @@ -37,7 +37,7 @@ public Q_SLOTS:

private:

class HDUI_API_CLASS _ObserverModel :
class ARCH_EXPORT_TYPE _ObserverModel :
public HdSceneIndexObserver, public QAbstractItemModel
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PXR_NAMESPACE_OPEN_SCOPE

class HduiSceneIndexObserverLoggingTreeView;

class HDUI_API_CLASS HduiSceneIndexObserverLoggingWidget : public QWidget
class ARCH_EXPORT_TYPE HduiSceneIndexObserverLoggingWidget : public QWidget
{
Q_OBJECT;
public:
Expand All @@ -38,4 +38,4 @@ class HDUI_API_CLASS HduiSceneIndexObserverLoggingWidget : public QWidget

PXR_NAMESPACE_CLOSE_SCOPE

#endif //PXR_IMAGING_HDUI_SCENE_INDEX_OBSERVER_LOGGING_WIDGET_H
#endif //PXR_IMAGING_HDUI_SCENE_INDEX_OBSERVER_LOGGING_WIDGET_H
2 changes: 1 addition & 1 deletion extras/imaging/examples/hdui/sceneIndexTreeWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Hdui_SceneIndexPrimTreeWidgetItem;

//-----------------------------------------------------------------------------

class HDUI_API_CLASS HduiSceneIndexTreeWidget
class ARCH_EXPORT_TYPE HduiSceneIndexTreeWidget
: public QTreeWidget, public HdSceneIndexObserver
{
Q_OBJECT;
Expand Down
2 changes: 1 addition & 1 deletion extras/usd/examples/usdResolverExample/resolverContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/// allows the client to specify a version mapping file to use for
/// {$VERSION} substitutions during asset resolution. See overview
/// for more details.
class UsdResolverExampleResolverContext
class ARCH_EXPORT_TYPE UsdResolverExampleResolverContext
{
public:
/// Create a context that specifies that the version mappings in
Expand Down
2 changes: 1 addition & 1 deletion extras/usd/examples/usdSchemaExamples/complex.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SdfAssetPath;
///
/// An example of a untyped IsA schema prim
///
class UsdSchemaExamplesComplex : public UsdSchemaExamplesSimple
class ARCH_EXPORT_TYPE UsdSchemaExamplesComplex : public UsdSchemaExamplesSimple
{
public:
/// Compile time constant representing what kind of schema this class is.
Expand Down
2 changes: 1 addition & 1 deletion extras/usd/examples/usdSchemaExamples/paramsAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SdfAssetPath;
/// \class UsdSchemaExamplesParamsAPI
///
///
class UsdSchemaExamplesParamsAPI : public UsdAPISchemaBase
class ARCH_EXPORT_TYPE UsdSchemaExamplesParamsAPI : public UsdAPISchemaBase
{
public:
/// Compile time constant representing what kind of schema this class is.
Expand Down
2 changes: 1 addition & 1 deletion extras/usd/examples/usdSchemaExamples/simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SdfAssetPath;
/// An example of an untyped schema prim. Note that it does not
/// specify a typeName
///
class UsdSchemaExamplesSimple : public UsdTyped
class ARCH_EXPORT_TYPE UsdSchemaExamplesSimple : public UsdTyped
{
public:
/// Compile time constant representing what kind of schema this class is.
Expand Down
16 changes: 6 additions & 10 deletions pxr/base/arch/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
/// A class is added to the API like this:
///
/// \code
/// class FOO_API FooClass ...
/// class ARCH_EXPORT_TYPE FooClass ...
/// \endcode
///
/// This will add every member to the API, including implicitly created
Expand All @@ -74,7 +74,7 @@
/// Instead they are added when explicitly instantiated like so:
///
/// \code
/// template class FOO_API FooTemplateClass<FooArgType>;
/// template class ARCH_EXPORT_TYPE FooTemplateClass<FooArgType>;
/// \endcode
///
/// It's also sometimes necessary to indicate that an instantiation exists
Expand Down Expand Up @@ -128,7 +128,7 @@
/// FOO_LOCAL:
///
/// \code
/// struct FOO_API FooSemiAPI {
/// struct ARCH_EXPORT_TYPE FooSemiAPI {
/// void DoSomethingPublic();
/// FOO_LOCAL void _DoSomethingPrivate();
/// };
Expand All @@ -153,20 +153,16 @@
# endif
#elif defined(ARCH_COMPILER_GCC) && ARCH_COMPILER_GCC_MAJOR >= 4 || defined(ARCH_COMPILER_CLANG)
# define ARCH_EXPORT __attribute__((visibility("default")))
# define ARCH_IMPORT
# define ARCH_IMPORT __attribute__((visibility("default")))
# define ARCH_HIDDEN __attribute__((visibility("hidden")))
# if defined(ARCH_COMPILER_CLANG)
# define ARCH_EXPORT_TYPE __attribute__((type_visibility("default")))
# else
# define ARCH_EXPORT_TYPE __attribute__((visibility("default")))
# endif
# define ARCH_EXPORT_TYPE __attribute__((visibility("default")))
#else
# define ARCH_EXPORT
# define ARCH_IMPORT
# define ARCH_HIDDEN
# define ARCH_EXPORT_TYPE
#endif
#define ARCH_EXPORT_TEMPLATE(type, ...)
#define ARCH_EXPORT_TEMPLATE(type, ...) extern template type ARCH_EXPORT __VA_ARGS__
#define ARCH_IMPORT_TEMPLATE(type, ...) extern template type ARCH_IMPORT __VA_ARGS__

#endif // PXR_BASE_ARCH_EXPORT_H
2 changes: 1 addition & 1 deletion pxr/base/arch/testArchAbi.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct ArchAbiBase2 {
};

template <class T>
struct ArchAbiDerived : public ArchAbiBase1, public ArchAbiBase2 {
struct ARCH_EXPORT_TYPE ArchAbiDerived : public ArchAbiBase1, public ArchAbiBase2 {
virtual ~ArchAbiDerived() { }
virtual const char* name() const { return "ArchAbiDerived"; }
};
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GfFrustum;
/// This class provides a thin wrapper on the camera data model,
/// with a small number of computations.
///
class GfCamera
class ARCH_EXPORT_TYPE GfCamera
{
public:
/// Projection type.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/dualQuatd.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ double GfDot(const GfDualQuatd& dq1, const GfDualQuatd& dq2);
/// https://www.cs.utah.edu/~ladislav/kavan06dual/kavan06dual.pdf
/// https://faculty.sites.iastate.edu/jia/files/inline-files/dual-quaternion.pdf
///
class GfDualQuatd final
class ARCH_EXPORT_TYPE GfDualQuatd final
{
public:
typedef double ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/dualQuatf.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ float GfDot(const GfDualQuatf& dq1, const GfDualQuatf& dq2);
/// https://www.cs.utah.edu/~ladislav/kavan06dual/kavan06dual.pdf
/// https://faculty.sites.iastate.edu/jia/files/inline-files/dual-quaternion.pdf
///
class GfDualQuatf final
class ARCH_EXPORT_TYPE GfDualQuatf final
{
public:
typedef float ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/dualQuath.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ GfHalf GfDot(const GfDualQuath& dq1, const GfDualQuath& dq2);
/// https://www.cs.utah.edu/~ladislav/kavan06dual/kavan06dual.pdf
/// https://faculty.sites.iastate.edu/jia/files/inline-files/dual-quaternion.pdf
///
class GfDualQuath final
class ARCH_EXPORT_TYPE GfDualQuath final
{
public:
typedef GfHalf ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/ilmbase_half.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ PXR_NAMESPACE_OPEN_SCOPE

namespace pxr_half {

class half
class ARCH_EXPORT_TYPE half
{
public:

Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/matrix2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GfMatrix2f;
/// Matrices are defined to be in row-major order, so <c>matrix[i][j]</c>
/// indexes the element in the \e i th row and the \e j th column.
///
class GfMatrix2d
class ARCH_EXPORT_TYPE GfMatrix2d
{
public:
typedef double ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/matrix2f.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GfMatrix2f;
/// Matrices are defined to be in row-major order, so <c>matrix[i][j]</c>
/// indexes the element in the \e i th row and the \e j th column.
///
class GfMatrix2f
class ARCH_EXPORT_TYPE GfMatrix2f
{
public:
typedef float ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/matrix3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GfQuatd;
/// matrix and S represents a scale matrix, the
/// product R*S will rotate a row vector, then scale
/// it.
class GfMatrix3d
class ARCH_EXPORT_TYPE GfMatrix3d
{
public:
typedef double ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/matrix3f.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GfQuatf;
/// matrix and S represents a scale matrix, the
/// product R*S will rotate a row vector, then scale
/// it.
class GfMatrix3f
class ARCH_EXPORT_TYPE GfMatrix3f
{
public:
typedef float ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/matrix4d.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class GfMatrix3d;
/// matrix and T represents a translation matrix, the
/// product R*T will rotate a row vector, then translate
/// it.
class GfMatrix4d
class ARCH_EXPORT_TYPE GfMatrix4d
{
public:
typedef double ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/matrix4f.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class GfMatrix3f;
/// matrix and T represents a translation matrix, the
/// product R*T will rotate a row vector, then translate
/// it.
class GfMatrix4f
class ARCH_EXPORT_TYPE GfMatrix4f
{
public:
typedef float ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/quatd.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ double GfDot(const GfQuatd& q1, const GfQuatd& q2);
/// Basic type: a quaternion, a complex number with a real coefficient and
/// three imaginary coefficients, stored as a 3-vector.
///
class GfQuatd
class ARCH_EXPORT_TYPE GfQuatd
{
public:
typedef double ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/quaternion.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PXR_NAMESPACE_OPEN_SCOPE
/// part and a vector of three imaginary values. Quaternions are used by the
/// \c GfRotation class to represent arbitrary-axis rotations.
///
class GfQuaternion
class ARCH_EXPORT_TYPE GfQuaternion
{
public:

Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/quatf.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ float GfDot(const GfQuatf& q1, const GfQuatf& q2);
/// Basic type: a quaternion, a complex number with a real coefficient and
/// three imaginary coefficients, stored as a 3-vector.
///
class GfQuatf
class ARCH_EXPORT_TYPE GfQuatf
{
public:
typedef float ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/quath.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GfHalf GfDot(const GfQuath& q1, const GfQuath& q2);
/// Basic type: a quaternion, a complex number with a real coefficient and
/// three imaginary coefficients, stored as a 3-vector.
///
class GfQuath
class ARCH_EXPORT_TYPE GfQuath
{
public:
typedef GfHalf ScalarType;
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/vec2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct GfIsGfVec<class GfVec2d> { static const bool value = true; };
/// Represents a vector of 2 components of type \c double.
/// It is intended to be fast and simple.
///
class GfVec2d
class ARCH_EXPORT_TYPE GfVec2d
{
public:
/// Scalar element type and dimension.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/vec2f.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct GfIsGfVec<class GfVec2f> { static const bool value = true; };
/// Represents a vector of 2 components of type \c float.
/// It is intended to be fast and simple.
///
class GfVec2f
class ARCH_EXPORT_TYPE GfVec2f
{
public:
/// Scalar element type and dimension.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/vec2h.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct GfIsGfVec<class GfVec2h> { static const bool value = true; };
/// Represents a vector of 2 components of type \c GfHalf.
/// It is intended to be fast and simple.
///
class GfVec2h
class ARCH_EXPORT_TYPE GfVec2h
{
public:
/// Scalar element type and dimension.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/vec2i.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct GfIsGfVec<class GfVec2i> { static const bool value = true; };
/// Represents a vector of 2 components of type \c int.
/// It is intended to be fast and simple.
///
class GfVec2i
class ARCH_EXPORT_TYPE GfVec2i
{
public:
/// Scalar element type and dimension.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/vec3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct GfIsGfVec<class GfVec3d> { static const bool value = true; };
/// Represents a vector of 3 components of type \c double.
/// It is intended to be fast and simple.
///
class GfVec3d
class ARCH_EXPORT_TYPE GfVec3d
{
public:
/// Scalar element type and dimension.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/vec3f.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct GfIsGfVec<class GfVec3f> { static const bool value = true; };
/// Represents a vector of 3 components of type \c float.
/// It is intended to be fast and simple.
///
class GfVec3f
class ARCH_EXPORT_TYPE GfVec3f
{
public:
/// Scalar element type and dimension.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/gf/vec3h.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct GfIsGfVec<class GfVec3h> { static const bool value = true; };
/// Represents a vector of 3 components of type \c GfHalf.
/// It is intended to be fast and simple.
///
class GfVec3h
class ARCH_EXPORT_TYPE GfVec3h
{
public:
/// Scalar element type and dimension.
Expand Down
Loading
Loading