CGAL 获取相关功能的依赖头文件
CGAL 获取相关功能的依赖头文件
由于CGAL是header include only。只需要头文件就可以实现相关的功能。有时候为了实现一个简单的功能, 在研究具体实现的时候能够知道这个功能对应的头文件有哪些,就可以大概知道涉及到了哪些模块,可以从哪几个地方入手进行深入学习。于是此处给处理基于python,头文件依赖获取的示例脚本,如下:
import os
import re
# Parameters
include_paths = [
"C:/dev/CGAL-5.0.2/include/"
]
root_file = "./test.cpp"
out_file = "./out.txt"
# Global variables
include_patterns = [
re.compile(r'.*#include.*<(.*)>.*'),
re.compile(r'.*#include.*"(.*)"')
]
all_dependent_files = []
def get_all_include_in_one_file(filename):
print(filename)
if filename in all_dependent_files:
return []
all_dependent_files.append(filename)
dependent_files = []
with open(filename, 'r', encoding='utf8') as fid:
for line in fid:
line = line.strip()
if line.find("#include") == -1:
continue
include_file = ""
for pattern in include_patterns:
match = pattern.match(line)
if match:
include_file = match.group(1)
break
if include_file == "":
continue
dependent_files.append(include_file)
return dependent_files
def parse_header_files(filename):
dependent_files = get_all_include_in_one_file(filename)
if len(dependent_files) == 0:
return
for include_file in dependent_files:
for include_path in include_paths:
parse_file = os.path.join(include_path, include_file)
if not os.path.isfile(parse_file):
print(parse_file + " is not file")
else:
parse_header_files(parse_file)
parse_header_files(root_file)
with open(out_file, 'w', encoding="utf8") as fid:
for line in all_dependent_files:
fid.write(line + "\n")
CGAL 获取相关功能的依赖头文件的更多相关文章
- cocos2d-x 扩充引擎基类功能 引起的头文件重复包含问题的分析
c++ 头文件包含 原因的分析: c++ 头文件的循环引用是指: .h 里面的里面的头文件的相互包含的,引起的重复引用的问题.cpp 里面包含头文件是不存在重复引用的问题(因为CPP没有#ifn ...
- Makefile目标,伪目标,头文件自动依赖
目标 即我们最终要生成的文件,make默认生成第一个目标,注意 makefile中tab和空格不是一回事,规则使用tab缩进,编辑器不要设置诸如"将tab替换为空格之类的选项",目 ...
- linux 内核头文件 linux kernel header
概述:在进行有关系统软件的安装的时候(编译一个新的驱动,或者安装一个系统级别的测试工具,例如systemtap),经常需要重新编译内核,相应的问题往往与内核头文件有关.那么,什么是内核头文件,为什么需 ...
- [CMake笔记] CMake向解决方案添加源文件兼头文件
回顾 在上一篇笔记里总结的时候说到,aux_source_directory这个函数在添加源码文件时,是不会把头文件添加进去的,这里就介经一下另外一个方法,也是我一直使用的. 添加文件*.cpp与*. ...
- 转:IOS:查找SDK路径和Framework头文件
通过Terminal进入Xcode.app所在目录,可以找到相应的SDK路径,相关 的Framework的头文件也在改目录下. 示例如下: Frameworks /Applications/xcode ...
- Golang使用pkg-config自动获取头文件和链接库的方法
为了能够重用已有的C语言库,我们在使用Golang开发项目或系统的时候难免会遇到Go和C语言混合编程,这时很多人都会选择使用cgo. 话说cgo这个东西可算得上是让人又爱又恨,好处在于它可以让你快速重 ...
- 字节顺序重置及“#include <algorith.h>”相关的STL最重要的头文件提醒
这两天在写一个程序,需要将二进制文件中的数据以指定结构读入内存,说明文档中有提到大端序和小端序(Big Endian or Little Endian) 的概念,就找了一下字节顺序重置的算法,在一篇名 ...
- Makefile自动生成头文件依赖
前言 Makefile自动生成头文件依赖是很常用的功能,本文的目的是想尽量详细说明其中的原理和过程. Makefile模板 首先给出一个本人在小项目中常用的Makefile模板,支持自动生成头文件依赖 ...
- C++11 多线程相关的头文件
C++11 新标准中引入了四个头文件来支持多线程编程,他们分别是<atomic> ,<thread>,<mutex>,<condition_variable& ...
随机推荐
- JSONObject转换为map
http://cloudyxuq.iteye.com/blog/1618213 private static HashMap<String, String> toHashMap(Objec ...
- 【linux】linux下java环境安装
1:下载jdk的包,通过ftp传到服务器 2:解压 tar zxvf jdk-8u181-linux-x64.tar.gz 3:环境配置 编辑配置文件: vim /etc/profile 在文件下插入 ...
- codeforce 436 D贪心思维题Make a Permutation!
D. Make a Permutation! time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- 【MySQL】详细说下MySQL删除数据的过程是什么样的?
drop table 这里先介绍一下[InnoDB]存储表空间概念: Innodb存储引擎,可将所有的数据库数据存放于[ibdata1]的共享表空间:也可以将每张表存放于独立的.idb文件的独立表空间 ...
- 27-1 分组-having
group by select * from TblStudent --1.请从学生表中查询出每个班的班级id和班级人数 select tsclassId as 班级id, 班级人数=count(*) ...
- 21-8 数据检索2 top和distinct
--distinct关键字,根据已经查询出的结果然后去除重复 select distinct * from TblStudent --Top(一般会配合order by一起使用) ---------- ...
- 【百度网盘活动】扩容2T+7天会员
https://pan.baidu.com/component/view?id=455 https://pan.baidu.com/union/smartProgramShare?scheme=bdn ...
- 【python爬虫】scrapy入门7:Scrapy中runspider和crawl的区别
runspider:不依赖创建项目 命令:scrapy runspider myspider.py 等同于 pyhton myspider.py crawl:使用spider进行爬取,依赖项目创建 ...
- 通用css 常用
复选框自定义样式input[type="checkbox"] { position: relative; width: 0.75rem; height: 0.75rem; back ...
- Object类及其equals()方法
== : 1.基本数据类型:根据基本数据类型的值判断是否相等,相等返回true,反之返回false 注意:两端数据类型可以不同, 在不同的情况下,也可以返回true 2.引用数据类型:Object ...