diff --git a/CMakeLists.txt b/CMakeLists.txt index 14117a9cf..98c126200 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ enable_testing() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/Code/cmake/Modules/") -option(RDK_BUILD_SWIG_WRAPPERS "build the experimental SWIG wrappers" OFF ) +option(RDK_BUILD_SWIG_WRAPPERS "build the SWIG wrappers" OFF ) option(RDK_BUILD_PYTHON_WRAPPERS "build the standard python wrappers" ON ) option(RDK_BUILD_COMPRESSED_SUPPLIERS "build in support for compressed MolSuppliers" OFF ) option(RDK_BUILD_INCHI_SUPPORT "build the rdkit inchi wrapper" OFF ) @@ -25,6 +25,13 @@ option(RDK_INSTALL_INTREE "install the rdkit in the source tree (former behavior option(RDK_INSTALL_STATIC_LIBS "install the rdkit static libraries" ON ) option(RDK_BUILD_SLN_SUPPORT "include support for the SLN format" ON ) option(RDK_TEST_MULTITHREADED "run some tests of multithreading" OFF ) +option(RDK_BUILD_SWIG_JAVA_WRAPPER "build the SWIG JAVA wrappers (does nothing if RDK_BUILD_SWIG_WRAPPERS is not set)" ON ) +option(RDK_BUILD_SWIG_CSHARP_WRAPPER "build the experimental SWIG C# wrappers (does nothing if RDK_BUILD_SWIG_WRAPPERS is not set)" OFF ) + +if(RDK_BUILD_SWIG_WRAPPERS!=ON) + set(RDK_BUILD_SWIG_JAVA_WRAPPER OFF) + set(RDK_BUILD_SWIG_CSHARP_WRAPPER OFF) +endif() include(TestBigEndian) TEST_BIG_ENDIAN(RDK_BIG_ENDIAN) diff --git a/Code/JavaWrappers/CMakeLists.txt b/Code/JavaWrappers/CMakeLists.txt index 8cd93f3ea..07f9026e7 100644 --- a/Code/JavaWrappers/CMakeLists.txt +++ b/Code/JavaWrappers/CMakeLists.txt @@ -44,4 +44,10 @@ else() endif(RDK_BUILD_AVALON_SUPPORT) endif() +if(RDK_BUILD_SWIG_JAVA_WRAPPER) add_subdirectory(gmwrapper) +endif() + +if(RDK_BUILD_SWIG_CSHARP_WRAPPER) +add_subdirectory(csharp_wrapper) +endif() diff --git a/Code/JavaWrappers/csharp_wrapper/CMakeLists.txt b/Code/JavaWrappers/csharp_wrapper/CMakeLists.txt new file mode 100644 index 000000000..8f2307ea4 --- /dev/null +++ b/Code/JavaWrappers/csharp_wrapper/CMakeLists.txt @@ -0,0 +1,58 @@ +project (GraphMolCSharp) + +include_directories( ${RDKit_ExternalDir} ) + +SET_SOURCE_FILES_PROPERTIES(GraphMolCSharp.i PROPERTIES CPLUSPLUS ON ) + +# Setup a few variables for environment-specific things +if(WIN32) + ADD_DEFINITIONS("/W3 /wd4716 /bigobj") + SET(PATH_SEP ";") + SET(COPY_CMD xcopy ${COPY_SOURCE} ${COPY_DEST} /Y /I) +else() + SET(PATH_SEP ":") + SET(COPY_CMD cp -p ${COPY_SOURCE} ${COPY_DEST}) +endif() + +# Coax SWIG into playing nicely with Apple environments +if(APPLE) + SET(CMAKE_SIZEOF_VOID_P 4) +endif(APPLE) + +if(CMAKE_SIZEOF_VOID_P MATCHES 4) + SET(CMAKE_SWIG_FLAGS -namespace "GraphMolWrap") +else() + SET(CMAKE_SWIG_FLAGS -namespace "GraphMolWrap" "-DSWIGWORDSIZE64") +endif() +SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_SOURCE_DIR}/swig_csharp ) + +if(RDK_BUILD_INCHI_SUPPORT) + SET(CMAKE_SWIG_FLAGS "-DBUILD_INCHI_SUPPORT" ${CMAKE_SWIG_FLAGS} ) +endif() +if(RDK_BUILD_AVALON_SUPPORT) + SET(CMAKE_SWIG_FLAGS "-DBUILD_AVALON_SUPPORT" ${CMAKE_SWIG_FLAGS} ) +endif() + +FILE(GLOB SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../*.i") + +# we added all source files, now remove the ones that we're not supporting in this build: +if(NOT RDK_BUILD_AVALON_SUPPORT) +LIST(REMOVE_ITEM SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../AvalonLib.i") +endif() + +if(NOT RDK_BUILD_INCHI_SUPPORT) +LIST(REMOVE_ITEM SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../Inchi.i") +endif() + +SET(SWIG_MODULE_GraphMolCSWrap_EXTRA_DEPS ${SWIG_SRC_FILES} ) + +SWIG_ADD_MODULE(GraphMolCSWrap "CSharp" GraphMolCSharp.i ) + +# it doesnt seem like the threading libs should need to be here, but +# as of Oct 2012 using boost 1.51 under at least ubuntu 12.04 we get a +# link error if they aren't there. +SWIG_LINK_LIBRARIES(GraphMolCSWrap ${RDKit_Wrapper_Libs} + ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ) + +INSTALL(TARGETS GraphMolCSWrap + DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} )