Jamfile.v2 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. # copyright John Maddock 2003, Artyom Beilis 2010
  2. # Distributed under the Boost Software License, Version 1.0.
  3. # (See accompanying file LICENSE_1_0.txt or copy at
  4. # http://www.boost.org/LICENSE_1_0.txt.
  5. project /boost/locale
  6. : source-location ../src
  7. ;
  8. import configure ;
  9. import os ;
  10. import toolset ;
  11. import project ;
  12. import feature ;
  13. # Features
  14. feature.feature boost.locale.iconv : on off : optional propagated ;
  15. feature.feature boost.locale.icu : on off : optional propagated ;
  16. feature.feature boost.locale.posix : on off : optional propagated ;
  17. feature.feature boost.locale.std : on off : optional propagated ;
  18. feature.feature boost.locale.winapi : on off : optional propagated ;
  19. # Configuration of libraries
  20. ## iconv
  21. obj has_iconv_libc_obj : ../build/has_iconv.cpp ;
  22. exe has_iconv : has_iconv_libc_obj ;
  23. explicit has_iconv ;
  24. ICONV_PATH = [ modules.peek : ICONV_PATH ] ;
  25. lib iconv
  26. :
  27. : <search>$(ICONV_PATH)/lib <link>shared <runtime-link>shared
  28. :
  29. : <include>$(ICONV_PATH)/include
  30. ;
  31. explicit iconv ;
  32. obj has_iconv_libc_ext : ../build/has_iconv.cpp iconv ;
  33. exe has_external_iconv : has_iconv_libc_ext iconv ;
  34. explicit has_external_iconv ;
  35. exe accepts_shared_option : ../build/option.cpp
  36. : <cxxflags>-shared-libstdc++
  37. <cxxflags>-shared-libgcc
  38. <linkflags>-shared-libstdc++
  39. <linkflags>-shared-libgcc
  40. ;
  41. # Xlocale
  42. obj has_xlocale_obj : ../build/has_xlocale.cpp ;
  43. exe has_xlocale : has_xlocale_obj ;
  44. explicit has_xlocale ;
  45. #end xlocale
  46. ICU_PATH = [ modules.peek : ICU_PATH ] ;
  47. ICU_LINK = [ modules.peek : ICU_LINK ] ;
  48. if $(ICU_LINK)
  49. {
  50. ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <runtime-link>shared ;
  51. ICU64_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin64 <runtime-link>shared ;
  52. }
  53. else
  54. {
  55. searched-lib icuuc : : <name>icuuc
  56. <search>$(ICU_PATH)/lib
  57. <link>shared
  58. <runtime-link>shared ;
  59. searched-lib icuuc : : <toolset>msvc
  60. <variant>debug
  61. <name>icuucd
  62. <search>$(ICU_PATH)/lib
  63. <link>shared
  64. <runtime-link>shared ;
  65. searched-lib icuuc : : <name>this_is_an_invalid_library_name ;
  66. searched-lib icudt : : <search>$(ICU_PATH)/lib
  67. <name>icudata
  68. <link>shared
  69. <runtime-link>shared ;
  70. searched-lib icudt : : <search>$(ICU_PATH)/lib
  71. <name>icudt
  72. <toolset>msvc
  73. <link>shared
  74. <runtime-link>shared ;
  75. searched-lib icudt : : <name>this_is_an_invalid_library_name ;
  76. searched-lib icuin : : <search>$(ICU_PATH)/lib
  77. <name>icui18n
  78. <link>shared
  79. <runtime-link>shared ;
  80. searched-lib icuin : : <toolset>msvc
  81. <variant>debug
  82. <name>icuind
  83. <search>$(ICU_PATH)/lib
  84. <link>shared
  85. <runtime-link>shared ;
  86. searched-lib icuin : : <toolset>msvc
  87. <variant>release
  88. <name>icuin
  89. <search>$(ICU_PATH)/lib
  90. <link>shared
  91. <runtime-link>shared ;
  92. searched-lib icuin : : <name>this_is_an_invalid_library_name ;
  93. explicit icuuc icudt icuin ;
  94. ICU_OPTS = <include>$(ICU_PATH)/include
  95. <library>icuuc/<link>shared/<runtime-link>shared
  96. <library>icudt/<link>shared/<runtime-link>shared
  97. <library>icuin/<link>shared/<runtime-link>shared
  98. <dll-path>$(ICU_PATH)/bin
  99. <runtime-link>shared ;
  100. searched-lib icuuc_64 : : <name>icuuc
  101. <search>$(ICU_PATH)/lib64
  102. <link>shared
  103. <runtime-link>shared ;
  104. searched-lib icuuc_64 : : <toolset>msvc
  105. <variant>debug
  106. <name>icuucd
  107. <search>$(ICU_PATH)/lib64
  108. <link>shared
  109. <runtime-link>shared ;
  110. searched-lib icuuc_64 : : <name>this_is_an_invalid_library_name ;
  111. searched-lib icudt_64 : : <search>$(ICU_PATH)/lib64
  112. <name>icudata
  113. <link>shared
  114. <runtime-link>shared ;
  115. searched-lib icudt_64 : : <search>$(ICU_PATH)/lib64
  116. <name>icudt
  117. <toolset>msvc
  118. <link>shared
  119. <runtime-link>shared ;
  120. searched-lib icudt_64 : : <name>this_is_an_invalid_library_name ;
  121. searched-lib icuin_64 : : <search>$(ICU_PATH)/lib64
  122. <name>icui18n
  123. <link>shared
  124. <runtime-link>shared ;
  125. searched-lib icuin_64 : : <toolset>msvc
  126. <variant>debug
  127. <name>icuind
  128. <search>$(ICU_PATH)/lib64
  129. <link>shared
  130. <runtime-link>shared ;
  131. searched-lib icuin_64 : : <toolset>msvc
  132. <variant>release
  133. <name>icuin
  134. <search>$(ICU_PATH)/lib64
  135. <link>shared
  136. <runtime-link>shared ;
  137. searched-lib icuin_64 : : <name>this_is_an_invalid_library_name ;
  138. explicit icuuc_64 icudt_64 icuin_64 ;
  139. ICU64_OPTS = <include>$(ICU_PATH)/include
  140. <library>icuuc_64/<link>shared/<runtime-link>shared
  141. <library>icudt_64/<link>shared/<runtime-link>shared
  142. <library>icuin_64/<link>shared/<runtime-link>shared
  143. <dll-path>$(ICU_PATH)/bin64
  144. <runtime-link>shared ;
  145. }
  146. obj has_icu_obj : ../build/has_icu_test.cpp : $(ICU_OPTS) ;
  147. obj has_icu64_obj : ../build/has_icu_test.cpp : $(ICU64_OPTS) ;
  148. exe has_icu : has_icu_obj : $(ICU_OPTS) ;
  149. exe has_icu64 : has_icu64_obj : $(ICU64_OPTS) ;
  150. explicit has_icu has_icu64 ;
  151. # This function is called whenever the 'boost_locale' metatarget
  152. # below is generated and figures what external components we have,
  153. # what user wants, and what sources have to be compiled in the end.
  154. rule configure-full ( properties * : flags-only )
  155. {
  156. local result ;
  157. local flags-result ;
  158. local found-iconv ;
  159. if <boost.locale.iconv>on in $(properties)
  160. || ! <boost.locale.iconv> in $(properties:G)
  161. && ! <target-os>solaris in $(properties)
  162. {
  163. # See if iconv is bundled with standard library.
  164. if [ configure.builds has_iconv : $(properties) : "iconv (libc)" ]
  165. {
  166. found-iconv = true ;
  167. }
  168. else
  169. {
  170. if [ configure.builds has_external_iconv : $(properties) : "iconv (separate)" ]
  171. {
  172. found-iconv = true ;
  173. result += <library>iconv ;
  174. }
  175. }
  176. }
  177. if $(found-iconv)
  178. {
  179. flags-result += <define>BOOST_LOCALE_WITH_ICONV=1 ;
  180. }
  181. local found-icu ;
  182. if ! <boost.locale.icu>off in $(properties)
  183. {
  184. if [ configure.builds has_icu : $(properties) : "icu" ]
  185. {
  186. found-icu = true ;
  187. flags-result += <define>BOOST_LOCALE_WITH_ICU=1 $(ICU_OPTS) ;
  188. }
  189. else if [ configure.builds has_icu64 : $(properties) : "icu (lib64)" ]
  190. {
  191. found-icu = true ;
  192. flags-result += <define>BOOST_LOCALE_WITH_ICU=1 $(ICU64_OPTS) ;
  193. }
  194. if $(found-icu)
  195. {
  196. ICU_SOURCES =
  197. boundary
  198. codecvt
  199. collator
  200. conversion
  201. date_time
  202. formatter
  203. icu_backend
  204. numeric
  205. time_zone
  206. ;
  207. result += <source>icu/$(ICU_SOURCES).cpp
  208. <library>../../thread/build//boost_thread
  209. ;
  210. }
  211. }
  212. if ! $(found-iconv) && ! $(found-icu) && ! <target-os>windows in $(properties) && ! <target-os>cygwin in $(properties)
  213. {
  214. ECHO "- Boost.Locale needs either iconv or ICU library to be built." ;
  215. result += <build>no ;
  216. }
  217. if ! <boost.locale.std> in $(properties:G)
  218. {
  219. if <toolset>sun in $(properties)
  220. {
  221. properties += <boost.locale.std>off ;
  222. }
  223. else
  224. {
  225. properties += <boost.locale.std>on ;
  226. }
  227. }
  228. if <boost.locale.std>off in $(properties)
  229. {
  230. flags-result += <define>BOOST_LOCALE_NO_STD_BACKEND=1 ;
  231. }
  232. else
  233. {
  234. STD_SOURCES =
  235. codecvt
  236. collate
  237. converter
  238. numeric
  239. std_backend
  240. ;
  241. result += <source>std/$(STD_SOURCES).cpp ;
  242. }
  243. if ! <boost.locale.winapi> in $(properties:G)
  244. {
  245. if <target-os>windows in $(properties)
  246. || <target-os>cygwin in $(properties)
  247. {
  248. properties += <boost.locale.winapi>on ;
  249. }
  250. else
  251. {
  252. properties += <boost.locale.winapi>off ;
  253. }
  254. }
  255. if <target-os>windows in $(properties)
  256. && <toolset>gcc in $(properties)
  257. && <link>shared in $(properties)
  258. && [ configure.builds accepts_shared_option : $(properties) : "g++ -shared-* supported" ]
  259. {
  260. flags-result += <cxxflags>-shared-libstdc++
  261. <cxxflags>-shared-libgcc
  262. <linkflags>-shared-libstdc++
  263. <linkflags>-shared-libgcc
  264. ;
  265. }
  266. if <boost.locale.winapi>off in $(properties)
  267. {
  268. flags-result += <define>BOOST_LOCALE_NO_WINAPI_BACKEND=1 ;
  269. }
  270. else
  271. {
  272. WINAPI_SOURCES =
  273. collate
  274. converter
  275. numeric
  276. win_backend
  277. ;
  278. result += <source>win32/$(WINAPI_SOURCES).cpp ;
  279. }
  280. if ( ! <boost.locale.winapi>off in $(properties) || ! <boost.locale.std>off in $(properties) )
  281. && ( <target-os>windows in $(properties) || <target-os>cygwin in $(properties) )
  282. {
  283. result += <source>win32/lcid.cpp ;
  284. }
  285. if ! <boost.locale.posix> in $(properties:G)
  286. {
  287. if <target-os>linux in $(properties)
  288. || <target-os>darwin in $(properties)
  289. || ( <target-os>freebsd in $(properties) && [ configure.builds has_xlocale : $(properties) : "xlocale supported" ] )
  290. {
  291. properties += <boost.locale.posix>on ;
  292. }
  293. else
  294. {
  295. properties += <boost.locale.posix>off ;
  296. }
  297. }
  298. if <boost.locale.posix>off in $(properties)
  299. {
  300. flags-result += <define>BOOST_LOCALE_NO_POSIX_BACKEND=1 ;
  301. }
  302. else
  303. {
  304. POSIX_SOURCES =
  305. collate
  306. converter
  307. numeric
  308. codecvt
  309. posix_backend
  310. ;
  311. result += <source>posix/$(POSIX_SOURCES).cpp ;
  312. }
  313. if <boost.locale.posix>on in $(properties) || <boost.locale.std>on in $(properties) || <boost.locale.winapi>on in $(properties)
  314. {
  315. result += <source>util/gregorian.cpp ;
  316. }
  317. result += <library>../../system/build//boost_system ;
  318. if "$(flags-only)" = "flags"
  319. {
  320. return $(flags-result) ;
  321. }
  322. else {
  323. result += $(flags-result) ;
  324. return $(result) ;
  325. }
  326. }
  327. rule configure ( properties * )
  328. {
  329. local result = [ configure-full $(properties) : "all" ] ;
  330. return $(result) ;
  331. }
  332. rule configure-flags ( properties * )
  333. {
  334. local result ;
  335. result = [ configure-full $(properties) : "flags" ] ;
  336. return $(result) ;
  337. }
  338. alias build_options : : : : <conditional>@configure ;
  339. alias build_flags : : : : <conditional>@configure-flags ;
  340. lib boost_locale
  341. :
  342. encoding/codepage.cpp
  343. shared/date_time.cpp
  344. shared/format.cpp
  345. shared/formatting.cpp
  346. shared/generator.cpp
  347. shared/ids.cpp
  348. shared/localization_backend.cpp
  349. shared/message.cpp
  350. shared/mo_lambda.cpp
  351. util/codecvt_converter.cpp
  352. util/default_locale.cpp
  353. util/info.cpp
  354. util/locale_data.cpp
  355. :
  356. # Don't link explicitly, not required
  357. <define>BOOST_THREAD_NO_LIB=1
  358. <link>shared:<define>BOOST_LOCALE_DYN_LINK=1
  359. <threading>multi
  360. # Meanwhile remove this
  361. <conditional>@configure
  362. ;
  363. boost-install boost_locale ;
  364. # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4