You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

308 lines
10 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: xtests/implicit_link.h (formerly xtests/xtests_implicit_link.h)
  3. *
  4. * Purpose: Implicit linking for the xTests API
  5. *
  6. * Created: 3rd March 2003
  7. * Updated: 11th August 2010
  8. *
  9. * Home: http://xtests.org/
  10. *
  11. * Copyright (c) 2003-2010, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are
  16. * met:
  17. *
  18. * - Redistributions of source code must retain the above copyright notice,
  19. * this list of conditions and the following disclaimer.
  20. * - Redistributions in binary form must reproduce the above copyright
  21. * notice, this list of conditions and the following disclaimer in the
  22. * documentation and/or other materials provided with the distribution.
  23. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
  24. * names of any contributors may be used to endorse or promote products
  25. * derived from this software without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  28. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  29. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  30. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  31. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  32. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  33. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  34. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  35. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  36. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  37. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. * ////////////////////////////////////////////////////////////////////// */
  40. /** \file xtests/implicit_link.h
  41. *
  42. * [C, C++] Implicit linking for the xTests library.
  43. *
  44. * This file may be <code>\#include</code>d in any compilation unit within a
  45. * given link unit to implicitly link in the appropriate <b>xTests</b>
  46. * archive (library).
  47. *
  48. * \note For compilers that do not support implicit linking, inclusion of
  49. * the file has no effect.
  50. */
  51. #ifndef XTESTS_INCL_XTESTS_H_IMPLICIT_LINK
  52. #define XTESTS_INCL_XTESTS_H_IMPLICIT_LINK
  53. /* /////////////////////////////////////////////////////////////////////////
  54. * Version information
  55. */
  56. #ifndef XTESTS_DOCUMENTATION_SKIP_SECTION
  57. # define XTESTS_VER_XTESTS_H_IMPLICIT_LINK_MAJOR 1
  58. # define XTESTS_VER_XTESTS_H_IMPLICIT_LINK_MINOR 9
  59. # define XTESTS_VER_XTESTS_H_IMPLICIT_LINK_REVISION 1
  60. # define XTESTS_VER_XTESTS_H_IMPLICIT_LINK_EDIT 29
  61. #endif /* !XTESTS_DOCUMENTATION_SKIP_SECTION */
  62. /* /////////////////////////////////////////////////////////////////////////
  63. * Includes
  64. */
  65. #ifndef XTESTS_INCL_XTESTS_H_XTESTS
  66. # include <xtests/xtests.h>
  67. #endif /* !XTESTS_INCL_XTESTS_H_XTESTS */
  68. #include <platformstl/platformstl.h>
  69. /* /////////////////////////////////////////////////////////////////////////
  70. * Implicit linking
  71. */
  72. #if defined(_WIN32) || \
  73. defined(_WIN64)
  74. # if defined(__BORLANDC__) || \
  75. /* defined(__DMC__) || */ \
  76. defined(__INTEL_COMPILER) || \
  77. defined(__MWERKS__) || \
  78. defined(_MSC_VER)
  79. # if !defined(__COMO__)
  80. # define XTESTS_IMPLICIT_LINK_SUPPORT
  81. # endif /* compiler */
  82. # endif /* compiler */
  83. # if defined(XTESTS_IMPLICIT_LINK_SUPPORT) && \
  84. defined(XTESTS_NO_IMPLICIT_LINK)
  85. # undef XTESTS_IMPLICIT_LINK_SUPPORT
  86. # endif /* XTESTS_IMPLICIT_LINK_SUPPORT && XTESTS_NO_IMPLICIT_LINK */
  87. # if defined(XTESTS_IMPLICIT_LINK_SUPPORT)
  88. /* prefix */
  89. # define XTESTS_IMPL_LINK_PREFIX
  90. /* library basename */
  91. # define XTESTS_IMPL_LINK_LIBRARY_BASENAME "xtests"
  92. /* major version */
  93. # define XTESTS_IMPL_LINK_MAJOR_VERSION "." STLSOFT_STRINGIZE(_XTESTS_VER_MAJOR)
  94. /* module name */
  95. # define XTESTS_IMPL_LINK_MODULE_NAME ".core"
  96. /* compiler tag */
  97. # if defined(__BORLANDC__)
  98. # if __BORLANDC__ == 0x0550
  99. # define XTESTS_IMPL_LINK_COMPILER_NAME "bc55"
  100. # elif (__BORLANDC__ == 0x0551)
  101. # define XTESTS_IMPL_LINK_COMPILER_NAME "bc551"
  102. # elif (__BORLANDC__ == 0x0560)
  103. # define XTESTS_IMPL_LINK_COMPILER_NAME "bc56"
  104. # elif (__BORLANDC__ == 0x0564)
  105. # define XTESTS_IMPL_LINK_COMPILER_NAME "bc564"
  106. # elif (__BORLANDC__ == 0x0582)
  107. # define XTESTS_IMPL_LINK_COMPILER_NAME "bc582"
  108. # elif (0x0590 == (__BORLANDC__ & 0xfff0))
  109. # define XTESTS_IMPL_LINK_COMPILER_NAME "bc59x"
  110. # elif (0x0610 == (__BORLANDC__ & 0xfff0))
  111. # define XTESTS_IMPL_LINK_COMPILER_NAME "bc61x"
  112. # else /* ? __BORLANDC__ */
  113. # error Unrecognised value of __BORLANDC__
  114. # endif /* __BORLANDC__ */
  115. /*
  116. # elif defined(__DMC__)
  117. # define XTESTS_IMPL_LINK_COMPILER_NAME "dm"
  118. */
  119. # elif defined(__INTEL_COMPILER)
  120. # if __INTEL_COMPILER == 600
  121. # define XTESTS_IMPL_LINK_COMPILER_NAME "icl6"
  122. # elif __INTEL_COMPILER == 700
  123. # define XTESTS_IMPL_LINK_COMPILER_NAME "icl7"
  124. # elif __INTEL_COMPILER == 800
  125. # define XTESTS_IMPL_LINK_COMPILER_NAME "icl8"
  126. # elif __INTEL_COMPILER == 900
  127. # define XTESTS_IMPL_LINK_COMPILER_NAME "icl9"
  128. # elif __INTEL_COMPILER == 1000
  129. # define XTESTS_IMPL_LINK_COMPILER_NAME "icl10"
  130. # elif __INTEL_COMPILER == 1100
  131. # define XTESTS_IMPL_LINK_COMPILER_NAME "icl11"
  132. # else /* ? __INTEL_COMPILER */
  133. # error Intel C/C++ version not supported
  134. # endif /* __INTEL_COMPILER */
  135. # elif defined(__MWERKS__)
  136. # if ((__MWERKS__ & 0xFF00) == 0x2400)
  137. # define XTESTS_IMPL_LINK_COMPILER_NAME "cw7"
  138. # elif ((__MWERKS__ & 0xFF00) == 0x3000)
  139. # define XTESTS_IMPL_LINK_COMPILER_NAME "cw8"
  140. # elif ((__MWERKS__ & 0xFF00) == 0x3200)
  141. # define XTESTS_IMPL_LINK_COMPILER_NAME "cw9"
  142. # else /* ? __MWERKS__ */
  143. # error Unrecognised value of __MWERKS__
  144. # endif /* __MWERKS__ */
  145. # elif defined(_MSC_VER)
  146. # if _MSC_VER == 1000
  147. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc4"
  148. # elif _MSC_VER == 1020
  149. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc42"
  150. # elif _MSC_VER == 1100
  151. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc5"
  152. # elif _MSC_VER == 1200
  153. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc6"
  154. # elif _MSC_VER == 1300
  155. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc7"
  156. # elif _MSC_VER == 1310
  157. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc71"
  158. # elif _MSC_VER == 1400
  159. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc8"
  160. # elif _MSC_VER == 1500
  161. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc9"
  162. # elif _MSC_VER == 1600
  163. # define XTESTS_IMPL_LINK_COMPILER_NAME "vc10"
  164. # else /* ? _MSC_VER */
  165. # error Visual C++ version not supported
  166. # endif /* _MSC_VER */
  167. # else /* ? compiler */
  168. # error Unrecognised compiler
  169. # endif /* compiler */
  170. /* operating system tag */
  171. # if defined(_STLSOFT_FORCE_ANY_COMPILER) && \
  172. defined(PLATFORMSTL_OS_IS_UNIX) && \
  173. defined(_WIN32)
  174. # define XTESTS_IMPL_LINK_OS_TAG ".unix"
  175. # endif /* pseudo UNIX */
  176. # if !defined(XTESTS_IMPL_LINK_OS_TAG)
  177. # define XTESTS_IMPL_LINK_OS_TAG ""
  178. # endif /* !XTESTS_IMPL_LINK_OS_TAG */
  179. /* architecture tag */
  180. # if defined(PLATFORMSTL_ARCH_IS_X86)
  181. # define XTESTS_IMPL_LINK_ARCH_TAG ""
  182. # elif defined(PLATFORMSTL_ARCH_IS_X64)
  183. # define XTESTS_IMPL_LINK_ARCH_TAG ".x64"
  184. # elif defined(PLATFORMSTL_ARCH_IS_IA64)
  185. # define XTESTS_IMPL_LINK_ARCH_TAG ".ia64"
  186. # endif /* arch */
  187. # if !defined(XTESTS_IMPL_LINK_ARCH_TAG)
  188. # define XTESTS_IMPL_LINK_ARCH_TAG ""
  189. # endif /* !XTESTS_IMPL_LINK_ARCH_TAG */
  190. /* encoding tag */
  191. # if defined(XTESTS_USE_WIDE_STRINGS)
  192. # define XTESTS_IMPL_LINK_ENCODING_TAG ".widestring"
  193. # else /* ? XTESTS_USE_WIDE_STRINGS */
  194. # define XTESTS_IMPL_LINK_ENCODING_TAG ""
  195. # endif /* XTESTS_USE_WIDE_STRINGS */
  196. /* threading tag */
  197. # if defined(__MT__) || \
  198. defined(_REENTRANT) || \
  199. defined(_MT)
  200. # if defined(_DLL) || \
  201. defined(__DLL)
  202. # define XTESTS_IMPL_LINK_THREADING_TAG ".dll"
  203. # else /* ? dll */
  204. # define XTESTS_IMPL_LINK_THREADING_TAG ".mt"
  205. # endif /* dll */
  206. # else /* ? mt */
  207. # define XTESTS_IMPL_LINK_THREADING_TAG ""
  208. # endif /* mt */
  209. /* NoX */
  210. # if defined(XTESTS_CF_NOX)
  211. # define XTESTS_IMPL_LINK_NOX_TAG ".nox"
  212. # else /* ? XTESTS_CF_NOX */
  213. # define XTESTS_IMPL_LINK_NOX_TAG ""
  214. # endif /* XTESTS_CF_NOX */
  215. /* debug tag */
  216. # if !defined(NDEBUG) && \
  217. defined(_DEBUG)
  218. # define XTESTS_IMPL_LINK_DEBUG_TAG ".debug"
  219. # else /* ? _DEBUG */
  220. # define XTESTS_IMPL_LINK_DEBUG_TAG ""
  221. # endif /* _DEBUG */
  222. /* suffix */
  223. # define XTESTS_IMPL_LINK_SUFFIX ".lib"
  224. /* Library name is:
  225. *
  226. * [lib]<library-basename>.<major-version>.<module-name>.<compiler-name>[.<os-arch-tag>][.<char-encoding-tag>][.<threading-tag>][.<nox-tag>][.<debug-tag>].{a|lib}
  227. */
  228. # define XTESTS_IMPL_LINK_LIBRARY_NAME XTESTS_IMPL_LINK_PREFIX \
  229. XTESTS_IMPL_LINK_LIBRARY_BASENAME \
  230. XTESTS_IMPL_LINK_MAJOR_VERSION \
  231. XTESTS_IMPL_LINK_MODULE_NAME \
  232. "." XTESTS_IMPL_LINK_COMPILER_NAME \
  233. XTESTS_IMPL_LINK_OS_TAG \
  234. XTESTS_IMPL_LINK_ARCH_TAG \
  235. XTESTS_IMPL_LINK_ENCODING_TAG \
  236. XTESTS_IMPL_LINK_THREADING_TAG \
  237. XTESTS_IMPL_LINK_NOX_TAG \
  238. XTESTS_IMPL_LINK_DEBUG_TAG \
  239. XTESTS_IMPL_LINK_SUFFIX
  240. # pragma message("lib: " XTESTS_IMPL_LINK_LIBRARY_NAME)
  241. # pragma comment(lib, XTESTS_IMPL_LINK_LIBRARY_NAME)
  242. # endif /* XTESTS_IMPLICIT_LINK_SUPPORT */
  243. #endif /* Win-32 || Win-64 */
  244. /* ////////////////////////////////////////////////////////////////////// */
  245. #endif /* !XTESTS_INCL_XTESTS_H_IMPLICIT_LINK */
  246. /* ////////////////////////////////////////////////////////////////////// */