4 # ***** BEGIN GPL LICENSE BLOCK *****
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # Contributor(s): Campbell Barton, M.G. Kishalmi
22 # ***** END GPL LICENSE BLOCK *****
28 c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build
31 python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
34 from project_info import (SIMPLE_PROJECTFILE,
43 cmake_compiler_defines,
50 def create_qtc_project_main():
51 files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
52 files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
55 # --- qtcreator specific, simple format
56 if SIMPLE_PROJECTFILE:
57 # --- qtcreator specific, simple format
58 PROJECT_NAME = "Blender"
59 f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w')
60 f.write("\n".join(files_rel))
62 f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w')
63 f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f))))))
65 qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
66 f = open(qtc_prj, 'w')
67 f.write("[General]\n")
69 qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
70 if not os.path.exists(qtc_cfg):
71 f = open(qtc_cfg, 'w')
72 f.write("// ADD PREDEFINED MACROS HERE!\n")
74 includes, defines = cmake_advanced_info()
76 # for some reason it doesnt give all internal includes
77 includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f)))
80 PROJECT_NAME = "Blender"
81 FILE_NAME = PROJECT_NAME.lower()
82 f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
83 f.write("\n".join(files_rel))
85 f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w')
86 f.write("\n".join(sorted(includes)))
88 qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
89 f = open(qtc_prj, 'w')
90 f.write("[General]\n")
92 qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
93 f = open(qtc_cfg, 'w')
94 f.write("// ADD PREDEFINED MACROS HERE!\n")
95 defines_final = [("#define %s %s" % item) for item in defines]
96 if sys.platform != "win32":
97 defines_final += cmake_compiler_defines() # defines from the compiler
98 f.write("\n".join(defines_final))
100 print("Blender project file written to: %s" % qtc_prj)
104 def create_qtc_project_python():
105 files = list(source_list(SOURCE_DIR, filename_check=is_py))
106 files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
109 # --- qtcreator specific, simple format
110 PROJECT_NAME = "Blender_Python"
111 FILE_NAME = PROJECT_NAME.lower()
112 f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
113 f.write("\n".join(files_rel))
115 qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
116 f = open(qtc_prj, 'w')
117 f.write("[General]\n")
119 qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
120 if not os.path.exists(qtc_cfg):
121 f = open(qtc_cfg, 'w')
122 f.write("// ADD PREDEFINED MACROS HERE!\n")
124 print("Python project file written to: %s" % qtc_prj)
128 create_qtc_project_main()
129 create_qtc_project_python()
132 if __name__ == "__main__":