Lines Matching refs:f

140 	f, _ := os.Create(filepath.Join(projectDir, cMakeListsFilename))
141 defer f.Close()
144 f.WriteString("# THIS FILE WAS AUTOMATICALY GENERATED!\n")
145 f.WriteString("# ANY MODIFICATION WILL BE OVERWRITTEN!\n\n")
146 f.WriteString("# To improve project view in Clion :\n")
147 f.WriteString("# Tools > CMake > Change Project Root \n\n")
148 f.WriteString(fmt.Sprintf("cmake_minimum_required(VERSION %s)\n", minimumCMakeVersionSupported))
149 f.WriteString(fmt.Sprintf("project(%s)\n", ccModule.ModuleBase.Name()))
150 f.WriteString(fmt.Sprintf("set(ANDROID_ROOT %s)\n\n", android.AbsSrcDirForExistingUseCases()))
153 f.WriteString(fmt.Sprintf("set(CMAKE_C_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang"))
154f.WriteString(fmt.Sprintf("set(CMAKE_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang++…
157 f.WriteString("list(APPEND\n")
158 f.WriteString(" SOURCE_FILES\n")
160 f.WriteString(fmt.Sprintf(" ${ANDROID_ROOT}/%s\n", src.String()))
162 f.WriteString(")\n")
165 f.WriteString("\n# GLOBAL ALL FLAGS:\n")
166 globalAllParameters := parseCompilerParameters(ccModule.flags.Global.CommonFlags, ctx, f)
167 translateToCMake(globalAllParameters, f, true, true)
169 f.WriteString("\n# LOCAL ALL FLAGS:\n")
170 localAllParameters := parseCompilerParameters(ccModule.flags.Local.CommonFlags, ctx, f)
171 translateToCMake(localAllParameters, f, true, true)
173 f.WriteString("\n# GLOBAL CFLAGS:\n")
174 globalCParameters := parseCompilerParameters(ccModule.flags.Global.CFlags, ctx, f)
175 translateToCMake(globalCParameters, f, true, true)
177 f.WriteString("\n# LOCAL CFLAGS:\n")
178 localCParameters := parseCompilerParameters(ccModule.flags.Local.CFlags, ctx, f)
179 translateToCMake(localCParameters, f, true, true)
181 f.WriteString("\n# GLOBAL C ONLY FLAGS:\n")
182 globalConlyParameters := parseCompilerParameters(ccModule.flags.Global.ConlyFlags, ctx, f)
183 translateToCMake(globalConlyParameters, f, true, false)
185 f.WriteString("\n# LOCAL C ONLY FLAGS:\n")
186 localConlyParameters := parseCompilerParameters(ccModule.flags.Local.ConlyFlags, ctx, f)
187 translateToCMake(localConlyParameters, f, true, false)
189 f.WriteString("\n# GLOBAL CPP FLAGS:\n")
190 globalCppParameters := parseCompilerParameters(ccModule.flags.Global.CppFlags, ctx, f)
191 translateToCMake(globalCppParameters, f, false, true)
193 f.WriteString("\n# LOCAL CPP FLAGS:\n")
194 localCppParameters := parseCompilerParameters(ccModule.flags.Local.CppFlags, ctx, f)
195 translateToCMake(localCppParameters, f, false, true)
197 f.WriteString("\n# GLOBAL SYSTEM INCLUDE FLAGS:\n")
198 globalIncludeParameters := parseCompilerParameters(ccModule.flags.SystemIncludeFlags, ctx, f)
199 translateToCMake(globalIncludeParameters, f, true, true)
202 f.WriteString(fmt.Sprintf("\nadd_executable(%s ${SOURCE_FILES})\n",
210 func translateToCMake(c compilerParameters, f *os.File, cflags bool, cppflags bool) {
211 writeAllIncludeDirectories(c.systemHeaderSearchPath, f, true)
212 writeAllIncludeDirectories(c.headerSearchPath, f, false)
214 writeAllRelativeFilePathFlags(c.relativeFilePathFlags, f, "CMAKE_C_FLAGS")
215 writeAllFlags(c.flags, f, "CMAKE_C_FLAGS")
218 writeAllRelativeFilePathFlags(c.relativeFilePathFlags, f, "CMAKE_CXX_FLAGS")
219 writeAllFlags(c.flags, f, "CMAKE_CXX_FLAGS")
222f.WriteString(fmt.Sprintf("include_directories(SYSTEM \"%s\")\n", buildCMakePath(path.Join(c.sysro…
234 func writeAllIncludeDirectories(includes []string, f *os.File, isSystem bool) {
244 f.WriteString(fmt.Sprintf("include_directories(%s \n", system))
247 f.WriteString(fmt.Sprintf(" \"%s\"\n", buildCMakePath(include)))
249 f.WriteString(")\n\n")
252 f.WriteString("file (GLOB_RECURSE TMP_HEADERS\n")
254 f.WriteString(fmt.Sprintf(" \"%s/**/*.h\"\n", buildCMakePath(include)))
256 f.WriteString(")\n")
257 f.WriteString("list (APPEND SOURCE_FILES ${TMP_HEADERS})\n\n")
265 func writeAllRelativeFilePathFlags(relativeFilePathFlags []relativeFilePathFlagType, f *os.File, ta…
267f.WriteString(fmt.Sprintf("set(%s \"${%s} %s=%s\")\n", tag, tag, flag.flag, buildCMakePath(flag.re…
271 func writeAllFlags(flags []string, f *os.File, tag string) {
273 f.WriteString(fmt.Sprintf("set(%s \"${%s} %s\")\n", tag, tag, flag))
339 func parseCompilerParameters(params []string, ctx android.SingletonContext, f *os.File) compilerPar…
343 f.WriteString(fmt.Sprintf("# Raw param [%d] = '%s'\n", i, str))
368 f.WriteString(fmt.Sprintf("# variable %s = '%s'\n", param, evaluated))
371 paramsFromVar := parseCompilerParameters(strings.Split(evaluated, " "), ctx, f)
376 f.WriteString(fmt.Sprintf("# variable %s could NOT BE RESOLVED\n", param))
384 f.WriteString("# Found a header search path marker with no path")
389 f.WriteString(fmt.Sprintf("# FLAG '%s' became %s\n", param, c))
395 f.WriteString("# Found a system root path marker with no path")
405f.WriteString(fmt.Sprintf("# Relative File Path Flag [%s] is not formatted as a=b/c/d \n", param))