adonmo / meos

Mobility Engine, Open Source
https://adonmo.github.io/meos/
MIT License
21 stars 3 forks source link

Build and publish wheels for Windows #16

Closed chaitan94 closed 4 years ago

chaitan94 commented 4 years ago

Need to fix all the errors and warnings when compiling on the MSVC platform.

Some sample errors and warnings:

  ./source\io\Deserializer.cpp(235): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
  ./source\io\Deserializer.cpp(254): error C2908: explicit specialization; 'T Deserializer<T>::nextValue(void)' has already been instantiated
chaitan94 commented 4 years ago

Fixed in ee6ba96f0b243311ddd1f651065e11f0e88d5997, 1a311828c0982d2dfdd9e7a6b95b9f890b9a4500 and 1add9c16e812ab31873e58d1a896d80c5b4cf079, GitHub action was added in 330b655b4073f876a3df30eaf062d6a67819866e.

The issue was mostly the following things are to be considered when compiling with MSVC:

  1. We need to use _mkgmtime in place of timegm
  2. We need to import <windows.h> for min and max functions to work
  3. When doing put_time, %z does not work as expected, hence best avoid it
  4. Fix DLL importing logic for Windows Python 3.8+

Additional notes for 4: For Python versions 3.8+, DLL importing mechanism changed significantly (Refer: https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew). Hence we need additional logic within the codebase to call os.add_dll_directory with appropriate path from which the DLLs can be loaded, which in our case is the geos_c.dll. Accordingly, I had to find a way to include python code to run along with the existing C++ extension module which is built with pybind11. So some refactoring has been done for that in 1add9c16e812ab31873e58d1a896d80c5b4cf079.