Rendering Engine 0.2.17
Modular Graphics Rendering Engine | v0.2.17
Loading...
Searching...
No Matches
create_project Namespace Reference

Functions

 create_project (name, destination=DEST_ROOT)
 

Variables

 TEMPLATE_ROOT = os.path.join("RenderingEngine", "Scripts", "Templates")
 
 DEST_ROOT = os.path.join("UserApplications")
 
int destination = 3 else DEST_ROOT
 

Function Documentation

◆ create_project()

create_project.create_project (   name,
  destination = DEST_ROOT 
)
@brief Create a new Rendering Engine user application.

Generates the project folder structure and copies template files.
Projects created in the default UserApplications directory are
automatically registered in UserApplications/CMakeLists.txt.

@param name         Name of the project to create.
@param destination  Directory in which the project will be created.

Definition at line 65 of file create_project.py.

65def create_project(name, destination=DEST_ROOT):
66 """
67 @brief Create a new Rendering Engine user application.
68
69 Generates the project folder structure and copies template files.
70 Projects created in the default UserApplications directory are
71 automatically registered in UserApplications/CMakeLists.txt.
72
73 @param name Name of the project to create.
74 @param destination Directory in which the project will be created.
75 """
76 destination = os.path.abspath(destination)
77 default_destination = os.path.abspath(DEST_ROOT)
78 project_dir = os.path.join(destination, name)
79
80 if os.path.exists(project_dir):
81 print(f"Error: Project '{name}' already exists at '{project_dir}'.")
82 return
83
84 os.makedirs(project_dir)
85 copy_template(TEMPLATE_ROOT, project_dir, name)
86
87 if destination == default_destination:
88 file_path = os.path.join(default_destination, "CMakeLists.txt")
89 cmake_add_project = "\n" + "add_subdirectory(" + name + ")"
90
91 with open(file_path, "a") as cmake_file:
92 cmake_file.write(cmake_add_project)
93 else:
94 if not register_project(project_dir):
95 print(
96 f"Warning: Project '{name}' was created successfully, "
97 "but could not be registered."
98 )
99 return
100
101 print(f"Created new project at {project_dir}")
102

Variable Documentation

◆ DEST_ROOT

create_project.DEST_ROOT = os.path.join("UserApplications")

Definition at line 35 of file create_project.py.

◆ destination

int create_project.destination = 3 else DEST_ROOT

Definition at line 107 of file create_project.py.

◆ TEMPLATE_ROOT

create_project.TEMPLATE_ROOT = os.path.join("RenderingEngine", "Scripts", "Templates")

Definition at line 34 of file create_project.py.