Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(244)

Unified Diff: src/cmd/go/pkg.go

Issue 8248043: code review 8248043: cmd/go: Add support for including C++ files in packages (Closed)
Patch Set: diff -r e86ab7e59e50 https://code.google.com/p/go Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/go/list.go ('k') | src/cmd/godoc/index.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/go/pkg.go
===================================================================
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -40,14 +40,17 @@
CgoFiles []string `json:",omitempty"` // .go sources files that import "C"
IgnoredGoFiles []string `json:",omitempty"` // .go sources ignored due to build constraints
CFiles []string `json:",omitempty"` // .c source files
- HFiles []string `json:",omitempty"` // .h source files
+ CXXFiles []string `json:",omitempty"` // .cc, .cpp and .cxx source files
+ HFiles []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files
SFiles []string `json:",omitempty"` // .s source files
SysoFiles []string `json:",omitempty"` // .syso system object files added to package
SwigFiles []string `json:",omitempty"` // .swig files
SwigCXXFiles []string `json:",omitempty"` // .swigcxx files
// Cgo directives
+ CgoCPPFLAGS []string `json:",omitempty"` // cgo: flags for C preprocessor
CgoCFLAGS []string `json:",omitempty"` // cgo: flags for C compiler
+ CgoCXXFLAGS []string `json:",omitempty"` // cgo: flags for C++ compiler
CgoLDFLAGS []string `json:",omitempty"` // cgo: flags for linker
CgoPkgConfig []string `json:",omitempty"` // cgo: pkg-config names
@@ -98,12 +101,15 @@
p.CgoFiles = pp.CgoFiles
p.IgnoredGoFiles = pp.IgnoredGoFiles
p.CFiles = pp.CFiles
+ p.CXXFiles = pp.CXXFiles
p.HFiles = pp.HFiles
p.SFiles = pp.SFiles
p.SysoFiles = pp.SysoFiles
p.SwigFiles = pp.SwigFiles
p.SwigCXXFiles = pp.SwigCXXFiles
+ p.CgoCPPFLAGS = pp.CgoCPPFLAGS
p.CgoCFLAGS = pp.CgoCFLAGS
+ p.CgoCXXFLAGS = pp.CgoCXXFLAGS
p.CgoLDFLAGS = pp.CgoLDFLAGS
p.CgoPkgConfig = pp.CgoPkgConfig
p.Imports = pp.Imports
@@ -389,6 +395,7 @@
p.CgoFiles,
p.IgnoredGoFiles,
p.CFiles,
+ p.CXXFiles,
p.HFiles,
p.SFiles,
p.SysoFiles,
@@ -481,6 +488,11 @@
return len(p.SwigFiles) > 0 || len(p.SwigCXXFiles) > 0
}
+// usesCgo returns whether the package needs to run cgo
+func (p *Package) usesCgo() bool {
+ return len(p.CgoFiles) > 0
+}
+
// swigSoname returns the name of the shared library we create for a
// SWIG input file.
func (p *Package) swigSoname(file string) string {
@@ -611,7 +623,7 @@
return false
}
- srcs := stringList(p.GoFiles, p.CFiles, p.HFiles, p.SFiles, p.CgoFiles, p.SysoFiles)
+ srcs := stringList(p.GoFiles, p.CFiles, p.CXXFiles, p.HFiles, p.SFiles, p.CgoFiles, p.SysoFiles)
for _, src := range srcs {
if olderThan(filepath.Join(p.Dir, src)) {
return true
« no previous file with comments | « src/cmd/go/list.go ('k') | src/cmd/godoc/index.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b