TEOS-10 / GSW-C

C implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
Other
18 stars 17 forks source link

Compilation on Windows? #13

Closed efiring closed 7 years ago

efiring commented 7 years ago

Question from https://github.com/efiring/python-gswc/pull/3: @dankelley or anyone else, are you building the C library on Windows? If so, are you applying any patches to do so? Or any other tricks?

dankelley commented 7 years ago

No, in the R package, the building is done by the R packaging system (called CRAN). For a package to get into CRAN, it has to compile an a whole lot of different systems (debian-clang, debian-gcc, fedora-clang, fedora-gcc, macosx-clang, windows-ix86+x86_64, solaris/sparc, solaris/x86) and I didn't have to set up anything special for any of these. The details of the individual building systems are at https://cran.r-project.org/web/checks/check_flavors.html#r-devel-windows-ix86_x86_64

The windows box is documented at the above-stated link to be windows server 64bit with gcc 4.9.3 through mingw-w64

It is certainly possible to set up patches and Makefile hints, but I think GSW-C is simple code and there's no reason to do that. I hope things can stay that way. Certainly, I'd hate to see any pragmas inserted to get efficiencies or other features on any particular system.

ocefpaf commented 7 years ago

@efiring It is possible to build with mingw but it would be nice to get it working with MSVC as any other Python extension. I am looking into the options.

efiring commented 7 years ago

@dankelley Very interesting, thank you! So, R is still managing to do everything with gcc or clang. That's what I would prefer also, but on the Python side we don't seem to be as well set up with respect to our mingw* toolchains. The code is simple enough, however, that it might be possible to make it MSVC-compatible with minimal changes. Much more complex packages like numpy and matplotlib are compiled with both MSVC and gcc, and I don't think they require much clutter to do so--but I haven't surveyed that carefully.

efiring commented 7 years ago

Informational update: for the new GSW-Python I have made a C++ version of the C code, and it works fine with MSVC, and with gcc, although for the latter I am sticking to the original C. The modifications are not too bad, but at least for now I am not planning on propagating them back to this repo.