Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: propagate CC/CXX into config.mk #419

Merged
merged 2 commits into from
Mar 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ else
end

# propagate more build flags from ENV
const CC = get(ENV, "CC", nothing)
const CXX = get(ENV, "CXX", nothing)
const ADD_CFLAGS = get(ENV, "ADD_CFLAGS", nothing)
const ADD_LDFLAGS = get(ENV, "ADD_LDFLAGS", nothing)

Expand Down Expand Up @@ -224,6 +226,12 @@ if !libmxnet_detected
end

# propagate more build flags from ENV
if CC != nothing
`sed -i -s "s@^export CC =\(.*\)@export CC = $CC@" config.mk`
end
if CXX != nothing
`sed -i -s "s@^export CXX =\(.*\)@export CXX = $CXX@" config.mk`
end
if ADD_CFLAGS != nothing
`sed -i -s "s@ADD_CFLAGS =\(.*\)@ADD_CFLAGS =\1 $ADD_CFLAGS@" config.mk`
end
Expand Down
2 changes: 2 additions & 0 deletions docs/src/user-guide/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ There are several environment variables that change this behaviour.
you can use the`MXNET_COMMIT` variable to point to either a version tag
(e.g. `v0.10.0`), a branch name (e.g. `master`) or a specific commit hash
(e.g. `a0b1c2d3`).
- `CC`: The path of C compiler.
- `CXX`: The path of C++ compiler.
- `ADD_CFLAGS`: Additional C flags. For instance,
if you need to point non-standard include directory, please set it as
`ENV["ADD_CFLAGS"] = "-I'/path/to/include/dir'"`.
Expand Down