2016-07-16 05:46:08 +02:00
|
|
|
FROM dockcross/base
|
2015-05-19 23:34:05 +02:00
|
|
|
MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
|
|
|
|
|
|
|
|
# The cross-compiling emulator
|
2016-07-06 04:24:59 +02:00
|
|
|
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - && \
|
2016-03-10 00:28:54 +01:00
|
|
|
apt-get install -y --no-install-recommends \
|
2015-05-19 23:34:05 +02:00
|
|
|
default-jre \
|
|
|
|
nodejs \
|
|
|
|
python2.7
|
|
|
|
|
2016-08-11 17:45:23 +02:00
|
|
|
ENV EMSCRIPTEN_VERSION 1.36.7
|
2015-05-19 23:34:05 +02:00
|
|
|
RUN cd /usr && \
|
|
|
|
curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | tar xz && \
|
|
|
|
cd ./emsdk_portable && \
|
|
|
|
./emsdk update && \
|
2016-03-10 00:46:16 +01:00
|
|
|
./emsdk install -j$(nproc) --build=Release sdk-tag-${EMSCRIPTEN_VERSION}-32bit && \
|
|
|
|
./emsdk activate --build=Release sdk-tag-${EMSCRIPTEN_VERSION}-32bit && \
|
|
|
|
./emsdk install node-4.1.1-64bit && \
|
|
|
|
./emsdk activate node-4.1.1-64bit && \
|
|
|
|
./emsdk uninstall node-4.1.1-32bit && \
|
2015-05-19 23:34:05 +02:00
|
|
|
find . -name "*.o" -exec rm {} \; && \
|
|
|
|
find . -name "*.a" -exec rm {} \; && \
|
|
|
|
find . -name "*.tmp" -exec rm {} \;
|
|
|
|
|
2016-03-10 00:46:16 +01:00
|
|
|
ENV PATH /usr/emsdk_portable:/usr/emsdk_portable/clang/tag-e${EMSCRIPTEN_VERSION}/build_tag-e${EMSCRIPTEN_VERSION}_32/bin:/usr/emsdk_portable/emscripten/tag-${EMSCRIPTEN_VERSION}:${PATH}
|
|
|
|
ENV CC=/usr/emsdk_portable/emscripten/tag-${EMSCRIPTEN_VERSION}/emcc \
|
|
|
|
CXX=/usr/emsdk_portable/emscripten/tag-${EMSCRIPTEN_VERSION}/em++ \
|
|
|
|
AR=/usr/emsdk_portable/emscripten/tag-${EMSCRIPTEN_VERSION}/emar
|
|
|
|
|
|
|
|
# Emscripten generates system libraries the firsts time it runs
|
2016-07-06 21:33:35 +02:00
|
|
|
ADD test/ /tmp/test/
|
2016-03-10 00:46:16 +01:00
|
|
|
RUN cd /tmp && \
|
|
|
|
/bin/echo -e "#include <iostream>\nint main() { std::cout << \"first run\"; return 0; }" > /tmp/first_run.cxx && \
|
2016-07-06 21:33:35 +02:00
|
|
|
$CXX /tmp/first_run.cxx -o a.out.js && \
|
2016-03-10 00:46:16 +01:00
|
|
|
rm /tmp/first_run.* && \
|
|
|
|
/bin/echo -e "#include <stdio.h>\nint main() { printf(\"first run\"); return 0; }" > /tmp/first_run.c && \
|
2016-07-06 21:33:35 +02:00
|
|
|
$CC /tmp/first_run.c -o a.out.js && \
|
|
|
|
rm /tmp/first_run.* a.out.js && \
|
|
|
|
cd /tmp/test && \
|
|
|
|
python /tmp/test/run.py; python /tmp/test/run.py && \
|
|
|
|
cd && rm -rf /tmp/test
|
2015-05-19 23:34:05 +02:00
|
|
|
|
2016-07-16 05:46:08 +02:00
|
|
|
ENV DEFAULT_DOCKCROSS_IMAGE dockcross/browser-asmjs
|
2016-07-04 06:10:36 +02:00
|
|
|
|
2015-07-24 22:06:40 +02:00
|
|
|
ENV CMAKE_TOOLCHAIN_FILE /usr/emsdk_portable/emscripten/tag-${EMSCRIPTEN_VERSION}/cmake/Modules/Platform/Emscripten.cmake
|
2016-08-11 17:51:42 +02:00
|
|
|
# CMakeForceCompiler was marked deprecated in CMake 3.6.0. It emits many
|
|
|
|
# warnings when using Emscripten. These changes can be removed in a future
|
|
|
|
# version of Emscripten when it is disabled or removed per:
|
|
|
|
# https://github.com/kripken/emscripten/pull/4477
|
|
|
|
RUN sed -i -e '/CMakeForceCompiler/d' -e '/CMAKE_FORCE_C/d' $CMAKE_TOOLCHAIN_FILE
|
|
|
|
|