|
14 | 14 | import logging as log
|
15 | 15 | from fnmatch import fnmatchcase
|
16 | 16 | from pathlib import Path
|
17 |
| -from shutil import copyfile, rmtree |
| 17 | +from shutil import copyfile, rmtree, move |
18 | 18 | from setuptools import setup, find_namespace_packages, Extension, Command
|
19 | 19 | from setuptools.command.build_ext import build_ext
|
20 | 20 | from setuptools.command.build_clib import build_clib
|
|
175 | 175 | DATA_INSTALL_CFG = {
|
176 | 176 | "core_dev": {
|
177 | 177 | "name": "core_dev",
|
178 |
| - "prefix": f"{BUILD_BASE}/libs.dev", |
| 178 | + "prefix": f"{BUILD_BASE}/libs.core.dev", |
| 179 | + "install_dir": "runtime", |
| 180 | + "binary_dir": OPENVINO_BINARY_DIR, |
| 181 | + "source_dir": OPENVINO_SOURCE_DIR |
| 182 | + }, |
| 183 | + "core_c_dev": { |
| 184 | + "name": "core_c_dev", |
| 185 | + "prefix": f"{BUILD_BASE}/libs.core_c.dev", |
179 | 186 | "install_dir": "runtime",
|
180 | 187 | "binary_dir": OPENVINO_BINARY_DIR,
|
181 | 188 | "source_dir": OPENVINO_SOURCE_DIR
|
@@ -422,7 +429,7 @@ def copy_package_libs(self, src_dirs):
|
422 | 429 | for src_dir in src_dirs:
|
423 | 430 | # additional blacklist filter, just to fix cmake install issues
|
424 | 431 | blacklist_patterns = [ # static libraries and PBD files
|
425 |
| - "^.*\\.a$", "^.*\\.lib$", "^.*\\.pdb$", |
| 432 | + "^.*\\.a$", "^.*\\.pdb$", |
426 | 433 | # TBB debug libraries
|
427 | 434 | "^.*_debug\\.dll$", "^.*_debug\\.\\d*\\.dylib$", "^.*_debug\\.so\\.\\d*$",
|
428 | 435 | # hwloc static libs on Windows
|
@@ -453,24 +460,37 @@ def copy_package_data(self, src_dirs):
|
453 | 460 | """Collect package data files from preinstalled dirs and put to the subpackage."""
|
454 | 461 | package_dir = os.path.join(PACKAGE_DIR, WHEEL_PACKAGE_DIR)
|
455 | 462 | os.makedirs(package_dir, exist_ok=True)
|
| 463 | + package_clibs_dir = os.path.join(PACKAGE_DIR, WHEEL_LIBS_INSTALL_DIR) |
| 464 | + os.makedirs(package_clibs_dir, exist_ok=True) |
456 | 465 |
|
457 | 466 | replacements = {
|
458 | 467 | # change the path where the libraries are installed (runtime/lib/intel64/Release -> openvino/libs)
|
459 |
| - f"{OV_RUNTIME_LIBS_DIR}": f"{WHEEL_LIBS_INSTALL_DIR}", |
| 468 | + r"({_IMPORT_PREFIX})\/(.*)\/(.*.[lib|dylib|so|dll])": rf"\1/{WHEEL_LIBS_INSTALL_DIR}/\3", |
460 | 469 | # change the path where the include files are installed (runtime/include -> openvino/include)
|
461 | 470 | r"({_IMPORT_PREFIX})\/(.*)\/(include)": rf"\1/{WHEEL_PACKAGE_DIR}/\3",
|
462 |
| - # changed the lib version (2024.3.0 -> 2430) |
463 |
| - r"(.so).(\d\d)(\d\d).(\d+).(\d+)": r"\1.\3\4\5" |
| 471 | + # change the libs versions (so.2024.3.0 -> so.2430 or 2024.3.0.dylib -> 2430.dylib) |
| 472 | + r"(.so)?.(\d\d)(\d\d).(\d+).(\d+)(.dylib)?": r"\1.\3\4\5\6", |
464 | 473 | }
|
465 | 474 |
|
466 | 475 | for src_dir in src_dirs:
|
467 | 476 | src, dst = Path(src_dir), Path(package_dir)
|
468 |
| - shutil.copytree(src, dst, dirs_exist_ok=True) |
469 | 477 |
|
470 |
| - # patch cmake configurations |
471 |
| - for file_path in Path(dst).rglob("*.cmake"): |
| 478 | + # move the static libs to the directory with the shared libraries |
| 479 | + for file_path in Path(src).rglob("*.lib"): |
| 480 | + file_name = os.path.basename(file_path) |
472 | 481 | if file_path.is_file():
|
473 |
| - replace_strings_in_file(file_path, replacements) |
| 482 | + dst_file = os.path.join(package_clibs_dir, file_name) |
| 483 | + move(file_path, dst_file) |
| 484 | + self.announce(f"Move {file_path} to {dst_file}", level=3) |
| 485 | + |
| 486 | + if os.path.isdir(src) and os.listdir(src): |
| 487 | + # copy the rest of the files to the package directly |
| 488 | + shutil.copytree(src, dst, dirs_exist_ok=True) |
| 489 | + |
| 490 | + # patch cmake configurations |
| 491 | + for file_path in Path(dst).rglob("*.cmake"): |
| 492 | + if file_path.is_file(): |
| 493 | + replace_strings_in_file(file_path, replacements) |
474 | 494 |
|
475 | 495 |
|
476 | 496 | def copy_file(src, dst, verbose=False, dry_run=False):
|
|
0 commit comments