MCPcopy Create free account
hub / github.com/celer-pkg/celer / detectPlatformTriple

Method detectPlatformTriple

buildsystems/build_b2.go:365–384  ·  view source on GitHub ↗

detectPlatformTriple dynamically detects the platform triple subdirectory in LLVM's include and lib directories. This avoids hardcoding platform-specific paths like "x86_64-unknown-linux-gnu".

(toolchainRoot string)

Source from the content-addressed store, hash-verified

363// in LLVM's include and lib directories. This avoids hardcoding platform-specific
364// paths like "x86_64-unknown-linux-gnu".
365func (b b2) detectPlatformTriple(toolchainRoot string) (string, error) {
366 // Look for platform-specific subdirectories in include/
367 includePath := filepath.Join(toolchainRoot, "include")
368 entries, err := os.ReadDir(includePath)
369 if err != nil {
370 return "", fmt.Errorf("failed to read include directory: %w", err)
371 }
372
373 // Find the first subdirectory that contains c++/v1/__config_site
374 for _, entry := range entries {
375 if entry.IsDir() && entry.Name() != "c++" {
376 configSite := filepath.Join(includePath, entry.Name(), "c++", "v1", "__config_site")
377 if fileio.PathExists(configSite) {
378 return entry.Name(), nil
379 }
380 }
381 }
382
383 return "", fmt.Errorf("could not find platform-specific subdirectory with __config_site")
384}
385
386func (b b2) formatUsingToolset(toolset, version, cxx string) string {
387 var compilerCmd string

Callers 1

ConfigureMethod · 0.95

Calls 2

PathExistsFunction · 0.92
NameMethod · 0.65

Tested by

no test coverage detected