Explicitly export symbols from libSPVRemapper

Windows requires symbols to be explicitly exported from DLLs, this
change simply marks the entire spirvbin_t class as exported.

The macros from visibility.h are included inline to get around include
path issues.
This commit is contained in:
Arcady Goldmints-Orlov 2024-09-12 15:40:52 -07:00 committed by arcady-lunarg
parent d7d5ab8f8a
commit 36ccaa31bd
2 changed files with 17 additions and 1 deletions

View File

@ -100,6 +100,7 @@ if (ENABLE_SPVREMAPPER)
POSITION_INDEPENDENT_CODE ON
VERSION "${GLSLANG_VERSION}"
SOVERSION "${GLSLANG_VERSION_MAJOR}")
glslang_only_export_explicit_symbols(SPVRemapper)
endif()
if(WIN32 AND BUILD_SHARED_LIBS)

View File

@ -41,6 +41,21 @@
#include <cstdlib>
#include <exception>
#ifdef GLSLANG_IS_SHARED_LIBRARY
#ifdef _WIN32
#ifdef GLSLANG_EXPORTING
#define GLSLANG_EXPORT __declspec(dllexport)
#else
#define GLSLANG_EXPORT __declspec(dllimport)
#endif
#elif __GNUC__ >= 4
#define GLSLANG_EXPORT __attribute__((visibility("default")))
#endif
#endif // GLSLANG_IS_SHARED_LIBRARY
#ifndef GLSLANG_EXPORT
#define GLSLANG_EXPORT
#endif
namespace spv {
class spirvbin_base_t
@ -83,7 +98,7 @@ namespace spv {
static inline constexpr Id NoResult = 0;
// class to hold SPIR-V binary data for remapping, DCE, and debug stripping
class spirvbin_t : public spirvbin_base_t
class GLSLANG_EXPORT spirvbin_t : public spirvbin_base_t
{
public:
spirvbin_t(int verbose = 0) : entryPoint(spv::NoResult), largestNewId(0), verbose(verbose), errorLatch(false)