Skip to content

Commit

Permalink
Merge pull request #12 from rdeits/cmake
Browse files Browse the repository at this point in the history
switch to new lcm cmake build
  • Loading branch information
rdeits authored Oct 11, 2016
2 parents 5d98f1d + 9ae7a2c commit e521d1c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 26 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
language: julia
sudo: required
dist: trusty
os:
- linux
- osx
julia:
- release
- 0.4
- 0.5
- nightly
notifications:
email: false
branches:
only:
- master

after_success:
- julia -e 'cd(Pkg.dir("PyLCM")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
73 changes: 48 additions & 25 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,68 @@ function cflags_validator(pkg_name)
end
end

@linux? (
begin
deps = [
python = library_dependency("python", aliases=["libpython2.7.so", "libpython3.2.so", "libpython3.3.so", "libpython3.4.so", "libpython3.5.so", "libpython3.6.so", "libpython3.7.so"], validate=cflags_validator("python"))
glib = library_dependency("glib", aliases=["libglib-2.0-0", "libglib-2.0", "libglib-2.0.so.0"], depends=[python], validate=cflags_validator("glib-2.0"))
lcm = library_dependency("lcm", aliases=["liblcm", "liblcm.1"], depends=[glib])

provides(AptGet, Dict("python-dev" => python, "libglib2.0-dev" => glib))
]
end
: begin
deps = [
glib = library_dependency("glib", aliases = ["libglib-2.0-0", "libglib-2.0", "libglib-2.0.so.0"])
lcm = library_dependency("lcm", aliases=["liblcm", "liblcm.1"], depends=[glib])
]
end
)
@static if is_linux()
deps = [
python = library_dependency("python", aliases=["libpython2.7.so", "libpython3.2.so", "libpython3.3.so", "libpython3.4.so", "libpython3.5.so", "libpython3.6.so", "libpython3.7.so"], validate=cflags_validator("python"))
glib = library_dependency("glib", aliases=["libglib-2.0-0", "libglib-2.0", "libglib-2.0.so.0"], depends=[python], validate=cflags_validator("glib-2.0"))
lcm = library_dependency("lcm", aliases=["liblcm", "liblcm.1"], depends=[glib])

provides(AptGet, Dict("python-dev" => python, "libglib2.0-dev" => glib))
]
else
deps = [
glib = library_dependency("glib", aliases = ["libglib-2.0-0", "libglib-2.0", "libglib-2.0.so.0"])
lcm = library_dependency("lcm", aliases=["liblcm", "liblcm.1"], depends=[glib])
]
end

prefix = joinpath(BinDeps.depsdir(lcm), "usr")
pkg_config_dirs = AbstractString[]
include_dirs = AbstractString[]
@osx_only begin

lcm_cmake_arguments = String[]
@static if is_apple()
if Pkg.installed("Homebrew") === nothing
error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
end
using Homebrew
provides(Homebrew.HB, "glib", glib, os=:Darwin)
push!(pkg_config_dirs, joinpath(Homebrew.prefix(), "lib", "pkgconfig"))
push!(include_dirs, joinpath(Homebrew.prefix(), "include"))
push!(lcm_cmake_arguments,
"-DCMAKE_LIBRARY_PATH=$(joinpath(Pkg.dir("Homebrew"), "deps", "usr", "lib"))")
push!(lcm_cmake_arguments,
"-DCMAKE_INCLUDE_PATH=$(joinpath(Pkg.dir("Homebrew"), "deps", "usr", "include"))")

end

provides(Yum,
Dict("glib" => glib))

lcm_sha = "9e53469cd0713ca8fbf37a968f6fd314f5f11584"
lcm_folder = "lcm-$(lcm_sha)"

provides(Sources,
URI("https://github.com/lcm-proj/lcm/releases/download/v1.3.1/lcm-1.3.1.zip"),
lcm)
URI("https://github.com/lcm-proj/lcm/archive/$(lcm_sha).zip"),
lcm,
unpacked_dir=lcm_folder)

provides(BuildProcess, Dict(Autotools(libtarget="lcm/liblcm.la", include_dirs=include_dirs, pkg_config_dirs=pkg_config_dirs) => lcm), onload="""
lcm_builddir = joinpath(BinDeps.depsdir(lcm), "builds", "lcm")
lcm_srcdir = joinpath(BinDeps.depsdir(lcm), "src", lcm_folder)
lcm_cmake_command = `cmake -DCMAKE_INSTALL_PREFIX=$(prefix)`
for arg in lcm_cmake_arguments
lcm_cmake_command = `$lcm_cmake_command $arg`
end
lcm_cmake_command = `$lcm_cmake_command $lcm_srcdir`

provides(BuildProcess,
(@build_steps begin
GetSources(lcm)
CreateDirectory(lcm_builddir)
@build_steps begin
ChangeDirectory(lcm_builddir)
lcm_cmake_command
`cmake --build . --target install`
end
end),
lcm,
onload="""
using PyCall
sys = pyimport("sys")
unshift!(PyVector(sys["path"]), joinpath("$(prefix)", "lib", "python" * string(sys[:version_info][1]) * "." * string(sys[:version_info][2]), "site-packages"))
Expand Down

0 comments on commit e521d1c

Please sign in to comment.