|
8 | 8 |
|
9 | 9 | DEFAULT_INCLUDE_DIR = sysconfig.get_config_var("INCLUDEDIR")
|
10 | 10 | DEFAULT_LIB_DIR = sysconfig.get_config_var("LIBDIR")
|
| 11 | +BUILD_TYPES = ( |
| 12 | + "debug", |
| 13 | + "default", |
| 14 | + "optimized", |
| 15 | + "release", |
| 16 | + "relwithdebinfo", |
| 17 | + "minsizerel", |
| 18 | +) |
11 | 19 |
|
12 | 20 |
|
13 | 21 | def find_ns3_lock() -> str:
|
@@ -313,14 +321,7 @@ def filter_module_name(library: str) -> str:
|
313 | 321 | components.pop(0)
|
314 | 322 |
|
315 | 323 | # Drop build profile suffix and test libraries
|
316 |
| - if components[-1] in [ |
317 |
| - "debug", |
318 |
| - "default", |
319 |
| - "optimized", |
320 |
| - "release", |
321 |
| - "relwithdebinfo", |
322 |
| - "minsizerel", |
323 |
| - ]: |
| 324 | + if components[-1] in BUILD_TYPES: |
324 | 325 | components.pop(-1)
|
325 | 326 | return "-".join(components)
|
326 | 327 |
|
@@ -521,12 +522,22 @@ def dependency_order(
|
521 | 522 | if os.path.isdir(linked_lib_include_dir):
|
522 | 523 | cppyy.add_include_path(linked_lib_include_dir)
|
523 | 524 |
|
524 |
| - for module in modules: |
525 |
| - cppyy.include(f"ns3/{module}-module.h") |
| 525 | + # Get build type |
| 526 | + build_type = "" # release |
| 527 | + for type in BUILD_TYPES: |
| 528 | + if type in libraries_to_load[-1]: |
| 529 | + build_type = type |
526 | 530 |
|
527 |
| - # After including all headers, we finally load the modules |
| 531 | + # Load a module, then its module header |
528 | 532 | for library in libraries_to_load:
|
529 | 533 | cppyy.load_library(library)
|
| 534 | + for module in modules: |
| 535 | + library_name_from_module = ( |
| 536 | + f"{version}-{module}{'-' if len(build_type)>0 else ''}{build_type}" |
| 537 | + ) |
| 538 | + if library_name_from_module in library: |
| 539 | + cppyy.include(f"ns3/{module}-module.h") |
| 540 | + break |
530 | 541 |
|
531 | 542 | # We expose cppyy to consumers of this module as ns.cppyy
|
532 | 543 | setattr(cppyy.gbl.ns3, "cppyy", cppyy)
|
|
0 commit comments