tpaviot / pythonocc-core

Python package for 3D geometry CAD/BIM/CAM
GNU Lesser General Public License v3.0
1.39k stars 380 forks source link

Compilation on Windows 10, step by step #520

Closed thorade closed 5 years ago

thorade commented 6 years ago

I tried to compile the latest master on Windows10, 64bit. All dependencies (OCE, Freetype, SWIG) were installed using conda (is that acceptable?).

The cmake step is giving me the error message:

TypeError: '>=' not supported between instances of 'NoneType' and 'tuple'

Also see screenshot below. Is that important or can I just ignore it? Is that related to the Python version? Would I have to specify somewhere that I use Python 3.6? Do I need to specify that I want 64bit? Can I use any VisualStudio version, or do I have to use a specific one? https://wiki.python.org/moin/WindowsCompilers

A solution file is generated, but when I open the .sln file in Visual Sudio and try to build ALL_BUILD, I am getting 268 errors, all of them with error code C2084.

Again, can I just ignore that? Sorry for asking possibly silly questions, I obviously do not have much CMake and SWIG experience...

I also tried to open the CmakeLists.txt in VisualStudio 2017 directly, but did not get any further than before.

cmake_pythonocc_tuple

Another warning I am getting is this:

1> CMake Deprecation Warning at C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.10/Modules/UseSWIG.cmake:260 (message):
1>   SWIG_ADD_MODULE is deprecated.  Use SWIG_ADD_LIBRARY instead.
1> Call Stack (most recent call first):
1>   CMakeLists.txt(265): (swig_add_module)
thorade commented 6 years ago

Another possible source for these erros: Are the versions of the dependencies as mentioned in the INSTALL.md still up-to-date? https://github.com/tpaviot/pythonocc-core/blob/master/INSTALL.md

I have the versions that were installed when installing pythonocc using the command from the README.md

conda install -c conda-forge -c dlr-sc -c pythonocc -c oce pythonocc-core
thorade commented 6 years ago

After using the matching version and bitness of VisualStudion the C2084 errors are gone, for Python 3.6 64bit that would be vs2015-x64. Probably obvious for everybody, except me, some hours ago. Does CMake support a way of setting a default compiler depending on the found Python version?

Now, the next newbie question: Running make install just gave me no rule found for creating INSTALL (or similar, translated form German). How would I install the freshly compiled files?

thorade commented 6 years ago

Success: After openening the .sln file in VisualStudio and successfully running build ALL_BUILD, I just had to also run build INSTALL. So, sorry if this issue has generated too much noise, but maybe it helps some other user in the future. Writing all this down has helped me, at least.

After running the build INSTALL, I also ran the test, and they all pass, except one:

======================================================================
ERROR: test_pickle_from_file (core_wrapper_features_unittest.TestWrapperFeatures)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mthorade\Documents\Python\pythonocc-core\test\core_wrapper_features_unittest.py", line 320, in test_pickle_from_file
    box_shape = pickle.load(shp_dump)
ModuleNotFoundError: No module named 'copy_reg\r'

When running run_tests_as_examples.py, some more tests fail (currently 74/94 work). Especially, core_matplotlib_box.py crahses python. Maybe just some dependencies missing? It works on Travis!

So, this issue could be closed, as it now works for me, but maybe you still want to

thorade commented 5 years ago

Probably outdated by now, closing.