-
.NET Framework wrapper of RDKit.
-
NuGet package is available at https://www.nuget.org/packages/RDKit.DotNetWrap/.
-
Example code is in Program.cs.
- Registered NuGet package was built using the following versions.
- RDKit Release_2021_09_4
- Eigen 3.3.8
- for Windows
- Boost 1.74.0
- Cairo 1.16.0
- libpng 1.6.37
- pixman 0.40.0
- zlib 1.2.11
- CMAKE 3.18.20081302-MSVC_2
- Visual Studio 2019
- Python 3.9
- SWIG 3.0.12
- dotnet-sdk-5.0
- for Linux
- Ubuntu 18.04.6 LTS on WSL2
Do the following procedure.
- Build native binaries for Windows
- Build native binaries for Linux
- Build .NET wrapper
- Build NuGet package
- On Windows 10 (x64)
- Install Visual Studio 2019 enabling C++, C# and CMAKE.
- Install Python version greater than 3.8.
- Install SWIG.
- IMPORTANT: SWIG-3.0 is required. SWIG-4.0 does not work.
- Make sure Python and SWIG are executable.
- Clone this repository to some directory. A name of the directory including path should be short. It is highly recommended to place it under 'C:'.
- Download the following source archives and extract them here.
- Download binery archives of both 32-bit and 64-bit versions of Boost for Visual Studio 2019, ie, msvc-14.2.
- https://sourceforge.net/projects/boost/files/boost-binaries/.
- Execute EXE files to extract. Defaults to store to
C:\local
. - Copy
boost_#_##_#
directory here. - Only dll and lib, ie, the files in
lib64-msvc-14.#
andlib32-msvc-14.#
, are used to build. - After above,
lib64-msvc-14.#
andlib32-msvc-14.#
should be created underboost_#_##_#
directory.
- Customize
config.txt
file according to where above dependencies are installed. - Open
Developer Command Prompt for VS 2019
. - Execute
bash build_win.bat
to create native binaries in${RDKIT_DIR}/Code/JavaWrappers/csharp_wrapper/win/
.
- Don't share with Windows build.
- Ubuntu 18.4 is recommended.
- Install python 3.8 or greater, swig 3.0, and eigen3.
- Install dotnet-sdk-5.0 and Mono.
sudo wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
sudo dpkg -i packages-microsoft-prod.deb && \
sudo rm packages-microsoft-prod.deb && \
sudo apt-get update && \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-5.0 && \
sudo apt-get install -y mono-mcs
- Clone this repository.
- Download the following source archives and extract them here.
- RDKit to
rdkit-Release_####_##_#
.
- RDKit to
- Customize
config.txt
file according to where above dependencies are installed. - Execute
bash build_linux.sh
to create native binaries in${RDKIT_DIR}/Code/JavaWrappers/csharp_wrapper/linux/
.
- On Windows 10 (x64)
- Open
Developer Command Prompt for VS 2019
. - Execute
python ./build_rdkit_csharp.py --build_wrapper
to create assembry files namedRDKit2DotNet.dll
in${RDKIT_DIR}\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet\bin\Release\
.
- Open
Developer Command Prompt for VS 2019
. - Copy native binaries for Linux to
${RDKIT_DIR}/Code/JavaWrappers/csharp_wrapper/linux/
. - Execute
python ./build_rdkit_csharp.py --build_nuget
to create NuGet package on${RDKIT_DIR}\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet\bin\Release\
.
- Open
Developer Command Prompt for VS 2019
. - Execute
nmake -f Makefile.win copy_to_myapp
.
Because RDKit's CMakeFile.txt does not work with SWIG 4.0, we need to install SWIG-3.0.
Download SWIG executable from https://sourceforge.net/projects/swig/files/swigwin/swigwin-3.0.12/, extract, and add the directory to PATH
.
If SWIG-3.0 package is not availabe in your system, install it from source with the following instruction.
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
wget https://sourceforge.net/projects/swig/files/swig/swig-3.0.12/swig-3.0.12.tar.gz
tar -zxvf swig-3.0.12.tar.gz
cd swig-3.0.12
./configure
make
sudo make install
make clean
If you required to uninstall SWIG-4.0, do the following.
sudo apt-get --purge remove swig
Do below to build and run test.
make -f Makefile.linux rdkit_java_test USE_BOOST=TRUE
cd ${RDKIT_DIR}/Code/JavaWrappers/gmwrapper/
wget https://repo1.maven.org/maven2/junit/junit/4.13/junit-4.13.jar
mv junit-4.13.jar junit4.jar
wget https://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
mv remotecontent\?filepath=org%2Fhamcrest%2Fhamcrest-core%2F1.3%2Fhamcrest-core-1.3.jar hamcrest-core.jar
export RDBASE=${RDKIT_DIR}
LD_LIBRARY_PATH=${RDKIT_DIR}/Code/JavaWrappers/gmwrapper:$LD_LIBRARY_PATH java -cp ${RDKIT_DIR}/Code/JavaWrappers/gmwrapper/junit4.jar:${RDKIT_DIR}/Code/JavaWrappers/gmwrapper/hamcrest-core.jar:${RDKIT_DIR}/Code/JavaWrappers/gmwrapper/org.RDKit.jar:${RDKIT_DIR}/Code/JavaWrappers/gmwrapper/build-test org.junit.runner.JUnitCore org.RDKit.GraphMolTestSuite