FreeCAD / homebrew-freecad

Homebrew recipes for FreeCAD
53 stars 34 forks source link

Add Support for QT5 #35

Closed bblacey closed 7 years ago

bblacey commented 7 years ago

The broader ecosystem is forging forward with QT5 and initial QT5 support has been added to FreeCAD. The scope of this issue is to add an option to build FreeCAD with QT5 which also requires moving to pyside2.

QT5 on macOS path-finding forum post

bblacey commented 7 years ago

To resolve CI build issues quickly, I exhumed the qt4 formulae from homebrew/boneyard to provide efficient qt4 support on Travis. A better approach would be to use cartr/homebrew-qt4 formula repo but currently cartr only provides bottles for Sierra. I have provided instructions and offered to support to migrate existing homebrew bottles to cartr's bintray account obviating the need for maintaining qt4 formula on our FreeCAD homebrew repo. This would provide more robust and longer-term qt4 support for the broader community and clear the way for QT5 dependency formula development so building on qt4 would tap-pin cartr/qt4 and building on qt5 would use hombrew/core and FreeCAD/freecad.

bblacey commented 7 years ago

I have worked with Cartr to provide bottles and updated formulae for legacy QT4 formulae in cartr's QT4 repo under issue cartr/homebrew-qt4#8 and PR cartr/homebrew-qt#9. Cartr's repo is recognized by the Homebrew Team and community as the official source for QT4 formula. Once cartr accepts and merges the pull request, we can remove the qt4 formulae (qt, shiboken, pyside and pyside-tools) from the FreeCAD/homebrew-freecad repo.

There is also an outstanding issue cartr/homebrew-qt4#5 to rename the qt formula to qt@4 following the current Homebrew versioning scheme to explicitly deconflict qt4 from qt5 which is becoming the default (i.e. qt ==> qt@4 and qt5 ==> qt). Merging the associated PR and closing the rename issue is blocked by a Homebrew bug that is in work. I believe we should change our FreeCAD/freecad formula to use Cartr's repo AFTER the rename PR is complete.

Once we finalize the QT4 legacy support by moving to Cartr's repo after the rename, I will refresh the ports-cache and begin integrating QT5 support into the FreeCAD/freecad formula. Ideally, the Homebrew QT5 rename will not be too disruptive.

bblacey commented 7 years ago

The phased approach is detailed in this forum post

ianrrees commented 7 years ago

As discussed on the forum, it looks we're going to need to stick with Qt <5.7 for a while, because PySide2 isn't yet compatible with Qt >=5.7 ( PYSIDE-323 and PYSIDE-322). Homebrew has moved on to Qt 5.7 already, and there's been a small change to Homebrew which means the original 5.6.2 recipe doesn't build anymore without a small modification...

Python 3 is in a similar situation, as Homebrew is at 3.6 but Pyside2 only supports up to 3.5. I suppose that won't be an issue with FreeCAD if we're still using Python 2.7.

Anyway, I've built and installed PySide2 on OSX 10.11 today. My plan is to make a document describing downgrading to (and sticking with) Qt 5.6 in Homebrew, then make a formula for PySide2, once I've got FreeCAD going with Qt5.

Any thoughts on how well this will work with the CI system? Building Qt from source takes some time, and it doesn't seem like the Qt 5.6 bottles are still around.

bblacey commented 7 years ago

@ianrrees - sounds great! Homebrew still officially supports QT 5.5, including bottles, so that is what I used for my alpha Qt5 testing. If you think we can stick with QT 5.5, then we won't need to worry about bottling 5.6. If on the other hand, we need QT 5.6, then once you tweak the formula and commit here, I can make a one-time investment to bottle QT 5.6 for Yosemite, El Capitan and Sierra on some VMs and post them to GitHub.

That said, I have started a qt5 branch locally that includes the following:

We are both contributors here so I can push my in-work qt5 branch to the repo so you can merge/add your commits. We don't need to worry about striving for a clean commit history on our working branch at this point, we can just push what we have working for now. Once the branch has everything we need, we can make a pass to squash commits and clean up the commit history. Does that sound good? If so, we probably want to keep the main discussion on the forum so others working the qt5 can help (e.g. f3nix/Matuesz) and benefit or enjoy this effort vicariously and keep this GitHub thread to items very specific to the qt5 change set we are developing.

It would be awesome if we can chip away at this together. Thoughts?

ianrrees commented 7 years ago

All sounds good!

How did you get Homebrew to install Qt 5.5?

I haven't run in to the same problem you mentioned with PySide (yet?), though I did find a bug in their Tetrix test/example...

A Qt5 branch here seems like the right way forward.

bblacey commented 7 years ago

Using the new Homebrew core version support - brew install qt@5.5

I just found the culprit commit, at least for 5.5 - https://codereview.qt-project.org/gitweb?p=pyside/pyside.git;a=commit;h=eb28469e920696a1d0833c55b5c20c5c5a6f9d5e

I am testing a pyside formula that builds up through the previous commit. If it passes, I will commit and push the qt5 branch. That will give you freecad that defaults to qt5, shiboken and pyside for qt5. I can start work on pyside-tools and perhaps you can see if you can resolve the issue with the aforementioned pyside commit? Or if you have other good stuff, I can push and just wait for you to add ;)

bblacey commented 7 years ago

@ianrrees, I just pushed the in-work/incomplete qt5 branch for collaboration. Much more fun to collaborate ;)

State of affairs on qt5 branch:

Known issues/gaps:

bblacey commented 7 years ago

Let's move the general conversation to the forum for transparency. Please subscribe to the topic.

bblacey commented 7 years ago

@ianrrees - in case you haven't yet subscribed to the forum topic, I have pushed the full set of pyside formula ports to the qt5 branch... You should be able to pull, use the freecad formula to install the dependencies and build the app. Details in the forum posts. We have a blocking issue with make install that hopefully either you or someone else will recognize the root cause for immediately.

bblacey commented 7 years ago

@ianrrees, I don't know if you ran into this yet or not but there is a Homebrew bug that makes it difficult to work with a branch within a tap (I found out because I reset by Homebrew ports and every time I tried to install, homebrew would checkout master in the freecad tap). The trick is to set homebrew.developer in the homebrew git config file.

So here is how you get up and running with the qt5 branch:

export HOMEBREW_DEVELOPER="1"
git config --file $(brew --prefix)/Homebrew/.git/config --add homebrew.developer 1
brew tap --full FreeCAD/freecad
cd $(brew --prefix)/Homebrew/Library/Taps/freecad/homebrew-freecad
git checkout -b qt5 origin/qt5

Once you have done that, you are ready to install the freecad dependencies using the qt5 branch.

brew install --only-dependencies freecad/freecad
brew install --only-dependencies freecad/freecad  #for some unresolved reason, you  have to run it twice to install all dependencies

# Manual steps until integrated into formulae
brew link --force qt@5.5
sudo ln -f -s /usr/local/Cellar/qt\@5.5/5.5.1/mkspecs /usr/local/mkspecs
sudo ln -f -s /usr/local/Cellar/qt\@5.5/5.5.1/plugins /usr/local/plugins

Build FreeCAD

cmake -DBUILD_FEM_NETGEN=ON -DFREECAD_USE_EXTERNAL_KDL=ON -DFREECAD_CREATE_MAC_APP=ON -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_QT5=ON ..

I hope this helps.

IR Edit - fix capitalisation in code snippets.

bblacey commented 7 years ago

FYI, I also pushed a cmake change to https://github.com/bblacey/FreeCAD-MacOS-CI/commits/qt5 that is required for QT5 on macOS.

bblacey commented 7 years ago

Qt 5.6.2 has been integrated into the CI builds.