mctools / mcpl

Monte Carlo Particle Lists
https://mctools.github.io/mcpl/
Other
29 stars 13 forks source link

MSVC build #75

Open efp opened 1 year ago

efp commented 1 year ago

It seems the windows build was only meant to be done with msys2 or cygwin. It depends on unistd.h... this is available for windows as a separate github project. Other than acquiring that header, the only other modification needed to build with msvc was something along these lines at mcpl.c 2550:

ifndef STDOUT_FILENO

#define STDOUT_FILENO _fileno(stdout)

endif

Or it could be done somewhere with an #ifdef _MSC_VER

I was about to say surely we could replace the POSIX stuff with STL stuff, but then I remembered this is C not C++, so I dunno.

tkittel commented 1 year ago

Thanks for the report. Yes, we need to more systematically fix the windows compilation. In the near future (this year), I hope we can put MCPL properly on conda and more completely on pypi. At the same time, we would most likely do whatever is needed to make it work on windows as well in that context. As far as I know, that is based on visual studio and not cygwin, so one might hope that it would help your use case as well. Of course, feel free to provide a more complete patch (or fixed file or PR) with the fixes you needed.