diff --git a/CMakeLists.txt b/CMakeLists.txt index e0f20a2a2..8d5bba246 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -600,6 +600,12 @@ endif () ## Define harfbuzz library +set(HB_VISIBILITY_INLINES_HIDDEN TRUE) +# XCOFF rejects hidden visibility on references to imported inline symbols. +if(CMAKE_SYSTEM_NAME MATCHES "^(AIX|OS400)$") + set(HB_VISIBILITY_INLINES_HIDDEN FALSE) +endif() + add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers}) target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS}) if (MINGW) @@ -608,7 +614,7 @@ endif() target_include_directories(harfbuzz PUBLIC "$" "$") -set_target_properties(harfbuzz PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) +set_target_properties(harfbuzz PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (HB_HAVE_FREETYPE AND TARGET freetype) target_link_libraries(harfbuzz freetype) endif () @@ -619,7 +625,7 @@ if (HB_HAVE_ICU) add_library(harfbuzz-icu ${PROJECT_SOURCE_DIR}/src/hb-icu.cc ${PROJECT_SOURCE_DIR}/src/hb-icu.h) add_dependencies(harfbuzz-icu harfbuzz) target_link_libraries(harfbuzz-icu harfbuzz ${THIRD_PARTY_LIBS}) - set_target_properties(harfbuzz-icu PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + set_target_properties(harfbuzz-icu PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (BUILD_SHARED_LIBS) if (BUILD_FRAMEWORK) @@ -646,7 +652,7 @@ if (HB_BUILD_SUBSET) list(APPEND project_headers ${subset_project_headers}) add_dependencies(harfbuzz-subset harfbuzz) target_link_libraries(harfbuzz-subset harfbuzz ${THIRD_PARTY_LIBS}) - set_target_properties(harfbuzz-subset PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + set_target_properties(harfbuzz-subset PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (MINGW) target_compile_options(harfbuzz-subset PRIVATE "-Wa,-mbig-obj") @@ -674,7 +680,7 @@ if (HB_BUILD_RASTER) add_library(harfbuzz-raster ${raster_project_sources} ${raster_project_headers}) add_dependencies(harfbuzz-raster harfbuzz) target_link_libraries(harfbuzz-raster harfbuzz ${HB_RASTER_THIRD_PARTY_LIBS}) - set_target_properties(harfbuzz-raster PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + set_target_properties(harfbuzz-raster PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (MINGW) target_compile_options(harfbuzz-raster PRIVATE "-Wa,-mbig-obj") @@ -703,7 +709,7 @@ if (HB_BUILD_VECTOR) add_library(harfbuzz-vector ${vector_project_sources} ${vector_project_headers}) add_dependencies(harfbuzz-vector harfbuzz) target_link_libraries(harfbuzz-vector harfbuzz ${HB_VECTOR_THIRD_PARTY_LIBS}) - set_target_properties(harfbuzz-vector PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + set_target_properties(harfbuzz-vector PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (MINGW) target_compile_options(harfbuzz-vector PRIVATE "-Wa,-mbig-obj") @@ -732,7 +738,7 @@ if (HB_BUILD_GPU) add_library(harfbuzz-gpu ${gpu_project_sources} ${gpu_project_headers}) add_dependencies(harfbuzz-gpu harfbuzz) target_link_libraries(harfbuzz-gpu harfbuzz) - set_target_properties(harfbuzz-gpu PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + set_target_properties(harfbuzz-gpu PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (MINGW) target_compile_options(harfbuzz-gpu PRIVATE "-Wa,-mbig-obj") @@ -803,7 +809,7 @@ if (HB_HAVE_GOBJECT) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/src) add_dependencies(harfbuzz-gobject harfbuzz) target_link_libraries(harfbuzz-gobject harfbuzz ${GOBJECT_LIBRARIES} ${THIRD_PARTY_LIBS}) - set_target_properties(harfbuzz-gobject PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + set_target_properties(harfbuzz-gobject PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (BUILD_SHARED_LIBS) if (BUILD_FRAMEWORK) @@ -829,7 +835,7 @@ if (HB_HAVE_CAIRO) add_library(harfbuzz-cairo ${PROJECT_SOURCE_DIR}/src/hb-cairo.cc ${PROJECT_SOURCE_DIR}/src/hb-static.cc ${PROJECT_SOURCE_DIR}/src/hb-cairo.h) add_dependencies(harfbuzz-cairo harfbuzz) target_link_libraries(harfbuzz-cairo harfbuzz ${THIRD_PARTY_LIBS}) - set_target_properties(harfbuzz-cairo PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) + set_target_properties(harfbuzz-cairo PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN}) if (BUILD_SHARED_LIBS) if (BUILD_FRAMEWORK) diff --git a/meson.build b/meson.build index 26ab24fb2..b7ba31f46 100644 --- a/meson.build +++ b/meson.build @@ -66,12 +66,16 @@ add_project_link_arguments(cpp.get_supported_link_arguments([ '-Bsymbolic-functions' ]), language: 'c') +visibility_inlines_hidden_argument = ['-fvisibility-inlines-hidden'] +# XCOFF rejects hidden visibility on references to imported inline symbols. +if host_machine.system() in ['os400', 'aix'] + visibility_inlines_hidden_argument = [] +endif add_project_arguments(cpp.get_supported_arguments([ '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics', - '-fvisibility-inlines-hidden', -]), language: 'cpp') +] + visibility_inlines_hidden_argument), language: 'cpp') if host_machine.cpu_family() == 'arm' and cpp.alignment('struct { char c; }') != 1 if cpp.has_argument('-mstructure-size-boundary=8')