Properly define in CMakeList EASTL_DLL and EAST_API if shared
According to https://github.com/electronicarts/EASTL/blob/master/include/EASTL/internal/config.h, when EASTL is built as a shared lib, EA_DLL should be defined, and EAST_API defined to __declspec(dllexport) if MSVC or CYGWIN:
Something like this could be added to CMakeLists.txt:
if(BUILD_SHARED_LIBS)
target_compile_definitions(EASTL PUBLIC EA_DLL)
if(MSVC OR CYGWIN)
target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)")
endif()
endif()
We already define EASTL_API in the config.h header. EA_DLL should be defined by the build system.
#define EASTL_DLL 1
#endif
#ifndef EASTL_API // If the build file hasn't already defined this to be dllexport...
#if EASTL_DLL
#if defined(_MSC_VER)
#define EASTL_API __declspec(dllimport)
#define EASTL_LOCAL
#elif defined(__CYGWIN__)
#define EASTL_API __attribute__((dllimport))
#define EASTL_LOCAL
#elif (defined(__GNUC__) && (__GNUC__ >= 4))
#define EASTL_API __attribute__ ((visibility("default")))
#define EASTL_LOCAL __attribute__ ((visibility("hidden")))
#else
#define EASTL_API
#define EASTL_LOCAL
#endif
#else
#define EASTL_API
#define EASTL_LOCAL
#endif
#endif
Where do you define EASTL_API as __declspec(dllexport) during build? It's dllimport in config.h, therefore this file is for consumer not for build (unless EASTL_API is externally defined as dllexport if build as shared library).
Sorry, my bad I thought we defined both in the header. I'll accept the PR if you submit it. Thanks!