# -*- coding: UTF-8 -*-
# 根据vcxproj生成cmake文件,便于linux下程序编译
import os
import sys
import xml.etree.ElementTree as ET
import codecs
import re
class cmake_tool(object):
def __init__(self):
self.clear()
def clear(self):
self.include_directories = []
self.link_directories = []
self.compile_files = []
self.definitions = "-D__LINUX__ -D__LINUX64"
self.project = ""
self.root = None # xml parse
self.namespace = ""
self.projectpath = ""
self.link_libs = ""
def find_item_group(self, DefinitionType='Debug|x64'):
groups = self.root.findall('ItemDefinitionGroup')
item_group = None
for group in groups:
if item_group:
break
for k, v in group.attrib.items():
if DefinitionType in v:
item_group = group
break
return item_group
def get_include_directories(self, item_group):
include_directories_item = item_group.find(
"ClCompile/AdditionalIncludeDirectories")
if include_directories_item is None:
return
VS跨平台编译-根据vcxproj生成cmake文件
最新推荐文章于 2024-07-17 09:38:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)