Browse Source

Fix mac and static build issues

rdb 10 years ago
parent
commit
1088cdedc8
2 changed files with 15 additions and 3 deletions
  1. 12 1
      dtool/src/prc/notifyCategoryProxy.h
  2. 3 2
      makepanda/makepanda.py

+ 12 - 1
dtool/src/prc/notifyCategoryProxy.h

@@ -127,6 +127,16 @@ INLINE ostream &operator << (ostream &out, NotifyCategoryProxy<GetCategory> &pro
 
 #ifdef CPPPARSER
 #define NotifyCategoryDecl(basename, expcl, exptp)
+#elif defined(WIN32_VC)
+// MSVC's rules for extern template classes differ slightly.
+#define NotifyCategoryDecl(basename, expcl, exptp) \
+  class expcl NotifyCategoryGetCategory_ ## basename { \
+  public: \
+    NotifyCategoryGetCategory_ ## basename(); \
+    static NotifyCategory *get_category(); \
+  }; \
+  EXPORT_TEMPLATE_CLASS(expcl, exptp, NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename>); \
+  extern expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
 #else
 #define NotifyCategoryDecl(basename, expcl, exptp) \
   class expcl NotifyCategoryGetCategory_ ## basename { \
@@ -134,7 +144,7 @@ INLINE ostream &operator << (ostream &out, NotifyCategoryProxy<GetCategory> &pro
     NotifyCategoryGetCategory_ ## basename(); \
     static NotifyCategory *get_category(); \
   }; \
-  exptp template class expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename>; \
+  EXPORT_TEMPLATE_CLASS(expcl, extern, NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename>); \
   extern expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
 #endif
 
@@ -161,6 +171,7 @@ INLINE ostream &operator << (ostream &out, NotifyCategoryProxy<GetCategory> &pro
 
 #else
 #define NotifyCategoryDefName(basename, actual_name, parent_category) \
+  template class NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename>; \
   NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat; \
   static NotifyCategoryGetCategory_ ## basename force_init_ ## basename ## _cat; \
   NotifyCategoryGetCategory_ ## basename:: \

+ 3 - 2
makepanda/makepanda.py

@@ -1155,7 +1155,8 @@ def CompileCxx(obj,src,opts):
             if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
         for x in ipath: cmd += ' -I' + x
 
-        cmd += ' -fvisibility=hidden'
+        if not GetLinkAllStatic():
+            cmd += ' -fvisibility=hidden'
 
         # Mac-specific flags.
         if GetTarget() == "darwin":
@@ -3227,8 +3228,8 @@ if (not RTDIST and not RUNTIME):
   OPTS=['DIR:dtool/src/test_interrogate']
   TargetAdd('test_interrogate_test_interrogate.obj', opts=OPTS, input='test_interrogate.cxx')
   TargetAdd('test_interrogate.exe', input='test_interrogate_test_interrogate.obj')
-  TargetAdd('test_interrogate.exe', input=COMMON_DTOOL_LIBS_PYSTUB)
   TargetAdd('test_interrogate.exe', input='libp3interrogatedb.dll')
+  TargetAdd('test_interrogate.exe', input=COMMON_DTOOL_LIBS_PYSTUB)
   TargetAdd('test_interrogate.exe', opts=['ADVAPI',  'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER'])
 
 #