| 124 | | PathVariable('BOOST_INCLUDES', 'Search path for boost include files', '/usr/include', PathVariable.PathAccept), |
| 125 | | PathVariable('BOOST_LIBS', 'Search path for boost library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept), |
| | 127 | # default is '/usr/include', see FindBoost method below |
| | 128 | ('BOOST_INCLUDES', 'Search path for boost include files', '',False), |
| | 129 | # default is '/usr/' + LIBDIR_SCHEMA, see FindBoost method below |
| | 130 | ('BOOST_LIBS', 'Search path for boost library files', '',False), |
| | 355 | def FindBoost(context, prefixes): |
| | 356 | """Routine to auto-find boost header dir, lib dir, and library naming structure. |
| | 357 | |
| | 358 | """ |
| | 359 | context.Message( 'Searching for boost libs and headers... ' ) |
| | 360 | env = context.env |
| | 361 | |
| | 362 | BOOST_LIB_DIR = None |
| | 363 | BOOST_INCLUDE_DIR = None |
| | 364 | BOOST_APPEND = None |
| | 365 | env['BOOST_APPEND'] = str() |
| | 366 | |
| | 367 | for searchDir in prefixes: |
| | 368 | libItems = glob(os.path.join(searchDir, LIBDIR_SCHEMA, 'libboost_filesystem*-*.*')) |
| | 369 | if not libItems: |
| | 370 | libItems = glob(os.path.join(searchDir, 'lib/libboost_filesystem*-*.*')) |
| | 371 | incItems = glob(os.path.join(searchDir, 'include/boost*/')) |
| | 372 | if len(libItems) >= 1 and len(incItems) >= 1: |
| | 373 | BOOST_LIB_DIR = os.path.dirname(libItems[0]) |
| | 374 | BOOST_INCLUDE_DIR = incItems[0].rstrip('boost/') |
| | 375 | match = re.search(r'libboost_filesystem-(.*)\..*', libItems[0]) |
| | 376 | if hasattr(match,'groups'): |
| | 377 | BOOST_APPEND = match.groups()[0] |
| | 378 | break |
| | 379 | |
| | 380 | msg = str() |
| | 381 | |
| | 382 | if not env['BOOST_LIBS']: |
| | 383 | if BOOST_LIB_DIR: |
| | 384 | msg += '\n *libs found: %s' % BOOST_LIB_DIR |
| | 385 | env['BOOST_LIBS'] = BOOST_LIB_DIR |
| | 386 | else: |
| | 387 | env['BOOST_LIBS'] = '/usr' + LIBDIR_SCHEMA |
| | 388 | else: |
| | 389 | msg += '\n *using boost lib dir: %s' % env['BOOST_LIBS'] |
| | 390 | |
| | 391 | if not env['BOOST_INCLUDES']: |
| | 392 | if BOOST_INCLUDE_DIR: |
| | 393 | msg += '\n *headers found: %s' % BOOST_INCLUDE_DIR |
| | 394 | env['BOOST_INCLUDES'] = BOOST_INCLUDE_DIR |
| | 395 | else: |
| | 396 | env['BOOST_INCLUDES'] = '/usr/include' |
| | 397 | else: |
| | 398 | msg += '\n *using boost include dir: %s' % env['BOOST_INCLUDES'] |
| | 399 | |
| | 400 | if not env['BOOST_TOOLKIT'] and not env['BOOST_ABI'] and not env['BOOST_VERSION']: |
| | 401 | if BOOST_APPEND: |
| | 402 | msg += '\n *lib naming extension found: %s' % BOOST_APPEND |
| | 403 | env['BOOST_APPEND'] = '-' + BOOST_APPEND |
| | 404 | else: |
| | 405 | msg += '\n *no lib naming extension found' |
| | 406 | else: |
| | 407 | # Creating BOOST_APPEND according to the Boost library naming order, |
| | 408 | # which goes <toolset>-<threading>-<abi>-<version>. See: |
| | 409 | # http://www.boost.org/doc/libs/1_35_0/more/getting_started/unix-variants.html#library-naming |
| | 410 | append_params = [''] |
| | 411 | if env['BOOST_TOOLKIT']: append_params.append(env['BOOST_TOOLKIT']) |
| | 412 | if thread_flag: append_params.append(thread_flag) |
| | 413 | if env['BOOST_ABI']: append_params.append(env['BOOST_ABI']) |
| | 414 | if env['BOOST_VERSION']: append_params.append(env['BOOST_VERSION']) |
| | 415 | |
| | 416 | # Constructing the BOOST_APPEND setting that will be used to find the |
| | 417 | # Boost libraries. |
| | 418 | if len(append_params) > 1: |
| | 419 | env['BOOST_APPEND'] = '-'.join(append_params) |
| | 420 | msg += '\n *using boost lib naming: %s' % env['BOOST_APPEND'] |
| | 421 | |
| | 422 | env.AppendUnique(CPPPATH = env['BOOST_INCLUDES']) |
| | 423 | env.AppendUnique(LIBPATH = env['BOOST_LIBS']) |
| | 424 | if env['COLOR_PRINT']: |
| | 425 | msg = "\033[94m%s\033[0m" % (msg) |
| | 426 | ret = context.Result(msg) |
| | 427 | return ret |
| | 428 | |
| | 648 | |
| | 649 | for libinfo in LIBSHEADERS: |
| | 650 | if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], libinfo[3]): |
| | 651 | if libinfo[2]: |
| | 652 | color_print (1,'Could not find required header or shared library for %s' % libinfo[0]) |
| | 653 | env['MISSING_DEPS'].append(libinfo[0]) |
| | 654 | else: |
| | 655 | color_print(4,'Could not find optional header or shared library for %s' % libinfo[0]) |
| | 656 | env['SKIPPED_DEPS'].append(libinfo[0]) |
| | 657 | |
| | 658 | if env['THREADING'] == 'multi': |
| | 659 | thread_flag = thread_suffix |
| | 660 | else: |
| | 661 | thread_flag = '' |
| | 662 | |
| | 663 | conf.FindBoost(BOOST_SEARCH_PREFIXES) |
| | 664 | |
| 592 | | thread_flag = thread_suffix |
| 593 | | else: |
| 594 | | thread_flag = '' |
| 595 | | |
| 596 | | for libinfo in LIBSHEADERS: |
| 597 | | if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], libinfo[3]): |
| 598 | | if libinfo[2]: |
| 599 | | color_print (1,'Could not find required header or shared library for %s' % libinfo[0]) |
| 600 | | env['MISSING_DEPS'].append(libinfo[0]) |
| 601 | | else: |
| 602 | | color_print(4,'Could not find optional header or shared library for %s' % libinfo[0]) |
| 603 | | env['SKIPPED_DEPS'].append(libinfo[0]) |
| 604 | | |
| 605 | | # Creating BOOST_APPEND according to the Boost library naming order, |
| 606 | | # which goes <toolset>-<threading>-<abi>-<version>. See: |
| 607 | | # http://www.boost.org/doc/libs/1_35_0/more/getting_started/unix-variants.html#library-naming |
| 608 | | append_params = [''] |
| 609 | | if env['BOOST_TOOLKIT']: append_params.append(env['BOOST_TOOLKIT']) |
| 610 | | if thread_flag: append_params.append(thread_flag) |
| 611 | | if env['BOOST_ABI']: append_params.append(env['BOOST_ABI']) |
| 612 | | if env['BOOST_VERSION']: append_params.append(env['BOOST_VERSION']) |
| 613 | | |
| | 689 | |