Files
openidea/generators/cpp.toml
T
l0ng-ai 605d5f4985 feat(new-project): project generators for mainstream languages and frameworks (#2689)
File › New Project offers 38 generators grouped by language (Java, Spring Boot, Quarkus, Micronaut, Kotlin, Ktor, Scala, Python/Django/FastAPI/Flask, Node/Vite/Next.js/Nuxt/Angular/SvelteKit/Astro/NestJS/Express, Go, Rust, C/C++, Zig, .NET, PHP/Laravel/Symfony, Ruby/Rails, Dart/Flutter, Swift, Elixir/Phoenix, Haskell, static website, empty). Each is a declaration in generators/<id>.toml run by the new ide-scaffold crate: built-in templates, the framework's official CLI run non-interactively, or a project service zip (Spring Initializr, code.quarkus.io, Micronaut Launch) whose metadata becomes form fields. Projects are built in a staging directory and moved into place only on success. The dialog renders each form from its schema, flags missing toolchains with install hints and streams progress; created projects open trusted. New Project is also on the welcome screen and the title bar project menu.

Closes #709
2026-11-11 17:22:57 +08:00

89 lines
1.5 KiB
TOML

id = "cpp"
name = "C/C++"
group = "C/C++"
icon = "project-cpp"
description = "A CMake executable in C or C++."
[[fields]]
id = "lang"
label = "Language:"
type = "choice"
segmented = true
options = [{ value = "cpp", label = "C++" }, { value = "c", label = "C" }]
default = "cpp"
[[fields]]
id = "cxx"
label = "C++ standard:"
type = "choice"
options = ["23", "20", "17", "14"]
default = "20"
visible = { lang = "cpp" }
[[fields]]
id = "cstd"
label = "C standard:"
type = "choice"
options = ["23", "17", "11", "99"]
default = "17"
visible = { lang = "c" }
[[files]]
path = "CMakeLists.txt"
when = { lang = "cpp" }
content = '''
cmake_minimum_required(VERSION 3.20)
project({{name|snake}} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD {{cxx}})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable({{name|snake}} src/main.cpp)
'''
[[files]]
path = "src/main.cpp"
when = { lang = "cpp" }
content = '''
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
'''
[[files]]
path = "CMakeLists.txt"
when = { lang = "c" }
content = '''
cmake_minimum_required(VERSION 3.20)
project({{name|snake}} LANGUAGES C)
set(CMAKE_C_STANDARD {{cstd}})
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable({{name|snake}} src/main.c)
'''
[[files]]
path = "src/main.c"
when = { lang = "c" }
content = '''
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}
'''
[[files]]
path = ".gitignore"
content = '''
build/
cmake-build-*/
'''