MCPcopy Create free account
hub / github.com/ClickHouse/ai-sdk-cpp / main

Function main

scripts/build.py:97–227  ·  view source on GitHub ↗

Build AI SDK C++ with modern tooling.

(mode: str, tests: bool, clean: bool, verbose: bool, export_compile_commands: bool, jobs: Optional[int])

Source from the content-addressed store, hash-verified

95 help="Number of parallel build jobs (default: CPU count)"
96)
97def main(mode: str, tests: bool, clean: bool, verbose: bool, export_compile_commands: bool, jobs: Optional[int]):
98 """Build AI SDK C++ with modern tooling."""
99
100 # Get project paths
101 script_dir = Path(__file__).parent
102 project_root = script_dir.parent
103 build_dir = project_root / "build"
104
105 # Display build configuration
106 config_table = Table(title="Build Configuration", show_header=True, header_style="bold blue")
107 config_table.add_column("Setting", style="cyan")
108 config_table.add_column("Value", style="green")
109
110 config_table.add_row("Project root", str(project_root))
111 config_table.add_row("Build directory", str(build_dir))
112 config_table.add_row("Build mode", mode.upper())
113 config_table.add_row("With tests", "✓" if tests else "✗")
114 config_table.add_row("Clean build", "✓" if clean else "✗")
115 config_table.add_row("Export compile commands", "✓" if export_compile_commands else "✗")
116 config_table.add_row("Parallel jobs", str(jobs or os.cpu_count() or 4))
117
118 console.print(config_table)
119 console.print()
120
121 # Clean build directory if requested
122 if clean and build_dir.exists():
123 with Progress(
124 SpinnerColumn(),
125 TextColumn("[progress.description]{task.description}"),
126 console=console,
127 ) as progress:
128 task = progress.add_task("Cleaning build directory...", total=None)
129 shutil.rmtree(build_dir)
130 progress.update(task, completed=True)
131 console.print("[green]✓[/green] Build directory cleaned")
132
133 # Create build directory
134 build_dir.mkdir(exist_ok=True)
135
136 console.print("[green]✓[/green] Dependencies configured via git submodules")
137 console.print()
138
139 # Configure CMake
140 with Progress(
141 SpinnerColumn(),
142 TextColumn("[progress.description]{task.description}"),
143 console=console,
144 ) as progress:
145 task = progress.add_task("Configuring with CMake...", total=None)
146
147 cmake_args = [
148 'cmake',
149 str(project_root),
150 '-G', 'Ninja',
151 f'-DCMAKE_BUILD_TYPE={mode.title()}',
152 ]
153
154 # Add export compile commands option

Callers 1

build.pyFile · 0.70

Calls 1

run_commandFunction · 0.85

Tested by

no test coverage detected