Unverified Commit 5d4d2119 by John Kessenich Committed by GitHub

Merge pull request #2303 from ben-clayton/limit-public-2

glslang: Only export public interface for SOs
parents 9e4429f3 d64e8599
......@@ -205,6 +205,21 @@ if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External)
add_subdirectory(External)
endif()
# glslang_only_export_explicit_symbols() makes the symbol visibility hidden by
# default for <target> when building shared libraries, and sets the
# GLSLANG_IS_SHARED_LIBRARY define, and GLSLANG_EXPORTING to 1 when specifically
# building <target>.
function(glslang_only_export_explicit_symbols target)
target_compile_definitions(${target} PUBLIC "GLSLANG_IS_SHARED_LIBRARY=1")
if(BUILD_SHARED_LIBS)
if(WIN32)
target_compile_definitions(${target} PRIVATE "GLSLANG_EXPORTING=1")
else()
target_compile_options(${target} PRIVATE "-fvisibility=hidden")
endif()
endif()
endfunction()
if(NOT TARGET SPIRV-Tools-opt)
set(ENABLE_OPT OFF)
endif()
......
......@@ -63,7 +63,7 @@
#include "../glslang/OSDependent/osinclude.h"
extern "C" {
SH_IMPORT_EXPORT void ShOutputHtml();
GLSLANG_EXPORT void ShOutputHtml();
}
// Command-line options
......
......@@ -132,6 +132,8 @@ target_include_directories(glslang PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
glslang_only_export_explicit_symbols(glslang)
if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(glslang PROPERTIES PREFIX "")
endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment