Including cpp/hpp source from separate module

15 views
Skip to first unread message

Casper van Elteren

unread,
Jun 2, 2021, 5:21:20 PM6/2/21
to cython-users

Hi,

I have built a module with several moving parts and I wanted to reuse some of the code in a new module.

I have the following situation
.
├── module
│   └── lib
│       ├── some_file.cpp
│       └── some_file.hpp
└── setup.py

This module builds fine and is installed in `site-packages` and I can see that the source files .cpp and .hpp are included. However, wen building a separate packages of which ^ is a submodule, it cannot find the respective headers

That is

.
└── module2
    ├── lib
    ├── module
    │   ├── module
    │   │   └── lib
    │   │       ├── some_file.cpp
    │   │       └── some_file.hpp
    │   └── setup.py
    ├── setup.py
    └── src

module 2 reads from the directory structure that is referred to as module/lib/some_file.hpp but installed; the submodule however is at module2/module/module/lib/

How can one share these definitions in cython?

Stefan Behnel

unread,
Jun 13, 2021, 4:41:01 PM6/13/21
to cython...@googlegroups.com
Casper van Elteren schrieb am 02.06.21 um 14:53:
I'm not sure I understand the second layout. Why are there two packages?
Why are they nested? Why do they need to know about each other?


> How can one share these definitions in cython?

Is there a way for you to adhere to a Python package layout? That usually
resolves such issues.

Stefan

Casper van Elteren

unread,
Jun 14, 2021, 2:08:13 AM6/14/21
to cython...@googlegroups.com
Hi Stefan,

I ended up figuring it out. I had to write a proper include to the already installed function. After adding the data files (i.e. the header files) and writing an include function a la numpy, it all started working nicely.

Best wishes,
C

--

---
You received this message because you are subscribed to a topic in the Google Groups "cython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cython-users/X-h1BXWgyqo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cython-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cython-users/4e0da156-b841-9af7-be12-3c5a5b7c5988%40behnel.de.


--

  • Checkout my website for contact info and current projects!
Reply all
Reply to author
Forward
0 new messages