Skip to content
Snippets Groups Projects
Commit f4f630e7 authored by Campbell Barton's avatar Campbell Barton
Browse files

Menu item to update the Blender project file

parent 90e20019
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
"""
This is just a wrapper to run Blender's QtCreator project file generator,
knowing only the CMake build path.
qtc_project_update.py <project_path>
"""
import sys
import os
PROJECT_DIR = sys.argv[-1]
def cmake_find_source(path):
import re
match = re.compile(r"^CMAKE_HOME_DIRECTORY\b")
cache = os.path.join(path, "CMakeCache.txt")
with open(cache, 'r', encoding='utf-8') as f:
for l in f:
if re.match(match, l):
return l[l.index("=") + 1:].strip()
return ""
SOURCE_DIR = cmake_find_source(PROJECT_DIR)
cmd = (
"python",
os.path.join(SOURCE_DIR, "build_files/cmake/cmake_qtcreator_project.py"),
PROJECT_DIR,
)
print(cmd)
os.system(" ".join(cmd))
<?xml version="1.0" encoding="UTF-8"?>
<externaltool id="qtc_project_update">
<description>Regenerate the project file</description>
<displayname>Project File Regenerate</displayname>
<category>Project</category>
<executable output="showinpane" error="showinpane" modifiesdocument="no">
<path>qtc_project_update.py</path>
<arguments>%{CurrentProject:BuildPath}</arguments>
</executable>
</externaltool>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment