Plugin improvements - #564
Conversation
JanNiklasB
left a comment
There was a problem hiding this comment.
Hey,
those are very nice improvements, I like especially the improved FindCRPropa.cmake.
I just noticed some minor things plus an issue in the python stubs generation, for which libcrpropa.so can not be found on first install since it is installed after the stubs command is called (this was caused by one of my PRs), this can easily be fixed by moving the code block (see comments) after the other installs.
With Regards,
Jan-Niklas
|
Thanks, @JanNiklasB. Everything worked on my laptop and on the cluster. Since you seem to have a different setup, can you double check that you can install it? |
|
|
My fix in mind would be something like: Make the path dependent on a variable which defaults to set(CRPROPA_TESTS_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "") # rename to anything more appropriate
mark_as_advanced(CRPROPA_TESTS_PATH)
add_test(NAME ${testName} COMMAND ${CRPROPA_TESTS_PATH}/${testName})
# and for python
add_test(NAME ${testName} COMMAND ${Python_EXECUTABLE} ${CRPROPA_TESTS_PATH}/${testName}.py)then change the variable manually in cmake .. -G Ninja \
-DCMAKE_PREFIX_PATH="${PREFIX}" \
-DPython_EXECUTABLE="${PYTHON}" \
-DPython_NumPy_INCLUDE_DIR="${NUMPY_INCLUDE_DIR}" \
-DPython_INCLUDE_DIR="${PYTHON_INCLUDE_DIR}" \
-DPython_INSTALL_PACKAGE_DIR="${SP_DIR}" \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DBUILD_DOC=OFF \
-DDOWNLOAD_DATA=OFF \
-DENABLE_COVERAGE=OFF \
-DENABLE_GIT=ON \
-DENABLE_HDF5=ON \
-DENABLE_OPENMP=ON \
-DENABLE_PYTHON=ON \
-DENABLE_QUIMBY=OFF \
-DENABLE_SWIG_BUILTIN=ON \
-DENABLE_TESTING=ON \
-DFAST_WAVES="${FAST_WAVES}" \
-DOMP_SCHEDULE=dynamic \
-DSIMD_EXTENSIONS="${SIMD_EXTENSIONS}" \
-DUSE_ABSOLUTE_RPATH=ON \
-DCRPROPA_TESTS_PATH="${PREFIX}/share/crpropa/test/" |
|
I think this version is cleaner, @JanNiklasB . The only thing I'm unsure about is the plugin's CMakeLists correctly finding gtests for older CRPropa versions. |
JanNiklasB
left a comment
There was a problem hiding this comment.
I think your way of finding gtest should in principle work in any case, only the includes might not be set every time (s. comment).
Furthermore, the dependencies of the python tests on the test that copies the crpropa python files should probably be placed inside the addtestPy function so that the dependency is set for all potential tests.
JanNiklasB
left a comment
There was a problem hiding this comment.
The tests are only failing because of typos in line 302 and 303 (see suggestions)
Other then that it now looks good to me.
|
I'm still working on my last attempt, @JanNiklasB . |
|
This version (current) is almost my last attempt, @JanNiklasB. I will just fix one more thing based on the outcome of our discussion. As you can see, one of the tests fail because of the pybind11-stubgen (in OSX only). I had originally removed all references to pybind from CMakeLists.txt because it does not pertain to CRPropa (at the moment). In my opinion, it should not even have been included in the cmake file. However, since it is already there, it can be offered as an option. Naturally, it should only be activated by the users who really want it and be kept off by default. That can be done with a cmake flag The question then becomes: should it be part of the conda release? To me this is a clear no, especially because it is making a test fail. It will just increase the size of the package and increase the runtime of the workflows. The way it currently is, it is acting as a strong dependence and I really don't see the practical advantage of having it in the default installation and conda release. I am adding this to the PR, since it is needed to make the tests pass, but I'd like to hear from you first. |
|
It is not failing because of (Compare #548 )
It enables the linting which is typically done by pylance and makes our documentation available without looking it up per |
|
Hm... Then I misunderstood the intent. In any case, I will add it as optional, but keep the default to |
|
I see why it seemed that it is needed for pybind11 extensions (it's in the name after all). Since swig does not generate proper modern stub files I searched for a third party alternative but it seems pybind11-stubgen is also the best option for swig... I like adding a option, I was hesitant with that since I did not want to create the implication that we would require Was that the last thing you wanted to add? If so I would approve it from my side. |
|
Yes, I got confused because I know you were working on pybind wrappers, so I thought you wanted to add something in the current version to prepare for that. Sorry about that. From my side, I'm done with this PR if all tests pass. Thanks for the review, @JanNiklasB! |
This PR improves the plugin examples, offering more information and flexibility for users developing their own plugins.
USE_CRPROPA_BUILTINin plugin's CMakeLists toUSE_OWN_CRPROPAto avoid confusion with SWIG's "builtin" feature.