Skip to content

How can I link a library with Cython and CMakeLists.txt? #910

@mcleantom

Description

@mcleantom

I am trying to make a version of this project, but using scikit-build-core to make it easier to install. The project links against the C library TA-Lib. I was wondering if its currently possible to link c libraries to the cython code using scikit_build_core from just pyproject.toml, or do I need to add a setup.py to my project and do something like:

ext_modules = cythonize([Extension("cymathlib", 
                                   ["cymathlib.pyx"], 
                                   libraries=["talib"],
                                   library_dirs=["/place/path/to/talib.so/here"]
                                   )])

And not use the CMakeLists.txt method?

If it is possible, would it be possible to have an example of how to link a library to the generated cython code from CMakeLists.txt?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions