r/cpp_questions • u/Suspicious-Grade-826 • 11m ago
OPEN How to create project templates
Hi, I don't know if this is the right subreddit but I was wondering if anyone would be able to tell me if this is possible, and, if so, to give a step by step guide to how I could do it (I know it might involve extensions):
- I am on Linux fedora, and lets say I have a completely fresh vscode install
- I want to have a template I can easily access via ideally pressing a button on the left side panel or something like that
- When creating a new project with this template, it should ask you for a directory of where to store the project and a name for it - this name should then be used as the folder name for the project in that directory
- This project should be C++23, use UTF-8 encoding, and support all the features of C++23, such as modules, and include the standard module - this should all work with IntelliSense (or if vscode uses something different) "knowing" this
- In the project, there should be 4 folders (like Visual Studio) - External Dependencies, Header Files, Resource Files, and Source Files. This is just for sorting my files but actually doesn't matter what I put where - the project acts as if everything is just in one folder, unorganised. In Source Files, by default there should be a file named main.cpp, which should be completely blank - not even int main() etc.
- When compiling, I would like it to be compiled as an appImage file (where the name of the file is the project name, or the name of this file can be changed) (I hear appImage can run on pretty much any Linux distro - that's why), which, despite being my OS being pretty much the newest and updated fedora, is compiled as if I compiled it on the oldest version of fedora that my project would actually compile on (I hear Linux applications are backwards compatible but not forwards)
- Also, when running, I should have the option to choose Debug or Release, and x64 or x86 (the defaults being Debug and x64). Then, in the project folder, a folder called "Dist" should be made, inside that "x64" and "x86" (only if ran/compiled for both), and inside each of them "Debug" and "Release" (only if ran/compiled), and inside them their respective versions of the appImage (only if ran/compiled, and should still just be named project_name.appImage (unless renamed)
Thanks to any help any of you can give, it is greatly appreciated - also, please can you tell me where things are that I haven't stated, e.g. where to change the name of the final appImage, where to change Debug or Release and x64 and x86.