Skip to content

allow :include in include_dirs field #3993

@nilsbecker

Description

@nilsbecker

Desired Behavior

the include_dirs subfield of the foreign_stubs field of the library stanza should accept :include files.

this would be useful when running a script to find out the necessary include dirs, to include the results of that step.

Example

i was trying to link to the python headers corresponding to the installed python executable. the directory is readily obtained from python with a rule like this:

(rule
    (target python-includes)
    (mode promote)
    (alias get-python-includes)
    (action 
        (with-stdout-to 
            python-includes 
            (run python -c "import sysconfig; print(sysconfig.get_paths()['include'])"))))

i then wanted to read this file like this:

(library 
    (name python_ocaml_init) 
    (foreign_stubs 
        (language c) 
        (names python_init) 
        (flags :standard -w -fPIC -Wall -O2)
        (include_dirs (:include python-includes)))
    (modules python_init)
[...]

which failed. i found a workaround using the flags field which does accept :include but the solution above is cleaner IMO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issueGood for contributing for the first time to the Dune codebase

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions