Added dockerfile for march=core2 compilation

pull/428/head
Ubuntu 2016-11-30 13:20:26 +00:00
rodzic 36f7106795
commit 619c644acf
4 zmienionych plików z 63 dodań i 0 usunięć

36
core2.Dockerfile 100644
Wyświetl plik

@ -0,0 +1,36 @@
#Pull in previously built packages image with lots of libraries.
FROM packages
# Prepare directories
RUN mkdir /code
WORKDIR /code
# Copy repository files
COPY ccd_defs_check.py /code/ccd_defs_check.py
COPY CMakeLists.txt /code/CMakeLists.txt
COPY configure.sh /code/configure.sh
COPY /.git/ /code/.git/
COPY .gitignore /code/.gitignore
COPY .gitmodules /code/.gitmodules
COPY /modules/ /code/modules/
COPY /opendm/ /code/opendm/
COPY /patched_files/ /code/patched_files/
COPY run.py /code/run.py
COPY /scripts/ /code/scripts/
COPY /SuperBuild/cmake/ /code/SuperBuild/cmake/
COPY /SuperBuild/CMakeLists.txt /code/SuperBuild/CMakeLists.txt
COPY /tests/ /code/tests/
# Update submodules
RUN git submodule init && git submodule update
# Replace g++ and gcc with our own scripts
COPY /docker/ /code/docker/
RUN mv -v /usr/bin/gcc /usr/bin/gcc_real && mv -v /usr/bin/g++ /usr/bin/g++_real && cp -v /code/docker/gcc /usr/bin/gcc && cp -v /code/docker/g++ /usr/bin/g++
#Compile code in SuperBuild and root directories
RUN cd SuperBuild && mkdir build && cd build && cmake .. && make -j$(nproc) \
&& cd ../.. && mkdir build && cd build && cmake .. && make -j$(nproc)
# Entry point
ENTRYPOINT ["python", "/code/run.py", "--project-path", "/code/"]

3
docker/README 100644
Wyświetl plik

@ -0,0 +1,3 @@
The g++ and gcc scripts in this directory are used to replace the real g++ and gcc programs so that compilation across all projects (including dependencies) uses the -march=core2 flag, which allows us to build a docker image compatible with most CPU architectures.
Without the -march=core2 flag, a docker image will contain binaries that are optimized for the machine that built the image, and will not run on older machines.

12
docker/g++ 100755
Wyświetl plik

@ -0,0 +1,12 @@
#!/bin/bash
args=""
for i in "$@"
do
if [[ $i != -march* ]]; then
args="$args $i"
fi
done
/usr/bin/g++_real -march=core2 $args

12
docker/gcc 100755
Wyświetl plik

@ -0,0 +1,12 @@
#!/bin/bash
args=""
for i in "$@"
do
if [[ $i != -march* ]]; then
args="$args $i"
fi
done
/usr/bin/gcc_real -march=core2 $args