5
5
# cd Code/MinimalLib/docker
6
6
#
7
7
# 2. build the JS and WASM libraries
8
- # (the build-arg arguments are all optional)
8
+ # (the build-arg arguments are all optional; in the following
9
+ # example we select the more performant, though still experimental,
10
+ # native WASM exception handling):
9
11
# docker build -t rdkit-minimallib --network=host \
10
12
# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
11
- # --build-arg "RDKIT_BRANCH=mybranch" .
13
+ # --build-arg "RDKIT_BRANCH=mybranch" \
14
+ # --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions".
12
15
#
13
16
# 3. create a temporary container and copy built libraries
14
17
# from the container to your local filesystem, then destroy
22
25
ARG RDKIT_GIT_URL="https://github.com/rdkit/rdkit.git"
23
26
ARG RDKIT_BRANCH="master"
24
27
ARG EMSDK_VERSION="latest"
28
+ ARG EXCEPTION_HANDLING="-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING"
25
29
ARG BOOST_MAJOR_VERSION="1"
26
- ARG BOOST_MINOR_VERSION="84 "
30
+ ARG BOOST_MINOR_VERSION="87 "
27
31
ARG BOOST_PATCH_VERSION="0"
32
+ ARG FREETYPE_VERSION="2.13.3"
28
33
29
34
FROM debian:bookworm as build-stage
30
35
ARG RDKIT_GIT_URL
31
36
ARG RDKIT_BRANCH
32
37
ARG EMSDK_VERSION
38
+ ARG EXCEPTION_HANDLING
33
39
ARG BOOST_MAJOR_VERSION
34
40
ARG BOOST_MINOR_VERSION
35
41
ARG BOOST_PATCH_VERSION
42
+ ARG FREETYPE_VERSION
36
43
37
44
LABEL maintainer=
"Greg Landrum <[email protected] >"
38
45
@@ -49,16 +56,15 @@ RUN apt-get update && apt-get upgrade -y && apt install -y \
49
56
50
57
ENV LANG C
51
58
52
- WORKDIR /opt
59
+ WORKDIR /src
53
60
ARG BOOST_DOT_VERSION="${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION}"
54
61
ARG BOOST_UNDERSCORE_VERSION="${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_PATCH_VERSION}"
55
- RUN wget -q https://boostorg.jfrog .io/artifactory/main /release/${BOOST_DOT_VERSION}/source/boost_${BOOST_UNDERSCORE_VERSION}.tar.gz && \
62
+ RUN wget -q https://archives.boost .io/release/${BOOST_DOT_VERSION}/source/boost_${BOOST_UNDERSCORE_VERSION}.tar.gz && \
56
63
tar xzf boost_${BOOST_UNDERSCORE_VERSION}.tar.gz
57
- WORKDIR /opt /boost_${BOOST_UNDERSCORE_VERSION}
64
+ WORKDIR /src /boost_${BOOST_UNDERSCORE_VERSION}
58
65
RUN ./bootstrap.sh --prefix=/opt/boost --with-libraries=system && \
59
66
./b2 install
60
67
61
-
62
68
WORKDIR /opt
63
69
RUN git clone https://github.com/emscripten-core/emsdk.git
64
70
@@ -68,30 +74,41 @@ RUN ./emsdk install ${EMSDK_VERSION} && \
68
74
69
75
# RUN source ./emsdk_env.sh
70
76
71
- RUN mkdir /src
77
+ RUN echo "source /opt/emsdk/emsdk_env.sh > /dev/null 2>&1" >> ~/.bashrc
78
+ SHELL ["/bin/bash" , "-c" , "-l" ]
79
+
80
+ WORKDIR /src
81
+ RUN wget -q https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
82
+ tar xzf freetype-${FREETYPE_VERSION}.tar.gz
83
+ WORKDIR /src/freetype-${FREETYPE_VERSION}
84
+ RUN mkdir build
85
+ WORKDIR /src/freetype-${FREETYPE_VERSION}/build
86
+ RUN emcmake cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ZLIB=OFF -DWITH_BZip2=OFF -DWITH_PNG=OFF \
87
+ -DCMAKE_C_FLAGS="${EXCEPTION_HANDLING}" -DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING}" \
88
+ -DCMAKE_INSTALL_PREFIX=/opt/freetype ..
89
+ RUN make -j2 && make -j2 install
90
+
72
91
WORKDIR /src
73
92
ENV RDBASE=/src/rdkit
74
93
RUN git clone ${RDKIT_GIT_URL}
75
94
WORKDIR $RDBASE
76
95
RUN git fetch --all --tags && \
77
96
git checkout ${RDKIT_BRANCH}
78
-
79
97
RUN mkdir build
80
98
WORKDIR $RDBASE/build
81
-
82
- RUN echo "source /opt/emsdk/emsdk_env.sh > /dev/null 2>&1" >> ~/.bashrc
83
- SHELL ["/bin/bash" , "-c" , "-l" ]
84
- RUN emcmake cmake -DBoost_INCLUDE_DIR=/opt/boost/include -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
99
+ RUN emcmake cmake -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
85
100
-DRDK_BUILD_PYTHON_WRAPPERS=OFF -DRDK_BUILD_CPP_TESTS=OFF -DRDK_BUILD_INCHI_SUPPORT=ON \
86
101
-DRDK_USE_BOOST_SERIALIZATION=OFF -DRDK_OPTIMIZE_POPCNT=OFF -DRDK_BUILD_THREADSAFE_SSS=OFF \
87
102
-DRDK_BUILD_DESCRIPTORS3D=OFF -DRDK_TEST_MULTITHREADED=OFF \
88
103
-DRDK_BUILD_MAEPARSER_SUPPORT=OFF -DRDK_BUILD_COORDGEN_SUPPORT=ON \
104
+ -DBoost_DIR=/opt/boost/lib/cmake/Boost-${BOOST_DOT_VERSION} \
105
+ -Dboost_headers_DIR=/opt/boost/lib/cmake/boost_headers-${BOOST_DOT_VERSION} \
89
106
-DRDK_BUILD_SLN_SUPPORT=OFF -DRDK_USE_BOOST_IOSTREAMS=OFF \
90
- -DFREETYPE_INCLUDE_DIRS=/opt/emsdk/upstream/emscripten/cache/sysroot /include/freetype2 \
91
- -DFREETYPE_LIBRARY=/opt/emsdk/upstream/emscripten/cache/sysroot/ lib/wasm32-emscripten /libfreetype.a \
92
- -DCMAKE_CXX_FLAGS="-Wno-enum-constexpr-conversion -s DISABLE_EXCEPTION_CATCHING=0 " \
93
- -DCMAKE_C_FLAGS="-Wno-enum-constexpr-conversion -DCOMPILE_ANSI_ONLY" \
94
- -DCMAKE_EXE_LINKER_FLAGS="-s MODULARIZE=1 -s EXPORT_NAME=\" 'initRDKitModule'\" " ..
107
+ -DFREETYPE_INCLUDE_DIRS=/opt/freetype /include/freetype2 \
108
+ -DFREETYPE_LIBRARY=/opt/freetype/ lib/libfreetype.a \
109
+ -DCMAKE_CXX_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG " \
110
+ -DCMAKE_C_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG -DCOMPILE_ANSI_ONLY" \
111
+ -DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING} -s STACK_OVERFLOW_CHECK=1 -s USE_PTHREADS=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MODULARIZE=1 -s EXPORT_NAME=\" 'initRDKitModule'\" " ..
95
112
96
113
# "patch" to make the InChI code work with emscripten:
97
114
RUN cp /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c.bak && \
0 commit comments