macOS Qt5 plan and status

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: macOS Qt5 plan and status

Post by f3nix »

blacey wrote: Hi Mateusz, On a Mac with a non-HiDPI display, the Qt5 build looks normal and the unit tests results match the main repo. I am currently traveling until the 2nd of Feb so I may not be able to test this on a Mac with a HiDPI display set to low-res until I return. From my limited reading, Qt is supposed to handle the scaling transparently, particularly on macOS and iOS devices and Qt 4.7.8 works properly on HiDPI displays.

http://blog.qt.io/blog/2016/01/26/high- ... in-qt-5-6/
https://blog.qt.io/blog/2013/04/25/reti ... s-and-x11/

We currently set the NSHighResolutionCapable flag in the FreeCAD Info.plist as follows:

Code: Select all

<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
I just wonder if the HiRes capable is being overridden somewhere in the code.
From Qt doc:
Applications mostly work with device independent pixels. Notable exceptions are OpenGL and code that works with raster graphics.
My understanding is that we have to take care of the scaling ourselves.

Simple test I have run:
QT_SCALE_FACTOR=2 ./FreeCAD

and changing the code to make Viewport width and height to be twice as big gives good results.
blacey wrote: I will try to set the scale factor external to the app to see if that helps as well but again, that might be up to a week away.
I do wonder if setting QT_SCALE_FACTOR=0.5 would "fix" this Viewport issue (icons and everything else should be too small).

Have a nice trip! :)

Cheers,
Mateusz
User avatar
nemesis
Posts: 373
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: macOS Qt5 plan and status

Post by nemesis »

blacey wrote:

Code: Select all

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9763 (Git)
Build type: Release
Branch: (detached from 79566f1)
Hash: 79566f173318d9152305eb87b609906c63f97197
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 3.1.3
OCC version: 7.0.0
Please download the Qt 5.6 builds, test them and provide feedback with respect to worthiness for defaulting the nightlies to Qt 5.6.

Enjoy!
unfortunately I didn't enjoy ;-)

Code: Select all

/Volumes/FreeCAD/FreeCAD.app/Contents/bin/FreeCAD 
FreeCAD 0.17, Libs: 0.17R9801 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2016
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Abort trap: 6
maybe normal because it's OS X 10.11.6 (15G1217)
on :

iMac (27 pouces, half-2010) (dude its close to 7 years :shock: )
2,8 GHz Intel Core i5
16 Go 1333 MHz DDR3
ATI Radeon HD 5750 1024 Mo
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: macOS Qt5 plan and status

Post by Jee-Bee »

nemesis wrote:maybe normal because it's OS X 10.11.6 (15G1217)
on :

iMac (27 pouces, half-2010) (dude its close to 7 years :shock: )
2,8 GHz Intel Core i5
16 Go 1333 MHz DDR3
ATI Radeon HD 5750 1024 Mo
I beat you :P

OSX 10.11.6 at a
MacBook (13-inch, Aluminum, Late 2008)
2,4 GHz Intel Core 2 Duo
8 GB 1067 MHz DDR3
nyholku
Posts: 149
Joined: Wed Dec 28, 2016 4:18 pm

Re: macOS Qt5 plan and status

Post by nyholku »

Hi,

I tried to build FreeCAD with Qt5 support to see if I have this issue,I'm on Macos 10.10.5 with MacBook Pro Retina.


My cmake without the "-DBUILD_QT5=1" works just fine and
I can build the code successfully.

I've got gt5 from homebrew:

Code: Select all

brew info qt
qt5: stable 5.7.1 (bottled), HEAD [keg-only]
Cross-platform application and UI framework
https://www.qt.io/
/usr/local/Cellar/qt5/5.7.1_1 (8,273 files, 243.7M)
  Poured from bottle on 2017-01-24 at 22:19:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/qt5.rb
==> Dependencies
Build: pkg-config ✔
Optional: dbus ✘
==> Requirements
Build: xcode ✔
Required: macOS >= 10.8 ✔
Optional: mysql ✘, postgresql ✘
==> Options
--with-dbus
	Build with dbus support
--with-docs
	Build documentation
--with-examples
	Build examples
--with-mysql
	Build with mysql support
--with-postgresql
	Build with postgresql support
--with-qtwebkit
	Build with QtWebkit module
--HEAD
	Install HEAD version
==> Caveats
We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.

This formula is keg-only, which means it was not symlinked into /usr/local.

Qt 5 has CMake issues when linked

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/qt5/lib
    CPPFLAGS: -I/usr/local/opt/qt5/include
    PKG_CONFIG_PATH: /usr/local/opt/qt5/lib/pkgconfig

nyholkus-MacBook-Pro-5:build2 nyholku$ 

But my CMake fails as follows, what am I doing wrong.

Code: Select all

 cmake -DBUILD_FEM_NETGEN="1"  -DFREECAD_CREATE_MAC_APP="1" -DBUILD_QT5=1 ../FreeCAD-git
-- prefix: /usr/local
-- datadir: data
-- docdir: doc
-- includedir: include
-- libdir: /usr/local/lib
-- Detected Homebrew install at /usr/local
-- Boost version: 1.63.0
-- Found the following Boost libraries:
--   filesystem
--   program_options
--   regex
--   signals
--   system
--   thread
--   chrono
--   date_time
--   atomic
-- Found Xerces-C: /usr/local/lib/libxerces-c.dylib
-- PyCXX found:
--   Headers:  /Users/nyholku/FreeCAD/FreeCAD-git/src
--   Sources:  /Users/nyholku/FreeCAD/FreeCAD-git/src/CXX
-- -- OpenCASCADE Community Edition has been found.
-- -- Found OCE/OpenCASCADE version: 6.8.0
-- -- OCE/OpenCASCADE include directory: /usr/local/Cellar/oce/0.17.2_1/OCE.framework/Versions/0.17/Resources/../../../../include/oce
-- -- OCE/OpenCASCADE shared libraries directory: 
-- VTK components: not found or used
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Check for medfile (libmed and libmedc) ...
-- Found NETGEN version 5.3, calculated: 328448
CMake Warning at CMakeLists.txt:738 (find_package):
  By not providing "FindQt5Network.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Network", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Network" with
  any of the following names:

    Qt5NetworkConfig.cmake
    qt5network-config.cmake

  Add the installation prefix of "Qt5Network" to CMAKE_PREFIX_PATH or set
  "Qt5Network_DIR" to a directory containing one of the above files.  If
  "Qt5Network" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:739 (find_package):
  By not providing "FindQt5Xml.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Xml", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Xml" with any
  of the following names:

    Qt5XmlConfig.cmake
    qt5xml-config.cmake

  Add the installation prefix of "Qt5Xml" to CMAKE_PREFIX_PATH or set
  "Qt5Xml_DIR" to a directory containing one of the above files.  If "Qt5Xml"
  provides a separate development package or SDK, be sure it has been
  installed.


CMake Warning at CMakeLists.txt:741 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:742 (find_package):
  By not providing "FindQt5PrintSupport.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5PrintSupport", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5PrintSupport"
  with any of the following names:

    Qt5PrintSupportConfig.cmake
    qt5printsupport-config.cmake

  Add the installation prefix of "Qt5PrintSupport" to CMAKE_PREFIX_PATH or
  set "Qt5PrintSupport_DIR" to a directory containing one of the above files.
  If "Qt5PrintSupport" provides a separate development package or SDK, be
  sure it has been installed.


CMake Warning at CMakeLists.txt:743 (find_package):
  By not providing "FindQt5OpenGL.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5OpenGL", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5OpenGL" with
  any of the following names:

    Qt5OpenGLConfig.cmake
    qt5opengl-config.cmake

  Add the installation prefix of "Qt5OpenGL" to CMAKE_PREFIX_PATH or set
  "Qt5OpenGL_DIR" to a directory containing one of the above files.  If
  "Qt5OpenGL" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:744 (find_package):
  By not providing "FindQt5Svg.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Svg", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Svg" with any
  of the following names:

    Qt5SvgConfig.cmake
    qt5svg-config.cmake

  Add the installation prefix of "Qt5Svg" to CMAKE_PREFIX_PATH or set
  "Qt5Svg_DIR" to a directory containing one of the above files.  If "Qt5Svg"
  provides a separate development package or SDK, be sure it has been
  installed.


CMake Warning at CMakeLists.txt:745 (find_package):
  By not providing "FindQt5UiTools.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5UiTools", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5UiTools" with
  any of the following names:

    Qt5UiToolsConfig.cmake
    qt5uitools-config.cmake

  Add the installation prefix of "Qt5UiTools" to CMAKE_PREFIX_PATH or set
  "Qt5UiTools_DIR" to a directory containing one of the above files.  If
  "Qt5UiTools" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:746 (find_package):
  By not providing "FindQt5Network.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Network", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Network" with
  any of the following names:

    Qt5NetworkConfig.cmake
    qt5network-config.cmake

  Add the installation prefix of "Qt5Network" to CMAKE_PREFIX_PATH or set
  "Qt5Network_DIR" to a directory containing one of the above files.  If
  "Qt5Network" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:747 (find_package):
  By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Concurrent", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Concurrent"
  with any of the following names:

    Qt5ConcurrentConfig.cmake
    qt5concurrent-config.cmake

  Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
  "Qt5Concurrent_DIR" to a directory containing one of the above files.  If
  "Qt5Concurrent" provides a separate development package or SDK, be sure it
  has been installed.


CMake Warning at CMakeLists.txt:750 (find_package):
  By not providing "FindQt5WebKitWidgets.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5WebKitWidgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5WebKitWidgets"
  with any of the following names:

    Qt5WebKitWidgetsConfig.cmake
    qt5webkitwidgets-config.cmake

  Add the installation prefix of "Qt5WebKitWidgets" to CMAKE_PREFIX_PATH or
  set "Qt5WebKitWidgets_DIR" to a directory containing one of the above
  files.  If "Qt5WebKitWidgets" provides a separate development package or
  SDK, be sure it has been installed.


CMake Error at CMakeLists.txt:755 (MESSAGE):
  ========================

  Qt5 libraries not found.

  ========================



-- Configuring incomplete, errors occurred!
See also "/Users/nyholku/FreeCAD/build2/CMakeFiles/CMakeOutput.log".
See also "/Users/nyholku/FreeCAD/build2/CMakeFiles/CMakeError.log".
nyholkus-MacBook-Pro-5:build2 nyholku$ 
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: macOS Qt5 plan and status

Post by triplus »

Well i am no Mac compile expert but the message is clear:

Code: Select all

Qt5 libraries not found.
Therefore you will need to sort that out.
nyholku
Posts: 149
Joined: Wed Dec 28, 2016 4:18 pm

Re: macOS Qt5 plan and status

Post by nyholku »

Thanks, that was helpful.

The thing is AFAIU this is supposed to build out of the box if pre-requisites are installed (I have qt5) and someone in this thread obviously has built this on Mac so I was thinking there might be a problem in the build process that someone already had figured out.

In FOSS I think re-doing that have already been done is frowned up on.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: macOS Qt5 plan and status

Post by triplus »

I doubt we can start using term "out of the box" just yet. After all libraries are involved that weren’t officially released yet. Read the thread and you will see why.
nyholku wrote:In FOSS I think re-doing that have already been done is frowned up on.
That is correct and @blacey shared a link to a script he uses on Travis in this thread. That i guess is your best bet. He uses some Qt 5 related symlinks in it and that should explain why CMake doesn’t see your Qt 5. Regardless of the fact if it's there or not.
nyholku
Posts: 149
Joined: Wed Dec 28, 2016 4:18 pm

Re: macOS Qt5 plan and status

Post by nyholku »

Thanks, that was actually helpful!
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

You need to run brew link --force Qt@5.6 to establish the homebrew links. In addition, you will need to create some individual links for make.

Here are the Qt5 install steps we use on Travis (note, some of these commands are used simply blackout Qt4 and install Qt5.6)

There are two relevant branches if you want to build with Qt5. First, I recommend the Qt56 branch in homebrew-freecad. You can use the commands shown in the Travis config to tap the qt56 branch and install the qt56 dependencies.

In addition, there is a Qt5 branch in my FreeCAD fork that includes cmake changes needed to build the FreeCAD app bundle.

Sorry for the slow response but I am traveling.

Good luck.
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: macOS Qt5 plan and status

Post by blacey »

nemesis wrote:unfortunately I didn't enjoy ;-)

Code: Select all

/Volumes/FreeCAD/FreeCAD.app/Contents/bin/FreeCAD 
FreeCAD 0.17, Libs: 0.17R9801 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2016
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Abort trap: 6
maybe normal because it's OS X 10.11.6 (15G1217)
on :

iMac (27 pouces, half-2010) (dude its close to 7 years :shock: )
2,8 GHz Intel Core i5
16 Go 1333 MHz DDR3
ATI Radeon HD 5750 1024 Mo
If you have another version of FreeCAD installed in /usr/local (i.e. you built it yourself), other versions may crash due to this mantis issue - https://www.freecadweb.org/tracker/view.php?id=2886

Please let me know if this is the root cause or not.
Post Reply