forked from Mirrorlandia_minetest/irrlicht
Move import/export macros into CMake
This commit is contained in:
parent
06db7b7ab7
commit
5a2b807890
@ -25,39 +25,15 @@
|
||||
#define _IRR_MATERIAL_MAX_TEXTURES_ 4
|
||||
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
|
||||
// To build Irrlicht as a static library, you must define _IRR_STATIC_LIB_ in both the
|
||||
// Irrlicht build, *and* in the user application, before #including <irrlicht.h>
|
||||
#ifndef _IRR_STATIC_LIB_
|
||||
#ifdef IRRLICHT_EXPORTS
|
||||
#define IRRLICHT_API __declspec(dllexport)
|
||||
#else
|
||||
#define IRRLICHT_API __declspec(dllimport)
|
||||
#endif // IRRLICHT_EXPORT
|
||||
#else
|
||||
#define IRRLICHT_API
|
||||
#endif // _IRR_STATIC_LIB_
|
||||
|
||||
// Declare the calling convention.
|
||||
#if defined(_STDCALL_SUPPORTED)
|
||||
#ifdef _WIN32
|
||||
#define IRRCALLCONV __stdcall
|
||||
#else
|
||||
#define IRRCALLCONV __cdecl
|
||||
#endif // STDCALL_SUPPORTED
|
||||
|
||||
#else // _IRR_WINDOWS_API_
|
||||
|
||||
// Force symbol export in shared libraries built with gcc.
|
||||
#if defined(__GNUC__) && !defined(_IRR_STATIC_LIB_) && defined(IRRLICHT_EXPORTS)
|
||||
#define IRRLICHT_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define IRRLICHT_API
|
||||
#define IRRCALLCONV
|
||||
#endif
|
||||
|
||||
#define IRRCALLCONV
|
||||
|
||||
#endif // _IRR_WINDOWS_API_
|
||||
#ifndef IRRLICHT_API
|
||||
#define IRRLICHT_API
|
||||
#endif
|
||||
|
||||
|
||||
#define _IRR_COMPILE_WITH_GUI_
|
||||
|
@ -4,7 +4,13 @@ option(USE_SDL2 "Use the SDL2 backend" FALSE)
|
||||
# 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")
|
||||
@ -453,13 +459,12 @@ target_include_directories(IrrlichtMt
|
||||
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user