Files
rdkit/Code/JavaWrappers/csharp_wrapper/README
Greg Landrum 9437cf466b update docs
2012-11-01 11:53:49 +00:00

37 lines
3.1 KiB
Plaintext

To build on Windows:
Since cmake doesn't know anything about C#, there's an unfortunate manual step involved in this.
- Make sure that the cmake configuration variable RDK_BUILD_SWIG_CSHARP_WRAPPER is set to ON.
- Run cmake to generate the solution file and open it in Visual Studio.
- Select the option to add an existing project and add $RDBASE/Code/JavaWrappers/csharp_wrapper/RDKit2DotNet.csproj
- Right click on the added project (named RDKit2DotNet) and add a dependency to RDKFuncs (this is the project that creates the C++ dll that the C# project needs)
- Build the RDKit2DotNet project.
Your bin directory ($RDBASE/Code/JavaWrappers/csharp_wrapper/bin/Release if you did a release build) now contains two DLLs:
RDKFuncs.dll is the C++ dll containing the RDKit functionality
RDKit2DotNet.dll contains the C# wrapper.
To use the wrappers in your own projects, you should copy both dlls into your project directory and add a reference to RDKit2DotNet.dll
The directory RDKitCSharpTest contains a sample test project and some code that makes very basic use of the wrapper functionality.
To build on a linux system with mono installed:
[OUT OF DATE]
Run SWIG:
---------
swig -c++ -csharp -namespace GraphMolWrap -DBUILD_AVALON_SUPPORT -DBUILD_INCHI_SUPPORT -DSWIGWORDSIZE64 -outdir ./swig_csharp -I/usr/include -I/usr/local/include -I$RDBASE/Code -I$RDBASE/Code/JavaWrappers -I$RDBASE/External -o GraphMolCSharp_wrap.cxx ./GraphMolCSharp.i
Compile and link the shared library:
------------------------------------
g++ -DGraphMolWrap_EXPORTS -DRDK_64BIT_BUILD -O3 -DNDEBUG -fPIC -I/usr/local/include -I$RDBASE/Code -I$RDBASE/Code/JavaWrappers -I$RDBASE/External -Wno-deprecated -Wno-unused-function -fno-strict-aliasing -fPIC -o GraphMolCSharp_wrap.cxx.o -c GraphMolCSharp_wrap.cxx
g++ -fPIC -O3 -DNDEBUG -shared -Wl,-soname,libRDKFuncs.so -o libRDKFuncs.so GraphMolCSharp_wrap.cxx.o -L/usr/local/lib $RDBASE/lib/libAvalonLib_static.a $RDBASE/lib/libavalon_clib_static.a $RDBASE/lib/libRDInchiLib_static.a $RDBASE/lib/libInchi_static.a $RDBASE/lib/libFileParsers_static.a $RDBASE/lib/libSmilesParse_static.a $RDBASE/lib/libDepictor_static.a $RDBASE/lib/libSubstructMatch_static.a $RDBASE/lib/libChemReactions_static.a $RDBASE/lib/libFingerprints_static.a $RDBASE/lib/libChemTransforms_static.a $RDBASE/lib/libSubgraphs_static.a $RDBASE/lib/libGraphMol_static.a $RDBASE/lib/libDataStructs_static.a $RDBASE/lib/libDescriptors_static.a $RDBASE/lib/libPartialCharges_static.a $RDBASE/lib/libMolTransforms_static.a $RDBASE/lib/libDistGeomHelpers_static.a $RDBASE/lib/libDistGeometry_static.a $RDBASE/lib/libForceFieldHelpers_static.a $RDBASE/lib/libForceField_static.a $RDBASE/lib/libEigenSolvers_static.a $RDBASE/lib/libOptimizer_static.a $RDBASE/lib/libMolAlign_static.a $RDBASE/lib/libAlignment_static.a $RDBASE/lib/libSimDivPickers_static.a $RDBASE/lib/libRDGeometryLib_static.a $RDBASE/lib/libRDGeneral_static.a -lboost_thread-mt -lboost_system-mt -lpthread
Build and test the csharp code:
-------------------------------
gmcs -out:RDKFuncs.dll -t:library swig_csharp/*.cs
gmcs -out:test.exe -addmodule:./RDKFuncs.dll test.cs
mono test.exe