Tools/devInstall/Linux/install-swig.sh: added

Moved and refreshed from bindings/python/swig_install.sh. Install
location now is /usr/local/swig-*, which ./configure picks up
automatically.

Specify --without-alllang for SWIG build, which should suppress building
tests and examples for specific languages.

Windows: Update source setup links for SWIG
This commit is contained in:
Mark Hillebrand 2017-06-27 11:07:54 +02:00
Родитель 7f89deb77b
Коммит a2b4997796
13 изменённых файлов: 75 добавлений и 31 удалений

Просмотреть файл

@ -81,7 +81,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="Build" Condition="$(HasSwig)" DependsOnTargets="$(BuildDependsOn)" />
<Target Name="CheckDependencies">
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#swig for installation instructions." />
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#optional-swig for installation instructions." />
<Error Condition="'$(CntkCsAssemblyVersion)' != '$(CntkComponentVersion)'" Text="The CntkCsAssemblyVersion in this project must be the same as the CntkComponentVersion in CNTK.Common.props." />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

Просмотреть файл

@ -0,0 +1,4 @@
# CNTK Linux Development Install Helpers.
This directory contains helper scripts to assist in setting up CNTK source
build on Linux (more specifically: Ubuntu 14.04).

Просмотреть файл

@ -0,0 +1,48 @@
#!/bin/bash
#
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
# Build and install SWIG on Ubuntu 14.04.
# SWIG is a source build dependency for the CNTK Java and Python bindings.
#
# This script is meant to be run interactively, and requires root permission
# (e.g., via sudo) for installation of build dependencies as well as the final
# binary.
SWIG_VERSION=3.0.10
SWIG_PATH=swig-$SWIG_VERSION
SWIG_PREFIX=/usr/local/$SWIG_PATH
[[ -d $SWIG_PREFIX ]] && {
echo There already is a directory $SWIG_PREFIX.
echo In case you want to rebuild and install, remove it first.
exit 1
}
set -e -x -o pipefail
if [[ $EUID -eq 0 ]]; then
AS_ROOT=
else
AS_ROOT=sudo
fi
REQUIRED_PACKAGES="wget ca-certificates build-essential libpcre3-dev"
if dpkg -s $REQUIRED_PACKAGES 1>/dev/null 2>/dev/null; then
printf "Packages already installed, skipping.\n"
else
$AS_ROOT apt-get update
$AS_ROOT apt-get install -y --no-install-recommends $REQUIRED_PACKAGES
fi
SCRIPT_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
cd "$SCRIPT_DIR"
wget -q http://prdownloads.sourceforge.net/swig/$SWIG_PATH.tar.gz -O - | tar xvfz -
cd swig-$SWIG_VERSION
# Note: we specify --without-alllang to suppress building tests and examples for specific languages.
./configure --prefix=$SWIG_PREFIX --without-alllang
make -j $(nproc)
$AS_ROOT make install
cd ..
rm -rf "$SWIG_PATH"

Просмотреть файл

@ -38,7 +38,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# For Java Bindings
openjdk-7-jdk \
# For SWIG
libpcre++-dev && \
libpcre3-dev && \
rm -rf /var/lib/apt/lists/*
RUN OPENMPI_VERSION=1.10.3 && \
@ -132,7 +132,8 @@ RUN mv /bin/sh /bin/sh.orig && \
RUN cd /root && \
wget -q http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz -O - | tar xvfz - && \
cd swig-3.0.10 && \
./configure --without-perl5 && \
# Note: we specify --without-alllang to suppress building tests and examples for specific languages.
./configure --without-alllang && \
make -j $(nproc) && \
make install

Просмотреть файл

@ -51,7 +51,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# For Java Bindings
openjdk-7-jdk \
# For SWIG
libpcre++-dev && \
libpcre3-dev && \
rm -rf /var/lib/apt/lists/*
RUN OPENMPI_VERSION=1.10.3 && \
@ -147,7 +147,8 @@ RUN mv /bin/sh /bin/sh.orig && \
RUN cd /root && \
wget -q http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz -O - | tar xvfz - && \
cd swig-3.0.10 && \
./configure --without-perl5 && \
# Note: we specify --without-alllang to suppress building tests and examples for specific languages.
./configure --without-alllang && \
make -j $(nproc) && \
make install

Просмотреть файл

@ -32,7 +32,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# For Java Bindings
openjdk-7-jdk \
# For SWIG
libpcre++-dev && \
libpcre3-dev && \
rm -rf /var/lib/apt/lists/*
RUN OPENMPI_VERSION=1.10.3 && \
@ -128,7 +128,8 @@ RUN mv /bin/sh /bin/sh.orig && \
RUN cd /root && \
wget -q http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz -O - | tar xvfz - && \
cd swig-3.0.10 && \
./configure --without-perl5 && \
# Note: we specify --without-alllang to suppress building tests and examples for specific languages.
./configure --without-alllang && \
make -j $(nproc) && \
make install

Просмотреть файл

@ -104,7 +104,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="Build" Condition="$(HasSwig)" DependsOnTargets="$(BuildDependsOn)" />
<Target Name="CheckDependencies">
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#swig for installation instructions." />
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#optional-swig for installation instructions." />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@ -113,4 +113,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

Просмотреть файл

@ -126,9 +126,9 @@
<None Include="std_unordered_map.i" />
</ItemGroup>
<Target Name="CheckDependencies">
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#swig for installation instructions." />
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#optional-swig for installation instructions." />
</Target>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Target Name="Build" Condition="$(HasSwig)" Outputs="$(TargetPath)" DependsOnTargets="$(BuildDependsOn)" />
<ImportGroup Label="ExtensionTargets" />
</Project>
</Project>

Просмотреть файл

@ -128,10 +128,10 @@
<None Include="std_unordered_map.i" />
</ItemGroup>
<Target Name="CheckDependencies">
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#swig for installation instructions." />
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#optional-swig for installation instructions." />
<Warning Condition="!$(HasJava)" Text="The project requires the Java JDK to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#optional-java for installation instructions." />
</Target>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Target Name="Build" Condition="$(HasSwig) And $(HasJava)" Outputs="$(TargetPath)" DependsOnTargets="$(BuildDependsOn)" />
<ImportGroup Label="ExtensionTargets" />
</Project>
</Project>

Просмотреть файл

@ -145,10 +145,9 @@
<None Include="cntk\tests\__init__.py" />
<None Include="README.md" />
<None Include="setup.py" />
<None Include="swig_install.sh" />
<None Include="test.bat" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

Просмотреть файл

@ -106,7 +106,6 @@
<Filter>cntk\io</Filter>
</None>
<None Include="setup.py" />
<None Include="swig_install.sh" />
<None Include="cntk\losses\__init__.py">
<Filter>cntk\losses</Filter>
</None>
@ -363,4 +362,4 @@
<Filter>cntk\ops\tests</Filter>
</None>
</ItemGroup>
</Project>
</Project>

Просмотреть файл

@ -1,13 +1,3 @@
#!/bin/bash
wget http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz
tar xvfz swig-3.0.10.tar.gz
pushd swig-3.0.10
./configure --without-java --without-perl5 --prefix=$(readlink -m ./root)
make -j 4
make install
echo This script has moved to Tools/devInstall/Linux/install-swig.sh.
exit 1

5
configure поставляемый
Просмотреть файл

@ -1015,8 +1015,9 @@ then
swig_path=$(find_swig)
if test x$swig_path = x
then
echo 'Cannot locate SWIG (>= 3.0.10), which is required Python/Java support.'
echo Check bindings/python/swig_install.sh for build instructions.
echo 'Cannot locate SWIG (>= 3.0.10), which is required for Python/Java support.'
echo Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Linux#optional-swig
echo for installation instructions.
exit 1
fi
fi