[Kde-bindings] KDE/kdebindings/smoke

Arno Rehn kde at arnorehn.de
Mon Oct 19 17:22:13 UTC 2009


SVN commit 1037645 by arnorehn:

Extend the macros so that linking against smoke works ok on Windows.
Define BASE_SMOKE_BUILDING if you're building a smoke lib which has
no parent modules (so Smoke::classMap is exported) and SMOKE_BUILDING
if you're building any smoke lib.
On compilers/linkers which don't support/need __declspec stuff (such as
gcc on *nix), it should be possible to leave everything as it is.

CCMAIL: kde-bindings at kde.org
CCMAIL: friesoft at gmail.com



 M  +1 -0      CMakeLists.txt  
 M  +2 -0      qt/CMakeLists.txt  
 M  +18 -12    smoke.h  


--- trunk/KDE/kdebindings/smoke/CMakeLists.txt #1037644:1037645
@@ -16,6 +16,7 @@
 
 set(SMOKE_ENABLED "no")
 if(ENABLE_SMOKE)
+    add_definitions(-DSMOKE_BUILDING)
     add_subdirectory(qt)
     set(SMOKE_ENABLED "yes - Qt")
 
--- trunk/KDE/kdebindings/smoke/qt/CMakeLists.txt #1037644:1037645
@@ -72,6 +72,8 @@
     ADD_DEFINITIONS(-DGCC_VISIBILITY)
 ENDIF(CMAKE_CXX_FLAGS MATCHES "-fvisibility")
 
+add_definitions(-DBASE_SMOKE_BUILDING)
+
 # kde4_add_library(smokeqt SHARED ${smokeqt_LIB_SRCS})
 add_library(smokeqt SHARED ${smokeqt_LIB_SRCS})
 
--- trunk/KDE/kdebindings/smoke/smoke.h #1037644:1037645
@@ -38,32 +38,38 @@
 */
 
 #ifdef WIN32
+  // Define this when building a smoke lib that doesn't have any parents - else Smoke::classMap is not exported.
+  #ifdef BASE_SMOKE_BUILDING
+    #define BASE_SMOKE_EXPORT __declspec(dllexport)
+  #else
+    #define BASE_SMOKE_EXPORT __declspec(dllimport)
+  #endif
+  // Define this when building a smoke lib.
+  #ifdef SMOKE_BUILDING
+    #define SMOKE_EXPORT __declspec(dllexport)
+  #else
+    #define SMOKE_EXPORT __declspec(dllimport)
+  #endif
   #define SMOKE_IMPORT __declspec(dllimport)
-  #define SMOKE_EXPORT __declspec(dllexport)
-  #define SMOKE_DLLLOCAL
-  #define SMOKE_DLLPUBLIC
 #else
   #ifdef GCC_VISIBILITY
-    #define SMOKE_IMPORT __attribute__ ((visibility("default")))
-    #define SMOKE_EXPORT __attribute__ ((visibility("default")))
-    #define SMOKE_DLLLOCAL __attribute__ ((visibility("hidden")))
-    #define SMOKE_DLLPUBLIC __attribute__ ((visibility("default")))
+    #define SMOKE_EXPORT __attribute__ ((visibility("default)))
+    #define BASE_SMOKE_EXPORT __attribute__ ((visibility("default)))
   #else
-    #define SMOKE_IMPORT
     #define SMOKE_EXPORT
-    #define SMOKE_DLLLOCAL
-    #define SMOKE_DLLPUBLIC
+    #define BASE_SMOKE_EXPORT
   #endif
+  #define SMOKE_IMPORT
 #endif
 
 class SmokeBinding;
 
-class SMOKE_EXPORT Smoke {
+class BASE_SMOKE_EXPORT Smoke {
 private:
     const char *module_name;
 
 public:
-    static SMOKE_EXPORT std::map<std::string, Smoke*> classMap;
+    static std::map<std::string, Smoke*> classMap;
 
     union StackItem; // defined below
     /**



More information about the Kde-bindings mailing list