You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
set(${TARGET_NAME}_LIB_NAME"${CMAKE_SHARED_LIBRARY_PREFIX}${TARGET_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"CACHESTRING"output library name for target ${TARGET_NAME}")
set(${TARGET_NAME}_LIB_NAME"${CMAKE_STATIC_LIBRARY_PREFIX}${TARGET_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"CACHESTRING"output library name for target ${TARGET_NAME}")
275
271
endif()
276
272
277
273
# Add dummy code to support `make target_name` under Terminal Command
Copy file name to clipboardExpand all lines: doc/design/build_system/README.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,3 +105,48 @@ shared_library(api
105
105
### Implementation
106
106
107
107
As above example CMakeLists.txt executes, each function invocation adds "nodes" to a dependency graph. It also use this graph to generate CMake commands including `add_executable`, `add_dependencies`, `target_link_libraries`, and `add_test`.
108
+
109
+
### Using Package Manager For Go
110
+
111
+
Building Go binaries and libraries need to satisfy their dependencies, generally
112
+
we can do `go get ./...` to download and compile all external dependencies. The
113
+
problems are:
114
+
115
+
1.`go get` will always get the latest code from the default branch of the
116
+
remote repo, so changes of dependents might break the build. This is very
117
+
different with what we already have in `cmake/external` which download a
118
+
specific version or commit id of the dependency.
119
+
1. Some locations can not access external dependencies through the internet, as mentioned
120
+
in https://github.com/PaddlePaddle/Paddle/issues/2605. Using package management
121
+
tools can package the dependencies as a "vendor" package, which can be mirrored
122
+
at many cloud file hosting, so users what to compile paddle by themselves can
123
+
download this "vendor" package from a mirror site.
124
+
125
+
#### Choose A Suitable Tool
126
+
127
+
As mentioned by @wangkuiyi, [Here](https://github.com/golang/go/wiki/PackageManagementTools)
128
+
list dozens of Go package managers. We choose the tool using following principles:
129
+
130
+
- Most "active" projects with more stars, more pull requests or commits
131
+
- Widely used project
132
+
133
+
After comparing all these projects, we shall choose between the most popular
134
+
tools: Godep and Glide.
135
+
136
+
Here's a brief comparison between Godep and Glide
137
+
: https://github.com/Masterminds/glide/wiki/Go-Package-Manager-Comparison. There are
138
+
also many complaints about using `Godep`. There's also a new "official" pakcage
139
+
management tool has been started at: https://github.com/golang/dep to resolve
140
+
such problems, but it's currently at Alpha stage. So the best choice now is
141
+
glide obviously.
142
+
143
+
#### Manage Go Packages
144
+
145
+
- Dependencies: `go/glide.yaml` will store the dependencies and their versions which
146
+
is directly imported by paddle. `go/glide.lock` will store all dependencies recursively
147
+
with their commit id. Builds will "lock" to these packages if we don't `glide up`
148
+
them
149
+
- Vendor package: `go/vendor` directory will generated when running `cmake` command. `cmake`
150
+
will download the code corresponding to `go/glide.lock`. If we put a vendor folder
151
+
under `go/`, cmake will just check the commit id to the packages under the folder,
152
+
if commit id matches, there will be no download at all.
0 commit comments