Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building for mac from a Visual Studio project.

Building for mac from a Visual Studio project.

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    B_Euden
    wrote on last edited by
    #1

    I've been given a QT4 visual studio vsxproj solution that I need to compile to run on a Mac but I'm a bit out of my depth being relatively new to QT. I've downloaded the QT5 creator for the mac, and a lot of the source files have 'windows related code, do I need to change this or does QT do this automatically?

    Any assistance in converting this project to run on a mac would be appreciated.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      No Qt can't automagically convert platform specific code.

      The first thing you should do is convert your Visual Studio project to a qmake project (IIRC it's an option you have with Qt's Visual Studio Addin) So you can use it easily on all platforms

      Then you can start working on the platform specify code. One solution is to surround it with

      @#ifdef Q_OS_WIN
      // windows specific code
      #endif@

      And the corresponding Q_OS_OSX etc...

      Same thing for includes etc.

      Another option you have depending on your code base is to extract the windows specific implementations in their own file so e.g. have

      mycoolclass.cpp <- common code

      mycoolclass_win.cpp <- specialized for windows

      mycoolclass_mac.cpp <- specialized for OS X/iOS

      etc…
      and only build them when needed. The selection can be done in your pro file. qmake's documentation will help you for that

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved