MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / BuildBindingCppExplicit

Function BuildBindingCppExplicit

Source/buildbindingccpp.go:1480–1549  ·  view source on GitHub ↗

BuildBindingCppExplicit builds headeronly C++-bindings of a library's API in form of expliclty loaded function handles.

(component ComponentDefinition, outputFolder string, outputFolderExample string,
	indentString string, ClassIdentifier string)

Source from the content-addressed store, hash-verified

1478
1479// BuildBindingCppExplicit builds headeronly C++-bindings of a library's API in form of expliclty loaded function handles.
1480func BuildBindingCppExplicit(component ComponentDefinition, outputFolder string, outputFolderExample string,
1481 indentString string, ClassIdentifier string) error {
1482 forceRecreation := false
1483 ExplicitLinking := true
1484 namespace := component.NameSpace
1485 libraryname := component.LibraryName
1486 baseName := component.BaseName
1487
1488 DynamicCHeader := path.Join(outputFolder, baseName+"_dynamic.h")
1489 log.Printf("Creating \"%s\"", DynamicCHeader)
1490 dynhfile, err := CreateLanguageFile(DynamicCHeader, indentString)
1491 if err != nil {
1492 return err
1493 }
1494 dynhfile.WriteCLicenseHeader(component,
1495 fmt.Sprintf("This is an autogenerated C++-Header file in order to allow an easy\n use of %s", libraryname),
1496 true)
1497 err = buildDynamicCCPPHeader(component, dynhfile, namespace, baseName, true, true)
1498 if err != nil {
1499 return err
1500 }
1501
1502 DynamicCppHeader := path.Join(outputFolder, baseName+"_dynamic.hpp")
1503 log.Printf("Creating \"%s\"", DynamicCppHeader)
1504 dynhppfile, err := CreateLanguageFile(DynamicCppHeader, indentString)
1505 if err != nil {
1506 return err
1507 }
1508 dynhppfile.WriteCLicenseHeader(component,
1509 fmt.Sprintf("This is an autogenerated C++-Header file in order to allow an easy\n use of %s", libraryname),
1510 true)
1511 err = buildCppHeader(component, dynhppfile, namespace, baseName, ClassIdentifier, ExplicitLinking)
1512 if err != nil {
1513 return err
1514 }
1515
1516 if len(outputFolderExample) > 0 {
1517 DynamicCPPExample := path.Join(outputFolderExample, namespace+"_example"+".cpp")
1518 if forceRecreation || !FileExists(DynamicCPPExample) {
1519 log.Printf("Creating \"%s\"", DynamicCPPExample)
1520 dyncppexamplefile, err := CreateLanguageFile(DynamicCPPExample, indentString)
1521 if err != nil {
1522 return err
1523 }
1524 dyncppexamplefile.WriteCLicenseHeader(component,
1525 fmt.Sprintf("This is an autogenerated C++ application that demonstrates the\n usage of the Dynamic C++ bindings of %s", libraryname),
1526 true)
1527 buildDynamicCppExample(component, dyncppexamplefile, outputFolder, ClassIdentifier, ExplicitLinking)
1528 } else {
1529 log.Printf("Omitting recreation of C++Dynamic example file \"%s\"", DynamicCPPExample)
1530 }
1531
1532 DynamicCPPCMake := path.Join(outputFolderExample, "CMakeLists.txt")
1533 if forceRecreation || !FileExists(DynamicCPPCMake) {
1534 log.Printf("Creating \"%s\"", DynamicCPPCMake)
1535 dyncppcmake, err := CreateLanguageFile(DynamicCPPCMake, " ")
1536 if err != nil {
1537 return err

Callers 1

createComponentFunction · 0.85

Calls 9

CreateLanguageFileFunction · 0.85
buildDynamicCCPPHeaderFunction · 0.85
buildCppHeaderFunction · 0.85
FileExistsFunction · 0.85
buildDynamicCppExampleFunction · 0.85
PrintfMethod · 0.80
WriteCLicenseHeaderMethod · 0.80

Tested by

no test coverage detected