Jamfile.v2 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. #
  2. # Copyright Andrey Semashev 2007 - 2016.
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE_1_0.txt or copy at
  5. # http://www.boost.org/LICENSE_1_0.txt)
  6. #
  7. import common ;
  8. import modules ;
  9. import os ;
  10. import path ;
  11. import project ;
  12. import feature ;
  13. import configure ;
  14. import log-architecture ;
  15. import log-platform-config ;
  16. using mc ;
  17. local here = [ modules.binding $(__name__) ] ;
  18. project.push-current [ project.current ] ;
  19. project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ;
  20. project.load [ path.join [ path.make $(here:D) ] ../config/x86-ext ] ;
  21. project.load [ path.join [ path.make $(here:D) ] ../config/pthread-mutex-robust ] ;
  22. project.load [ path.join [ path.make $(here:D) ] ../config/native-syslog ] ;
  23. project.load [ path.join [ path.make $(here:D) ] ../config/atomic-int32 ] ;
  24. project.pop-current ;
  25. # Windows libs
  26. lib psapi ;
  27. lib advapi32 ;
  28. lib secur32 ;
  29. lib ws2_32 ;
  30. lib mswsock ;
  31. # UNIX libs
  32. lib rt ;
  33. lib socket ;
  34. lib nsl ;
  35. lib ipv6 ;
  36. rule has-config-flag ( flag : properties * )
  37. {
  38. if ( "<define>$(flag)" in $(properties) || "<define>$(flag)=1" in $(properties) )
  39. {
  40. return 1 ;
  41. }
  42. else
  43. {
  44. return ;
  45. }
  46. }
  47. rule check-instruction-set ( properties * )
  48. {
  49. local result ;
  50. local instruction_set = [ feature.get-values "log-instruction-set" : [ log-architecture.deduce-instruction-set $(properties) ] ] ;
  51. if $(instruction_set) = i386 || $(instruction_set) = i486
  52. {
  53. if ! $(.annouced-failure)
  54. {
  55. ECHO Boost.Log is not supported on the specified target CPU and will not be built. At least i586 class CPU is required. ;
  56. .annouced-failure = 1 ;
  57. }
  58. result = <build>no ;
  59. }
  60. return $(result) ;
  61. }
  62. rule select-regex-backend ( properties * )
  63. {
  64. local result = ;
  65. # Use Boost.Regex backend by default. It produces smaller executables and also has the best performance for small string matching.
  66. if ! (
  67. [ has-config-flag BOOST_LOG_WITHOUT_SETTINGS_PARSERS : $(properties) ] ||
  68. [ has-config-flag BOOST_LOG_WITHOUT_DEFAULT_FACTORIES : $(properties) ] ||
  69. [ has-config-flag BOOST_LOG_USE_STD_REGEX : $(properties) ] ||
  70. [ has-config-flag BOOST_LOG_USE_BOOST_XPRESSIVE : $(properties) ] )
  71. {
  72. result = <library>/boost/regex//boost_regex ;
  73. }
  74. return $(result) ;
  75. }
  76. rule check-pthread-mutex-robust ( properties * )
  77. {
  78. local result = ;
  79. local has_pthread_mutex_robust = [ configure.builds /boost/log/pthread-mutex-robust//pthread_mutex_robust : $(properties) : pthread-supports-robust-mutexes ] ;
  80. if $(has_pthread_mutex_robust)
  81. {
  82. result = <define>BOOST_LOG_HAS_PTHREAD_MUTEX_ROBUST ;
  83. }
  84. return $(result) ;
  85. }
  86. rule check-atomic-int32 ( properties * )
  87. {
  88. local result = ;
  89. local has_atomic_int32 = [ configure.builds /boost/log/atomic-int32//atomic_int32 : $(properties) : native-atomic-int32-supported ] ;
  90. if ! $(has_atomic_int32)
  91. {
  92. result = <define>BOOST_LOG_WITHOUT_IPC ;
  93. }
  94. return $(result) ;
  95. }
  96. rule check-native-syslog ( properties * )
  97. {
  98. local result = ;
  99. if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ]
  100. {
  101. local has_native_syslog = [ configure.builds /boost/log/native-syslog//native_syslog : $(properties) : native-syslog-supported ] ;
  102. if $(has_native_syslog)
  103. {
  104. result = <define>BOOST_LOG_USE_NATIVE_SYSLOG ;
  105. }
  106. }
  107. return $(result) ;
  108. }
  109. rule check-message-compiler ( properties * )
  110. {
  111. local result ;
  112. if <target-os>windows in $(properties)
  113. {
  114. if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
  115. {
  116. local has_mc = [ configure.builds /boost/log/message-compiler//test-availability : $(properties) : message-compiler ] ;
  117. if ! $(has_mc)
  118. {
  119. result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
  120. }
  121. }
  122. else
  123. {
  124. # This branch is needed to fix building with MinGW
  125. result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
  126. }
  127. }
  128. else
  129. {
  130. result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
  131. }
  132. return $(result) ;
  133. }
  134. project boost/log
  135. : source-location ../src
  136. : requirements
  137. <conditional>@check-instruction-set
  138. <conditional>@check-atomic-int32
  139. <conditional>@select-regex-backend
  140. <conditional>@check-pthread-mutex-robust
  141. <conditional>@check-native-syslog
  142. <conditional>@check-message-compiler
  143. <conditional>@log-platform-config.set-platform-defines
  144. <include>../src
  145. <define>__STDC_CONSTANT_MACROS # Use system-defined macros for integer constants, if possible
  146. <define>BOOST_SPIRIT_USE_PHOENIX_V3=1
  147. <define>BOOST_THREAD_DONT_USE_CHRONO=1 # Don't introduce false dependency on Boost.Chrono
  148. # Disable warnings about using 'insecure' standard C functions
  149. <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
  150. <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
  151. <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
  152. <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
  153. <toolset>intel-win:<define>_SCL_SECURE_NO_WARNINGS
  154. <toolset>intel-win:<define>_SCL_SECURE_NO_DEPRECATE
  155. <toolset>intel-win:<define>_CRT_SECURE_NO_WARNINGS
  156. <toolset>intel-win:<define>_CRT_SECURE_NO_DEPRECATE
  157. <toolset>msvc:<cxxflags>/bigobj
  158. <toolset>msvc:<cxxflags>/wd4503 # decorated name length exceeded, name was truncated
  159. <toolset>msvc:<cxxflags>/wd4456 # declaration of 'A' hides previous local declaration
  160. <toolset>msvc:<cxxflags>/wd4459 # declaration of 'A' hides global declaration
  161. <toolset>msvc:<cxxflags>/wd4003 # not enough actual parameters for macro 'X' - caused by BOOST_PP_IS_EMPTY and BOOST_PP_IS_BEGIN_PARENS which are used by Fusion
  162. # Disable Intel warnings:
  163. # warning #177: function "X" was declared but never referenced
  164. # warning #780: using-declaration ignored -- it refers to the current namespace
  165. # warning #2196: routine is both "inline" and "noinline"
  166. # remark #1782: #pragma once is obsolete. Use #ifndef guard instead.
  167. # remark #193: zero used for undefined preprocessing identifier "X"
  168. # remark #304: access control not specified ("public" by default)
  169. # remark #981: operands are evaluated in unspecified order
  170. # remark #1418: external function definition with no prior declaration
  171. # Mostly comes from Boost.Phoenix: warning #411: class "X" defines no constructor to initialize the following: reference member "Y"...
  172. # warning #734: "X" (declared at line N of "file.hpp"), required for copy that was eliminated, is inaccessible
  173. # warning #279: controlling expression is constant
  174. <toolset>intel-win:<cxxflags>"/Qwd177,780,2196,1782,193,304,981,1418,411,734,279"
  175. <toolset>intel-linux:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
  176. <toolset>intel-darwin:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
  177. <toolset>darwin:<cxxflags>-ftemplate-depth-1024
  178. <toolset>clang:<cxxflags>-ftemplate-depth-1024
  179. <toolset>gcc:<cxxflags>-ftemplate-depth-1024
  180. <toolset>gcc:<cxxflags>-fno-strict-aliasing # avoids strict aliasing violations in other Boost components
  181. <toolset>gcc,<target-os>windows:<linkflags>-Wl,--enable-auto-import
  182. <toolset>gcc,<target-os>cygwin:<linkflags>-Wl,--enable-auto-import
  183. <library>/boost/date_time//boost_date_time
  184. <library>/boost/filesystem//boost_filesystem
  185. <threading>single:<define>BOOST_LOG_NO_THREADS
  186. <threading>multi:<library>/boost/atomic//boost_atomic
  187. <threading>multi:<library>/boost/thread//boost_thread
  188. <target-os>windows:<library>ws2_32
  189. <target-os>windows:<library>mswsock
  190. <target-os>windows:<library>advapi32
  191. <target-os>cygwin:<library>ws2_32
  192. <target-os>cygwin:<library>mswsock
  193. <target-os>cygwin:<library>advapi32
  194. # Boost.Interprocess does not compile on Cygwin: https://github.com/boostorg/interprocess/issues/76
  195. <target-os>cygwin:<define>BOOST_LOG_WITHOUT_IPC
  196. <target-os>linux:<library>rt
  197. <target-os>solaris:<library>socket
  198. <target-os>solaris:<library>nsl
  199. <target-os>hpux:<library>ipv6
  200. <target-os>freebsd:<library>rt
  201. <target-os>qnxnto:<library>socket
  202. <toolset>pgi:<library>rt
  203. : usage-requirements
  204. <toolset>clang:<cxxflags>-Wno-bind-to-temporary-copy
  205. <toolset>clang:<cxxflags>-Wno-unused-function
  206. ;
  207. local BOOST_LOG_COMMON_SRC =
  208. attribute_name.cpp
  209. attribute_set.cpp
  210. attribute_value_set.cpp
  211. code_conversion.cpp
  212. core.cpp
  213. record_ostream.cpp
  214. severity_level.cpp
  215. global_logger_storage.cpp
  216. named_scope.cpp
  217. process_name.cpp
  218. process_id.cpp
  219. thread_id.cpp
  220. timer.cpp
  221. exceptions.cpp
  222. default_attribute_names.cpp
  223. default_sink.cpp
  224. text_ostream_backend.cpp
  225. text_file_backend.cpp
  226. text_multifile_backend.cpp
  227. thread_specific.cpp
  228. once_block.cpp
  229. timestamp.cpp
  230. threadsafe_queue.cpp
  231. event.cpp
  232. trivial.cpp
  233. spirit_encoding.cpp
  234. format_parser.cpp
  235. date_time_format_parser.cpp
  236. named_scope_format_parser.cpp
  237. permissions.cpp
  238. dump.cpp
  239. ;
  240. BOOST_LOG_COMMON_SSSE3_SRC =
  241. dump_ssse3
  242. ;
  243. BOOST_LOG_COMMON_AVX2_SRC =
  244. dump_avx2
  245. ;
  246. rule ssse3-targets-cond ( properties * )
  247. {
  248. local result = <build>no ;
  249. if <log-architecture>x86 in [ log-architecture.deduce-architecture $(properties) ]
  250. {
  251. local has_ssse3 = [ configure.builds /boost/log/x86-extensions//ssse3 : $(properties) : compiler-supports-ssse3 ] ;
  252. if $(has_ssse3)
  253. {
  254. result = ;
  255. if <toolset>gcc in $(properties) || <toolset>clang in $(properties)
  256. {
  257. result = <cxxflags>"-msse -msse2 -msse3 -mssse3" ;
  258. }
  259. else if <toolset>intel in $(properties)
  260. {
  261. if <toolset-intel:platform>win in $(properties)
  262. {
  263. result = <cxxflags>"/QxSSSE3" ;
  264. }
  265. else
  266. {
  267. result = <cxxflags>"-xSSSE3" ;
  268. }
  269. }
  270. else if <toolset>msvc in $(properties)
  271. {
  272. # MSVC doesn't really care about these switches, all SSE intrinsics are always available, but still...
  273. # Also 64 bit MSVC doesn't have the /arch:SSE2 switch as it is the default.
  274. if <log-address-model>32 in [ log-architecture.deduce-address-model $(properties) ]
  275. {
  276. result = <cxxflags>"/arch:SSE2" ;
  277. }
  278. }
  279. }
  280. }
  281. # if ! <build>no in $(result)
  282. # {
  283. # ECHO Boost.Log: Using SSSE3 optimized implementation ;
  284. # }
  285. # ECHO $(result) ;
  286. return $(result) ;
  287. }
  288. for local src in $(BOOST_LOG_COMMON_SSSE3_SRC)
  289. {
  290. obj $(src)
  291. : ## sources ##
  292. $(src).cpp
  293. : ## requirements ##
  294. <conditional>@ssse3-targets-cond
  295. <link>shared:<define>BOOST_LOG_DLL
  296. <define>BOOST_LOG_BUILDING_THE_LIB=1
  297. : ## default-build ##
  298. : ## usage-requirements ##
  299. <define>BOOST_LOG_USE_SSSE3
  300. ;
  301. explicit $(src) ;
  302. }
  303. rule avx2-targets-cond ( properties * )
  304. {
  305. local result = <build>no ;
  306. if <log-architecture>x86 in [ log-architecture.deduce-architecture $(properties) ]
  307. {
  308. local has_avx2 = [ configure.builds /boost/log/x86-extensions//avx2 : $(properties) : compiler-supports-avx2 ] ;
  309. if $(has_avx2)
  310. {
  311. result = ;
  312. if <toolset>gcc in $(properties)
  313. {
  314. result = <cxxflags>"-mavx -mavx2 -fabi-version=0" ;
  315. }
  316. else if <toolset>clang in $(properties)
  317. {
  318. result = <cxxflags>"-mavx -mavx2" ;
  319. }
  320. else if <toolset>intel in $(properties)
  321. {
  322. if <toolset-intel:platform>win in $(properties)
  323. {
  324. result = <cxxflags>"/arch:CORE-AVX2" ;
  325. }
  326. else
  327. {
  328. result = <cxxflags>"-xCORE-AVX2 -fabi-version=0" ;
  329. }
  330. }
  331. else if <toolset>msvc in $(properties)
  332. {
  333. result = <cxxflags>"/arch:AVX" ;
  334. }
  335. }
  336. }
  337. # if ! <build>no in $(result)
  338. # {
  339. # ECHO Boost.Log: Using AVX2 optimized implementation ;
  340. # }
  341. # ECHO $(result) ;
  342. return $(result) ;
  343. }
  344. for local src in $(BOOST_LOG_COMMON_AVX2_SRC)
  345. {
  346. obj $(src)
  347. : ## sources ##
  348. $(src).cpp
  349. : ## requirements ##
  350. <conditional>@avx2-targets-cond
  351. <link>shared:<define>BOOST_LOG_DLL
  352. <define>BOOST_LOG_BUILDING_THE_LIB=1
  353. : ## default-build ##
  354. : ## usage-requirements ##
  355. <define>BOOST_LOG_USE_AVX2
  356. ;
  357. explicit $(src) ;
  358. }
  359. rule select-arch-specific-sources ( properties * )
  360. {
  361. local result ;
  362. if <log-architecture>x86 in [ log-architecture.deduce-architecture $(properties) ]
  363. {
  364. local has_ssse3 = [ configure.builds /boost/log/x86-extensions//ssse3 : $(properties) : compiler-supports-ssse3 ] ;
  365. if $(has_ssse3)
  366. {
  367. result += <define>BOOST_LOG_USE_SSSE3 ;
  368. result += <source>$(BOOST_LOG_COMMON_SSSE3_SRC) ;
  369. }
  370. local has_avx2 = [ configure.builds /boost/log/x86-extensions//avx2 : $(properties) : compiler-supports-avx2 ] ;
  371. if $(has_avx2)
  372. {
  373. result += <define>BOOST_LOG_USE_AVX2 ;
  374. result += <source>$(BOOST_LOG_COMMON_AVX2_SRC) ;
  375. }
  376. }
  377. # ECHO Arch sources: $(result) ;
  378. return $(result) ;
  379. }
  380. rule select-platform-specific-sources ( properties * )
  381. {
  382. local result ;
  383. if <target-os>windows in $(properties)
  384. {
  385. result += <source>windows/light_rw_mutex.cpp ;
  386. if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ]
  387. {
  388. result += <source>windows/object_name.cpp ;
  389. result += <source>windows/mapped_shared_memory.cpp ;
  390. result += <source>windows/ipc_sync_wrappers.cpp ;
  391. result += <source>windows/ipc_reliable_message_queue.cpp ;
  392. result += <library>secur32 ;
  393. }
  394. if ! [ has-config-flag BOOST_LOG_WITHOUT_DEBUG_OUTPUT : $(properties) ]
  395. {
  396. result += <source>windows/debug_output_backend.cpp ;
  397. }
  398. if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
  399. {
  400. result += <source>windows/simple_event_log.mc ;
  401. result += <source>windows/event_log_backend.cpp ;
  402. result += <library>psapi ;
  403. DEPENDS windows/event_log_backend.cpp : windows/simple_event_log.mc ;
  404. }
  405. }
  406. else
  407. {
  408. result += <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
  409. result += <define>BOOST_LOG_WITHOUT_DEBUG_OUTPUT ;
  410. if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ]
  411. {
  412. result += <source>posix/object_name.cpp ;
  413. result += <source>posix/ipc_reliable_message_queue.cpp ;
  414. }
  415. }
  416. if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ]
  417. {
  418. result += <source>syslog_backend.cpp ;
  419. }
  420. # ECHO Platform sources: $(result) ;
  421. return $(result) ;
  422. }
  423. lib boost_log
  424. : ## sources ##
  425. $(BOOST_LOG_COMMON_SRC)
  426. : ## requirements ##
  427. <conditional>@select-arch-specific-sources
  428. <conditional>@select-platform-specific-sources
  429. <link>shared:<define>BOOST_LOG_DLL
  430. <define>BOOST_LOG_BUILDING_THE_LIB=1
  431. : ## default-build ##
  432. : ## usage-requirements ##
  433. <link>shared:<define>BOOST_LOG_DYN_LINK=1
  434. <threading>single:<define>BOOST_LOG_NO_THREADS
  435. ;
  436. local BOOST_LOG_SETUP_COMMON_SRC =
  437. parser_utils.cpp
  438. init_from_stream.cpp
  439. init_from_settings.cpp
  440. settings_parser.cpp
  441. filter_parser.cpp
  442. formatter_parser.cpp
  443. default_filter_factory.cpp
  444. matches_relation_factory.cpp
  445. default_formatter_factory.cpp
  446. ;
  447. lib boost_log_setup
  448. : ## sources ##
  449. setup/$(BOOST_LOG_SETUP_COMMON_SRC)
  450. : ## requirements ##
  451. <link>shared:<define>BOOST_LOG_DYN_LINK=1
  452. <link>shared:<define>BOOST_LOG_SETUP_DLL
  453. <define>BOOST_LOG_SETUP_BUILDING_THE_LIB=1
  454. <library>boost_log
  455. : ## default-build ##
  456. : ## usage-requirements ##
  457. <link>shared:<define>BOOST_LOG_SETUP_DYN_LINK=1
  458. <threading>single:<define>BOOST_LOG_NO_THREADS
  459. ;
  460. boost-install boost_log boost_log_setup ;