Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# native WASM exception handling):
# docker build -t rdkit-minimallib --network=host \
# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
# --build-arg "RDKIT_BRANCH=mybranch" \
# --build-arg "RDKIT_TAG=Release_2026_03_3" \
# --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions".
#
# 3. create a temporary container and copy built libraries
Expand All @@ -23,7 +23,7 @@


ARG RDKIT_GIT_URL="https://github.com/rdkit/rdkit.git"
ARG RDKIT_BRANCH="master"
ARG RDKIT_TAG="Release_2026_03_3"
ARG EMSDK_VERSION="latest"
ARG EXCEPTION_HANDLING="-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING"
ARG BOOST_MAJOR_VERSION="1"
Expand All @@ -33,7 +33,7 @@ ARG FREETYPE_VERSION="2.13.3"

FROM debian:bookworm as build-stage
ARG RDKIT_GIT_URL
ARG RDKIT_BRANCH
ARG RDKIT_TAG
ARG EMSDK_VERSION
ARG EXCEPTION_HANDLING
ARG BOOST_MAJOR_VERSION
Expand Down Expand Up @@ -93,7 +93,7 @@ ENV RDBASE=/src/rdkit
RUN git clone ${RDKIT_GIT_URL}
WORKDIR $RDBASE
RUN git fetch --all --tags && \
git checkout ${RDKIT_BRANCH}
git checkout tags/${RDKIT_TAG}
RUN mkdir build
WORKDIR $RDBASE/build
RUN emcmake cmake -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
Expand All @@ -106,7 +106,7 @@ RUN emcmake cmake -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
-DRDK_BUILD_SLN_SUPPORT=OFF -DRDK_USE_BOOST_IOSTREAMS=OFF \
-DFREETYPE_INCLUDE_DIRS=/opt/freetype/include/freetype2 \
-DFREETYPE_LIBRARY=/opt/freetype/lib/libfreetype.a \
-DCMAKE_CXX_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG" \
-DCMAKE_CXX_FLAGS="${EXCEPTION_HANDLING} -sUSE_ZLIB=1 -O3 -DNDEBUG" \
-DCMAKE_C_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG -DCOMPILE_ANSI_ONLY" \
-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'\"" ..

Expand All @@ -117,13 +117,21 @@ RUN cp /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c /src/rdkit/Extern
# comment out a line which causes a compilation error on some platforms
# (based on the change which has already been applied to the RapidJSON master branch, see
# https://github.com/Tencent/rapidjson/blob/ab1842a2dae061284c0a62dca1cc6d5e7e37e346/include/rapidjson/document.h#L414)
RUN sed -i 's|^\( *\)\(GenericStringRef\& operator=(const GenericStringRef\& rhs) { s = rhs.s; length = rhs.length; } *\)$|\1//\2|' \
/src/rdkit/External/rapidjson-1.1.0/include/rapidjson/document.h
RUN if [ -f /src/rdkit/External/rapidjson-1.1.0/include/rapidjson/document.h ]; then \
sed -i 's|^\( *\)\(GenericStringRef\& operator=(const GenericStringRef\& rhs) { s = rhs.s; length = rhs.length; } *\)$|\1//\2|' \
/src/rdkit/External/rapidjson-1.1.0/include/rapidjson/document.h; \
fi

# build and "install"
RUN make -j2 RDKit_minimal && \
cp Code/MinimalLib/RDKit_minimal.* ../Code/MinimalLib/demo/

# Build the ESM version (using the cached CMake configuration from the previous build). The linker
# flags are the same as for the non-ESM version, except "-s EXPORT_ES6=1" at the end.
RUN emcmake cmake -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'\" -s EXPORT_ES6=1" .. && \
make -j2 RDKit_minimal && \
cp Code/MinimalLib/RDKit_minimal.js ../Code/MinimalLib/demo/RDKit_minimal_esm.js

# run the tests
WORKDIR /src/rdkit/Code/MinimalLib/tests
RUN /opt/emsdk/node/*/bin/node tests.js
Expand All @@ -133,4 +141,4 @@ RUN /opt/emsdk/node/*/bin/node tests.js
# https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
FROM scratch as export-stage
COPY --from=build-stage /src/rdkit/Code/MinimalLib/demo /
COPY --from=build-stage /src/rdkit/Code/MinimalLib/docs /
COPY --from=build-stage /src/rdkit/Code/MinimalLib/docs /
17 changes: 12 additions & 5 deletions examples/angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": 1,
"cli": {
"packageManager": "yarn",
"schematicCollections": ["@angular-eslint/schematics"],
"schematicCollections": [
"@angular-eslint/schematics"
],
"analytics": false
},
"newProjectRoot": "projects",
Expand Down Expand Up @@ -54,12 +56,14 @@
"src/assets",
{
"glob": "RDKit_minimal.wasm",
"input": "node_modules/@rdkit/rdkit/dist/",
"input": "node_modules/@rdkit/rdkit/dist/esm",
"output": "/"
}
],
"styles": ["src/styles.css"],
"scripts": ["node_modules/@rdkit/rdkit/dist/RDKit_minimal.js"],
"styles": [
"src/styles.css"
],
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
Expand Down Expand Up @@ -118,7 +122,10 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
Expand Down
Loading