#define _IRR_MATERIAL_MAX_TEXTURES_ 4\r
\r
\r
-#ifdef _IRR_WINDOWS_API_\r
-\r
-// To build Irrlicht as a static library, you must define _IRR_STATIC_LIB_ in both the\r
-// Irrlicht build, *and* in the user application, before #including <irrlicht.h>\r
-#ifndef _IRR_STATIC_LIB_\r
-#ifdef IRRLICHT_EXPORTS\r
-#define IRRLICHT_API __declspec(dllexport)\r
-#else\r
-#define IRRLICHT_API __declspec(dllimport)\r
-#endif // IRRLICHT_EXPORT\r
-#else\r
-#define IRRLICHT_API\r
-#endif // _IRR_STATIC_LIB_\r
-\r
-// Declare the calling convention.\r
-#if defined(_STDCALL_SUPPORTED)\r
+#ifdef _WIN32\r
#define IRRCALLCONV __stdcall\r
#else\r
-#define IRRCALLCONV __cdecl\r
-#endif // STDCALL_SUPPORTED\r
-\r
-#else // _IRR_WINDOWS_API_\r
+#define IRRCALLCONV\r
+#endif\r
\r
-// Force symbol export in shared libraries built with gcc.\r
-#if defined(__GNUC__) && !defined(_IRR_STATIC_LIB_) && defined(IRRLICHT_EXPORTS)\r
-#define IRRLICHT_API __attribute__ ((visibility("default")))\r
-#else\r
+#ifndef IRRLICHT_API\r
#define IRRLICHT_API\r
#endif\r
\r
-#define IRRCALLCONV\r
-\r
-#endif // _IRR_WINDOWS_API_\r
-\r
\r
#define _IRR_COMPILE_WITH_GUI_\r
#define _IRR_COMPILE_WITH_LIBJPEG_\r
# Compiler flags
add_definitions(-DIRRLICHT_EXPORTS)
-if(NOT BUILD_SHARED_LIBS)
+if(BUILD_SHARED_LIBS)
+ if(WIN32)
+ add_definitions("-DIRRLICHT_API=__declspec(dllexport)")
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
+ add_definitions("-DIRRLICHT_API=__attribute__ ((visibility(\"default\")))")
+ endif()
+else()
add_definitions(-D_IRR_STATIC_LIB_)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries(IrrlichtMt PRIVATE ${link_libs})
-# Propagate static library flag to lib users, only needed for Windows
-if(NOT BUILD_SHARED_LIBS)
- target_compile_definitions(IrrlichtMt INTERFACE _IRR_STATIC_LIB_)
-endif()
if(WIN32)
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_)
endif()
+if(WIN32 AND BUILD_SHARED_LIBS)
+ target_compile_definitions(IrrlichtMt INTERFACE IRRLICHT_API=__declspec(dllimport))
+endif()
if(APPLE OR ANDROID OR EMSCRIPTEN)
target_compile_definitions(IrrlichtMt PUBLIC IRR_MOBILE_PATHS)
endif()