From 01d390825a5d9ba37715b80cd0aa7aede022dcec Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 22 May 2009 23:27:16 +0000 Subject: DEV-27646 dll linkage for login module. Ok, finally got this to a point where it doesn't break the build and I can check in. llcommon can be built as a shared library (disabled but can be enabled with cmake cache var LLCOMMON_LINK_SHARED. reviewed by Mani on tuesday (I still need to get his suggested changes re-reviewed) --- indra/llcommon/llpreprocessor.h | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'indra/llcommon/llpreprocessor.h') diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 2e4fd4787a..5ff7814997 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -93,17 +93,6 @@ #endif -// Deal with the differeneces on Windows -#if LL_MSVC -namespace snprintf_hack -{ - int snprintf(char *str, size_t size, const char *format, ...); -} - -// #define snprintf safe_snprintf /* Flawfinder: ignore */ -using snprintf_hack::snprintf; -#endif // LL_MSVC - // Static linking with apr on windows needs to be declared. #ifdef LL_WINDOWS #ifndef APR_DECLARE_STATIC @@ -133,6 +122,36 @@ using snprintf_hack::snprintf; #pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation. #pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning) #pragma warning( disable : 4996 ) // warning: deprecated + +// level 4 warnings that we need to disable: +#pragma warning (disable : 4100) // unreferenced formal parameter +#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) ) +#pragma warning (disable : 4244) // possible loss of data on conversions +#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template +#pragma warning (disable : 4512) // assignment operator could not be generated +#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) ) + +#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class +#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class #endif // LL_MSVC +#if LL_WINDOWS +#define LL_DLLEXPORT __declspec(dllexport) +#define LL_DLLIMPORT __declspec(dllimport) +#else +#define LL_DLLEXPORT +#define LL_DLLIMPORT +#endif // LL_WINDOWS + + +#if LL_COMMON_LINK_SHARED +# if LL_COMMON_BUILD +# define LL_COMMON_API LL_DLLEXPORT +# else //LL_COMMON_BUILD +# define LL_COMMON_API LL_DLLIMPORT +# endif //LL_COMMON_BUILD +#else // LL_COMMON_LINK_SHARED +# define LL_COMMON_API +#endif // LL_COMMON_LINK_SHARED + #endif // not LL_LINDEN_PREPROCESSOR_H -- cgit v1.3 From c1d59f02609def47507c76d65c60f220c508a71f Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 2 Jul 2009 14:40:05 -0400 Subject: Windows now links to shared apr when LLCOMMON_LINK_SHARED is on. --- indra/cmake/APR.cmake | 39 +++-- indra/llcommon/llpreprocessor.h | 314 ++++++++++++++++++++-------------------- 2 files changed, 184 insertions(+), 169 deletions(-) (limited to 'indra/llcommon/llpreprocessor.h') diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake index 0755aeee03..efd47f756a 100644 --- a/indra/cmake/APR.cmake +++ b/indra/cmake/APR.cmake @@ -13,18 +13,33 @@ if (STANDALONE) else (STANDALONE) use_prebuilt_binary(apr_suite) if (WINDOWS) - set(APR_LIBRARIES - debug ${ARCH_PREBUILT_DIRS_DEBUG}/apr-1.lib - optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apr-1.lib - ) - set(APRICONV_LIBRARIES - debug ${ARCH_PREBUILT_DIRS_DEBUG}/apriconv-1.lib - optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apriconv-1.lib - ) - set(APRUTIL_LIBRARIES - debug ${ARCH_PREBUILT_DIRS_DEBUG}/aprutil-1.lib ${APRICONV_LIBRARIES} - optimized ${ARCH_PREBUILT_DIRS_RELEASE}/aprutil-1.lib ${APRICONV_LIBRARIES} - ) + if (LLCOMMON_LINK_SHARED) + set(APR_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapr-1.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.lib + ) + set(APRICONV_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapriconv-1.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libapriconv-1.lib + ) + set(APRUTIL_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libaprutil-1.lib ${APRICONV_LIBRARIES} + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.lib ${APRICONV_LIBRARIES} + ) + else (LLCOMMON_LINK_SHARED) + set(APR_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/apr-1.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apr-1.lib + ) + set(APRICONV_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/apriconv-1.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/apriconv-1.lib + ) + set(APRUTIL_LIBRARIES + debug ${ARCH_PREBUILT_DIRS_DEBUG}/aprutil-1.lib ${APRICONV_LIBRARIES} + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/aprutil-1.lib ${APRICONV_LIBRARIES} + ) + endif (LLCOMMON_LINK_SHARED) elseif (DARWIN) set(APR_LIBRARIES debug ${ARCH_PREBUILT_DIRS_DEBUG}/libapr-1.a diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 5ff7814997..ed6ca9a25f 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -1,157 +1,157 @@ -/** - * @file llpreprocessor.h - * @brief This file should be included in all Linden Lab files and - * should only contain special preprocessor directives - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LLPREPROCESSOR_H -#define LLPREPROCESSOR_H - -// Figure out endianness of platform -#ifdef LL_LINUX -#define __ENABLE_WSTRING -#include -#endif // LL_LINUX - -#if LL_SOLARIS -# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported. -# define LL_BIG_ENDIAN 1 -# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed -# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API -# endif -# include // ensure we know which end is up -#endif // LL_SOLARIS - -#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386))) -#define LL_LITTLE_ENDIAN 1 -#else -#define LL_BIG_ENDIAN 1 -#endif - -// Per-compiler switches -#ifdef __GNUC__ -#define LL_FORCE_INLINE inline __attribute__((always_inline)) -#else -#define LL_FORCE_INLINE __forceinline -#endif - -// Figure out differences between compilers -#if defined(__GNUC__) - #define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - #ifndef LL_GNUC - #define LL_GNUC 1 - #endif -#elif defined(__MSVC_VER__) || defined(_MSC_VER) - #ifndef LL_MSVC - #define LL_MSVC 1 - #endif - #if _MSC_VER < 1400 - #define LL_MSVC7 //Visual C++ 2003 or earlier - #endif -#endif - -// Deal with minor differences on Unixy OSes. -#if LL_DARWIN || LL_LINUX - // Different name, same functionality. - #define stricmp strcasecmp - #define strnicmp strncasecmp - - // Not sure why this is different, but... - #ifndef MAX_PATH - #define MAX_PATH PATH_MAX - #endif // not MAX_PATH - -#endif - - -// Static linking with apr on windows needs to be declared. -#ifdef LL_WINDOWS -#ifndef APR_DECLARE_STATIC -#define APR_DECLARE_STATIC // For APR on Windows -#endif -#ifndef APU_DECLARE_STATIC -#define APU_DECLARE_STATIC // For APR util on Windows -#endif -#endif - -#if defined(LL_WINDOWS) -#define BOOST_REGEX_NO_LIB 1 -#define CURL_STATICLIB 1 -#define XML_STATIC -#endif // LL_WINDOWS - - -// Deal with VC6 problems -#if LL_MSVC -#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4. -#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4. -#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4. -//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4. -#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" -#pragma warning( disable : 4786 ) // silly MS warning deep inside their include file -#pragma warning( disable : 4284 ) // silly MS warning deep inside their include file -#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation. -#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning) -#pragma warning( disable : 4996 ) // warning: deprecated - -// level 4 warnings that we need to disable: -#pragma warning (disable : 4100) // unreferenced formal parameter -#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) ) -#pragma warning (disable : 4244) // possible loss of data on conversions -#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template -#pragma warning (disable : 4512) // assignment operator could not be generated -#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) ) - -#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class -#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class -#endif // LL_MSVC - -#if LL_WINDOWS -#define LL_DLLEXPORT __declspec(dllexport) -#define LL_DLLIMPORT __declspec(dllimport) -#else -#define LL_DLLEXPORT -#define LL_DLLIMPORT -#endif // LL_WINDOWS - - -#if LL_COMMON_LINK_SHARED -# if LL_COMMON_BUILD -# define LL_COMMON_API LL_DLLEXPORT -# else //LL_COMMON_BUILD -# define LL_COMMON_API LL_DLLIMPORT -# endif //LL_COMMON_BUILD -#else // LL_COMMON_LINK_SHARED -# define LL_COMMON_API -#endif // LL_COMMON_LINK_SHARED - -#endif // not LL_LINDEN_PREPROCESSOR_H +/** + * @file llpreprocessor.h + * @brief This file should be included in all Linden Lab files and + * should only contain special preprocessor directives + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LLPREPROCESSOR_H +#define LLPREPROCESSOR_H + +// Figure out endianness of platform +#ifdef LL_LINUX +#define __ENABLE_WSTRING +#include +#endif // LL_LINUX + +#if LL_SOLARIS +# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported. +# define LL_BIG_ENDIAN 1 +# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed +# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API +# endif +# include // ensure we know which end is up +#endif // LL_SOLARIS + +#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386))) +#define LL_LITTLE_ENDIAN 1 +#else +#define LL_BIG_ENDIAN 1 +#endif + +// Per-compiler switches +#ifdef __GNUC__ +#define LL_FORCE_INLINE inline __attribute__((always_inline)) +#else +#define LL_FORCE_INLINE __forceinline +#endif + +// Figure out differences between compilers +#if defined(__GNUC__) + #define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + #ifndef LL_GNUC + #define LL_GNUC 1 + #endif +#elif defined(__MSVC_VER__) || defined(_MSC_VER) + #ifndef LL_MSVC + #define LL_MSVC 1 + #endif + #if _MSC_VER < 1400 + #define LL_MSVC7 //Visual C++ 2003 or earlier + #endif +#endif + +// Deal with minor differences on Unixy OSes. +#if LL_DARWIN || LL_LINUX + // Different name, same functionality. + #define stricmp strcasecmp + #define strnicmp strncasecmp + + // Not sure why this is different, but... + #ifndef MAX_PATH + #define MAX_PATH PATH_MAX + #endif // not MAX_PATH + +#endif + + +// Static linking with apr on windows needs to be declared. +#if LL_WINDOWS && !LL_COMMON_LINK_SHARED +#ifndef APR_DECLARE_STATIC +#define APR_DECLARE_STATIC // For APR on Windows +#endif +#ifndef APU_DECLARE_STATIC +#define APU_DECLARE_STATIC // For APR util on Windows +#endif +#endif + +#if defined(LL_WINDOWS) +#define BOOST_REGEX_NO_LIB 1 +#define CURL_STATICLIB 1 +#define XML_STATIC +#endif // LL_WINDOWS + + +// Deal with VC6 problems +#if LL_MSVC +#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4. +#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4. +#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4. +//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4. +#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" +#pragma warning( disable : 4786 ) // silly MS warning deep inside their include file +#pragma warning( disable : 4284 ) // silly MS warning deep inside their include file +#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation. +#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning) +#pragma warning( disable : 4996 ) // warning: deprecated + +// level 4 warnings that we need to disable: +#pragma warning (disable : 4100) // unreferenced formal parameter +#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) ) +#pragma warning (disable : 4244) // possible loss of data on conversions +#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template +#pragma warning (disable : 4512) // assignment operator could not be generated +#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) ) + +#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class +#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class +#endif // LL_MSVC + +#if LL_WINDOWS +#define LL_DLLEXPORT __declspec(dllexport) +#define LL_DLLIMPORT __declspec(dllimport) +#else +#define LL_DLLEXPORT +#define LL_DLLIMPORT +#endif // LL_WINDOWS + + +#if LL_COMMON_LINK_SHARED +# if LL_COMMON_BUILD +# define LL_COMMON_API LL_DLLEXPORT +# else //LL_COMMON_BUILD +# define LL_COMMON_API LL_DLLIMPORT +# endif //LL_COMMON_BUILD +#else // LL_COMMON_LINK_SHARED +# define LL_COMMON_API +#endif // LL_COMMON_LINK_SHARED + +#endif // not LL_LINDEN_PREPROCESSOR_H -- cgit v1.3 From 1af41b3ba733938541d7cc92ae56dd883638e32f Mon Sep 17 00:00:00 2001 From: "palmer@eniac54.lindenlab.com" Date: Thu, 30 Jul 2009 18:52:34 -0700 Subject: Fixes to build on linux for DEV-35401. Moves libllcommon.so to a staging dir for unit tests to work and gets rid of LL_COMMON_API in forward declarations --- indra/cmake/LLAddBuildTest.cmake | 2 +- indra/cmake/Linking.cmake | 1 + indra/llcommon/CMakeLists.txt | 15 +++++++++++++++ indra/llcommon/llapp.h | 2 +- indra/llcommon/llapr.h | 4 ++-- indra/llcommon/llerror.h | 2 +- indra/llcommon/llevent.h | 10 +++++----- indra/llcommon/llevents.h | 2 +- indra/llcommon/lllog.h | 2 +- indra/llcommon/llmetrics.h | 2 +- indra/llcommon/llpreprocessor.h | 4 +++- indra/llcommon/llrun.h | 2 +- indra/llcommon/llsdutil.h | 2 +- indra/llcommon/llstat.h | 2 +- indra/llcommon/llstring.h | 8 ++++---- indra/llcommon/llthread.h | 6 +++--- indra/llcommon/lluri.h | 6 +++--- indra/llcommon/metaclass.h | 6 +++--- indra/llcommon/metaproperty.h | 4 ++-- indra/llcommon/reflective.h | 2 +- 20 files changed, 51 insertions(+), 33 deletions(-) (limited to 'indra/llcommon/llpreprocessor.h') diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index aa77bbac65..013cc5109f 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -123,7 +123,7 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources) IF(WINDOWS) set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}) ELSE(WINDOWS) - set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:/usr/lib) + set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib) ENDIF(WINDOWS) IF(LL_TEST_VERBOSE) diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 578edf9989..30b3cc9994 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -14,6 +14,7 @@ if (NOT STANDALONE) endif (VIEWER) set(ARCH_PREBUILT_DIRS_RELEASE ${ARCH_PREBUILT_DIRS}) set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS}) + set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged .sos") elseif (DARWIN) set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release) set(ARCH_PREBUILT_DIRS ${ARCH_PREBUILT_DIRS_RELEASE}) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index c46e2583f1..2ecd4ee5d4 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -245,6 +245,20 @@ if(LLCOMMON_LINK_SHARED) # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests. set_target_properties(llcommon PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR}) endif(SHARED_LIB_STAGING_DIR) + + get_target_property(LLCOMMON_PATH llcommon LOCATION) + get_filename_component(LLCOMMON_FILE ${LLCOMMON_PATH} NAME) + add_custom_command( + TARGET llcommon POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS + -E + copy_if_different + ${LLCOMMON_FILE} + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/${LLCOMMON_FILE} + COMMENT "Copying llcommon to the staging folder." + ) + else(LLCOMMON_LINK_SHARED) add_library (llcommon ${llcommon_SOURCE_FILES}) endif(LLCOMMON_LINK_SHARED) @@ -263,6 +277,7 @@ target_link_libraries( add_dependencies(llcommon stage_third_party_libs) + include(LLAddBuildTest) SET(llcommon_TEST_SOURCE_FILES # WARNING: Please don't write tests against LLCommon or LLMath until this issue is resolved: https://jira.lindenlab.com/jira/browse/DEV-29456 diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index cc60ba0b80..35f6f7028d 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -61,7 +61,7 @@ public: }; #endif -class LLApp +class LL_COMMON_API LLApp { friend class LLErrorThread; public: diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index f968eabc18..0898aeec47 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -167,8 +167,8 @@ private: apr_uint32_t mData; }; -typedef LL_COMMON_API LLAtomic32 LLAtomicU32; -typedef LL_COMMON_API LLAtomic32 LLAtomicS32; +typedef LLAtomic32 LLAtomicU32; +typedef LLAtomic32 LLAtomicS32; // File IO convenience functions. // Returns NULL if the file fails to openm sets *sizep to file size of not NULL diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 6ccdf2174b..4f68fb9f76 100644 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -129,7 +129,7 @@ namespace LLError They are not intended for general use. */ - class LL_COMMON_API CallSite; + class CallSite; class LL_COMMON_API Log { diff --git a/indra/llcommon/llevent.h b/indra/llcommon/llevent.h index 192cb84fea..0ea7cf4ae8 100644 --- a/indra/llcommon/llevent.h +++ b/indra/llcommon/llevent.h @@ -41,10 +41,10 @@ namespace LLOldEvents { -class LL_COMMON_API LLEventListener; -class LL_COMMON_API LLEvent; -class LL_COMMON_API LLEventDispatcher; -class LL_COMMON_API LLObservable; +class LLEventListener; +class LLEvent; +class LLEventDispatcher; +class LLObservable; // Abstract event. All events derive from LLEvent class LL_COMMON_API LLEvent : public LLThreadSafeRefCount @@ -104,7 +104,7 @@ protected: std::vector mDispatchers; }; -class LL_COMMON_API LLObservable; // defined below +class LLObservable; // defined below // A structure which stores a Listener and its metadata struct LLListenerEntry diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 8ebffc008f..6df418fe5a 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -172,7 +172,7 @@ private: /***************************************************************************** * LLEventPumps *****************************************************************************/ -class LL_COMMON_API LLEventPump; +class LLEventPump; /** * LLEventPumps is a Singleton manager through which one typically accesses diff --git a/indra/llcommon/lllog.h b/indra/llcommon/lllog.h index b0ec570c01..4b6777bb9c 100644 --- a/indra/llcommon/lllog.h +++ b/indra/llcommon/lllog.h @@ -39,7 +39,7 @@ class LLLogImpl; class LLApp; -class LL_COMMON_API LLSD; +class LLSD; class LL_COMMON_API LLLog { diff --git a/indra/llcommon/llmetrics.h b/indra/llcommon/llmetrics.h index 11e10a5a2e..f6f49eb456 100644 --- a/indra/llcommon/llmetrics.h +++ b/indra/llcommon/llmetrics.h @@ -36,7 +36,7 @@ #define LL_LLMETRICS_H class LLMetricsImpl; -class LL_COMMON_API LLSD; +class LLSD; class LL_COMMON_API LLMetrics { diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index ed6ca9a25f..671e85b16f 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -138,12 +138,14 @@ #if LL_WINDOWS #define LL_DLLEXPORT __declspec(dllexport) #define LL_DLLIMPORT __declspec(dllimport) +#elif LL_LINUX +#define LL_DLLEXPORT __attribute__ ((visibility("default"))) +#define LL_DLLIMPORT #else #define LL_DLLEXPORT #define LL_DLLIMPORT #endif // LL_WINDOWS - #if LL_COMMON_LINK_SHARED # if LL_COMMON_BUILD # define LL_COMMON_API LL_DLLEXPORT diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h index afe65fd734..1fc9925df9 100644 --- a/indra/llcommon/llrun.h +++ b/indra/llcommon/llrun.h @@ -38,7 +38,7 @@ #include #include -class LL_COMMON_API LLRunnable; +class LLRunnable; /** * @class LLRunner diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 8cb459d81b..6a6c396687 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -35,7 +35,7 @@ #ifndef LL_LLSDUTIL_H #define LL_LLSDUTIL_H -class LL_COMMON_API LLSD; +class LLSD; // U32 LL_COMMON_API LLSD ll_sd_from_U32(const U32); diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h index 5d77215beb..64ea8e5b40 100644 --- a/indra/llcommon/llstat.h +++ b/indra/llcommon/llstat.h @@ -40,7 +40,7 @@ #include "llframetimer.h" #include "llfile.h" -class LL_COMMON_API LLSD; +class LLSD; // Set this if longer stats are needed #define ENABLE_LONG_TIME_STATS 0 diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index eb36dafee3..24a8d49a54 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -345,9 +345,9 @@ public: template std::basic_string LLStringUtilBase::null; template std::string LLStringUtilBase::sLocale; -typedef LL_COMMON_API LLStringUtilBase LLStringUtil; -typedef LL_COMMON_API LLStringUtilBase LLWStringUtil; -typedef LL_COMMON_API std::basic_string LLWString; +typedef LLStringUtilBase LLStringUtil; +typedef LLStringUtilBase LLWStringUtil; +typedef std::basic_string LLWString; //@ Use this where we want to disallow input in the form of "foo" // This is used to catch places where english text is embedded in the code @@ -419,7 +419,7 @@ LL_COMMON_API std::string rawstr_to_utf8(const std::string& raw); // // We should never use UTF16 except when communicating with Win32! // -typedef LL_COMMON_API std::basic_string llutf16string; +typedef std::basic_string llutf16string; LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str, S32 len); LL_COMMON_API LLWString utf16str_to_wstring(const llutf16string &utf16str); diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index e6bf95aaa9..c3d7650bd9 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -38,9 +38,9 @@ #include "apr_thread_cond.h" -class LL_COMMON_API LLThread; -class LL_COMMON_API LLMutex; -class LL_COMMON_API LLCondition; +class LLThread; +class LLMutex; +class LLCondition; class LL_COMMON_API LLThread { diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h index 33fd88b497..eb5c5203eb 100644 --- a/indra/llcommon/lluri.h +++ b/indra/llcommon/lluri.h @@ -37,9 +37,9 @@ #include -class LL_COMMON_API LLSD; -class LL_COMMON_API LLUUID; -class LL_COMMON_API LLApp; +class LLSD; +class LLUUID; +class LLApp; /** * diff --git a/indra/llcommon/metaclass.h b/indra/llcommon/metaclass.h index 8b93e0d6d5..f38bcd2d57 100644 --- a/indra/llcommon/metaclass.h +++ b/indra/llcommon/metaclass.h @@ -40,9 +40,9 @@ #include "stdtypes.h" -class LL_COMMON_API LLReflective; -class LL_COMMON_API LLMetaProperty; -class LL_COMMON_API LLMetaMethod; +class LLReflective; +class LLMetaProperty; +class LLMetaMethod; class LL_COMMON_API LLMetaClass { public: diff --git a/indra/llcommon/metaproperty.h b/indra/llcommon/metaproperty.h index 96e1b314a4..6c016c56dd 100644 --- a/indra/llcommon/metaproperty.h +++ b/indra/llcommon/metaproperty.h @@ -39,8 +39,8 @@ #include "llsd.h" #include "reflective.h" -class LL_COMMON_API LLMetaClass; -class LL_COMMON_API LLReflective; +class LLMetaClass; +class LLReflective; class LL_COMMON_API LLMetaProperty { public: diff --git a/indra/llcommon/reflective.h b/indra/llcommon/reflective.h index 541712538b..a13537681d 100644 --- a/indra/llcommon/reflective.h +++ b/indra/llcommon/reflective.h @@ -35,7 +35,7 @@ #ifndef LL_REFLECTIVE_H #define LL_REFLECTIVE_H -class LL_COMMON_API LLMetaClass; +class LLMetaClass; class LL_COMMON_API LLReflective { public: -- cgit v1.3 From a1c69da32657ca94166519e1e522dd1d790bfa47 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Sep 2009 16:50:44 -0400 Subject: QAR-1619: Fix Windows link errors when building INTEGRATION_TEST_lllazy. The problem arose because we were setting LL_COMMON_BUILD in llcommon/CMakeLists.txt, not only for the library build itself but also for its LL_ADD_INTEGRATION_TEST tests. This told all the headers compiled into the INTEGRATION_TEST_lllazy executable that the executable was providing all the llcommon symbols, rather than importing them. The solution is to switch to the llcommon_EXPORTS symbol automagically defined by CMake when building the llcommon shared library itself. --- indra/llcommon/CMakeLists.txt | 2 -- indra/llcommon/llpreprocessor.h | 11 ++++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'indra/llcommon/llpreprocessor.h') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 147b361ad8..baf374ee38 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -242,7 +242,6 @@ list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) if(LLCOMMON_LINK_SHARED) add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) - add_definitions(-DLL_COMMON_BUILD=1) if(SHARED_LIB_STAGING_DIR) # *FIX:Mani --- @@ -290,7 +289,6 @@ target_link_libraries( add_dependencies(llcommon stage_third_party_libs) - include(LLAddBuildTest) SET(llcommon_TEST_SOURCE_FILES ) diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index f135beed6a..f853e31002 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -149,11 +149,16 @@ #endif // LL_WINDOWS #if LL_COMMON_LINK_SHARED -# if LL_COMMON_BUILD +// CMake automagically defines llcommon_EXPORTS only when building llcommon +// sources, and only when llcommon is a shared library (i.e. when +// LL_COMMON_LINK_SHARED). We must still test LL_COMMON_LINK_SHARED because +// otherwise we can't distinguish between (non-llcommon source) and (llcommon +// not shared). +# if defined(llcommon_EXPORTS) # define LL_COMMON_API LL_DLLEXPORT -# else //LL_COMMON_BUILD +# else //llcommon_EXPORTS # define LL_COMMON_API LL_DLLIMPORT -# endif //LL_COMMON_BUILD +# endif //llcommon_EXPORTS #else // LL_COMMON_LINK_SHARED # define LL_COMMON_API #endif // LL_COMMON_LINK_SHARED -- cgit v1.3