File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 8484#define CPP_UTILITIES_GENERIC_LIB_HIDDEN __attribute__((visibility("hidden")))
8585#endif
8686
87+ /*!
88+ * \def CPP_UTILITIES_MAIN_EXPORT
89+ * \brief Exports the main() functions on platforms where this is needed.
90+ * \remarks Needed on Android with Qt where applications are shared libraries.
91+ * Otherwise loading the app will fail with the error "dlsym failed: undefined
92+ * symbol: main".
93+ * \sa See qtbase commit 29b17fa335388c9b93f70c29b2398cf2fee65785 (where this is solved
94+ with the sledgehammer method of setting the default visibility).
95+ */
96+
97+ #ifdef PLATFORM_ANDROID
98+ #define CPP_UTILITIES_MAIN_EXPORT CPP_UTILITIES_GENERIC_LIB_EXPORT
99+ #else
100+ #define CPP_UTILITIES_MAIN_EXPORT
101+ #endif
102+
87103/*!
88104 * \def CPP_UTILITIES_UNUSED
89105 * \brief Prevents warnings about unused variables.
Original file line number Diff line number Diff line change @@ -70,12 +70,7 @@ set_target_properties(
7070 AUTOGEN_TARGET_DEPENDS "${AUTOGEN_DEPS} "
7171 QT_DEFAULT_PLUGINS "${META_QT_DEFAULT_PLUGINS} "
7272 EXPORT_COMPILE_COMMANDS "${ENABLE_EXPORT_COMPILE_COMMANDS} " )
73- if (NOT ANDROID)
74- set_target_properties (${META_TARGET_NAME} PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden)
75- # note: Android *.so files need CXX visibility set to default (see qtbase commit
76- # 29b17fa335388c9b93f70c29b2398cf2fee65785). Otherwise loading the app will fail with the error "dlsym failed: undefined
77- # symbol: main".
78- endif ()
73+ set_target_properties (${META_TARGET_NAME} PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden)
7974if (NOT META_CXX_STANDARD STREQUAL "any" )
8075 set_target_properties (${META_TARGET_NAME} PROPERTIES CXX_STANDARD "${META_CXX_STANDARD} " )
8176endif ()
You can’t perform that action at this time.
0 commit comments