Skip to content

Commit

Permalink
Merge pull request #6 from AirspaceTechnologies/AT-8842
Browse files Browse the repository at this point in the history
AT-8842: README + SWIG 4.0.1
  • Loading branch information
brettgoing authored May 28, 2020
2 parents 9b42e20 + 20ea8ef commit 9173792
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 18 deletions.
40 changes: 40 additions & 0 deletions AIRSPACE-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Airspace Golang Wrapper Repo for OR-Tools

This is a fork of [Google's OR-Tools repo](https://github.com/google/or-tools).
It has Go bindings and binaries for use with Go projects.

## Mac Setup for Local Go Development
1. Download binaries for Mac:
`https://github.com/AirspaceTechnologies/or-tools/releases/download/v7.6-go1.14.1/or-tools_MacOsX-10.15.4_v7.6.7696.tar.gz`
1. Install/extract to rpath (e.g. `/usr/local`)
1. Download and install Go package `go get github.com/airspace/technologies/or-tools/gen/ortools/go/constraintsolver`
1. Use in Go code. E.g. `import github.com/airspacetechnologies/or-tools/gen/ortools/go/constraintsolver`

## Mac Setup for Local OR-tools Development (Extending/Wrapping OR-tools)
1. Install XCode:
`xcode-select install`
1. Install C++ tools:
`brew install cmake wget pkg-config`
1. Install SWIG 4.0.1:
`brew install swig`
1. Install protobuf for Go:
`go get github.com/golang/protobuf/[email protected]`
1. Clone Airspace OR-tools:
`git clone [email protected]:AirspaceTechnologies/or-tools.git`
1. Make third party:
`make third_party`
1. Make go:
`make clean_go go`
1. Make go tests:
`make test_go`

## Build and Release
1. Follow steps above (`Mac Setup for Local OR-tools Development`)
1. Make Debian binary archive (takes ~45 mins, uses Docker to build everything from scratch):
`make --directory=makefiles debian_go_export`
1. Make local Mac binary archive:
`make golib_archive`
1. Log into Github and create a release with the resulting binaries

## TODO
1. Make `IntVar`->`IntExpr` casting cleaner
28 changes: 17 additions & 11 deletions makefiles/docker/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ LABEL maintainer="[email protected]"
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN apt-get update -qq \
&& apt-get install -yq \
git wget libssl-dev pkg-config build-essential \
autoconf libtool zlib1g-dev lsb-release \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
&& apt-get install -yq \
git wget libssl-dev pkg-config build-essential \
autoconf libtool zlib1g-dev lsb-release \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install CMake 3.16.4
RUN wget "https://cmake.org/files/v3.16/cmake-3.16.4-Linux-x86_64.sh" \
&& chmod a+x cmake-3.16.4-Linux-x86_64.sh \
&& ./cmake-3.16.4-Linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.16.4-Linux-x86_64.sh
&& chmod a+x cmake-3.16.4-Linux-x86_64.sh \
&& ./cmake-3.16.4-Linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.16.4-Linux-x86_64.sh
CMD [ "/bin/bash" ]

# Install SWIG 4.0.1 (currently testing)
FROM base AS swig
RUN echo 'Package: * \nPin: release a=stable \nPin-Priority: 900' > /etc/apt/preferences.d/stable.pref \
&& echo 'Package: * \nPin: release a=testing \nPin-Priority: 400' > /etc/apt/preferences.d/testing.pref \
&& mv /etc/apt/sources.list /etc/apt/sources.list.d/stable.list \
&& echo 'deb http://deb.debian.org/debian testing main \ndeb http://deb.debian.org/debian testing-updates main' \
> /etc/apt/sources.list.d/testing.list
RUN apt-get update -qq \
&& apt-get install -yq swig \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
&& apt-get install -yq swig/testing \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
10 changes: 3 additions & 7 deletions makefiles/docker/debian/go.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ ENV GOROOT=/usr/local/go
ENV GOPATH=/home/go
ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin
ENV GO111MODULE=on
RUN apt-get update -qq \
&& wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz \
RUN wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz \
&& mkdir -p /usr/local/go \
&& mkdir -p /home/go \
&& tar -xvf go1.14.1.linux-amd64.tar.gz -C /usr/local \
&& rm -rf go1.14.1.linux-amd64.tar.gz \
&& go get github.com/golang/protobuf/[email protected] \
&& apt-get install -yq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
&& go get github.com/golang/protobuf/[email protected]
RUN make -version

FROM env AS devel
Expand All @@ -21,7 +17,7 @@ COPY . .

FROM devel AS build
RUN make third_party
RUN make clean_go install_go
RUN make clean_go go
RUN ldconfig

FROM build AS test
Expand Down

0 comments on commit 9173792

Please sign in to comment.