Closed yurivict closed 2 years ago
There are CMake variables to control the build of each component:
DIP_BUILD_PYDIP=Off
turns off the build of the Python bindings.DIP_BUILD_JAVAIO=Off
turns off the build of the javaIO module, the bindings for the Java library Bio-Formats.By default these components will be built by make all
if the required dependencies are found, you need to explicitly turn off components you don't want installed.
However, if you use the DIPlib project as a submodule of another CMake project, and in that project only link against, for example, the DIPlib library, then only the DIPlib library will be built.
If there is a better way to set up the project, other than splitting it up into a separate repository for each component, please let me know!
Splitting into components is an optimal solution. For example, I was unable to build the Python bindings separately. They are practically a separate project, but they are bundled with the C++ project and aren't easily buildable separately.
Well, the Python bindings depend on the library, it makes no sense to build them without building the library.
If they are separate projects, it would be a lot more difficult to build the Python bindings, because you'd have to build two projects instead of one.
I guess I don't understand your use case.
On FreeBSD (and in general) multiple Python versions can be installed at the same time. Python bindings should be built for each Python version.
One port/package would be for the C++ project, and another port/package would be for the Python bindings. This isn't difficult.
If you build the project for different Python versions sequentially, the DIPlib library will not be rebuild, only the bindings themselves will be.
This is how the GitHub Action builds the Python package for different versions of Python that you'll find on PyPI. See the script.
But this would require to keep the build directory. We only keep the installed package, and not the build directory.
What if there was an alternate CMakeList.txt file that builds the Python bindings using an already installed version of DIPlib?
I’d be happy to help you write it and maintain it in the repository.
You’d have to replace the standard CMake script with this alternate one, then build the package. Or maybe it lives in a subdirectory, you’d have to run CMake in the subdirectory.
I think this would simplify your workflow significantly, and it would only duplicate a small bit of CMake script.
Here is an example in the Faiss project.
It builds both as an embedded cmake script, and as a standalone project.
That's an interesting approach. I think I can rewrite the CMake script for the Python bindings in that way, but it'll be quite a bit of work.
Ports/packages need to reliably build only components that they need to build.