Python Bindings on Windows VS2019+ #122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR description
This PR facilitates the compilation of oofempy on Windows using VS2019+
PR changes
The changes on the codebase are limited and quite straightforward.
They mostly involve the addition of the export macro for matrix and vector assemblers.
Pybind is bumped to version 2.9.1 which drops support to old Python 2.7 and 3.5.
Note: It should still be possible to use version 2.9.0 as it's the first to fix a compatibility problem with the recent VC toolchains.
How to build oofempy on Windows, VS2019+, Python 3.6+
Prerequisite - Python debug symbols and binaries must NOT be installed.
Note: pybind/pybind11#3403
Setup your CMake
USE_PYBIND_BINDINGS
PYBIND11_FINDPYTHON
to let CMake find the Python installation on your system.Problems with Windows and its case insensitive file names
Context:
VERSION
file#include <version>
appears, which includes theversion
file from the MSVC standard library.INCLUDE
environment variable.This is not a problem when the filesystem is case sensitive. Windows, however, is case insensitive and, given how the compiler looks for include directories, it means that
VERSION
file is preferred overversion
thus breaking the compilation.In order to overcome this issue, two solutions are possible:
/I "$(VC_IncludePath)"
to the compiler flags in your CMake configuration: