From 1c4a9838154399f1cdb9f3d7f69d00c4862d0c14 Mon Sep 17 00:00:00 2001 From: Alexander Oster Date: Fri, 5 Aug 2022 16:07:12 +0200 Subject: [PATCH] Added Cpp Documentation creation --- Source/automaticcomponenttoolkit.go | 28 ++++++++++++++++++++++------ Source/buildbindingccpp.go | 21 +++++++++++++++++---- Source/componentdefinition.go | 1 + 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Source/automaticcomponenttoolkit.go b/Source/automaticcomponenttoolkit.go index 864d486b..557242d5 100644 --- a/Source/automaticcomponenttoolkit.go +++ b/Source/automaticcomponenttoolkit.go @@ -147,6 +147,18 @@ func createComponent(component ComponentDefinition, outfolderBase string, bindin case "CppDynamic": { + + outputFolderDocumentationCppExplicit := ""; + + if (binding.Documentation != "") { + + outputFolderDocumentationCppExplicit = outputFolderDocumentation + "/Cpp" + err = os.MkdirAll(outputFolderDocumentationCppExplicit, os.ModePerm) + if err != nil { + log.Fatal(err) + } + } + outputFolderBindingCppDynamic := outputFolderBindings + "/CppDynamic" err = os.MkdirAll(outputFolderBindingCppDynamic, os.ModePerm) if err != nil { @@ -169,7 +181,7 @@ func createComponent(component ComponentDefinition, outfolderBase string, bindin } err = BuildBindingCppExplicit(component, outputFolderBindingCppDynamic, outputFolderExampleCppDynamic, - indentString, binding.ClassIdentifier) + outputFolderDocumentationCppExplicit, indentString, binding.ClassIdentifier) if err != nil { return err } @@ -177,10 +189,14 @@ func createComponent(component ComponentDefinition, outfolderBase string, bindin case "Cpp": { - outputFolderDocumentationCppImplicit := outputFolderDocumentation + "/Cpp" - err = os.MkdirAll(outputFolderDocumentationCppImplicit, os.ModePerm) - if err != nil { - log.Fatal(err) + outputFolderDocumentationCppImplicit := ""; + + if (binding.Documentation != "") { + outputFolderDocumentationCppImplicit = outputFolderDocumentation + "/Cpp"; + err = os.MkdirAll(outputFolderDocumentationCppImplicit, os.ModePerm) + if err != nil { + log.Fatal(err) + } } outputFolderBindingCppImplicit := outputFolderBindings + "/Cpp" @@ -513,7 +529,7 @@ func printUsageInfo() { } func main() { - ACTVersion := "1.7.0-develop" + ACTVersion := "1.8.0-develop" fmt.Fprintln(os.Stdout, "Automatic Component Toolkit v"+ACTVersion) if len(os.Args) < 2 { printUsageInfo() diff --git a/Source/buildbindingccpp.go b/Source/buildbindingccpp.go index fa9d36f4..45cce48e 100644 --- a/Source/buildbindingccpp.go +++ b/Source/buildbindingccpp.go @@ -170,9 +170,13 @@ func BuildBindingCppImplicit(component ComponentDefinition, outputFolder string, } } - err = BuildCCPPDocumentation(component, outputFolderDocumentation, ClassIdentifier) - if err != nil { - return err + if (outputFolderDocumentation != "") { + + err = BuildCCPPDocumentation(component, outputFolderDocumentation, ClassIdentifier) + if err != nil { + return err + } + } @@ -1580,7 +1584,7 @@ func buildCppHeader(component ComponentDefinition, w LanguageWriter, NameSpace s // BuildBindingCppExplicit builds headeronly C++-bindings of a library's API in form of expliclty loaded function handles. func BuildBindingCppExplicit(component ComponentDefinition, outputFolder string, outputFolderExample string, - indentString string, ClassIdentifier string) error { + outputFolderDocumentation string, indentString string, ClassIdentifier string) error { forceRecreation := false ExplicitLinking := true namespace := component.NameSpace @@ -1646,6 +1650,15 @@ func BuildBindingCppExplicit(component ComponentDefinition, outputFolder string, log.Printf("Omitting recreation of C++Dynamic example file \"%s\"", DynamicCPPCMake) } } + + if (outputFolderDocumentation != "") { + + err = BuildCCPPDocumentation(component, outputFolderDocumentation, ClassIdentifier) + if err != nil { + return err + } + + } return nil } diff --git a/Source/componentdefinition.go b/Source/componentdefinition.go index 27b0109b..89affefd 100644 --- a/Source/componentdefinition.go +++ b/Source/componentdefinition.go @@ -137,6 +137,7 @@ type ComponentDefinitionBinding struct { Language string `xml:"language,attr"` Indentation string `xml:"indentation,attr"` ClassIdentifier string `xml:"classidentifier,attr"` + Documentation string `xml:"documentation,attr"` Version string `xml:"version,attr"` }