Merge "Only write CMakeLists.txt for normal variants"
This commit is contained in:
@@ -62,10 +62,14 @@ func (c *cmakelistsGeneratorSingleton) GenerateBuildActions(ctx android.Singleto
|
|||||||
|
|
||||||
outputDebugInfo = (getEnvVariable(envVariableGenerateDebugInfo, ctx) == envVariableTrue)
|
outputDebugInfo = (getEnvVariable(envVariableGenerateDebugInfo, ctx) == envVariableTrue)
|
||||||
|
|
||||||
|
// Track which projects have already had CMakeLists.txt generated to keep the first
|
||||||
|
// variant for each project.
|
||||||
|
seenProjects := map[string]bool{}
|
||||||
|
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
if ccModule, ok := module.(*Module); ok {
|
if ccModule, ok := module.(*Module); ok {
|
||||||
if compiledModule, ok := ccModule.compiler.(CompiledInterface); ok {
|
if compiledModule, ok := ccModule.compiler.(CompiledInterface); ok {
|
||||||
generateCLionProject(compiledModule, ctx, ccModule)
|
generateCLionProject(compiledModule, ctx, ccModule, seenProjects)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -114,14 +118,22 @@ func linkAggregateCMakeListsFiles(path string, info os.FileInfo, err error) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateCLionProject(compiledModule CompiledInterface, ctx android.SingletonContext, ccModule *Module) {
|
func generateCLionProject(compiledModule CompiledInterface, ctx android.SingletonContext, ccModule *Module,
|
||||||
|
seenProjects map[string]bool) {
|
||||||
srcs := compiledModule.Srcs()
|
srcs := compiledModule.Srcs()
|
||||||
if len(srcs) == 0 {
|
if len(srcs) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the directory hosting the cmakelists.txt exists
|
// Only write CMakeLists.txt for the first variant of each architecture of each module
|
||||||
clionproject_location := getCMakeListsForModule(ccModule, ctx)
|
clionproject_location := getCMakeListsForModule(ccModule, ctx)
|
||||||
|
if seenProjects[clionproject_location] {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
seenProjects[clionproject_location] = true
|
||||||
|
|
||||||
|
// Ensure the directory hosting the cmakelists.txt exists
|
||||||
projectDir := path.Dir(clionproject_location)
|
projectDir := path.Dir(clionproject_location)
|
||||||
os.MkdirAll(projectDir, os.ModePerm)
|
os.MkdirAll(projectDir, os.ModePerm)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user