kopia lustrzana https://github.com/OpenDroneMap/ODM
Added dockerfile for march=core2 compilation
rodzic
36f7106795
commit
619c644acf
|
@ -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/"]
|
|
@ -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.
|
|
@ -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
|
|
@ -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
|
Ładowanie…
Reference in New Issue