From f6924ed69c97a76f1d8f51c6e70334d7c84b81b7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 13 May 2019 05:48:38 +0800 Subject: [PATCH] Support building ligo as dll --- code/nel/include/nel/ligo/ligo_config.h | 2 +- code/nel/include/nel/ligo/ligo_error.h | 2 +- code/nel/include/nel/ligo/ligo_material.h | 2 +- code/nel/include/nel/ligo/primitive.h | 26 +++++++++---------- code/nel/include/nel/ligo/primitive_class.h | 4 +-- .../nel/ligo/primitive_configuration.h | 2 +- code/nel/include/nel/ligo/primitive_utils.h | 4 +-- code/nel/include/nel/ligo/transition.h | 2 +- code/nel/include/nel/ligo/zone_bank.h | 4 +-- code/nel/include/nel/ligo/zone_edge.h | 2 +- code/nel/include/nel/ligo/zone_region.h | 4 +-- code/nel/include/nel/ligo/zone_template.h | 2 +- code/nel/include/nel/misc/types_nl.h | 8 +++++- code/nel/src/ligo/CMakeLists.txt | 6 ++++- 14 files changed, 40 insertions(+), 30 deletions(-) diff --git a/code/nel/include/nel/ligo/ligo_config.h b/code/nel/include/nel/ligo/ligo_config.h index 092f6caba..60fb67a28 100644 --- a/code/nel/include/nel/ligo/ligo_config.h +++ b/code/nel/include/nel/ligo/ligo_config.h @@ -36,7 +36,7 @@ class CPrimitive; * \author Nevrax France * \date 2001 */ -class CLigoConfig +class NLLIGO_API CLigoConfig { public: diff --git a/code/nel/include/nel/ligo/ligo_error.h b/code/nel/include/nel/ligo/ligo_error.h index 69d180afe..2628ba3f9 100644 --- a/code/nel/include/nel/ligo/ligo_error.h +++ b/code/nel/include/nel/ligo/ligo_error.h @@ -31,7 +31,7 @@ namespace NLLIGO * \author Nevrax France * \date 2001 */ -class CLigoError +class NLLIGO_API CLigoError { public: enum TError diff --git a/code/nel/include/nel/ligo/ligo_material.h b/code/nel/include/nel/ligo/ligo_material.h index 986a020f1..17393fb08 100644 --- a/code/nel/include/nel/ligo/ligo_material.h +++ b/code/nel/include/nel/ligo/ligo_material.h @@ -36,7 +36,7 @@ class CLigoConfig; * \author Nevrax France * \date 2001 */ -class CMaterial +class NLLIGO_API CMaterial { public: diff --git a/code/nel/include/nel/ligo/primitive.h b/code/nel/include/nel/ligo/primitive.h index d964ac125..7615c0d89 100644 --- a/code/nel/include/nel/ligo/primitive.h +++ b/code/nel/include/nel/ligo/primitive.h @@ -79,7 +79,7 @@ public: * This class is a property class for ligo primitive. * This is a simple string */ -class CPropertyString : public IProperty +class NLLIGO_API CPropertyString : public IProperty { public: CPropertyString () {} @@ -106,7 +106,7 @@ public: * This class is a property class for ligo primitive. * This is a string array */ -class CPropertyStringArray : public IProperty +class NLLIGO_API CPropertyStringArray : public IProperty { public: CPropertyStringArray () {} @@ -132,7 +132,7 @@ public: * This class is a property class for ligo primitive. * This is a string array */ -class CPropertyColor : public IProperty +class NLLIGO_API CPropertyColor : public IProperty { public: NLMISC::CRGBA Color; @@ -154,7 +154,7 @@ public: // *************************************************************************** -class CPrimVector : public NLMISC::CVector +class NLLIGO_API CPrimVector : public NLMISC::CVector { public: CPrimVector () @@ -184,7 +184,7 @@ public: * Provide access to common properties. * Provide access to the primitive hierachy */ -class IPrimitive : public NLMISC::IStreamable +class NLLIGO_API IPrimitive : public NLMISC::IStreamable { friend class CPrimitives; public: @@ -417,7 +417,7 @@ private: // *************************************************************************** // Simple primitive node -class CPrimNode : public IPrimitive +class NLLIGO_API CPrimNode : public IPrimitive { public: // \name From IClassable @@ -442,7 +442,7 @@ protected: // *************************************************************************** -class CPrimPoint : public IPrimitive +class NLLIGO_API CPrimPoint : public IPrimitive { public: @@ -484,7 +484,7 @@ protected: // *************************************************************************** -class CPrimPath : public IPrimitive +class NLLIGO_API CPrimPath : public IPrimitive { public: @@ -520,7 +520,7 @@ protected: // *************************************************************************** -class CPrimZone : public IPrimitive +class NLLIGO_API CPrimZone : public IPrimitive { public: @@ -583,7 +583,7 @@ protected: * Usage of this primitive imply the setting of the appropriate 'ligo context' * before reading or copy/pasting alias. */ -class CPrimAlias : public IPrimitive +class NLLIGO_API CPrimAlias : public IPrimitive { friend class CPrimitives; @@ -646,7 +646,7 @@ public: /* This class is deprecated. */ -class CPrimRegion +class NLLIGO_API CPrimRegion { public: @@ -670,7 +670,7 @@ public: /** * This class is a ligo primitives set */ -class CPrimitives +class NLLIGO_API CPrimitives { public: @@ -752,7 +752,7 @@ private: /** Singleton to manage special loading feature related to * unique alias assignment */ -class CPrimitiveContext +class NLLIGO_API CPrimitiveContext { static CPrimitiveContext *_Instance; diff --git a/code/nel/include/nel/ligo/primitive_class.h b/code/nel/include/nel/ligo/primitive_class.h index 24b46d1f4..fd33e3c56 100644 --- a/code/nel/include/nel/ligo/primitive_class.h +++ b/code/nel/include/nel/ligo/primitive_class.h @@ -39,7 +39,7 @@ class CLigoConfig; * \author Nevrax France * \date 2002 */ -class CPrimitiveClass +class NLLIGO_API CPrimitiveClass { public: @@ -127,7 +127,7 @@ public: }; // Parameter description - class CParameter : public CInitParameters + class NLLIGO_API CParameter : public CInitParameters { public: CParameter () {} diff --git a/code/nel/include/nel/ligo/primitive_configuration.h b/code/nel/include/nel/ligo/primitive_configuration.h index 41d149811..79bd748a0 100644 --- a/code/nel/include/nel/ligo/primitive_configuration.h +++ b/code/nel/include/nel/ligo/primitive_configuration.h @@ -38,7 +38,7 @@ class IPrimitive; * \author Nevrax France * \date 2001 */ -class CPrimitiveConfigurations +class NLLIGO_API CPrimitiveConfigurations { public: diff --git a/code/nel/include/nel/ligo/primitive_utils.h b/code/nel/include/nel/ligo/primitive_utils.h index 15b73ed4f..f3ce75ac6 100644 --- a/code/nel/include/nel/ligo/primitive_utils.h +++ b/code/nel/include/nel/ligo/primitive_utils.h @@ -361,10 +361,10 @@ void filterPrimitiveChilds(IPrimitive *parent, Pred &predicate, TPrimitiveSet &r * return a unique node because there is no name * uniqueness constraint in the primitive system. */ -std::string buildPrimPath(const IPrimitive *prim); +NLLIGO_API std::string buildPrimPath(const IPrimitive *prim); /** Return a set of primitive that match a given path*/ -void selectPrimByPath(IPrimitive *rootNode, const std::string &path, TPrimitiveSet &result); +NLLIGO_API void selectPrimByPath(IPrimitive *rootNode, const std::string &path, TPrimitiveSet &result); } // namespace NLLIGO diff --git a/code/nel/include/nel/ligo/transition.h b/code/nel/include/nel/ligo/transition.h index 9a7b989c1..7ed4ea41c 100644 --- a/code/nel/include/nel/ligo/transition.h +++ b/code/nel/include/nel/ligo/transition.h @@ -38,7 +38,7 @@ class CMaterial; * \author Nevrax France * \date 2001 */ -class CTransition +class NLLIGO_API CTransition { public: diff --git a/code/nel/include/nel/ligo/zone_bank.h b/code/nel/include/nel/ligo/zone_bank.h index 8ad084fb2..724fae736 100644 --- a/code/nel/include/nel/ligo/zone_bank.h +++ b/code/nel/include/nel/ligo/zone_bank.h @@ -45,7 +45,7 @@ namespace NLLIGO // *************************************************************************** -class CZoneBankElement +class NLLIGO_API CZoneBankElement { // Category stuff @@ -87,7 +87,7 @@ public: // *************************************************************************** -class CZoneBank +class NLLIGO_API CZoneBank { std::map _ElementsMap; diff --git a/code/nel/include/nel/ligo/zone_edge.h b/code/nel/include/nel/ligo/zone_edge.h index 6d6e611fb..1ae9ebbdd 100644 --- a/code/nel/include/nel/ligo/zone_edge.h +++ b/code/nel/include/nel/ligo/zone_edge.h @@ -43,7 +43,7 @@ class CLigoConfig; * \author Nevrax France * \date 2001 */ -class CZoneEdge +class NLLIGO_API CZoneEdge { public: diff --git a/code/nel/include/nel/ligo/zone_region.h b/code/nel/include/nel/ligo/zone_region.h index ca619181e..6986a5fb4 100644 --- a/code/nel/include/nel/ligo/zone_region.h +++ b/code/nel/include/nel/ligo/zone_region.h @@ -33,7 +33,7 @@ namespace NLLIGO // *************************************************************************** -struct SPiece +struct NLLIGO_API SPiece { sint32 w, h; // Max 255x255 std::vector Tab; @@ -43,7 +43,7 @@ struct SPiece // *************************************************************************** -class CZoneRegion +class NLLIGO_API CZoneRegion { public: diff --git a/code/nel/include/nel/ligo/zone_template.h b/code/nel/include/nel/ligo/zone_template.h index 449a78592..e1e855461 100644 --- a/code/nel/include/nel/ligo/zone_template.h +++ b/code/nel/include/nel/ligo/zone_template.h @@ -37,7 +37,7 @@ class CLigoError; * \author Nevrax France * \date 2001 */ -class CZoneTemplate +class NLLIGO_API CZoneTemplate { public: diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 76dd9c21e..be771c94c 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -544,7 +544,7 @@ typedef uint16 ucchar; #define NL_DECL_DLLIMP #endif -// TODO: Move this within libraries? +// TODO: Move this within libraries. #ifdef NL_DLLEXP #ifdef NLMISC_DLLEXP #define NLMISC_API NL_DECL_DLLEXP @@ -561,10 +561,16 @@ typedef uint16 ucchar; #else #define NLGEORGES_API NL_DECL_DLLIMP #endif +#ifdef NLLIGO_DLLEXP +#define NLLIGO_API NL_DECL_DLLEXP +#else +#define NLLIGO_API NL_DECL_DLLIMP +#endif #else #define NLMISC_API #define NLSOUND_LOWLEVEL_API #define NLGEORGES_API +#define NLLIGO_API #endif // To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234) diff --git a/code/nel/src/ligo/CMakeLists.txt b/code/nel/src/ligo/CMakeLists.txt index 39823c4d5..1faffd3bc 100644 --- a/code/nel/src/ligo/CMakeLists.txt +++ b/code/nel/src/ligo/CMakeLists.txt @@ -1,7 +1,7 @@ FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../../include/nel/ligo/*.h) -NL_TARGET_LIB(nelligo ${HEADERS} ${SRC}) +NL_TARGET_LIB2(nelligo ${HEADERS} ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) @@ -11,6 +11,10 @@ NL_ADD_RUNTIME_FLAGS(nelligo) NL_ADD_LIB_SUFFIX(nelligo) +IF(WIN32 AND NOT WITH_STATIC2) + ADD_DEFINITIONS(-DNLLIGO_DLLEXP) +ENDIF() + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) IF(WITH_PCH)