CMake generated application bundle

Having trouble installing or compiling FreeCAD? Get help here.
peterl94
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

CMake generated application bundle

Postby peterl94 » Wed Aug 14, 2013 1:34 am

Hi,

I made some modification to FreeCAD's CMake files to be able to automatically create a relocatable Mac application bundle, by just doing make install. I pushed my changes to my newly created FreeCAD repo if anyone want's to try it out. https://github.com/peterl94/FreeCAD_sf_ ... ee/osx-app There are a few caveats however, depending on how you build FreeCAD's dependencies (I was using Homebrew). First of all, if the libraries don't have absolute install names (e.g. libboost_system.dylib instead of /usr/local/lib/libboost_system.dylib), you will have to specify where they can be found with the CMake variable BUNDLE_DEPS_DIRS (semi-colon seperated). Secondly, some Qt libraries get copied into the bundle twice -- the .4.dylib and the .4.8.5.dylib version. Since the .4.dylib version is supposed to be a symlink, you have create it yourself. Also, you will have to copy qt_menu.nib into the Resources folder in the bundle. (qt_menu.nib is located in src/gui/mac or in the QtGui.framework) Lastly, you will probably have to fix some permissions.

One more thing, it currently assumes you are not using the system Python.

You can also try out my build here (OS X 10.8 only), but it has couple problems. The images don't get rendered in the start page and the snap icons are missing in the draft workbench.

Please let me know if you have any problems with it or if you have any ideas of how to make it better.

~ Peter
moonman91
Posts: 12
Joined: Mon Aug 12, 2013 3:20 pm

Re: CMake generated application bundle

Postby moonman91 » Sun Aug 18, 2013 2:50 pm

Hey,

I've been trying to build on mac (OS X 10.6.8) for a moment now.

I tried your version but the cmake fails. I got this error :

Code: Select all

-- prefix: /usr/local
-- datadir: FreeCAD.app/Contents/Resources
-- docdir: FreeCAD.app/Contents/doc
-- includedir: include
-- Found PythonLibs: /usr/lib/libpython2.5.dylib (found suitable exact version "2.7.5") 
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   filesystem
--   program_options
--   regex
--   signals
--   system
--   thread
-- Found Xerces-C: /usr/local/lib/libxerces-c.dylib
-- PyCXX found:
--   Headers:  /Users/Fabrice/Downloads/FreeCAD_sf_master-osx-app/src
--   Sources:  /Users/Fabrice/Downloads/FreeCAD_sf_master-osx-app/src/CXX
-- OpenCASCADE Community Edition has been found.
-- Could NOT find Spnav (missing:  SPNAV_LIBRARY SPNAV_INCLUDE_DIR) 
matplotlib not found, Plot module will not available until matplotlib is installed!
-- Platform is 64-bit, set -D_OCC64
-- DEBUG: -g -DFC_DEBUG
fatal: Not a git repository (or any of the parent directories): .git
sh: bzr: command not found
svn: '/Users/Fabrice/Downloads/FreeCAD_sf_master-osx-app' is not a working copy
Unknown version control
/Users/Fabrice/Downloads/FreeCAD_sf_master-osx-app/build/src/Build/Version.h written
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
CMake Error at bundle/CMakeLists.txt:4 (get_filename_component):
  get_filename_component called with incorrect number of arguments


-- Configuring incomplete, errors occurred!
I looked into the cmakelists files and I found the variable OCC_LIBRARY (in the function get_filename_component) which I'm not sure is defined somewhere. But I'm really new to cMake and I'm not sure to understand everything.

Any ideas?

By the way, which version of freecad is it?
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: CMake generated application bundle

Postby NormandC » Sun Aug 18, 2013 6:13 pm

moonman91 wrote:By the way, which version of freecad is it?
The git repo Peter linked is cloned from the current FreeCAD development source code (tentatively labeled v0.14). It is not a final release. But in my experience it's no less stable than the "stable" official release. Actually it's got a few bugs fixes compared to v0.13.1830.
peterl94
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: CMake generated application bundle

Postby peterl94 » Sun Aug 18, 2013 9:11 pm

Yep, it's a clone of master. And you're right about the error; OCC_LIBRARY is not being defined. I mistakenly thought that it always gets defined, but I realize now that it only gets defined when the OCE cmake files can't be found (which happened to me for some reason, even though I had installed OCE). I just committed a workaround for now (use a hard coded path).

Also, I haven't tested what will happen when you use the system python. It should work, but I can't guarantee it.

Thanks for trying out my branch!
moonman91
Posts: 12
Joined: Mon Aug 12, 2013 3:20 pm

Re: CMake generated application bundle

Postby moonman91 » Mon Aug 19, 2013 9:08 am

The cmake seems to work now!
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The Fortran compiler identification is GNU
-- Check for working Fortran compiler: /usr/local/bin/gfortran
-- Check for working Fortran compiler: /usr/local/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/local/bin/gfortran supports Fortran 90
-- Checking whether /usr/local/bin/gfortran supports Fortran 90 -- yes
-- Looking for GL/gl.h
-- Looking for GL/gl.h - not found
-- Looking for C++ include istream
-- Looking for C++ include istream - found
-- Looking for C++ include ostream
-- Looking for C++ include ostream - found
-- Looking for C++ include fstream
-- Looking for C++ include fstream - found
-- Looking for C++ include sstream
-- Looking for C++ include sstream - found
-- Looking for C++ include ios
-- Looking for C++ include ios - found
-- Looking for C++ include iostream
-- Looking for C++ include iostream - found
-- Looking for C++ include iomanip
-- Looking for C++ include iomanip - found
-- Looking for C++ include iostream
-- Looking for C++ include iostream - found
-- Check for STD namespace
-- Check for STD namespace - found
-- prefix: /usr/local
-- datadir: data
-- docdir: doc
-- includedir: include
-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/2.7/bin/python (found version "2.7.5")
-- Found PythonLibs: /usr/lib/libpython2.5.dylib (found suitable exact version "2.7.5")
-- Boost version: 1.53.0
-- Found the following Boost libraries:
-- filesystem
-- program_options
-- regex
-- signals
-- system
-- thread
-- Found Xerces-C: /usr/local/lib/libxerces-c.dylib
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.3")
-- PyCXX found:
-- Headers: /Users/Fabrice/Documents/freecad_bundle/src
-- Sources: /Users/Fabrice/Documents/freecad_bundle/src/CXX
-- OpenCASCADE Community Edition has been found.
-- Found SWIG: /opt/local/bin/swig (found version "2.0.9")
-- Found Eigen3: /usr/local/include/eigen3 (Required is at least version "2.91.0")
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - found
-- Found Qt4: /usr/bin/qmake (found suitable version "4.8.5", minimum required is "4.5.0")
-- Found Freetype: /usr/X11R6/lib/libfreetype.dylib (found version "2.3.9")
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework
-- Found OpenGLU: /System/Library/Frameworks/AGL.framework
-- Could NOT find Spnav (missing: SPNAV_LIBRARY SPNAV_INCLUDE_DIR)
matplotlib not found, Plot module will not available until matplotlib is installed!
-- Platform is 64-bit, set -D_OCC64
-- DEBUG: -g -DFC_DEBUG
git
/Users/Fabrice/Documents/freecad_bundle/build/src/Build/Version.h written
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/BaseClassPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/BoundBoxPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/PersistencePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/VectorPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/MatrixPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/RotationPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/PlacementPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/AxisPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/UnitPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Base/QuantityPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/App/DocumentPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/App/DocumentObjectPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/App/DocumentObjectGroupPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/App/ComplexGeoDataPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/App/PropertyContainerPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/App/MaterialPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Points/App/PointsPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Mesh/App/FacetPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Mesh/App/MeshFeaturePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Mesh/App/MeshPointPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Mesh/App/MeshPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/ArcPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/ArcOfCirclePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/CirclePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/EllipsePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/HyperbolaPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/ParabolaPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/OffsetCurvePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/GeometryPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/GeometryCurvePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/GeometrySurfacePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/LinePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/PointPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/BezierCurvePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/BSplineCurvePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/PlanePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/ConePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/CylinderPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/SpherePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/ToroidPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/BezierSurfacePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/BSplineSurfacePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/OffsetSurfacePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/RectangularTrimmedSurfacePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/SurfaceOfExtrusionPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/SurfaceOfRevolutionPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/PartFeaturePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/Part2DObjectPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeCompoundPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeCompSolidPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeEdgePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeFacePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeShellPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeSolidPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeVertexPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/TopoShapeWirePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Sketcher/App/SketchObjectSFPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Sketcher/App/SketchObjectPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Sketcher/App/ConstraintPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Sketcher/App/SketchPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Robot/App/Robot6AxisPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Robot/App/TrajectoryPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Robot/App/WaypointPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Robot/App/RobotObjectPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Mod/Fem/App/FemMeshPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Gui/DocumentPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Gui/PythonWorkbenchPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Gui/ViewProviderPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Gui/ViewProviderDocumentObjectPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Gui/ViewProviderPythonFeaturePy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Gui/WorkbenchPy.cpp
-- /Users/Fabrice/Documents/freecad_bundle/build/src/Gui/SelectionObjectPy.cpp
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Fabrice/Documents/freecad_bundle/build
But I'm facing the same build problem as with the master branch source files. I'm starting a new thread not to pollute this one.