Fixed project template naming issues

This commit is contained in:
Bobby Youstra 2021-07-25 16:17:11 -07:00
parent ca5df9b4f8
commit 77510a259c
No known key found for this signature in database
GPG Key ID: 46665F9BA88E45C5
2 changed files with 9 additions and 9 deletions

View File

@ -37,8 +37,6 @@ def main():
os.makedirs(os.path.join(project_dir, "cmake"), exist_ok=False)
os.makedirs(os.path.join(project_dir, "src"), exist_ok=False)
except OSError as e:
raise e
print(f"Found existing Morpheus directory structure under {project_dir}!\n"
f"Not overwriting files and aborting...", file=sys.stderr)
@ -71,11 +69,13 @@ def main():
cmake_file_contents = cmake_file.read()
with open(os.path.join(project_dir, "CMakeLists.txt"), 'w') as cmake_file:
cmake_file.write(cmake_file_contents.\
replace("set(PROJECT_NAME \"Project Template Name\")",
f"set(PROJECT_NAME \"{new_project_name}\")").\
replace("set(MORPHEUS_DIR \"\")",
f"set(MORPHEUS_DIR \"{os.path.abspath(morpheus_dir).replace("\", "\/")})"))
morpheus_dir = os.path.abspath(morpheus_dir).replace(os.sep, "/")
cmake_file.write(cmake_file_contents. \
replace("set(PROJECT_NAME \"Project Template Name\")",
f"set(PROJECT_NAME \"{new_project_name}\")"). \
replace("set(MORPHEUS_DIR \"\")",
f"set(MORPHEUS_DIR \"{morpheus_dir}\")"))
print(f"Morpheus project {new_project_name} successfully created at {project_dir}!")
else:
@ -87,4 +87,4 @@ def main():
if __name__ == "__main__":
main()
main()

View File

@ -8,7 +8,7 @@ include("cmake/morpheus_build_utils.cmake")
## Project-dependent variables
## ---------------------------
set(PROJECT_NAME "TestProject")
set(PROJECT_NAME "Project Template Name")
set(MAIN_SRC_FILES src/main.cpp)