setup.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: msvc/wx/setup.h
  3. // Purpose: wrapper around the real wx/setup.h for Visual C++
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 2004-12-12
  7. // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _MSC_VER
  11. #error "This file should only be included when using Microsoft Visual C++"
  12. #endif
  13. // VC++ IDE predefines _DEBUG and _UNICODE for the new projects itself, but
  14. // the other symbols (WXUSINGDLL, __WXUNIVERSAL__, ...) should be defined
  15. // explicitly!
  16. #include "wx/version.h"
  17. #include "wx/cpp.h"
  18. // notice that wxSUFFIX_DEBUG is a string but wxSUFFIX itself must be an
  19. // identifier as string concatenation is not done inside #include where we
  20. // need it
  21. #ifdef _DEBUG
  22. #define wxSUFFIX_DEBUG "d"
  23. #ifdef _UNICODE
  24. #define wxSUFFIX ud
  25. #else // !_UNICODE
  26. #define wxSUFFIX d
  27. #endif // _UNICODE/!_UNICODE
  28. #else
  29. #define wxSUFFIX_DEBUG ""
  30. #ifdef _UNICODE
  31. #define wxSUFFIX u
  32. #else // !_UNICODE
  33. // don't define wxSUFFIX at all as preprocessor operations don't work
  34. // with empty values so we need to check for this case specially below
  35. #endif // _UNICODE/!_UNICODE
  36. #endif
  37. // compiler-specific prefix: by default it's always just "vc" for compatibility
  38. // reasons but if you use multiple MSVC versions you probably build them with
  39. // COMPILER_PREFIX=vcXX and in this case you may want to either predefine
  40. // wxMSVC_VERSION as "XX" or define wxMSVC_VERSION_AUTO to use the appropriate
  41. // version depending on the compiler used
  42. #ifdef wxMSVC_VERSION
  43. #define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION)
  44. #elif defined(wxMSVC_VERSION_AUTO)
  45. #if _MSC_VER == 1200
  46. #define wxCOMPILER_PREFIX vc60
  47. #elif _MSC_VER == 1300
  48. #define wxCOMPILER_PREFIX vc70
  49. #elif _MSC_VER == 1310
  50. #define wxCOMPILER_PREFIX vc71
  51. #elif _MSC_VER == 1400
  52. #define wxCOMPILER_PREFIX vc80
  53. #elif _MSC_VER == 1500
  54. #define wxCOMPILER_PREFIX vc90
  55. #elif _MSC_VER == 1600
  56. #define wxCOMPILER_PREFIX vc100
  57. #elif _MSC_VER == 1700
  58. #define wxCOMPILER_PREFIX vc110
  59. #elif _MSC_VER == 1800
  60. #define wxCOMPILER_PREFIX vc120
  61. #else
  62. #error "Unknown MSVC compiler version, please report to wx-dev."
  63. #endif
  64. #else
  65. #define wxCOMPILER_PREFIX vc
  66. #endif
  67. // architecture-specific part: not used (again, for compatibility), for x86
  68. #if defined(_M_X64)
  69. #define wxARCH_SUFFIX _x64
  70. #elif defined(_M_IA64)
  71. #define wxARCH_SUFFIX _ia64
  72. #else // assume _M_IX86
  73. #define wxARCH_SUFFIX
  74. #endif
  75. // Ensure the library configuration is defined
  76. #ifndef wxCFG
  77. #define wxCFG
  78. #endif
  79. // Construct the path for the subdirectory under /lib/ that the included setup.h
  80. // will be used from
  81. #ifdef WXUSINGDLL
  82. #define wxLIB_SUBDIR \
  83. wxCONCAT4(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _dll, wxCFG)
  84. #else // !DLL
  85. #define wxLIB_SUBDIR \
  86. wxCONCAT4(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _lib, wxCFG)
  87. #endif // DLL/!DLL
  88. // The user can predefine a different prefix if not using the default MSW port
  89. // with MSVC.
  90. #ifndef wxTOOLKIT_PREFIX
  91. #if defined(__WXGTK__)
  92. #define wxTOOLKIT_PREFIX gtk2
  93. #else
  94. #define wxTOOLKIT_PREFIX msw
  95. #endif
  96. #endif // wxTOOLKIT_PREFIX
  97. // the real setup.h header file we need is in the build-specific directory,
  98. // construct the path to it
  99. #ifdef wxSUFFIX
  100. #define wxSETUPH_PATH \
  101. wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h)
  102. #else // suffix is empty
  103. #define wxSETUPH_PATH \
  104. wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h)
  105. #endif
  106. #define wxSETUPH_PATH_STR wxSTRINGIZE(wxSETUPH_PATH)
  107. #include wxSETUPH_PATH_STR
  108. // the library names depend on the build, these macro builds the correct
  109. // library name for the given base name
  110. #ifdef wxSUFFIX
  111. #define wxSUFFIX_STR wxSTRINGIZE(wxSUFFIX)
  112. #else // suffix is empty
  113. #define wxSUFFIX_STR ""
  114. #endif
  115. #define wxSHORT_VERSION_STRING \
  116. wxSTRINGIZE(wxMAJOR_VERSION) wxSTRINGIZE(wxMINOR_VERSION)
  117. #define wxWX_LIB_NAME(name, subname) \
  118. "wx" name wxSHORT_VERSION_STRING wxSUFFIX_STR subname
  119. #define wxBASE_LIB_NAME(name) wxWX_LIB_NAME("base", "_" name)
  120. #define wxTOOLKIT_LIB_NAME(name) wxWX_LIB_NAME(wxSTRINGIZE(wxTOOLKIT_PREFIX), "_" name)
  121. // This one is for 3rd party libraries: they don't have the version number
  122. // in their names and usually exist in ANSI version only (except for regex)
  123. //
  124. // 3rd party libraries are also are not linked in when using DLLs as they're
  125. // embedded inside our own DLLs and don't need to be linked with the user code.
  126. #define wx3RD_PARTY_LIB_NAME(name) "wx" name wxSUFFIX_DEBUG
  127. // special version for regex as it does have a Unicode version
  128. #define wx3RD_PARTY_LIB_NAME_U(name) "wx" name wxSUFFIX_STR
  129. #pragma comment(lib, wxWX_LIB_NAME("base", ""))
  130. #ifndef wxNO_NET_LIB
  131. #ifndef WXUSINGDLL
  132. #pragma comment(lib, "wsock32")
  133. #endif
  134. #pragma comment(lib, wxBASE_LIB_NAME("net"))
  135. #endif
  136. #if wxUSE_XML && !defined(wxNO_XML_LIB)
  137. #pragma comment(lib, wxBASE_LIB_NAME("xml"))
  138. #endif
  139. #if wxUSE_REGEX && !defined(wxNO_REGEX_LIB) && !defined(WXUSINGDLL)
  140. #pragma comment(lib, wx3RD_PARTY_LIB_NAME_U("regex"))
  141. #endif
  142. #if wxUSE_GUI
  143. #if wxUSE_XML && !defined(wxNO_EXPAT_LIB) && !defined(WXUSINGDLL)
  144. #pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat"))
  145. #endif
  146. #if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL)
  147. #pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg"))
  148. #endif
  149. #if wxUSE_LIBPNG && !defined(wxNO_PNG_LIB) && !defined(WXUSINGDLL)
  150. #pragma comment(lib, wx3RD_PARTY_LIB_NAME("png"))
  151. #endif
  152. #if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB) && !defined(WXUSINGDLL)
  153. #pragma comment(lib, wx3RD_PARTY_LIB_NAME("tiff"))
  154. #endif
  155. #if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) && !defined(WXUSINGDLL)
  156. #pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib"))
  157. #endif
  158. #pragma comment(lib, wxTOOLKIT_LIB_NAME("core"))
  159. #ifndef wxNO_ADV_LIB
  160. #pragma comment(lib, wxTOOLKIT_LIB_NAME("adv"))
  161. #endif
  162. #if wxUSE_HTML && !defined(wxNO_HTML_LIB)
  163. #pragma comment(lib, wxTOOLKIT_LIB_NAME("html"))
  164. #endif
  165. #if wxUSE_GLCANVAS && !defined(wxNO_GL_LIB)
  166. #pragma comment(lib, wxTOOLKIT_LIB_NAME("gl"))
  167. #endif
  168. #if wxUSE_DEBUGREPORT && !defined(wxNO_QA_LIB)
  169. #pragma comment(lib, wxTOOLKIT_LIB_NAME("qa"))
  170. #endif
  171. #if wxUSE_XRC && !defined(wxNO_XRC_LIB)
  172. #pragma comment(lib, wxTOOLKIT_LIB_NAME("xrc"))
  173. #endif
  174. #if wxUSE_AUI && !defined(wxNO_AUI_LIB)
  175. #pragma comment(lib, wxTOOLKIT_LIB_NAME("aui"))
  176. #endif
  177. #if wxUSE_PROPGRID && !defined(wxNO_PROPGRID_LIB)
  178. #pragma comment(lib, wxTOOLKIT_LIB_NAME("propgrid"))
  179. #endif
  180. #if wxUSE_RIBBON && !defined(wxNO_RIBBON_LIB)
  181. #pragma comment(lib, wxTOOLKIT_LIB_NAME("ribbon"))
  182. #endif
  183. #if wxUSE_RICHTEXT && !defined(wxNO_RICHTEXT_LIB)
  184. #pragma comment(lib, wxTOOLKIT_LIB_NAME("richtext"))
  185. #endif
  186. #if wxUSE_MEDIACTRL && !defined(wxNO_MEDIA_LIB)
  187. #pragma comment(lib, wxTOOLKIT_LIB_NAME("media"))
  188. #endif
  189. #if wxUSE_STC && !defined(wxNO_STC_LIB)
  190. #pragma comment(lib, wxTOOLKIT_LIB_NAME("stc"))
  191. #ifndef WXUSINGDLL
  192. #pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla"))
  193. #endif
  194. #endif
  195. #if wxUSE_WEBVIEW && !defined(wxNO_WEBVIEW_LIB)
  196. #pragma comment(lib, wxTOOLKIT_LIB_NAME("webview"))
  197. #endif
  198. #endif // wxUSE_GUI
  199. #ifndef WXUSINGDLL
  200. // Make sure all required system libraries are added to the linker too when
  201. // using static libraries.
  202. #pragma comment(lib, "kernel32")
  203. #pragma comment(lib, "user32")
  204. #pragma comment(lib, "gdi32")
  205. #pragma comment(lib, "comdlg32")
  206. #pragma comment(lib, "winspool")
  207. #pragma comment(lib, "winmm")
  208. #pragma comment(lib, "shell32")
  209. #pragma comment(lib, "comctl32")
  210. #pragma comment(lib, "ole32")
  211. #pragma comment(lib, "oleaut32")
  212. #pragma comment(lib, "uuid")
  213. #pragma comment(lib, "rpcrt4")
  214. #pragma comment(lib, "advapi32")
  215. #if wxUSE_URL_NATIVE
  216. #pragma comment(lib, "wininet")
  217. #endif
  218. #ifdef __WXGTK__
  219. #pragma comment(lib, "gtk-win32-2.0.lib")
  220. #pragma comment(lib, "gdk-win32-2.0.lib")
  221. #pragma comment(lib, "pangocairo-1.0.lib")
  222. #pragma comment(lib, "gdk_pixbuf-2.0.lib")
  223. #pragma comment(lib, "cairo.lib")
  224. #pragma comment(lib, "pango-1.0.lib")
  225. #pragma comment(lib, "gobject-2.0.lib")
  226. #pragma comment(lib, "gthread-2.0.lib")
  227. #pragma comment(lib, "glib-2.0.lib")
  228. #endif
  229. #endif // !WXUSINGDLL