diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-04-16 13:07:24 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-04-16 13:07:24 +0100 |
commit | 0c100b7dd2b30e75b799d806df4ef899fd98e1ea (patch) | |
tree | 464c922e949c7e4d5d891fb2cdda5daee5612537 /sci-chemistry/openbabel | |
parent | e68d405c5d712af4387159df07e226217bdda049 (diff) |
gentoo resync : 16.04.2022
Diffstat (limited to 'sci-chemistry/openbabel')
-rw-r--r-- | sci-chemistry/openbabel/Manifest | 1 | ||||
-rw-r--r-- | sci-chemistry/openbabel/files/openbabel-python.cmake | 104 |
2 files changed, 105 insertions, 0 deletions
diff --git a/sci-chemistry/openbabel/Manifest b/sci-chemistry/openbabel/Manifest index c26e4e5832f4..85e159ec9039 100644 --- a/sci-chemistry/openbabel/Manifest +++ b/sci-chemistry/openbabel/Manifest @@ -1,3 +1,4 @@ +AUX openbabel-python.cmake 4402 BLAKE2B 36c325a26f9b23c3957db22110628a0a922ad02b6a7415fc197713d3df8f1703475bf2f2c53b546b7915466ce30b6b3c72c505ea72443dd23a17a7f9131f4f6e SHA512 a7bcdf90588930b05d11312429e735d3cc6a94053e67117bef6c1614932651abee7c4e082916482a9012622c0f29c3ba62dd7788b72aca6c88293660c7f2a3db DIST openbabel-3.1.1_p20210225.tar.gz 36674527 BLAKE2B bb82fc96f704249d211bd86c73de0cf4e7cfe5e2ba5c745aa8b4f6f19583837e2181d85101377810095f6b71fc3b91bf2f6f5636726fc8271c6905f1f8c59e7b SHA512 9ff7cb4acbfad7a9c5c8d0dd8930ac0390d0d0f2758d1a6120009071f47ffe718f92ad620d37f26f196babb14649c52b5eb7bb161c342ef36aec655e0a172de4 DIST openbabel.jpg 12159 BLAKE2B b701df2b8c29df607dc2bd3997a282aa9a726d56c789ff2db900d33234dc691f76b6af12a4c9ccda4f09984504b863c40c39e8bf91058939996714ede2dd37c7 SHA512 998ea526c8c92f87dd203527fdd9f4e001357e951409209f41ab68e0b730fe12d97f9079c12ca289be413854ea2abcf8bb691ae5af823a6f29d6a590e1a3e2b0 DIST openbabel.png 29060 BLAKE2B 8d217d92125cc73462437411dd4e0cc05179cb0934f5ed15a307acc6b549b8ebab250a48a05ef7657f48c6df394f37da9b659de61efb1477b79b573a5b393ad3 SHA512 bbcaaa37663b526c9038ccb9edaf05ccc3ad1a861739a737f05f363098d8402a10b36e341fcc0aca636e809c6c32db99bf987b41719a0c756bf5e31444d3eb70 diff --git a/sci-chemistry/openbabel/files/openbabel-python.cmake b/sci-chemistry/openbabel/files/openbabel-python.cmake new file mode 100644 index 000000000000..425b4656a9d2 --- /dev/null +++ b/sci-chemistry/openbabel/files/openbabel-python.cmake @@ -0,0 +1,104 @@ +# The following is a cmake fragment taken from scripts/CMakeLists.txt and +# edited for Gentoo python multibuild compatibility. + +if (PYTHON_BINDINGS) + # Tags should be edited to reflect the active python implementation + set(EPYTHON @@EPYTHON@@) + set(PYTHON_INCUDE_DIR @@PYTHON_INCUDE_DIR@@) + set(PYTHON_LIBS @@PYTHON_LIBS@@) + set(PYTHON_SITEDIR @@PYTHON_SITEDIR@@) + + include_directories(${PYTHON_INCUDE_DIR}) + + add_custom_command( + OUTPUT ${CMAKE_SOURCE_DIR}/scripts/${EPYTHON}/openbabel-python.cpp ${CMAKE_SOURCE_DIR}/scripts/${EPYTHON}/openbabel.py + COMMAND ${SWIG_EXECUTABLE} -python -c++ -small -O -templatereduce -naturalvar -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_BINARY_DIR}/include -o ${CMAKE_SOURCE_DIR}/scripts/${EPYTHON}/openbabel-python.cpp ${eigen_define} -outdir ${CMAKE_SOURCE_DIR}/scripts/${EPYTHON} ${CMAKE_SOURCE_DIR}/scripts/openbabel-python.i + MAIN_DEPENDENCY openbabel-python.i + VERBATIM + ) + + configure_file(${CMAKE_SOURCE_DIR}/scripts/python/openbabel/__init__.py.in + ${CMAKE_BINARY_DIR}/scripts/${EPYTHON}/openbabel/__init__.py) + + add_library(bindings_python_${EPYTHON} MODULE ${CMAKE_SOURCE_DIR}/scripts/${EPYTHON}/openbabel-python.cpp) + target_link_libraries(bindings_python_${EPYTHON} ${PYTHON_LIBS} ${BABEL_LIBRARY}) + + set_target_properties(bindings_python_${EPYTHON} + PROPERTIES + OUTPUT_NAME _openbabel + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/scripts/${EPYTHON}/openbabel + PREFIX "" + SUFFIX .so ) + + add_dependencies(bindings_python_${EPYTHON} openbabel) + + install(TARGETS bindings_python_${EPYTHON} + LIBRARY DESTINATION ${PYTHON_SITEDIR}/openbabel + COMPONENT bindings_python) + install(FILES ${CMAKE_BINARY_DIR}/scripts/${EPYTHON}/openbabel/__init__.py + DESTINATION ${PYTHON_SITEDIR}/openbabel + COMPONENT bindings_python) + install(FILES ${CMAKE_SOURCE_DIR}/scripts/${EPYTHON}/openbabel.py + DESTINATION ${PYTHON_SITEDIR}/openbabel + COMPONENT bindings_python) + install(FILES ${CMAKE_SOURCE_DIR}/scripts/python/openbabel/pybel.py + DESTINATION ${PYTHON_SITEDIR}/openbabel + COMPONENT bindings_python) + + if (ENABLE_TESTS) + # Make sure all module files are together in the same directory for testing + add_custom_command(TARGET bindings_python_${EPYTHON} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/scripts/${EPYTHON}/openbabel.py ${CMAKE_BINARY_DIR}/scripts/${EPYTHON}/openbabel/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/scripts/python/openbabel/pybel.py ${CMAKE_BINARY_DIR}/scripts/${EPYTHON}/openbabel/) + set(TEST_SOURCE_DIR ${CMAKE_SOURCE_DIR}/test) + # define TESTDATADIR for tests that need input files + add_definitions(-DTESTDATADIR="${TEST_SOURCE_DIR}/files/") + # define FORMATDIR for location of format plugin binaries + set(FORMATDIR "${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}/") + add_definitions(-DFORMATDIR="${FORMATDIR}/") + include_directories(${TEST_SOURCE_DIR}) + + # The macro is modified from cmake/modules/UsePythonTest.cmake + MACRO(ADD_PYTHON_TEST TESTNAME FILENAME) + GET_SOURCE_FILE_PROPERTY(loc ${FILENAME} LOCATION) + STRING(REGEX REPLACE ";" " " wo_semicolumn "${ARGN}") + FILE(WRITE ${CMAKE_BINARY_DIR}/test/${TESTNAME}.cmake +" + MESSAGE(\"${PYTHONPATH}\") + EXECUTE_PROCESS( + COMMAND ${EPYTHON} ${loc} ${wo_semicolumn} + RESULT_VARIABLE import_res + OUTPUT_VARIABLE import_output + ERROR_VARIABLE import_output + ) + + # Pass the output back to ctest + IF(import_output) + MESSAGE(\${import_output}) + ENDIF(import_output) + IF(import_res) + MESSAGE(SEND_ERROR \${import_res}) + ENDIF(import_res) +" + ) + ADD_TEST(${TESTNAME} ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/test/${TESTNAME}.cmake) + ENDMACRO(ADD_PYTHON_TEST) + + set(pybindtests + bindings + _pybel + example + obconv_writers + cdjsonformat + pcjsonformat + roundtrip + ) + foreach(pybindtest ${pybindtests}) + ADD_PYTHON_TEST(pybindtest_${pybindtest}_${EPYTHON} ${TEST_SOURCE_DIR}/test${pybindtest}.py) + set_tests_properties(pybindtest_${pybindtest}_${EPYTHON} PROPERTIES + ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/scripts/${EPYTHON}:${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX};LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/scripts/${EPYTHON}:${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}:\$ENV{LD_LIBRARY_PATH};BABEL_LIBDIR=${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}/;BABEL_DATADIR=${CMAKE_SOURCE_DIR}/data" + FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed" + ) + endforeach(pybindtest ${pybindtests}) + endif (ENABLE_TESTS) +endif(PYTHON_BINDINGS) |