Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Cython language #48

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

LecrisUT
Copy link
Collaborator

@LecrisUT LecrisUT commented Aug 25, 2024

So I am playing around with creating a Cython language to try and simplify the way to make Cython files. The basic files that need to be created are documented here and I am looking at other implemented Fortran, CSharp, etc. languages for reference.

The end-goal is to make the CMakeLists.txt as:

cmake_minimum_required(VERSION 3.25...3.29)
project(simple LANGUAGES C Cython)

python_add_library(simple MODULE WITH_SOABI)
target_sources(simple PRIVATE simple.pyx)

install(TARGETS simple DESTINATION .)

Approach 1: set(CMAKE_Cython_OUTPUT_EXTENSION ".c")

The hope here is that we could define only the bare minimum to create the necessary .c files and have the C compiler part take over from there. Unfortunately CMake does not seem to chain the parts accordingly.

Maybe if we can manipulate the dependencies in .dep this approach would work.

Approach 2: chain CMAKE_Cython_COMPILE_OBJECT with CMAKE_C_COMPILE_OBJECT

This should probably work with the current implementation, and at first glance it seems to do what it needs to do, but the link-library part doesn't seem to be configured correctly yet

@LecrisUT
Copy link
Collaborator Author

LecrisUT commented Aug 25, 2024

With a6ad971 it somewhat works:

  • Figure out why it appends .so twice. If you manually edit that, the installed files seem to import correctly
  • Dependencies how?
  • Could python_add_library also be simplified to add_library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant