Skip to content

Commit

Permalink
Restore mono build (#7377)
Browse files Browse the repository at this point in the history
* Add mono build back into C# build

* Add mono build back into C# build

* Add mono build back into C# build

* Don't do mono build on Linux if dotnet is used

* CSharp dotnet build always on windows. Enable dotnet testing in vs_build_swit

* Fix typos
  • Loading branch information
jones-gareth committed Apr 24, 2024
1 parent 24aba69 commit 5d034e3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .azure-pipelines/vs_build_swig.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
steps:
- task: UseDotNet@2
displayName: 'Install .NET Core 8 SDK'
inputs:
version: 8.x
performMultiLevelLookup: true
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Setup build environment
- script: |
Expand Down Expand Up @@ -53,7 +58,7 @@ steps:
set PYTHONPATH=%RDBASE%;%PYTHONPATH%
set PATH=%RDBASE%\lib;%PATH%
cd build
ctest -C Release -j $(number_of_cores) --output-on-failure -T Test
ctest -R CSharpTests -C Release -T test --output-on-failure --verbose
displayName: Run tests
- task: PublishTestResults@2
inputs:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ option(RDK_BUILD_SLN_SUPPORT "include support for the SLN format" ON )
option(RDK_TEST_MULTITHREADED "run some tests of multithreading" ON )
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 )
option(RDK_BUILD_DOTNET_CSHARP_TESTS "build the DotNet Core tests for C# wrappers (does nothing if RDK_BUILD_SWIG_CSHARP_WRAPPER is not set)" OFF )
option(RDK_BUILD_DOTNET_CSHARP_TESTS "build the DotNet Core tests for C# wrappers on Linux (does nothing if RDK_BUILD_SWIG_CSHARP_WRAPPER is not set and is ignored on Windows)" OFF )
option(RDK_SWIG_STATIC "statically link rdkit libraries into the SWIG wrappers" ON )
option(RDK_TEST_MMFF_COMPLIANCE "run MMFF compliance tests (requires tar/gzip)" ON )
option(RDK_BUILD_CPP_TESTS "build the c++ tests (disabing can speed up builds" ON)
Expand Down
25 changes: 23 additions & 2 deletions Code/JavaWrappers/csharp_wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ SWIG_LINK_LIBRARIES(RDKFuncs ${RDKit_Wrapper_Libs}
INSTALL(TARGETS RDKFuncs
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} )

if (RDK_BUILD_DOTNET_CSHARP_TESTS)
if (RDK_BUILD_DOTNET_CSHARP_TESTS OR MSVC)

find_program(DOTNET_EXE dotnet)
if (NOT DOTNET_EXE)
Expand All @@ -108,5 +108,26 @@ if (RDK_BUILD_DOTNET_CSHARP_TESTS)
COMMAND ${DOTNET_EXE} test RDKitDotNetCore.sln "-l:console$<SEMICOLON>verbosity=normal"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
else(RDK_BUILD_DOTNET_CSHARP_TESTS OR MSVC)
# find the mcs executable on non-windows systems, if dotnet is not used:
find_program(GMCS_EXE mcs)
if (NOT GMCS_EXE)
MESSAGE ("mcs (executable) is not found. Please add it to PATH and rerun cmake.")
MESSAGE(FATAL_ERROR "Cannot find required executable mcs")
endif (NOT GMCS_EXE)

# code adapted from the wrapper code for
# GDCM: http://gdcm.svn.sf.net/viewvc/gdcm/trunk/Wrapping/Java/CMakeLists.txt?view=markup
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/RDKit2DotNet.dll
## 1. run this custom command only after swig has been run.
COMMAND ${GMCS_EXE} -platform:${PLATFORM} -out:RDKit2DotNet.dll -t:library "swig_csharp/*.cs"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS "${swig_generated_file_fullname}"
)
ADD_CUSTOM_TARGET(RDKFuncsDLL ALL
DEPENDS RDKFuncs ${CMAKE_CURRENT_SOURCE_DIR}/RDKit2DotNet.dll
COMMENT "building mono dll"
)
endif(RDK_BUILD_DOTNET_CSHARP_TESTS OR MSVC)

endif()

0 comments on commit 5d034e3

Please sign in to comment.