Skip to content

CMake updates for NastranIO/pyNastran/Cython. - #49

Merged
JohnDN90 merged 9 commits into
nastran_iofrom
nastran_io-cmake
Nov 26, 2019
Merged

JohnDN90 merged 9 commits into
nastran_iofrom
nastran_io-cmake

Conversation

@jdeaton

@jdeaton jdeaton commented Nov 22, 2019 •

Copy link
Copy Markdown
Member

NastranIO integrated as an optional unit into MAST library via CMake completed.

- NastranIO adds Python dependency not needed otherwise so we make this support optional.
@jdeaton

jdeaton commented Nov 22, 2019

Copy link
Copy Markdown
Member Author

@JohnDN90 its been awhile since I ran Cython. Which of the source files in what you did was generated by cython? I think we should setup CMake to run Cython during configuration rather than committing the final version in the repo.

@JohnDN90

Copy link
Copy Markdown
Member

This file generates the pynastranIO.h and pynastranIO.cpp files after running cythonize on it. I agree that in the end we should have CMake cythonize the .pyx and generate the other two files, I just wanted to include them in the initial commit until we get CMake running cythonize.

The NastranIO.cpp and NastranIO.h are manually created by me.

- Increment to CMake 3.13 requirement due to improved support for adding includes/libraries to targets (3.13) and FindPython (3.12).
- Built-in CMake still seems to have trouble finding consistent interpreter/headers/library when there are multiple options. Has been especially troublesome on macOS or when using Spack built Python.
@jdeaton

jdeaton commented Nov 24, 2019

Copy link
Copy Markdown
Member Author

This file generates the pynastranIO.h and pynastranIO.cpp files after running cythonize on it. I agree that in the end we should have CMake cythonize the .pyx and generate the other two files, I just wanted to include them in the initial commit until we get CMake running cythonize.

The NastranIO.cpp and NastranIO.h are manually created by me.

Just curious, did you have trouble when compiling MAST using the pynastranIO.h/.cpp files you generated needing headers for numpy? When I compile your files, it looks like they have #include "numpy/arrayobject.h" and #include "numpy/ufuncobject.h" in them, which I'm not currently including in the MAST target_include_directories(). Are your Python modules on a standard path or something?

I believe I need to somehow automatically find the path to these numpy headers and be able to feed them to the MAST compilation.

@jdeaton

jdeaton commented Nov 24, 2019

Copy link
Copy Markdown
Member Author

Just answered my last comment. You were using the built-in CMake FindPython3, which finds the Numpy header path and includes it with the regular Python header variable. I replaced it with a custom FindPython3 since the built-in was having trouble with my Spack build.

- CMake >3.12 able to find Numpy headers itself, but we are using custom FindPython3.
- Option only necessary if developing Python bindings and making changes to pyNastran interface currently.
@jdeaton jdeaton assigned jdeaton and JohnDN90 and unassigned jdeaton Nov 26, 2019
@JohnDN90
JohnDN90 merged commit 4201f2f into nastran_io Nov 26, 2019
@JohnDN90
JohnDN90 deleted the nastran_io-cmake branch November 26, 2019 19:52
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.

2 participants