fix(linker): include 模块自动扫描支持 .no_autobuild 标记与构建目录排除
- _scan_dir_for_libs:模块目录含 .no_autobuild 时跳过 C 源编译与库文件自动发现 - 递归时跳过 build/cmake-build*/.git/__pycache__/. 开头目录 - 防止 fltk 等内嵌完整第三方源码的 include 模块被误编译
This commit is contained in:
1 parent
e33792a9ad
commit
5ba5fb5ff3
1 file changed
+15
-1
@@ -2263,8 +2263,22 @@ class Phase2Translator:
|
||||
_vlog().info(f"[includes] 需要编译的源文件: {len(self.extra_compile_files)} 个")
|
||||
|
||||
def _scan_dir_for_libs(self, directory: str, module_name: str) -> None:
|
||||
"""递归扫描目录中的库文件和源文件"""
|
||||
"""递归扫描目录中的库文件和源文件
|
||||
|
||||
模块目录含 `.no_autobuild` 标记时直接跳过:该模块的 C/C++ 源码
|
||||
与库文件由 project.vpj linker.static_libs 显式链接(如 fltk 内嵌
|
||||
完整 FLTK/C 源码树,避免误编译整个第三方库)。递归时跳过常见
|
||||
构建/缓存目录(build、cmake-build*、.git、__pycache__、. 开头)。
|
||||
"""
|
||||
if _CachedIsFile(os.path.join(directory, '.no_autobuild')):
|
||||
return
|
||||
for root, dirs, files in os.walk(directory):
|
||||
dirs[:] = [
|
||||
d for d in dirs
|
||||
if d not in ('.git', '__pycache__', 'build', 'cmake-build')
|
||||
and not d.startswith('cmake-build-')
|
||||
and not d.startswith('.')
|
||||
]
|
||||
for fname in files:
|
||||
fpath = os.path.join(root, fname)
|
||||
_, ext = os.path.splitext(fname)
|
||||
|
||||
Reference in new issue
Block a user