]> git.saurik.com Git - wxWidgets.git/blobdiff - include/msvc/wx/setup.h
Fix memory leak in wxXmlNode::operator=().
[wxWidgets.git] / include / msvc / wx / setup.h
index b123899eb21b53def01fbe3c24aaf1ada2f72fee..f60059a208b91802fb89eac1628d2405ada36a12 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        msvc/wx/msw/setup.h
+// Name:        msvc/wx/setup.h
 // Purpose:     wrapper around the real wx/setup.h for Visual C++
 // Author:      Vadim Zeitlin
 // Modified by:
     #ifdef _UNICODE
         #define wxSUFFIX u
     #else // !_UNICODE
-        #define wxSUFFIX
+        // don't define wxSUFFIX at all as preprocessor operations don't work
+        // with empty values so we need to check for this case specially below
     #endif // _UNICODE/!_UNICODE
 #endif
 
-// compiler-specific prefix, we may use version-specific one in the future but
-// for now it's just "vc" for all versions for compatibility
-#define wxCOMPILER_PREFIX vc
+// compiler-specific prefix: by default it's always just "vc" for compatibility
+// reasons but if you use multiple MSVC versions you probably build them with
+// COMPILER_PREFIX=vcXX and in this case you may want to either predefine
+// wxMSVC_VERSION as "XX" or define wxMSVC_VERSION_AUTO to use the appropriate
+// version depending on the compiler used
+#ifdef wxMSVC_VERSION
+    #define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION)
+#elif defined(wxMSVC_VERSION_AUTO)
+    #if _MSC_VER == 1200
+        #define wxCOMPILER_PREFIX vc60
+    #elif _MSC_VER == 1300
+        #define wxCOMPILER_PREFIX vc70
+    #elif _MSC_VER == 1310
+        #define wxCOMPILER_PREFIX vc71
+    #elif _MSC_VER == 1400
+        #define wxCOMPILER_PREFIX vc80
+    #elif _MSC_VER == 1500
+        #define wxCOMPILER_PREFIX vc90
+    #elif _MSC_VER == 1600
+        #define wxCOMPILER_PREFIX vc100
+    #elif _MSC_VER == 1700
+        #define wxCOMPILER_PREFIX vc110
+    #else
+        #error "Unknown MSVC compiler version, please report to wx-dev."
+    #endif
+#else
+    #define wxCOMPILER_PREFIX vc
+#endif
 
 // architecture-specific part: not used (again, for compatibility), for x86
 #if defined(_M_X64)
-    #define wxARCH_SUFFIX _amd64
+    #define wxARCH_SUFFIX _x64
 #elif defined(_M_IA64)
     #define wxARCH_SUFFIX _ia64
 #else // assume _M_IX86
     #define wxLIB_SUBDIR wxCONCAT3(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _lib)
 #endif // DLL/!DLL
 
+// The user can predefine a different prefix if not using the default MSW port
+// with MSVC.
+#ifndef wxTOOLKIT_PREFIX
+    #if defined(__WXGTK__)
+        #define wxTOOLKIT_PREFIX gtk2
+    #else
+        #define wxTOOLKIT_PREFIX msw
+    #endif
+#endif // wxTOOLKIT_PREFIX
 
 // the real setup.h header file we need is in the build-specific directory,
 // construct the path to it
-#define wxSETUPH_PATH \
-    wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /msw, wxSUFFIX, /wx/setup.h)
+#ifdef wxSUFFIX
+    #define wxSETUPH_PATH \
+        wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h)
+#else // suffix is empty
+    #define wxSETUPH_PATH \
+        wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h)
+#endif
+
 #define wxSETUPH_PATH_STR wxSTRINGIZE(wxSETUPH_PATH)
 
 #include wxSETUPH_PATH_STR
 
 // the library names depend on the build, these macro builds the correct
 // library name for the given base name
-#define wxSUFFIX_STR wxSTRINGIZE(wxSUFFIX)
+#ifdef wxSUFFIX
+    #define wxSUFFIX_STR wxSTRINGIZE(wxSUFFIX)
+#else // suffix is empty
+    #define wxSUFFIX_STR ""
+#endif
 #define wxSHORT_VERSION_STRING \
     wxSTRINGIZE(wxMAJOR_VERSION) wxSTRINGIZE(wxMINOR_VERSION)
 
     "wx" name wxSHORT_VERSION_STRING wxSUFFIX_STR subname
 
 #define wxBASE_LIB_NAME(name) wxWX_LIB_NAME("base", "_" name)
-#define wxMSW_LIB_NAME(name) wxWX_LIB_NAME("msw", "_" name)
+#define wxTOOLKIT_LIB_NAME(name) wxWX_LIB_NAME(wxSTRINGIZE(wxTOOLKIT_PREFIX), "_" name)
 
-// this one is for 3rd party libraries: they don't have the version number
+// This one is for 3rd party libraries: they don't have the version number
 // in their names and usually exist in ANSI version only (except for regex)
+//
+// 3rd party libraries are also are not linked in when using DLLs as they're
+// embedded inside our own DLLs and don't need to be linked with the user code.
 #define wx3RD_PARTY_LIB_NAME(name) "wx" name wxSUFFIX_DEBUG
 
 // special version for regex as it does have a Unicode version
 #ifndef wxNO_XML_LIB
     #pragma comment(lib, wxBASE_LIB_NAME("xml"))
 #endif
-#if wxUSE_REGEX && !defined(wxNO_REGEX_LIB)
+#if wxUSE_REGEX && !defined(wxNO_REGEX_LIB) && !defined(WXUSINGDLL)
     #pragma comment(lib, wx3RD_PARTY_LIB_NAME_U("regex"))
 #endif
 
 #if wxUSE_GUI
-    #if wxUSE_XML && !defined(wxNO_EXPAT_LIB)
+    #if wxUSE_XML && !defined(wxNO_EXPAT_LIB) && !defined(WXUSINGDLL)
         #pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat"))
     #endif
-    #if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB)
+    #if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL)
         #pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg"))
     #endif
-    #if wxUSE_LIBPNG && !defined(wxNO_PNG_LIB)
+    #if wxUSE_LIBPNG && !defined(wxNO_PNG_LIB) && !defined(WXUSINGDLL)
         #pragma comment(lib, wx3RD_PARTY_LIB_NAME("png"))
     #endif
-    #if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB)
+    #if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB) && !defined(WXUSINGDLL)
         #pragma comment(lib, wx3RD_PARTY_LIB_NAME("tiff"))
     #endif
-    #if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB)
+    #if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) && !defined(WXUSINGDLL)
         #pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib"))
     #endif
 
-    #pragma comment(lib, wxMSW_LIB_NAME("core"))
+    #pragma comment(lib, wxTOOLKIT_LIB_NAME("core"))
 
     #ifndef wxNO_ADV_LIB
-        #pragma comment(lib, wxMSW_LIB_NAME("adv"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("adv"))
     #endif
 
     #ifndef wxNO_HTML_LIB
-        #pragma comment(lib, wxMSW_LIB_NAME("html"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("html"))
     #endif
     #if wxUSE_GLCANVAS && !defined(wxNO_GL_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("gl"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("gl"))
     #endif
     #if wxUSE_DEBUGREPORT && !defined(wxNO_QA_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("qa"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("qa"))
     #endif
     #if wxUSE_XRC && !defined(wxNO_XRC_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("xrc"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("xrc"))
     #endif
     #if wxUSE_AUI && !defined(wxNO_AUI_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("aui"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("aui"))
     #endif
     #if wxUSE_PROPGRID && !defined(wxNO_PROPGRID_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("propgrid"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("propgrid"))
     #endif
     #if wxUSE_RIBBON && !defined(wxNO_RIBBON_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("ribbon"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("ribbon"))
     #endif
     #if wxUSE_RICHTEXT && !defined(wxNO_RICHTEXT_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("richtext"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("richtext"))
     #endif
     #if wxUSE_MEDIACTRL && !defined(wxNO_MEDIA_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("media"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("media"))
     #endif
     #if wxUSE_STC && !defined(wxNO_STC_LIB)
-        #pragma comment(lib, wxMSW_LIB_NAME("stc"))
-        #pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla"))
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("stc"))
+        #ifndef WXUSINGDLL
+            #pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla"))
+        #endif
+    #endif
+    #if wxUSE_WEBVIEW && !defined(wxNO_WEBVIEW_LIB)
+        #pragma comment(lib, wxTOOLKIT_LIB_NAME("webview"))
     #endif
 #endif // wxUSE_GUI
+
+
+#ifndef WXUSINGDLL
+    // Make sure all required system libraries are added to the linker too when
+    // using static libraries.
+    #pragma comment(lib, "kernel32")
+    #pragma comment(lib, "user32")
+    #pragma comment(lib, "gdi32")
+    #pragma comment(lib, "comdlg32")
+    #pragma comment(lib, "winspool")
+    #pragma comment(lib, "winmm")
+    #pragma comment(lib, "shell32")
+    #pragma comment(lib, "comctl32")
+    #pragma comment(lib, "ole32")
+    #pragma comment(lib, "oleaut32")
+    #pragma comment(lib, "uuid")
+    #pragma comment(lib, "rpcrt4")
+    #pragma comment(lib, "advapi32")
+    #pragma comment(lib, "wsock32")
+    #if wxUSE_URL_NATIVE
+        #pragma comment(lib, "wininet")
+    #endif
+
+    #ifdef __WXGTK__
+        #pragma comment(lib, "gtk-win32-2.0.lib")
+        #pragma comment(lib, "gdk-win32-2.0.lib")
+        #pragma comment(lib, "pangocairo-1.0.lib")
+        #pragma comment(lib, "gdk_pixbuf-2.0.lib")
+        #pragma comment(lib, "cairo.lib")
+        #pragma comment(lib, "pango-1.0.lib")
+        #pragma comment(lib, "gobject-2.0.lib")
+        #pragma comment(lib, "gthread-2.0.lib")
+        #pragma comment(lib, "glib-2.0.lib")
+    #endif
+#endif // !WXUSINGDLL