Skip to content

Commit 6248dcf

Browse files
spywogangatp
andauthored
Add command-line argument to prevent the generation of CMakeLists.txt (#222)
The command-line argument, '-suppresscmake', doesn't generate CMakeLists.txt file for C++ implementation. It only takes effect if '-suppressstub' argument is not set. Co-authored-by: gangatp <[email protected]>
1 parent 41ef814 commit 6248dcf

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Source/automaticcomponenttoolkit.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ const (
4848
eACTModeDiff = 1
4949
)
5050

51-
func createComponent(component ComponentDefinition, outfolderBase string, bindingsDirectoryOverride string, interfacesDirectoryOverride string, stubDirectoryOverride string, suppressBindings bool, suppressStub bool, suppressInterfaces bool, suppressSubcomponents bool, suppressLicense bool, suppressExamples bool) (error) {
51+
func createComponent(component ComponentDefinition, outfolderBase string, bindingsDirectoryOverride string, interfacesDirectoryOverride string, stubDirectoryOverride string, suppressBindings bool, suppressStub bool, suppressInterfaces bool, suppressSubcomponents bool, suppressLicense bool, suppressExamples bool, suppressCmake bool) (error) {
5252

5353
log.Printf("Creating Component \"%s\"", component.LibraryName)
5454

5555
if (!suppressSubcomponents) {
5656
for _, subComponent := range component.ImportedComponentDefinitions {
57-
err := createComponent(subComponent, outfolderBase, "", "", "", suppressBindings, suppressStub, suppressInterfaces, suppressSubcomponents, suppressLicense, suppressExamples)
57+
err := createComponent(subComponent, outfolderBase, "", "", "", suppressBindings, suppressStub, suppressInterfaces, suppressSubcomponents, suppressLicense, suppressExamples, suppressCmake)
5858
if (err != nil) {
5959
return err
6060
}
@@ -506,7 +506,7 @@ func createComponent(component ComponentDefinition, outfolderBase string, bindin
506506
}
507507

508508
err = BuildImplementationCPP(component, outputFolderImplementationCpp, outputFolderImplementationCppStub,
509-
outputFolderImplementationProject, implementation, suppressStub, suppressInterfaces)
509+
outputFolderImplementationProject, implementation, suppressStub, suppressInterfaces, suppressCmake)
510510
if err != nil {
511511
return err
512512
}
@@ -578,6 +578,7 @@ func printUsageInfo() {
578578
fmt.Fprintln(os.Stdout, " -suppressinterfaces: do not generate the contents of the interfaces-folder")
579579
fmt.Fprintln(os.Stdout, " -suppresssubcomponents: do not generate any files for subcomponents")
580580
fmt.Fprintln(os.Stdout, " -suppressexamples: do not generate any examples")
581+
fmt.Fprintln(os.Stdout, " -suppresscmake: do not generate CMakeLists.txt file for C++ implementation. It only takes effect if -suppressstub argument is not set.")
581582
fmt.Fprintln(os.Stdout, " ")
582583
fmt.Fprintln(os.Stdout, "Tutorials, info and source-code on: https://github.com/Autodesk/AutomaticComponentToolkit/ .")
583584
fmt.Fprintln(os.Stdout, "ACT stops now.")
@@ -616,6 +617,7 @@ func main() {
616617
suppressInterfaces := false;
617618
suppressSubcomponents := false;
618619
suppressExamples := false;
620+
suppressCmake := false;
619621

620622
if len(os.Args) >= 4 {
621623
for idx := 2; idx < len(os.Args); idx ++ {
@@ -667,6 +669,9 @@ func main() {
667669
suppressExamples = true;
668670
}
669671

672+
if os.Args[idx] == "-suppresscmake" {
673+
suppressCmake = true;
674+
}
670675
}
671676
}
672677
if mode == eACTModeGenerate {
@@ -730,7 +735,7 @@ func main() {
730735
// }
731736
// }
732737

733-
err = createComponent(component, outfolderBase, bindingsDirectoryOverride, interfacesDirectoryOverride, stubDirectoryOverride, suppressBindings, suppressStub, suppressInterfaces, suppressSubcomponents, suppressLicense, suppressExamples)
738+
err = createComponent(component, outfolderBase, bindingsDirectoryOverride, interfacesDirectoryOverride, stubDirectoryOverride, suppressBindings, suppressStub, suppressInterfaces, suppressSubcomponents, suppressLicense, suppressExamples, suppressCmake)
734739
if (err != nil) {
735740
if err == ErrPythonBuildFailed {
736741
log.Println("Python binding generation failed (Due to usage of reserved keywords)")

Source/buildimplementationcpp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import (
4343
)
4444

4545
// BuildImplementationCPP builds C++ interface classes, implementation stubs and wrapper code that maps to the C-header
46-
func BuildImplementationCPP(component ComponentDefinition, outputFolder string, stubOutputFolder string, projectOutputFolder string, implementation ComponentDefinitionImplementation, suppressStub bool, suppressInterfaces bool) error {
46+
func BuildImplementationCPP(component ComponentDefinition, outputFolder string, stubOutputFolder string, projectOutputFolder string, implementation ComponentDefinitionImplementation, suppressStub bool, suppressInterfaces bool, suppressCmake bool) error {
4747
forceRecreation := false
4848

4949
doJournal := len (component.Global.JournalMethod) > 0;
@@ -169,7 +169,7 @@ func BuildImplementationCPP(component ComponentDefinition, outputFolder string,
169169
log.Printf("Omitting recreation of implementation stub \"%s\"", IntfWrapperStubName)
170170
}
171171

172-
if ( len(projectOutputFolder) > 0 ) {
172+
if ( !suppressCmake && len(projectOutputFolder) > 0 ) {
173173
CMakeListsFileName := path.Join(projectOutputFolder, "CMakeLists.txt");
174174
if forceRecreation || !FileExists(CMakeListsFileName) {
175175
log.Printf("Creating CMake-Project \"%s\" for CPP Implementation", CMakeListsFileName)

0 commit comments

Comments
 (0)