BuildBindingCppImplicit builds dynamic C++-bindings of a library's API in form of implicitly linked functions handles.
(component ComponentDefinition, outputFolder string, outputFolderExample string, indentString string, ClassIdentifier string)
| 116 | |
| 117 | // BuildBindingCppImplicit builds dynamic C++-bindings of a library's API in form of implicitly linked functions handles. |
| 118 | func BuildBindingCppImplicit(component ComponentDefinition, outputFolder string, outputFolderExample string, indentString string, ClassIdentifier string) error { |
| 119 | forceRecreation := false |
| 120 | ExplicitLinking := false |
| 121 | |
| 122 | namespace := component.NameSpace |
| 123 | libraryname := component.LibraryName |
| 124 | baseName := component.BaseName |
| 125 | |
| 126 | CppHeader := path.Join(outputFolder, baseName+"_implicit.hpp") |
| 127 | log.Printf("Creating \"%s\"", CppHeader) |
| 128 | hppfile, err := CreateLanguageFile(CppHeader, indentString) |
| 129 | if err != nil { |
| 130 | return err |
| 131 | } |
| 132 | hppfile.WriteCLicenseHeader(component, |
| 133 | fmt.Sprintf("This is an autogenerated C++-Header file in order to allow an easy\n use of %s", libraryname), |
| 134 | true) |
| 135 | err = buildCppHeader(component, hppfile, namespace, baseName, ClassIdentifier, ExplicitLinking) |
| 136 | if err != nil { |
| 137 | return err |
| 138 | } |
| 139 | |
| 140 | if len(outputFolderExample) > 0 { |
| 141 | CPPExample := path.Join(outputFolderExample, namespace+"_example"+".cpp") |
| 142 | if forceRecreation || !FileExists(CPPExample) { |
| 143 | log.Printf("Creating \"%s\"", CPPExample) |
| 144 | cppexamplefile, err := CreateLanguageFile(CPPExample, indentString) |
| 145 | if err != nil { |
| 146 | return err |
| 147 | } |
| 148 | cppexamplefile.WriteCLicenseHeader(component, |
| 149 | fmt.Sprintf("This is an autogenerated C++ application that demonstrates the\n usage of the C++ bindings of %s", libraryname), |
| 150 | true) |
| 151 | buildDynamicCppExample(component, cppexamplefile, outputFolder, ClassIdentifier, ExplicitLinking) |
| 152 | } else { |
| 153 | log.Printf("Omitting recreation of C++-example file \"%s\"", CPPExample) |
| 154 | } |
| 155 | |
| 156 | CPPCMake := path.Join(outputFolderExample, "CMakeLists.txt") |
| 157 | if forceRecreation || !FileExists(CPPCMake) { |
| 158 | log.Printf("Creating \"%s\"", CPPCMake) |
| 159 | cppcmake, err := CreateLanguageFile(CPPCMake, " ") |
| 160 | if err != nil { |
| 161 | return err |
| 162 | } |
| 163 | cppcmake.WriteCMakeLicenseHeader(component, |
| 164 | fmt.Sprintf("This is an autogenerated CMake Project that demonstrates the\n usage of the C++ bindings of %s", libraryname), |
| 165 | true) |
| 166 | buildCppDynamicExampleCMake(component, cppcmake, outputFolder, outputFolderExample, ExplicitLinking) |
| 167 | } else { |
| 168 | log.Printf("Omitting recreation of C++-example CMakeLists-file \"%s\"", CPPCMake) |
| 169 | } |
| 170 | } |
| 171 | return nil |
| 172 | } |
| 173 | |
| 174 | func buildDynamicCCPPHeader(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string, |
| 175 | headerOnly bool, useCPPTypes bool) error { |
no test coverage detected