def create_qtc_project_python(): files = list(source_list(SOURCE_DIR, filename_check=is_py)) files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format if 0: PROJECT_NAME = "Blender_Python" else: # be tricky, get the project name from SVN if we can! PROJECT_NAME = project_name_get(SOURCE_DIR) + "_Python" FILE_NAME = PROJECT_NAME.lower() f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') f.write("\n".join(files_rel)) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) if not os.path.exists(qtc_cfg): f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") print("Python project file written to: %r" % qtc_prj)
def create_qtc_project_python(name): from project_info import ( SOURCE_DIR, # CMAKE_DIR, PROJECT_DIR, source_list, is_py, project_name_get, ) files = list(source_list(SOURCE_DIR, filename_check=is_py)) files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format # be tricky, get the project name from git if we can! PROJECT_NAME = (name or project_name_get()) + "_Python" FILE_NAME = PROJECT_NAME.lower() with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f: f.write("\n".join(files_rel)) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) with open(qtc_prj, 'w') as f: f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) if not os.path.exists(qtc_cfg): with open(qtc_cfg, 'w') as f: f.write("// ADD PREDEFINED MACROS HERE!\n") print("Python project file written to: %r" % qtc_prj)
def create_qtc_project_main(): files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format if SIMPLE_PROJECTFILE: # --- qtcreator specific, simple format PROJECT_NAME = "Blender" f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') f.write("\n".join(files_rel)) f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f)))))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME) if not os.path.exists(qtc_cfg): f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") else: includes, defines = cmake_advanced_info() # for some reason it doesnt give all internal includes includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f))) includes.sort() if 0: PROJECT_NAME = "Blender" else: # be tricky, get the project name from SVN if we can! PROJECT_NAME = project_name_get(SOURCE_DIR) FILE_NAME = PROJECT_NAME.lower() f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') f.write("\n".join(files_rel)) f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8') f.write("\n".join(sorted(includes))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines] if sys.platform != "win32": defines_final += cmake_compiler_defines() f.write("\n".join(defines_final)) print("Blender project file written to: %r" % qtc_prj)
def create_qtc_project_main(): files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format if SIMPLE_PROJECTFILE: # --- qtcreator specific, simple format PROJECT_NAME = "Blender" f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') f.write("\n".join(files_rel)) f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f)))))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME) if not os.path.exists(qtc_cfg): f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") else: includes, defines = cmake_advanced_info() # for some reason it doesnt give all internal includes includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f))) includes.sort() PROJECT_NAME = "Blender" FILE_NAME = PROJECT_NAME.lower() f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') f.write("\n".join(files_rel)) f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') f.write("\n".join(sorted(includes))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") defines_final = [("#define %s %s" % item) for item in defines] if sys.platform != "win32": defines_final += cmake_compiler_defines() # defines from the compiler f.write("\n".join(defines_final)) print("Blender project file written to: %s" % qtc_prj)
def create_nb_project_main(): from xml.sax.saxutils import escape files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) files_rel = [relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() if SIMPLE_PROJECTFILE: pass else: includes, defines = cmake_advanced_info() if (includes, defines) == (None, None): return # for some reason it doesn't give all internal includes includes = list( set(includes) | set(dirname(f) for f in files if is_c_header(f))) includes.sort() if 0: PROJECT_NAME = "Blender" else: # be tricky, get the project name from git if we can! PROJECT_NAME = project_name_get() make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM") make_exe_basename = os.path.basename(make_exe) # --------------- NB specific defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines] defines += [ cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines() ] def file_list_to_nested(files): # convert paths to hierarchy paths_nested = {} def ensure_path(filepath): filepath_split = filepath.split(os.sep) pn = paths_nested for subdir in filepath_split[:-1]: pn = pn.setdefault(subdir, {}) pn[filepath_split[-1]] = None for path in files: ensure_path(path) return paths_nested PROJECT_DIR_NB = join(PROJECT_DIR, "nbproject") if not exists(PROJECT_DIR_NB): os.mkdir(PROJECT_DIR_NB) # SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR) f = open(join(PROJECT_DIR_NB, "project.xml"), 'w') f.write('<?xml version="1.0" encoding="UTF-8"?>\n') f.write('<project xmlns="http://www.netbeans.org/ns/project/1">\n') f.write(' <type>org.netbeans.modules.cnd.makeproject</type>\n') f.write(' <configuration>\n') f.write( ' <data xmlns="http://www.netbeans.org/ns/make-project/1">\n' ) f.write(' <name>%s</name>\n' % PROJECT_NAME) f.write(' <c-extensions>c,m</c-extensions>\n') f.write(' <cpp-extensions>cpp,cxx,cc,mm</cpp-extensions>\n') f.write( ' <header-extensions>h,hxx,hh,hpp,inl</header-extensions>\n' ) f.write(' <sourceEncoding>UTF-8</sourceEncoding>\n') f.write(' <make-dep-projects/>\n') f.write(' <sourceRootList>\n') f.write(' <sourceRootElem>%s</sourceRootElem>\n' % SOURCE_DIR) # base_root_rel f.write(' </sourceRootList>\n') f.write(' <confList>\n') f.write(' <confElem>\n') f.write(' <name>Default</name>\n') f.write(' <type>0</type>\n') f.write(' </confElem>\n') f.write(' </confList>\n') f.write(' <formatting>\n') f.write( ' <project-formatting-style>false</project-formatting-style>\n' ) f.write(' </formatting>\n') f.write(' </data>\n') f.write(' </configuration>\n') f.write('</project>\n') f.close() f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w') f.write('<?xml version="1.0" encoding="UTF-8"?>\n') f.write('<configurationDescriptor version="95">\n') f.write( ' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n' ) f.write(' <df root="%s" name="0">\n' % SOURCE_DIR) # base_root_rel # write files! files_rel_local = [ normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel ] files_rel_hierarchy = file_list_to_nested(files_rel_local) # print(files_rel_hierarchy) def write_df(hdir, ident): dirs = [] files = [] for key, item in sorted(hdir.items()): if item is None: files.append(key) else: dirs.append((key, item)) for key, item in dirs: f.write('%s <df name="%s">\n' % (ident, key)) write_df(item, ident + " ") f.write('%s </df>\n' % ident) for key in files: f.write('%s<in>%s</in>\n' % (ident, key)) write_df(files_rel_hierarchy, ident=" ") f.write(' </df>\n') f.write(' <logicalFolder name="ExternalFiles"\n') f.write(' displayName="Important Files"\n') f.write(' projectFiles="false"\n') f.write(' kind="IMPORTANT_FILES_FOLDER">\n') # f.write(' <itemPath>../GNUmakefile</itemPath>\n') f.write(' </logicalFolder>\n') f.write(' </logicalFolder>\n') # default, but this dir is infact not in blender dir so we can ignore it # f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n') f.write( ' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n' ) f.write(' <sourceRootList>\n') f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel f.write(' </sourceRootList>\n') f.write(' <projectmakefile>Makefile</projectmakefile>\n') # paths again f.write(' <confs>\n') f.write(' <conf name="Default" type="0">\n') f.write(' <toolsSet>\n') f.write(' <compilerSet>default</compilerSet>\n') f.write(' <dependencyChecking>false</dependencyChecking>\n') f.write(' <rebuildPropChanged>false</rebuildPropChanged>\n') f.write(' </toolsSet>\n') f.write(' <codeAssistance>\n') f.write(' </codeAssistance>\n') f.write(' <makefileType>\n') f.write(' <makeTool>\n') f.write( ' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n') if make_exe_basename == "ninja": build_cmd = "ninja" clean_cmd = "ninja -t clean" else: build_cmd = "${MAKE} -f Makefile" clean_cmd = "${MAKE} -f Makefile clean" f.write(' <buildCommand>%s</buildCommand>\n' % escape(build_cmd)) f.write(' <cleanCommand>%s</cleanCommand>\n' % escape(clean_cmd)) f.write(' <executablePath>./bin/blender</executablePath>\n') del build_cmd, clean_cmd def write_toolinfo(): f.write(' <incDir>\n') for inc in includes: f.write(' <pElem>%s</pElem>\n' % inc) f.write(' </incDir>\n') f.write(' <preprocessorList>\n') for cdef in defines: f.write(' <Elem>%s</Elem>\n' % escape(cdef)) f.write(' </preprocessorList>\n') f.write(' <cTool>\n') write_toolinfo() f.write(' </cTool>\n') f.write(' <ccTool>\n') write_toolinfo() f.write(' </ccTool>\n') f.write(' </makeTool>\n') f.write(' </makefileType>\n') # finishe makefle info f.write(' \n') for path in files_rel_local: is_c = path.endswith(".c") f.write(' <item path="%s"\n' % path) f.write(' ex="false"\n') f.write(' tool="%d"\n' % (0 if is_c else 1)) f.write(' flavor2="%d">\n' % (3 if is_c else 0)) f.write(' </item>\n') f.write(' <runprofile version="9">\n') f.write(' <runcommandpicklist>\n') f.write(' </runcommandpicklist>\n') f.write(' <runcommand>%s</runcommand>\n' % os.path.join(CMAKE_DIR, "bin/blender")) f.write(' <rundir>%s</rundir>\n' % SOURCE_DIR) f.write(' <buildfirst>false</buildfirst>\n') f.write(' <terminal-type>0</terminal-type>\n') f.write(' <remove-instrumentation>0</remove-instrumentation>\n') f.write(' <environment>\n') f.write(' </environment>\n') f.write(' </runprofile>\n') f.write(' </conf>\n') f.write(' </confs>\n') # todo f.write('</configurationDescriptor>\n') f.close()
def create_qtc_project_main(name): from project_info import ( SIMPLE_PROJECTFILE, SOURCE_DIR, # CMAKE_DIR, PROJECT_DIR, source_list, is_project_file, is_c_header, cmake_advanced_info, cmake_compiler_defines, project_name_get, ) files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format if SIMPLE_PROJECTFILE: # --- qtcreator specific, simple format PROJECT_NAME = name or "Blender" FILE_NAME = PROJECT_NAME.lower() with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f: f.write("\n".join(files_rel)) with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') as f: f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f)))))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) with open(qtc_prj, 'w') as f: f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) if not os.path.exists(qtc_cfg): with open(qtc_cfg, 'w') as f: f.write("// ADD PREDEFINED MACROS HERE!\n") else: includes, defines = cmake_advanced_info() if (includes, defines) == (None, None): return # for some reason it doesn't give all internal includes includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f))) includes.sort() # be tricky, get the project name from CMake if we can! PROJECT_NAME = name or project_name_get() FILE_NAME = PROJECT_NAME.lower() with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f: f.write("\n".join(files_rel)) with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8') as f: f.write("\n".join(sorted(includes))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) with open(qtc_prj, 'w') as f: f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) with open(qtc_cfg, 'w') as f: f.write("// ADD PREDEFINED MACROS TO %s_custom.config!\n" % FILE_NAME) qtc_custom_cfg = os.path.join(PROJECT_DIR, "%s_custom.config" % FILE_NAME) if os.path.exists(qtc_custom_cfg): with open(qtc_custom_cfg, 'r') as fc: f.write(fc.read()) f.write("\n") defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines] if os.name != "nt": defines_final += cmake_compiler_defines() f.write("\n".join(defines_final)) print("Blender project file written to: %r" % qtc_prj)
def create_nb_project_main(): files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) files_rel = [relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() if SIMPLE_PROJECTFILE: pass else: includes, defines = cmake_advanced_info() if (includes, defines) == (None, None): return # for some reason it doesnt give all internal includes includes = list(set(includes) | set(dirname(f) for f in files if is_c_header(f))) includes.sort() if 0: PROJECT_NAME = "Blender" else: # be tricky, get the project name from git if we can! PROJECT_NAME = project_name_get() # --------------- NB spesific defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines] defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()] def file_list_to_nested(files): # convert paths to hierarchy paths_nested = {} def ensure_path(filepath): filepath_split = filepath.split(os.sep) pn = paths_nested for subdir in filepath_split[:-1]: pn = pn.setdefault(subdir, {}) pn[filepath_split[-1]] = None for path in files: ensure_path(path) return paths_nested PROJECT_DIR_NB = join(PROJECT_DIR, "nbproject") if not exists(PROJECT_DIR_NB): os.mkdir(PROJECT_DIR_NB) # SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR) f = open(join(PROJECT_DIR_NB, "project.xml"), 'w') f.write('<?xml version="1.0" encoding="UTF-8"?>\n') f.write('<project xmlns="http://www.netbeans.org/ns/project/1">\n') f.write(' <type>org.netbeans.modules.cnd.makeproject</type>\n') f.write(' <configuration>\n') f.write(' <data xmlns="http://www.netbeans.org/ns/make-project/1">\n') f.write(' <name>%s</name>\n' % PROJECT_NAME) f.write(' <c-extensions>c,m</c-extensions>\n') f.write(' <cpp-extensions>cpp,cxx,cc,mm</cpp-extensions>\n') f.write(' <header-extensions>h,hxx,hh,hpp,inl</header-extensions>\n') f.write(' <sourceEncoding>UTF-8</sourceEncoding>\n') f.write(' <make-dep-projects/>\n') f.write(' <sourceRootList>\n') f.write(' <sourceRootElem>%s</sourceRootElem>\n' % SOURCE_DIR) # base_root_rel f.write(' </sourceRootList>\n') f.write(' <confList>\n') f.write(' <confElem>\n') f.write(' <name>Default</name>\n') f.write(' <type>0</type>\n') f.write(' </confElem>\n') f.write(' </confList>\n') f.write(' <formatting>\n') f.write(' <project-formatting-style>false</project-formatting-style>\n') f.write(' </formatting>\n') f.write(' </data>\n') f.write(' </configuration>\n') f.write('</project>\n') f.close() f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w') f.write('<?xml version="1.0" encoding="UTF-8"?>\n') f.write('<configurationDescriptor version="94">\n') f.write(' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n') f.write(' <df name="0" root="%s">\n' % SOURCE_DIR) # base_root_rel # write files! files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel] files_rel_hierarchy = file_list_to_nested(files_rel_local) # print(files_rel_hierarchy) def write_df(hdir, ident): dirs = [] files = [] for key, item in sorted(hdir.items()): if item is None: files.append(key) else: dirs.append((key, item)) for key, item in dirs: f.write('%s <df name="%s">\n' % (ident, key)) write_df(item, ident + " ") f.write('%s </df>\n' % ident) for key in files: f.write('%s<in>%s</in>\n' % (ident, key)) write_df(files_rel_hierarchy, ident=" ") f.write(' </df>\n') f.write(' <logicalFolder name="ExternalFiles"\n') f.write(' displayName="Important Files"\n') f.write(' projectFiles="false"\n') f.write(' kind="IMPORTANT_FILES_FOLDER">\n') # f.write(' <itemPath>../GNUmakefile</itemPath>\n') f.write(' </logicalFolder>\n') f.write(' </logicalFolder>\n') # default, but this dir is infact not in blender dir so we can ignore it # f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n') f.write(' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n') f.write(' <sourceRootList>\n') f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel f.write(' </sourceRootList>\n') f.write(' <projectmakefile>Makefile</projectmakefile>\n') # paths again f.write(' <confs>\n') f.write(' <conf name="Default" type="0">\n') f.write(' <toolsSet>\n') f.write(' <compilerSet>default</compilerSet>\n') f.write(' </toolsSet>\n') f.write(' <dependencyChecking>false</dependencyChecking>\n') f.write(' <rebuildPropChanged>false</rebuildPropChanged>\n') f.write(' <makefileType>\n') f.write(' <makeTool>\n') f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n') f.write(' <buildCommand>${MAKE} -f Makefile</buildCommand>\n') f.write(' <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>\n') f.write(' <executablePath>./bin/blender</executablePath>\n') def write_toolinfo(): f.write(' <incDir>\n') for inc in includes: f.write(' <pElem>%s</pElem>\n' % inc) f.write(' </incDir>\n') f.write(' <preprocessorList>\n') for cdef in defines: f.write(' <Elem>%s</Elem>\n' % cdef) f.write(' </preprocessorList>\n') f.write(' <cTool>\n') write_toolinfo() f.write(' </cTool>\n') f.write(' <ccTool>\n') write_toolinfo() f.write(' </ccTool>\n') f.write(' </makeTool>\n') f.write(' </makefileType>\n') # finishe makefle info f.write(' \n') for path in files_rel_local: f.write(' <item path="%s"\n' % path) f.write(' ex="false"\n') f.write(' tool="1"\n') f.write(' flavor2="0">\n') f.write(' </item>\n') f.write(' <runprofile version="9">\n') f.write(' <runcommandpicklist>\n') f.write(' </runcommandpicklist>\n') f.write(' <runcommand>%s</runcommand>\n' % os.path.join(CMAKE_DIR, "bin/blender")) f.write(' <rundir>%s</rundir>\n' % SOURCE_DIR) f.write(' <buildfirst>false</buildfirst>\n') f.write(' <terminal-type>0</terminal-type>\n') f.write(' <remove-instrumentation>0</remove-instrumentation>\n') f.write(' <environment>\n') f.write(' </environment>\n') f.write(' </runprofile>\n') f.write(' </conf>\n') f.write(' </confs>\n') # todo f.write('</configurationDescriptor>\n') f.close()
def create_qtc_project_main(): files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format if SIMPLE_PROJECTFILE: # --- qtcreator specific, simple format PROJECT_NAME = "Blender" f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') f.write("\n".join(files_rel)) f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') f.write("\n".join( sorted( list( set( os.path.dirname(f) for f in files_rel if is_c_header(f)))))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME) if not os.path.exists(qtc_cfg): f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") else: includes, defines = cmake_advanced_info() # for some reason it doesnt give all internal includes includes = list( set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f))) includes.sort() if 0: PROJECT_NAME = "Blender" else: # be tricky, get the project name from SVN if we can! PROJECT_NAME = project_name_get(SOURCE_DIR) FILE_NAME = PROJECT_NAME.lower() f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') f.write("\n".join(files_rel)) f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8') f.write("\n".join(sorted(includes))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS TO %s_custom.config!\n" % FILE_NAME) qtc_custom_cfg = os.path.join(PROJECT_DIR, "%s_custom.config" % FILE_NAME) if os.path.exists(qtc_custom_cfg): fc = open(qtc_custom_cfg, 'r') f.write(fc.read()) fc.close() f.write("\n") defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines] if sys.platform != "win32": defines_final += cmake_compiler_defines() f.write("\n".join(defines_final)) print("Blender project file written to: %r" % qtc_prj)