Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling XwWindow on osx #19

Open
jf--- opened this issue Sep 12, 2018 · 6 comments
Open

compiling XwWindow on osx #19

jf--- opened this issue Sep 12, 2018 · 6 comments

Comments

@jf---
Copy link

jf--- commented Sep 12, 2018

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

@trelau
Copy link
Owner

trelau commented Sep 13, 2018

Good catch. I think there was some contributions similar to this for XwWindow: f15d989

So yes I think something can be done for osx. I just don't have an osx platform to test on.

Regarding the conda recipe: I started that but abandoned it because the build time was way beyond the limits for Appveyor and Travis (both were grateful enough to extend the build time to 3 hours I think for Laughlin Research, but I never asked for conda). I'm hoping that breaking out types into smaller files decreases build time and gets it under the conda-forge limit so the recipe can be finished (that is the current effort of the pyOCCT_binder for OCCT 7.3.0).

@jf---
Copy link
Author

jf--- commented Sep 13, 2018

XwWindow: f15d989

That's a very helpful pointer, thx...

ecause the build time was way beyond the limits for Appveyor and Travis (both were grateful enough to extend the build time to 3 hours I think for Laughlin Research, but I never asked for conda)

Thomas asked for a similar thing for pythonocc, on TravisCI.

Something really cool is that succesful compile's on master got uploaded to Thomas' conda account, which means that there's then very little overhead keeping up with changes in master.
I could look into porting that?

@trelau
Copy link
Owner

trelau commented Sep 13, 2018

CI integration hasn't been fully built out, so that would be a great next step. I think it makes sense to upload successful master builds to my account, and eventually I'd like to get conda-forge builds for releases.

@trelau trelau added the bug Something isn't working label Sep 13, 2018
@trelau
Copy link
Owner

trelau commented May 10, 2020

@jf--- master branch is updated to occt 7.4.0 (and smesh) and CI for windows and linux py 3.6 to 3.8. i experimented with osx support but didn't get the CI stuff right and hard to do since i don't have that platform locally to quickly debug.

if you're interested, i have a branch i could push with some github actions for osx if you want to give it a shot and/or provide some feedback. but even just building the bindings locally on osx would be a great help. actually...i'm going to push that osx branch but leave out the compile part, but it will generate the binding source. if you want, you can grab that and try and compile. any feedback or tweaks to the binding process would be great!

@trelau trelau removed the bug Something isn't working label Jun 13, 2021
@whophil
Copy link
Contributor

whophil commented Oct 25, 2021

I'm interested in Mac builds and conda-forge. Is there still any interest in this, or has there been any movement? I can help out with both.

@trelau
Copy link
Owner

trelau commented Oct 26, 2021

I would like to support OSX, but I work on Windows and find it tough and very slow to debug for other platforms since I have to rely on the Github Actions results. You'll note that in the Actions for this repo I do attempt to generate the bindings for OSX, but not compile. If you could attempt this locally and contribute that would be great!

@whophil whophil mentioned this issue Nov 7, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants