Skip to content

compiling XwWindow on osx #19

@jf---

Description

@jf---

Hi,

I'm trying to compile pyocct on osx.
So far, so good, though compilation trips over XwWindow.

This is probably due to linking to Xw_Window rather than Cocoa_Window
PythonOCC does conditional compilation like so for the visualization module:

#ifdef WNT
  #include <windows.h>
  #include <WNT_WClass.hxx>
  #include <WNT_Window.hxx>
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
  #include <Cocoa_Window.hxx>
#else
  #include <Xw_Window.hxx>
#endif

Perhaps this could be carried over as:

#include <pyOCCT_Common.hpp>

#include <xTypes.h>

#include <Aspect_DisplayConnection.hxx>
#include <Aspect_FBConfig.hxx>
#include <Aspect_Window.hxx>

#ifdef WNT
  #include <WNT_Window.hxx>
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
  #include <Cocoa_Window.hxx>
#else
  #include <Xw_Window.hxx>
#endif

#include <Xw_Window.hxx>

Which brings me to my question; would by extension the class definition look like so?
( I'm new to pybinder11 and not a c++ programmer... go easy on me ;)

   #ifdef WNT
     py::class_<Xw_Window, opencascade::handle<WNT_Window>, Aspect_Window>(mod, "Xw_Window", "This class defines XLib window intended for creation of OpenGL context.")
   #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
     py::class_<Xw_Window, opencascade::handle<Cocoa_Window>, Aspect_Window>(mod, "Xw_Window", "This class defines XLib window intended for creation of OpenGL context.")
   #else
     py::class_<Xw_Window, opencascade::handle<Xw_Window>, Aspect_Window>(mod, "Xw_Window", "This class defines XLib window intended for creation of OpenGL context.")
   #endif

I'm a little surprised, since seeing pyocct up and running on windows, which should run into the same compilation issue I figure. Any pointer to how this works currently is much appreciated.

Finally, this thread on conda-forge was very helpful ( MacOSX10.9.sdk pointer ). That said, should those improvements to the conda recipe not be carried over to this repo?


Finally, the viewer is doing a similar conditional ( pyocct ) import.
For conditional WNT / Xw / Cocoa Window instantiating see this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions