3Dconnexion Mac support
3Dconnexion Mac support
Hi,
I had a look at the 3dconnexion code for Mac support. I changed it quite a bit and I am happy now with the way it works. I did not yet check if building on Linux is affected and I can't check the Windows build. I would be grateful if someone had a look at it and if it would end up in master
https://github.com/tsadowski/FreeCAD.git tsadowski-3dconnexion-mac
Cheers,
Torsten
I had a look at the 3dconnexion code for Mac support. I changed it quite a bit and I am happy now with the way it works. I did not yet check if building on Linux is affected and I can't check the Windows build. I would be grateful if someone had a look at it and if it would end up in master
https://github.com/tsadowski/FreeCAD.git tsadowski-3dconnexion-mac
Cheers,
Torsten
Last edited by NormandC on Wed Jan 21, 2015 12:35 am, edited 1 time in total.
Reason: An url link is not a proper topic subject.
Reason: An url link is not a proper topic subject.
Re: 3Dconnexion Mac support
Great! Thanks for your work. I don't have a 3dconnexion mouse so I won't be able to test the actual code, but there is a few cmake changes that need to be made.
Is this really a requirement of 3dconnexion? If so, please make it conditional on FREECAD_USE_3DCONNEXION. There are several people here that are using FreeCAD on 10.6, and at least one using 32-bit 10.6. I was able to compile your branch on 10.6, but I don't know if 3dconnexion still provides drivers for it.
Also, one of your changes disables freetype support. This would fix that:
I have the 3Dconnexion sdk installed, is this a requirement?
Thanks,
Peter
Code: Select all
# 10.9 is the lowest working deployment target
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES x86_64)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
endif(APPLE)
Also, one of your changes disables freetype support. This would fix that:
Code: Select all
@@ -168,10 +168,12 @@ elseif(MSVC OR APPLE)
OPTION(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse."
else(MSVC)
set(FREECAD_USE_3DCONNEXION OFF)
+endif(MSVC)
+if(NOT MSVC)
OPTION(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" ON)
OPTION(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" OFF)
OPTION(FREECAD_USE_PCL "Build the features that use PCL libs" OFF)
-endif(MSVC)
+endif(NOT MSVC)
# if this is set override some options
if (FREECAD_BUILD_DEBIAN)
Thanks,
Peter
Re: 3Dconnexion Mac support
Setting the architecture is not necessary at least before we figure out to make universal binaries. Setting a deployment target is recommended because it enables weak linking of frameworks. If the 3dconnexion framework is strongly linked then the program would not run on computers without the framework. 10.6 did not work for me because of a linker error. I think the problem is homebrew. I don't know about their policy in this matter.
I'm sorry for messing up the cmake conditionals.
The SDK is not necessary. Everything needed is in the framework from the driver installation. I was actually shocked by the "SDK". The examples are so outdated they don't build and if you get them to build might crash.
Cheers,
Torsten
I'm sorry for messing up the cmake conditionals.
The SDK is not necessary. Everything needed is in the framework from the driver installation. I was actually shocked by the "SDK". The examples are so outdated they don't build and if you get them to build might crash.
Cheers,
Torsten
Re: 3Dconnexion Mac support
Ah, that makes sense. I think it would be better to let everybody set those options themselves then. I currently compile the official builds on a 10.6 machine, and so I will be able to set the deployment target to 10.6.
Re: 3Dconnexion Mac support
Am I right that the code still needs some tweaks before it's ready for merge?
Re: 3Dconnexion Mac support
I removed the deployment target from CMakeLists.txt. It builds, it runs but it is strongly linked and crashes on start if the 3Dconnexion framework is not present. I will look further into this.
I would like to have it pulled but the official Mac version should currently be built without 3Dconnexion support.
Cheers,
Torsten
I would like to have it pulled but the official Mac version should currently be built without 3Dconnexion support.
Cheers,
Torsten
Re: 3Dconnexion Mac support
Have you set those variables in the cache? If you are using the cmake-gui, you will need to check "Advanced" for those options to show up.
Re: 3Dconnexion Mac support
Ok I have a solution. Playing with the OSX_DEPLOYMENT_TARGET was not successful but luckily also not necessary. Weak linking is set explicitly and I had to declare the external symbols as weak imports.
In Gui/CMakeLists.txt:
and in GuiApplicationNativeEventAware.h:
Sorry, I was not able to rebase all my changes to the current master.
Cheers,
Torsten
In Gui/CMakeLists.txt:
Code: Select all
set(3DCONNEXION_LINKFLAGS "-F/Library/Frameworks -weak_framework 3DconnexionClient")
set(3DCONNEXION_INCLUDE_DIR /Library/Frameworks/3DconnexionClient.framework/Headers )
Code: Select all
#include <3DconnexionClient/ConnexionClientAPI.h>
extern OSErr InstallConnexionHandlers(ConnexionMessageHandlerProc messageHandler, ConnexionAddedHandlerProc addedHandler, ConnexionRemovedHandlerProc removedHandler)
__attribute__((weak_import));
extern UInt16 RegisterConnexionClient(UInt32 signature, UInt8 *name, UInt16 mode, UInt32 mask) __attribute__((weak_import));
extern void UnregisterConnexionClient(UInt16 clientID) __attribute__((weak_import));
extern void CleanupConnexionHandlers(void) __attribute__((weak_import));
Cheers,
Torsten
Re: 3Dconnexion Mac support
Postpone to after the 0.15 release.
Re: 3Dconnexion Mac support
Could I get it into 0.15 if I succeed in a rebase?
Cheers, Torsten
Cheers, Torsten