FreeCAD/CMakeLists.txt
Yorik van Havre 3f4e55a474 Initial merge of Path module branch
authors: Yorik van Havre, Dan Falck, Brad Collette, Frederik Johansson, Dmitry Platonov,

eb4fd6c Path: moved colors preferences page to Path group
f4e5d70 a little more work on auto tool change
99a6e2f tied tool numbers in ops to last loaded tool
2d6fcda no need to select object for tooltable edit
b53eb15 Path: Fixed path bug #10 - Tooltableeditor
d6e996f Path: Fixed path bug #36 - Finish editing
16fe598 Path: Fixed path bug #37: labels in compound dialog
22dc594 Bugfix in pocket, was producing strange arcs due to a rounding error Path doesnt render values such as:-4.4408920985e-16 produced by python
9aae1d5 Make Gcode editor restore its size and position from last opened
b44e1d6 Move addToProject to PathUtils
71b727a Make all tools show its correct icon in the tree
86b32e0 Further simplify the code and fix issue in PathHop
e63b6b7 Simplify code and make automatic project creation more consistent across tools
261bfa3 Add ability to have external orocos-kdl library instead of the suplied in FreeCAD, used in Robot and Path workbenches
95efa27 Drilling-rapid to first location before moving Z
73537d6 I forgot to parse the SubObjects of the selection
044c23d improvements to drilling selection and properties
347fe62 small improvement to PathKurveUtils sorting
95ffe39 formatting
1003968 split full circles
27b19c2 added basic feedrate to PathKurveUtils
372ef57 Path: removed Path_rc and DemoParts from Cmake
98705ad using toBiarcs for paths based on splines
32663e5 slight startpt/endpt simplification
fd8f258 parametric start and end pts to PathKurve
b5e4761 still working on pathkurvetutils and points
01bf423 worked out clockwise profile paths
2825191 fixed typo
5a87872 still working on start and stop points for kurve
7fe77bc allowing points for start and stop of path
cb57d1b making ptlist consistant
3f2bf6c improvements to PathKurve
e3765a0 added libarea for pofile op-still much work to do
c882df2 small fix for adding arcs to edgelist
2cbac06 forgot Path_rc.py
45bf437 applied fix for windows icons not showing
61dbe07 PathUtils code cleanup
9d49cb8 Fix SortPath if no offset is specified
332eca0 split SortEdges and MakePath in prep for using kurve_funcs from HeeksCNC
799f1f1 tweaking visualization a bit
ba8eee6 small change back to way project holds toolpath for visualization
5ca4984 applied Werner's kdl patch
14c93be added units to tlo,revised centroid post
3c6341d Path: fixed spaces missing in file reading
10c20f9 removed editor button from project and post work
68ff118 removed stock command added small function to find last z value
0b71f92 tidying up profile a bit
fe8b4e9 moved the findtool function to PathUtils
4441695 Path: Exposed Command.transform() to python
09ed1d1 Path: Added a default empty preferences page
6ff0689 forgot to add the PathFromShape.py file
d6e3c4a added simple python proxy for PathShape So that it can be inserted into the Project tree automatically. Later, we can connect the base object to the shape so that it changes if the base shape is changed.
f5ca514 clean up of PathCopy.py
8336b96 moved Path from Shape to New Operation menu
7e73998 made PathCopy a child of the Project/Compound
7674b37 missed a modified file for unit handling
9aa1327 small change to account for pathcopy being InList
c35a109 PathPost doesn't barf now if the user rearranged the project.
09c4a1f working on Machine properties again
4bc32a4 more view property fixes
a453ad2 set defaults from post
3b051cb more property changes
ef5a015 reorganized properties.  Used PropertyLength/Distance in Drilling
311a059 made it so that the viewprovider settings would stick
e427303 fixed post function
3e528dc removed post processor file property from PathProject and added it to PathMachine
58a5339 added Machine object to hold post processor file name and tooltable information. Moved the cornermin,cornermax bounding box of machine to it. Haven't connected post processor file output from it yet, will do that next. Disconnected path output from Project object. It is really just a Group now that holds all the other path objects. Posts will now have to parse the objects inside it to get gcode. I think we are already doing that with the linuxcnc post and I plan on doing that with future posts. Removed a lot of view properties from lots of objects that don't need them. Use mode=2 and vobj.setEditorMode('LineWidth',mode) as an example of that. Removed placement property for things like PathComment because it doesn't make sense to try to alter placement of nongeometric things.
dd8b831 adding properties for using units
f84a2cc Multiple selection of points and circles for drilling.
f3d645a added viewprovider for drill icon in object tree
f564462 changed R plane behaviour for G81 drill cycle
85a056d added a few more drill/tap/bore cycles,changed z to R plane between drill cycles
9312ef9 Path: Added 3D representation of G81, G82 and G83 drill ops
0ed19d5 A stab at pathpocket with some reasonable properties and stepping down.
da9d6b5 forgot a quote mark
1c49c8d changed icon for optional stop
b7eb50e First bit of work on drilling.
4b3bc52 moved where comments and optional stops are located
3e9fbd7 added optional and mandatory stop commands
9e94269 added comment object
c3e44f5 removed a few properties
7cf86d7 automatic populating of tool numbers based on active ToolNumber
b607843 added tool length offset and load tool commands, made PathCompound accept objects that PathProject removed
8a93d54 reworked linuxcnc_post to use commands natively and not toGCode()
85f2cfd PathPost command now handles more cases including generic. Adds a simple dumper post to get raw commands.
aa827fa added G43 tool length offset
b1bf6d3 added new post, modded Profile for comments, fixed ZClearance in Profile
2fd5f2c added post process command and button
3cf6107 forgot about adding a file to cmake again
77f8a7f added new post, rearranged icons,modified PathProject
7e6adf3 added active property to PathPocket
d6b479a fixed stock, added active/inactive to a few ops
9a96b72 added pathplane and made fixture and pathprofile automatically populate or even create a project
d214281 forgot to add the actual script needed for stock
1adf36a added PathStock for material visualization
2ef30ea fixed bug in fixtures and changed icon
7b3e9dd made fixtures go inside a Path Project
6143c9a fixed JSON encoding error
c46cb2b added simple script to use the ToolTableEditor`
fc70a4d Turned Compound & Project into python objects
a1b9127 trying to fix segfualt
1bbf53e repaired fixture offsets
739e387 missing import. revised for new structure.  Creates multiple paths again.
38f2d25 added missing import
1837645 adding parameters to PathCompound
208bfdb Path: New pre/post interface
a252be1 rearranged and added some parameters to PathProject and PathCompound
9fa6278 Path: Added safe height property to project
de6812e made the icon a bit thicker
25beab0 merging Path-Copy with Path-Fixture
5cfffdc added icon for fixture offsets
af18281 Path: Added Path Copy object
89865ef pre support tool change and spindle speed (partially)
e9960f7 changes to opensbp post only.
421c12b Path: Fixed bug in paths with no move
272a11d added linuxcnc_post.py back to cmake
715c72b removed unused files
4ea4e18 added fixture offset script, removed unneeded scripts
855a3e0 fix for toolchange to get Tnumber to show
64f497c Path: Fixed unresponsive import/export dialogs
51c7a9e revert example post to simple form
5e25f3a Renamed pre_ and post_ scripts to _pre and _post
9837f3f first pass cleanup
9a42cee Path: Fixed scripts search path
3467a73 Path: search for pre & post scripts in user dir too - fixes #12
b46e527 Path: fixed precision bug - closes #25
c65fc05 added another post from sliptonic
718f499 Path: Enabled comments in Paths
ea0952f Path: Added preference color for machine extents
7578467 Path: Implemented machine properties  - issue yorikvanhavre/FreeCAD#8
1ae3a7d minor change to comment location
49f742d added Spindle Speed to profile
2a4374c added a second post processor example
5278d46 worked on sorting, reversing, sorting, and more sorting
7bc81bf separating selection function from PathUtils
64dd77c Path: small fix in absolute/relative coords
f435303 face selection works again
fa7074f rolled back and took another try at discretizing curves
ae1ff5b changed discretizing slightly
8e47d16 added discretizing of bezier curves to toolpaths
e85e087 fix for open wires/profiles worked on sorting again
a9a8a29 worked out arc segments over 180 degrees but not full circles yet
073a4a0 refactoring where sorting takes place
6723052 one more time on the sorting
050221c arc direction and path order-still problems but better
d7a79b1 I think I worked out backwards arc problem
a721aae corrected final depth on profile
4f07f01 I forgot to add the file for the previous commit
8eac175 combined ConvGcode and PathSelection into PathUtils
488a593 added some profile utility functions
4c4e0b2 worked on arc moves and reordering
cf04c3a Path: Added Hop tool and added arcs handlingin PathShape
417e9c7 Path: removed Tool number from dressup
4cedb9d Path: Fixed dressup
1b7e79f Path: Added UsePlacements property to compounds
8241513 Path: Added Dressup + fixed cmake + enabled python view provider
9721037 Path: Update bounding boxes when drawing path
9d8192e Path: Split compound into compound and project objects
250cdc7 Path: Added Drilling tool
8939e03 Path: Added translation file
466fe54 Path: Added an initial rapid move to FeatureShapes
7dfab6f Path: Added pocket tool
795f3c0 Path: added a ShowFirstRapid property to the path viewprovider
21e1272 Path: show number of tools in compound's task dialog
8dde2c5 Path: Added Profile tool
32b3fc1 Path: Added GUI import/export
fa1db60 Path: allow to import heeks tooltables and removed c++ workbench
e8c5a3a Path: Fixed tooltable editor
29fd0e4 Path: Allow pre scripts to return a list to create a compound
1eec4bd Path: Tooltable editor (BUGGY)
3ee661d Path: updated Path module dependencies in cmake
7137e04 Path: Added UI to reorder children of a path compound feature
3fb7073 Path: Added Path::FeatureShape feature
f496615 Path: added post editor
069b070 Path: Added structure for post scripts
bd0e669 Path: Added Path.insert() function
fcf1f18 Path: small bugfixes
09124e3 Path: Added spaces in (pseudo) Gcode output
efcb755 Path: Added pre script example
7a6a267 adding macro to find outer profile
274ff82 added a few macros
521d095 Path: Added FeatureCompound object
06eee1a adding python scripts and part files
42119ab added LGPL license
e8f0742 added demo parts and python experiments
c849734 Path: added tooltable property & Path.show() function
1886b4a Path: Added Path::FeaturePython object
b48b9d8 Path: correct placement behaviour and support for G90 and G91
00fe8a6 Path: Added support for G00
896c359 Path: Enabled different color for rapid moves
885a8d9 Path: small fix
a8d310b Path: improvements to the view provider
9fd88c5 Path: now removes comments when creating paths from gcode
dc0a0f1 Path: Fixed Z coordinate
ba6abc8 Path: Fixed color properties
8605629 Path: remember Z coord of last point if not specified
0d66fa9 Path: Misc upgrades to the view provider
f77c399 Path: Now supposes absolute positions instead of relative
a23b4e8 Path: Tooltable now behaves as a dicionary
eef5669 Path: simplified file saving/restoring
f15262f Path: enabled reading & writing of Path features
0a735ee More uniform caps system for enums, and added more materials
ad3f88e added a few more tools
ef62185 added more tools
f489758 removed whitespaces
5f906c6 added a few more tool definitions
84608dc minor changes to names
3ca1b5c Path: added Tool and Tooltable objects
d852a0b Path: extended path py object, enable coin representation in view provider
f7980b3 Path: extended the command object
a6205c4 Added Path Feature
dae6499 Path: Added Path object
693c0df Temporarily removed Gui from cmake
c2519e7 Path module: First commit
b3860d5 made a little progress- added ConvGcode to split and reverse paths
5761235 removed wire.reverse()- I couldn't get the hang of it
54a5482 added selection script along with parameters for profile
cecc1df Path: removed Tool number from dressup
7ca8e79 Path: Fixed dressup
d7d1a9b Path: Added UsePlacements property to compounds
a001d7c Path: Added Dressup + fixed cmake + enabled python view provider
5ff31b3 Path: Update bounding boxes when drawing path
946f26c Path: Split compound into compound and project objects
4c9fedd Path: Added Drilling tool
e88d431 Path: Added translation file
a989530 Path: Added an initial rapid move to FeatureShapes
8faab1e Path: Added pocket tool
e2dd1a4 Path: added a ShowFirstRapid property to the path viewprovider
5daa4ed Path: show number of tools in compound's task dialog
18bd973 Path: Added Profile tool
f613104 Path: Added GUI import/export
7e7bc79 Path: allow to import heeks tooltables and removed c++ workbench
a60325f Path: Fixed tooltable editor
802b413 Path: Allow pre scripts to return a list to create a compound
35fb2a1 Path: Tooltable editor (BUGGY)
3040bc1 Path: updated Path module dependencies in cmake
680d9a8 Path: Added UI to reorder children of a path compound feature
8ed321c Path: Added Path::FeatureShape feature
f81ccdd Path: added post editor
34d2cef Path: Added structure for post scripts
2ea3060 Path: Added Path.insert() function
e8561f4 Path: small bugfixes
ef6fe49 Path: Added spaces in (pseudo) Gcode output
909a944 Path: Added pre script example
58abd71 adding macro to find outer profile
a7415c5 added a few macros
51cd15b Path: Added FeatureCompound object
be6c10a adding python scripts and part files
30bde91 added LGPL license
93babeb added demo parts and python experiments
f69c9a9 Path: added tooltable property & Path.show() function
5796bea Path: Added Path::FeaturePython object
e6052bd Path: correct placement behaviour and support for G90 and G91
9f3977c Path: Added support for G00
1b95678 Path: Enabled different color for rapid moves
90bdc2c Path: small fix
6394ceb Path: improvements to the view provider
aa93f1e Path: now removes comments when creating paths from gcode
35a479b Path: Fixed Z coordinate
1947315 Path: Fixed color properties
987d8e3 Path: remember Z coord of last point if not specified
64da26c Path: Misc upgrades to the view provider
283df2b Path: Now supposes absolute positions instead of relative
b59a46d Path: Tooltable now behaves as a dicionary
b4c2edb Path: simplified file saving/restoring
8b36988 Path: enabled reading & writing of Path features
308bb20 More uniform caps system for enums, and added more materials
f9f129c added a few more tools
eb83a31 added more tools
bb40643 removed whitespaces
13cd406 added a few more tool definitions
6357082 minor changes to names
6a14580 Path: added Tool and Tooltable objects
bc14864 Path: extended path py object, enable coin representation in view provider
a8a19a0 Path: extended the command object
0174d04 Added Path Feature
a829a6c Path: Added Path object
ba7ca94 Temporarily removed Gui from cmake
3c9d77a Path module: First commit
2015-07-04 18:30:10 -03:00

957 lines
37 KiB
CMake

project(FreeCAD_trunk)
set(FREECAD_VERSION "0.16")
set(PACKAGE_NAME "FreeCAD")
set(PACKAGE_VERSION_MAJOR "0")
set(PACKAGE_VERSION_MINOR "16")
set(PACKAGE_VERSION_PATCH "4665")
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
# added in cmake 3.0
if(POLICY CMP0050)
cmake_policy(SET CMP0050 OLD)
endif(POLICY CMP0050)
endif(COMMAND cmake_policy)
# include local modules
include(AddFileDependencies)
include(cMake/FreeCadMacros.cmake)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")
#if(CMAKE_CFG_INTDIR STREQUAL .)
# No Debug/Release output paths
set(DEBUG_MAIN_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(RELEASE_MAIN_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
#else(CMAKE_CFG_INTDIR STREQUAL .)
# set(DEBUG_MAIN_OUTPUT_PATH ${CMAKE_BINARY_DIR}/src/Main/Debug)
# set(RELEASE_MAIN_OUTPUT_PATH ${CMAKE_BINARY_DIR}/src/Main/Release)
#endif(CMAKE_CFG_INTDIR STREQUAL .)
if(WIN32)
set(PLATFORM_CP xcopy /Y /S)
set(PLATFORM_MK mkdir)
else(WIN32)
set(PLATFORM_CP cp)
set(PLATFORM_MK mkdir -p)
endif(WIN32)
# ================================================================================
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANGXX TRUE)
endif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
include(cMake/ConfigureChecks.cmake)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_definitions(-DHAVE_CONFIG_H)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-write-strings")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
# get linker errors as soon as possible and not at runtime e.g. for modules
if(UNIX)
# SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
endif(UNIX)
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
# ================================================================================
# Output directories for install target
if(WIN32)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Installation root directory")
else(WIN32)
SET(CMAKE_INSTALL_PREFIX "/usr/lib${LIB_SUFFIX}/freecad" CACHE PATH "Installation root directory")
endif(WIN32)
SET(CMAKE_INSTALL_DATADIR data CACHE PATH "Output directory for data and resource files")
SET(CMAKE_INSTALL_INCLUDEDIR include CACHE PATH "Output directory for header files")
SET(CMAKE_INSTALL_DOCDIR doc CACHE PATH "Output directory for documentation and license files")
# Don't set it without manual adaption of LibDir variable in src/App/FreeCADInit.py
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
if(NOT WIN32)
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
SET(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif(NOT IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
endif(NOT WIN32)
SET(PYCXX_INCLUDE_DIR
"${CMAKE_SOURCE_DIR}/src" CACHE PATH
"Path to the directory containing PyCXX's CXX/Config.hxx include file")
SET(PYCXX_SOURCE_DIR
"${CMAKE_SOURCE_DIR}/src/CXX" CACHE PATH
"Path to the directory containing PyCXX's cxxextensions.c source file")
# used as compiler defines
SET(RESOURCEDIR "${CMAKE_INSTALL_DATADIR}")
SET(DOCDIR "${CMAKE_INSTALL_DOCDIR}")
MESSAGE(STATUS "prefix: ${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS "datadir: ${CMAKE_INSTALL_DATADIR}")
MESSAGE(STATUS "docdir: ${CMAKE_INSTALL_DOCDIR}")
MESSAGE(STATUS "includedir: ${CMAKE_INSTALL_INCLUDEDIR}")
MESSAGE(STATUS "libdir: ${CMAKE_INSTALL_LIBDIR}")
# ==============================================================================
# == Win32 is default behaviour use the LibPack copied in Source tree ==========
if(MSVC)
OPTION(FREECAD_RELEASE_PDB "Create PDB file for Release version." OFF)
OPTION(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." ON)
OPTION(FREECAD_LIBPACK_USEPYSIDE "Use PySide in LibPack rather to PyQt and Swig." ON)
set(FREECAD_LIBPACK_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Directory of the FreeCAD LibPack")
else(MSVC)
OPTION(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." OFF)
set(FREECAD_LIBPACK_DIR "" CACHE PATH "Directory of the FreeCAD LibPack")
endif(MSVC)
# ==============================================================================
# == All the options for the build process ============
OPTION(BUILD_GUI "Build FreeCAD Gui. Otherwise you have only the command line and the Python import module." ON)
OPTION(FREECAD_MAINTAINERS_BUILD "Build FreeCAD for Maintainers, with Docu and 3rd party libs. On Windows the Installer is build." OFF)
OPTION(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF)
OPTION(FREECAD_USE_EXTERNAL_PIVY "Use system installed python-pivy instead of the bundled." OFF)
OPTION(FREECAD_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bundled." OFF)
OPTION(FREECAD_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF)
OPTION(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF)
if(APPLE)
OPTION(FREECAD_CREATE_MAC_APP "Create app bundle on install" OFF)
if(FREECAD_CREATE_MAC_APP)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/src/MacAppBundle/FreeCAD.app/
DESTINATION ${CMAKE_INSTALL_PREFIX}/${PACKAGE_NAME}.app
)
# It should be safe to assume we've got sed on OSX...
install(CODE "
execute_process(COMMAND
sed -i \"\" -e s/VERSION_STRING_FROM_CMAKE/${PACKAGE_VERSION}/
-e s/NAME_STRING_FROM_CMAKE/${PACKAGE_NAME}/
${CMAKE_INSTALL_PREFIX}/${PACKAGE_NAME}.app/Contents/Info.plist)
")
set(CMAKE_INSTALL_PREFIX
${CMAKE_INSTALL_PREFIX}/${PACKAGE_NAME}.app/Contents)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
endif(FREECAD_CREATE_MAC_APP)
endif(APPLE)
OPTION(BUILD_CAM "Build the FreeCAD CAM module and the needed libs, be aware, unfinished code!" OFF)
OPTION(BUILD_FEM "Build the FreeCAD FEM module, be aware, unfinished code!" ON)
OPTION(BUILD_SANDBOX "Build the FreeCAD Sandbox module which is only for testing purposes" OFF)
OPTION(BUILD_TEMPLATE "Build the FreeCAD template module which is only for testing purposes" OFF)
OPTION(BUILD_ARCH "Build the FreeCAD Architecture module" ON)
OPTION(BUILD_ASSEMBLY "Build the FreeCAD Assembly module" OFF)
OPTION(BUILD_COMPLETE "Build the FreeCAD complete module" ON)
OPTION(BUILD_DRAFT "Build the FreeCAD draft module" ON)
OPTION(BUILD_DRAWING "Build the FreeCAD drawing module" ON)
OPTION(BUILD_IDF "Build the FreeCAD idf module" ON)
OPTION(BUILD_IMAGE "Build the FreeCAD image module" ON)
OPTION(BUILD_IMPORT "Build the FreeCAD import module" ON)
OPTION(BUILD_INSPECTION "Build the FreeCAD inspection module" ON)
OPTION(BUILD_JTREADER "Build the FreeCAD jt reader module" OFF)
OPTION(BUILD_MATERIAL "Build the FreeCAD material module" ON)
OPTION(BUILD_MESH "Build the FreeCAD mesh module" ON)
OPTION(BUILD_MESH_PART "Build the FreeCAD mesh part module" ON)
OPTION(BUILD_OPENSCAD "Build the FreeCAD openscad module" ON)
OPTION(BUILD_PART "Build the FreeCAD part module" ON)
OPTION(BUILD_PART_DESIGN "Build the FreeCAD part design module" ON)
OPTION(BUILD_PATH "Build the FreeCAD path module" ON)
OPTION(BUILD_PLOT "Build the FreeCAD plot module" ON)
OPTION(BUILD_POINTS "Build the FreeCAD points module" ON)
OPTION(BUILD_RAYTRACING "Build the FreeCAD ray tracing module" ON)
OPTION(BUILD_REVERSEENGINEERING "Build the FreeCAD reverse engineering module" ON)
OPTION(BUILD_ROBOT "Build the FreeCAD robot module" ON)
OPTION(BUILD_SHIP "Build the FreeCAD ship module" ON)
OPTION(BUILD_SKETCHER "Build the FreeCAD sketcher module" ON)
OPTION(BUILD_SPREADSHEET "Build the FreeCAD spreadsheet module" ON)
OPTION(BUILD_START "Build the FreeCAD start module" ON)
OPTION(BUILD_TEST "Build the FreeCAD test module" ON)
OPTION(BUILD_WEB "Build the FreeCAD web module" ON)
OPTION(BUILD_VR "Build the FreeCAD Oculus Rift support (need Oculus SDK 4.x or higher)" OFF)
if(MSVC)
OPTION(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" OFF)
OPTION(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" ON)
OPTION(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
elseif(APPLE)
find_library(3DCONNEXIONCLIENT_FRAMEWORK 3DconnexionClient)
if(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
OPTION(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
else(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
OPTION(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." OFF)
endif(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
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)
OPTION(FREECAD_USE_EXTERNAL_PIVY "Use system installed python-pivy instead of the bundled." ON)
endif(NOT MSVC)
# if this is set override some options
if (FREECAD_BUILD_DEBIAN)
set(FREECAD_USE_EXTERNAL_ZIPIOS ON)
set(FREECAD_USE_EXTERNAL_PIVY ON)
# A Debian package for SMESH doesn't exist
#set(FREECAD_USE_EXTERNAL_SMESH ON)
endif (FREECAD_BUILD_DEBIAN)
# ==============================================================================
#inter-module dependencies
#took these from Mod/Complete/App/AppComplete.cpp. appears to be working.
if(BUILD_COMPLETE)
set(BUILD_MESH ON)
set(BUILD_POINTS ON)
set(BUILD_DRAWING ON)
set(BUILD_RAYTRACING ON)
set(BUILD_PART_DESIGN ON)
set(BUILD_IMAGE ON)
set(BUILD_DRAFT ON)
endif(BUILD_COMPLETE)
#inferred from .py files. appears to be working.
if(BUILD_ARCH)
set(BUILD_PART ON)
set(BUILD_MESH ON)
set(BUILD_DRAFT ON)
endif(BUILD_ARCH)
#inferred from .py files. appears to be working.
if(BUILD_OPENSCAD)
set(BUILD_MESH_PART ON)
set(BUILD_DRAFT ON)
endif(BUILD_OPENSCAD)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_INSPECTION)
set(BUILD_MESH ON)
set(BUILD_POINTS ON)
set(BUILD_PART ON)
endif(BUILD_INSPECTION)
#inferred from .py files. appears to be working.
if(BUILD_SHIP)
set(BUILD_PART ON)
set(BUILD_PLOT ON)
set(BUILD_IMAGE ON)
endif(BUILD_SHIP)
#inferred from .py files. appears to be working.
if(BUILD_SPREADSHEET)
set(BUILD_DRAFT ON)
endif(BUILD_SPREADSHEET)
#this has been tested. appears to be working.
if(BUILD_DRAFT)
set(BUILD_SKETCHER ON)
endif(BUILD_DRAFT)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_PART_DESIGN)
set(BUILD_SKETCHER ON)
endif(BUILD_PART_DESIGN)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_REVERSEENGINEERING)
set(BUILD_PART ON)
set(BUILD_MESH ON)
endif(BUILD_REVERSEENGINEERING)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_MESH_PART)
set(BUILD_PART ON)
set(BUILD_MESH ON)
set(BUILD_SMESH ON)
endif(BUILD_MESH_PART)
#inferred from cmakelists.txt. build errors. obsolete?
if(BUILD_CAM)
set(BUILD_PART ON)
set(BUILD_MESH ON)
endif(BUILD_CAM)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_RAYTRACING)
set(BUILD_PART ON)
endif(BUILD_RAYTRACING)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_DRAWING)
set(BUILD_PART ON)
endif(BUILD_DRAWING)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_ROBOT)
set(BUILD_PART ON)
endif(BUILD_ROBOT)
#path module dependencies.
if(BUILD_PATH)
set(BUILD_PART ON)
set(BUILD_ROBOT ON)
endif(BUILD_PATH)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_SKETCHER)
set(BUILD_PART ON)
endif(BUILD_SKETCHER)
#inferred from .py files. built, but not sure how to test.
if(BUILD_IDF)
set(BUILD_PART ON)
endif(BUILD_IDF)
#inferred from cmakelists.txt. built, but not sure how to test.
if(BUILD_IMPORT)
set(BUILD_PART ON)
endif(BUILD_IMPORT)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_FEM)
set(BUILD_PART ON)
set(BUILD_SMESH ON)
endif(BUILD_FEM)
#inferred from cmakelists.txt. appears to be working.
if(BUILD_SANDBOX)
set(BUILD_PART ON)
set(BUILD_MESH ON)
endif(BUILD_SANDBOX)
#inferred from header includes. not tested.
if(BUILD_JTREADER)
set(BUILD_MESH ON)
endif(BUILD_JTREADER)
#leaving test module for someone else.
#image has none. as far as I can tell.
#mesh has none. as far as I can tell.
#part has none. as far as I can tell.
#material has none. as far as I can tell.
#web has none. as far as I can tell.
#start has none. as far as I can tell.
#assembly has none. as far as I can tell.
#plot has none. as far as I can tell.
#points has none. as far as I can tell
# ==============================================================================
if(FREECAD_LIBPACK_USE)
# checking for a unique file in LibPack location to make sure the right version of the LibPack is there
find_file(FREECAD_LIBPACK_CHECKFILE6X boost_program_options-vc80-mt-gd.lib ${FREECAD_LIBPACK_DIR}/lib )
find_file(FREECAD_LIBPACK_CHECKFILE7X boost_program_options-vc90-mt-gd-1_39.lib ${FREECAD_LIBPACK_DIR}/lib )
find_file(FREECAD_LIBPACK_CHECKFILE8X boost_program_options-vc90-mt-gd-1_48.lib ${FREECAD_LIBPACK_DIR}/lib )
find_file(FREECAD_LIBPACK_CHECKFILE9X boost_program_options-vc90-mt-gd-1_54.lib ${FREECAD_LIBPACK_DIR}/lib )
find_file(FREECAD_LIBPACK_CHECKFILE10X boost_program_options-vc110-mt-1_55.lib ${FREECAD_LIBPACK_DIR}/lib )
find_file(FREECAD_LIBPACK_CHECKCUSTOM boost_program_options-vc90-mt-gd-1_41.lib ${FREECAD_LIBPACK_DIR}/lib )
find_file(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER MANIFEST.db ${FREECAD_LIBPACK_DIR})
# don't show them in the GUI
set(FREECAD_LIBPACK_CHECKFILE6X "${FREECAD_LIBPACK_CHECKFILE6X}" CACHE INTERNAL "Find libpack")
set(FREECAD_LIBPACK_CHECKFILE7X "${FREECAD_LIBPACK_CHECKFILE7X}" CACHE INTERNAL "Find libpack")
set(FREECAD_LIBPACK_CHECKFILE8X "${FREECAD_LIBPACK_CHECKFILE8X}" CACHE INTERNAL "Find libpack")
set(FREECAD_LIBPACK_CHECKFILE9X "${FREECAD_LIBPACK_CHECKFILE9X}" CACHE INTERNAL "Find libpack")
set(FREECAD_LIBPACK_CHECKFILE10X "${FREECAD_LIBPACK_CHECKFILE10X}" CACHE INTERNAL "Find libpack")
set(FREECAD_LIBPACK_CHECKCUSTOM "${FREECAD_LIBPACK_CHECKCUSTOM}" CACHE INTERNAL "Find libpack")
set(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER "${FREECAD_LIBPACK_CHECKFILE_CLBUNDLER}" CACHE INTERNAL "Find libpack")
IF(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
set(FREECAD_LIBPACK_VERSION "CLbundler" CACHE STRING "Displays if the libpack has been found" FORCE)
include(cMake/UseLibPackCLbundler.cmake)
ELSEIF(FREECAD_LIBPACK_CHECKFILE6X)
set(FREECAD_LIBPACK_VERSION "6.x" CACHE STRING "Displays if the libpack has been found" FORCE)
include(cMake/UseLibPack6x.cmake)
ELSEIF(FREECAD_LIBPACK_CHECKFILE7X)
set(FREECAD_LIBPACK_VERSION "7.x" CACHE STRING "Displays if the libpack has been found" FORCE)
include(cMake/UseLibPack7x.cmake)
ELSEIF(FREECAD_LIBPACK_CHECKFILE8X)
set(FREECAD_LIBPACK_VERSION "8.x" CACHE STRING "Displays if the libpack has been found" FORCE)
include(cMake/UseLibPack8x.cmake)
set(SWIG_EXECUTABLE ${FREECAD_LIBPACK_DIR}/tools/swigwin-1.3.40/swig.exe CACHE STRING "Swig" FORCE)
ELSEIF(FREECAD_LIBPACK_CHECKFILE9X)
set(FREECAD_LIBPACK_VERSION "9.x" CACHE STRING "Displays if the libpack has been found" FORCE)
include(cMake/UseLibPack9x.cmake)
set(SWIG_EXECUTABLE ${FREECAD_LIBPACK_DIR}/tools/swigwin-2.0.11/swig.exe CACHE STRING "Swig" FORCE)
set(FREECAD_USE_EXTERNAL_PIVY ON CACHE BOOL "Switch off local pivy" FORCE)
set(FREECAD_LIBPACK_PYSIDEUIC_REL "${FREECAD_LIBPACK_DIR}/pyside-tools/Lib/site-packages")
file(GLOB FREECAD_LIBPACK_PIVY_COIN "${FREECAD_LIBPACK_DIR}/pivy/*.*")
file(GLOB FREECAD_LIBPACK_SHIBOKEN "${FREECAD_LIBPACK_DIR}/shiboken-1.2.1/lib/site-packages/*.pyd")
file(GLOB FREECAD_LIBPACK_PYSIDE "${FREECAD_LIBPACK_DIR}/pyside/lib/site-packages/PySide/*.py*")
file(GLOB_RECURSE FREECAD_LIBPACK_PYSIDEUIC RELATIVE "${FREECAD_LIBPACK_PYSIDEUIC_REL}" "${FREECAD_LIBPACK_PYSIDEUIC_REL}/pysideuic/*.py")
file(GLOB FREECAD_LIBPACK_PYTHON "${FREECAD_LIBPACK_DIR}/bin/*.py*")
ELSEIF(FREECAD_LIBPACK_CHECKFILE10X)
set(FREECAD_LIBPACK_VERSION "10.x" CACHE STRING "Displays if the libpack has been found" FORCE)
include(cMake/UseLibPack10x.cmake)
set(SWIG_EXECUTABLE ${FREECAD_LIBPACK_DIR}/tools/swigwin-3.0.2/swig.exe CACHE STRING "Swig" FORCE)
ELSEIF(FREECAD_LIBPACK_CHECKCUSTOM)
set(FREECAD_LIBPACK_VERSION "Custom" CACHE STRING "Displays if the libpack has been found" FORCE)
include(cMake/UseLibPackCustom.cmake)
ELSE(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
set(FREECAD_LIBPACK_VERSION "NOTFOUND" CACHE STRING "Displays if the libpack has been found" FORCE)
message(SEND_ERROR "Could not find libpack in specified location:" ${FREECAD_LIBPACK_DIR})
ENDIF(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
# -------------------------------- PyCXX --------------------------------
find_package(PyCXX REQUIRED)
# -------------------------------- Swig ----------------------------------
find_package(SWIG)
IF(NOT SWIG_FOUND)
MESSAGE("SWIG was not found, build no SWIG binding for pivy")
ENDIF(NOT SWIG_FOUND)
# -------------------------------- Shiboken/PySide ------------------------
find_package(PySideTools REQUIRED) # Pyside utilities (pyside-uic & pyside-rcc)
# -------------------------------- Salome SMESH --------------------------
if(NOT FREECAD_USE_EXTERNAL_SMESH)
set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
endif()
endif(FREECAD_LIBPACK_USE)
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
# ================================================================================
# == for other OSes search the packages ==========================================
# -------------------------------- Python --------------------------------
#http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677598
# Acceptable versions of Python
set(Python_ADDITIONAL_VERSIONS "2.3" "2.4" "2.5" "2.6" "2.7" "2.8" "2.9")
# For building on OS X
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# If the user doesn't tell us which package manager they're using
if(NOT DEFINED MACPORTS_PREFIX AND NOT DEFINED HOMEBREW_PREFIX)
# Try to find MacPorts path
find_program(MACPORTS_EXECUTABLE port)
if(EXISTS ${MACPORTS_EXECUTABLE})
string(REPLACE "/bin/port" ""
MACPORTS_PREFIX ${MACPORTS_EXECUTABLE})
message(STATUS "Detected MacPorts install at ${MACPORTS_PREFIX}")
endif(EXISTS ${MACPORTS_EXECUTABLE})
# Try to find Homebrew path
find_program(HOMEBREW_EXECUTABLE brew)
if(EXISTS ${HOMEBREW_EXECUTABLE})
set(HOMEBREW_PREFIX "/usr/local")
message(STATUS "Detected Homebrew install at ${HOMEBREW_PREFIX}")
endif()
endif(NOT DEFINED MACPORTS_PREFIX AND NOT DEFINED HOMEBREW_PREFIX)
# In case someone tries to shoot themselves in the foot
if(DEFINED MACPORTS_PREFIX AND DEFINED HOMEBREW_PREFIX)
message(SEND_ERROR
"Multiple package management systems detected - ")
message(SEND_ERROR
"define either MACPORTS_PREFIX or HOMEBREW_PREFIX")
# No package manager
elseif(NOT DEFINED MACPORTS_PREFIX AND NOT DEFINED HOMEBREW_PREFIX)
message(SEND_ERROR
"No package manager detected - install MacPorts or Homebrew")
# The hopefully-normal case - one package manager identified
else(DEFINED MACPORTS_PREFIX AND DEFINED HOMEBREW_PREFIX)
# Construct a list like python;python2.9;python2.8;...
set(Python_ADDITIONAL_VERSIONS_REV ${Python_ADDITIONAL_VERSIONS})
list(REVERSE Python_ADDITIONAL_VERSIONS_REV)
set(_PYTHON_NAMES "python")
foreach(_PYTHON_VERSION IN LISTS Python_ADDITIONAL_VERSIONS_REV)
list(APPEND _PYTHON_NAMES "python${_PYTHON_VERSION}")
endforeach(_PYTHON_VERSION)
# Find python in the package management systems, using names in that
# list in decreasing priority. Note that a manually specified
# PYTHON_EXECUTABLE still has prescedence over this.
find_program(PYTHON_EXECUTABLE
NAMES ${_PYTHON_NAMES}
PATHS ${MACPORTS_PREFIX} ${HOMEBREW_PREFIX}
PATH_SUFFIXES /bin
NO_DEFAULT_PATH)
endif(DEFINED MACPORTS_PREFIX AND DEFINED HOMEBREW_PREFIX)
# Warn user if we still only have the system Python
string(FIND ${PYTHON_EXECUTABLE} "/usr/bin/python" _FIND_SYS_PYTHON)
if(_FIND_SYS_PYTHON EQUAL 0)
message(SEND_ERROR
"Only found the stock Python, that's probably bad.")
endif(_FIND_SYS_PYTHON EQUAL 0)
# Ask Python to tell us it's include directory, if nobody else has
if(NOT DEFINED PYTHON_INCLUDE_DIR)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"from distutils.sysconfig import get_python_inc;print get_python_inc()"
OUTPUT_VARIABLE PYTHON_INCLUDE_DIR
RESULT_VARIABLE PYTHON_INCLUDE_DIR_RESULT
ERROR_QUIET)
if(NOT PYTHON_INCLUDE_DIR_RESULT MATCHES 0)
message(SEND_ERROR "Failed to determine PYTHON_INCLUDE_DIR")
endif(NOT PYTHON_INCLUDE_DIR_RESULT MATCHES 0)
endif(NOT DEFINED PYTHON_INCLUDE_DIR)
# Similar for the Python library - there must be an easier way...
if(NOT DEFINED PYTHON_LIBRARY)
# Get the library path
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
"from distutils import sysconfig;print sysconfig.get_config_var('LIBDIR')"
OUTPUT_VARIABLE PYTHON_LIBRARY_DIR
RESULT_VARIABLE PYTHON_LIBRARY_DIR_RESULT
ERROR_QUIET)
string(STRIP ${PYTHON_LIBRARY_DIR} PYTHON_LIBRARY_DIR)
if(NOT PYTHON_LIBRARY_DIR_RESULT MATCHES 0)
message(SEND_ERROR "Failed to determine PYTHON_LIBRARY")
endif(NOT PYTHON_LIBRARY_DIR_RESULT MATCHES 0)
# Get library filename - might not be safe to assume .dylib extension?
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
"import sys;print 'libpython%d.%d.dylib'%sys.version_info[0:2]"
OUTPUT_VARIABLE PYTHON_LIBRARY_FILE
RESULT_VARIABLE PYTHON_LIBRARY_FILE_RESULT
ERROR_QUIET)
string(STRIP ${PYTHON_LIBRARY_FILE} PYTHON_LIBRARY_FILE)
if(NOT PYTHON_LIBRARY_FILE_RESULT MATCHES 0)
message(SEND_ERROR "Failed to determine PYTHON_LIBRARY")
endif(NOT PYTHON_LIBRARY_FILE_RESULT MATCHES 0)
set(PYTHON_LIBRARY "${PYTHON_LIBRARY_DIR}/${PYTHON_LIBRARY_FILE}")
else(NOT DEFINED PYTHON_LIBRARY)
# Used on MacPorts systems for finding Shiboken and PySide
# TODO: When we start requiring minimum CMake version above
# 2.8.11, change PATH below to DIRECTORY
get_filename_component(PYTHON_LIBRARY_DIR ${PYTHON_LIBRARY} PATH)
endif(NOT DEFINED PYTHON_LIBRARY)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_package(PythonInterp REQUIRED)
IF (NOT DEFINED PYTHON_VERSION_STRING)
find_package(PythonLibs REQUIRED)
ELSE (NOT DEFINED PYTHON_VERSION_STRING)
find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
ENDIF(NOT DEFINED PYTHON_VERSION_STRING)
IF(NOT PYTHONLIBS_FOUND)
MESSAGE(FATAL_ERROR "Python not found, install python!")
ENDIF(NOT PYTHONLIBS_FOUND)
# -------------------------------- pcl ----------------------------------
#PCL needs to be found before boost because the PCLConfig also calls find_package(Boost ...),
#but with different components
if(FREECAD_USE_PCL)
find_package(PCL REQUIRED COMPONENTS common kdtree features surface io)
endif(FREECAD_USE_PCL)
# -------------------------------- Boost --------------------------------
SET( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.41.0" "1.39.0" "1.38.0" "1.37.0"
"1.36.1" "1.36.0" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34"
"1.33.1" "1.33.0" "1.33" )
find_package(Boost COMPONENTS filesystem program_options regex signals system thread REQUIRED)
# -------------------------------- XercesC --------------------------------
find_package(XercesC REQUIRED)
# -------------------------------- ZLIB --------------------------------
find_package(ZLIB REQUIRED)
# -------------------------------- PyCXX --------------------------------
find_package(PyCXX REQUIRED)
# -------------------------------- OpenCasCade --------------------------------
find_package(OpenCasCade)
# -------------------------------- Salome SMESH --------------------------
# Salome SMESH sources are under src/3rdParty now
IF(OCC_FOUND)
if(NOT FREECAD_USE_EXTERNAL_SMESH)
set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
else()
find_package(SMESH)
if(NOT SMESH_FOUND)
message(ERROR "SMESH was not found.")
endif()
include_directories(${SMESH_INCLUDE_DIR})
endif()
set(SMESH_FOUND TRUE)
ENDIF(OCC_FOUND)
# -------------------------------- Netgen --------------------------------
if (BUILD_FEM_NETGEN)
find_package(NETGEN)
endif(BUILD_FEM_NETGEN)
# -------------------------------- OpenCV --------------------------------
# not needed at the moment
#find_package(OpenCV REQUIRED)
# -------------------------------- Swig ----------------------------------
find_package(SWIG)
IF(NOT SWIG_FOUND)
MESSAGE("SWIG was not found, build no SWIG binding for pivy")
ENDIF(NOT SWIG_FOUND)
# -------------------------------- Eigen --------------------------------
find_package(Eigen3)
# -------------------------------- ODE ----------------------------------
# find_package(ODE)
# -------------------------------- Qt --------------------------------
# sets ${QT_LIBRARIES}
SET(QT_MIN_VERSION 4.5.0)
set(QT_USE_QTNETWORK TRUE)
set(QT_USE_QTXML TRUE)
if(BUILD_GUI)
set(QT_USE_QTOPENGL TRUE)
set(QT_USE_QTSVG TRUE)
set(QT_USE_QTUITOOLS TRUE)
set(QT_USE_QTWEBKIT TRUE)
endif(BUILD_GUI)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
IF(NOT QT4_FOUND)
MESSAGE("Library qt-4.3 or above is not available, install QT or FreeCAD Gui version will not be built")
ENDIF(NOT QT4_FOUND)
IF(NOT QT_QTWEBKIT_FOUND)
MESSAGE("Qt Webkit not found, will not build browser integration!")
ENDIF(NOT QT_QTWEBKIT_FOUND)
# This is a special version of the built in macro qt4_wrap_cpp
# It is required since moc'ed files are now included instead of being added to projects directly
# It adds a reverse dependency to solve this
# This has the unfortunate side effect that some files are always rebuilt
# There is probably a cleaner solution than this
macro(fc_wrap_cpp outfiles )
# get include dirs
QT4_GET_MOC_FLAGS(moc_flags)
QT4_EXTRACT_OPTIONS(moc_files moc_options moc_target ${ARGN})
# fixes bug 0000585: bug with boost 1.48
SET(moc_options ${moc_options} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
foreach(it ${moc_files})
get_filename_component(it ${it} ABSOLUTE)
QT4_MAKE_OUTPUT_FILE(${it} moc_ cpp outfile)
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
COMMAND ${QT_MOC_EXECUTABLE}
ARGS ${moc_options} ${it} -o ${outfile}
MAIN_DEPENDENCY ${it}
)
set(${outfiles} ${${outfiles}} ${outfile})
add_file_dependencies(${it} ${outfile})
endforeach(it)
endmacro(fc_wrap_cpp)
#--------------------FreeType-----------------------
if(FREECAD_USE_FREETYPE)
find_package(Freetype)
if(NOT FREETYPE_FOUND)
MESSAGE("FreeType2 library is not available. Part module will lack of makeWireString().")
endif(NOT FREETYPE_FOUND)
endif(FREECAD_USE_FREETYPE)
#---------------------------------------------------
if(BUILD_GUI)
# -------------------------------- OpenGL --------------------------------
find_package(OpenGL)
include(FindPackageMessage)
if(OPENGL_GLU_FOUND)
find_package_message(OPENGL_GLU
"Found OpenGLU: ${OPENGL_glu_LIBRARY}"
"[${OPENGL_glu_LIBRARY}][${OEPNGL_INCLUDE_DIR}]")
else(OPENGL_GLU_FOUND)
message(FATAL_ERROR "The GLU library is required. Make sure it is installed.")
endif(OPENGL_GLU_FOUND)
# -------------------------------- Coin3D --------------------------------
find_package(Coin3D REQUIRED)
# ------------------------------ Spaceball -------------------------------
if (WIN32)
#future
else(WIN32)
find_package(Spnav)
endif(WIN32)
# -------------------------------- Shiboken/PySide ------------------------
# set(PYTHON_SUFFIX -python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
SET(PYTHON_SUFFIX -python2.7) # for shiboken
SET(PYTHON_BASENAME -python2.7) # for PySide
if(DEFINED MACPORTS_PREFIX)
find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")
find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")
endif(DEFINED MACPORTS_PREFIX)
find_package(Shiboken REQUIRED)
find_package(PySide REQUIRED)
find_package(PySideTools REQUIRED) # Pyside utilities (pyside-uic & pyside-rcc)
# ------------------------------ Matplotlib ------------------------------
find_package(Matplotlib)
IF(MATPLOTLIB_FOUND)
message(STATUS "-- matplotlib-${MATPLOTLIB_VERSION} has been found.")
ELSE(MATPLOTLIB_FOUND)
message("-- matplotlib not found, Plot module won't be available!")
ENDIF(MATPLOTLIB_FOUND)
# ------------------------------------------------------------------------
endif(BUILD_GUI)
endif(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
if(BUILD_VR)
find_package(Rift)
endif(BUILD_VR)
# copy build convenient files for M$
if(WIN32)
if (EXISTS BuildAll.bat)
configure_file(BuildAll.bat ${CMAKE_BINARY_DIR}/BuildAll.bat COPYONLY)
endif (EXISTS BuildAll.bat)
#configure_file(BuildAllNice.bat ${CMAKE_BINARY_DIR}/BuildAllNice.bat COPYONLY)
endif(WIN32)
# ================================================================================
# == Global Compiler and Linker Settings =========================================
include_directories(${CMAKE_BINARY_DIR}/src
${CMAKE_SOURCE_DIR}/src)
# check for 64-bit platform
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
MESSAGE(STATUS "Platform is 64-bit, set -D_OCC64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_OCC64")
add_definitions(-D_OCC64 )
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
MESSAGE(STATUS "Platform is 32-bit")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
IF(MSVC)
# set default compiler settings
SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /EHa")
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG /Zm128")
# set default libs
SET (CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib SHFolder.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib winmm.lib comsupp.lib Ws2_32.lib dbghelp.lib ")
set (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}")
# set linker flag /nodefaultlib
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB")
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB")
IF(FREECAD_RELEASE_PDB)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
ENDIF(FREECAD_RELEASE_PDB)
# Mark 32 bit executables large address aware so they can use > 2GB address space
# NOTE: This setting only has an effect on machines with at least 3GB of RAM, although it sets the linker option it doesn't set the the linker switch 'Enable Large Addresses'
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
ELSE(MSVC)
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG")
#MESSAGE(STATUS "DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
ENDIF(MSVC)
IF(MINGW)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12477
# Actually '-Wno-inline-dllimport' should work to suppress warnings of the form:
# inline function 'foo' is declared as dllimport: attribute ignored
# But it doesn't work with MinGW gcc 4.5.0 while using '-Wno-attributes' seems to
# do the trick.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads -Wno-attributes")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthreads -Wno-attributes")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
# http://stackoverflow.com/questions/8375310/warning-auto-importing-has-been-activated-without-enable-auto-import-specifie
# SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
LINK_LIBRARIES(-lgdi32)
ENDIF(MINGW)
# force build directory to be different to source directory
#if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
#MESSAGE(SEND_ERROR "The build directory (${CMAKE_BINARY_DIR}) must be different to the source directory "
# "(${CMAKE_SOURCE_DIR}). Please choose another build directory!")
#elseif()
add_subdirectory(src)
add_subdirectory(data)
#endif()
# ================================================================================
# == Packaging ===================================================================
if(FREECAD_MAINTAINERS_BUILD AND NOT WIN32)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An extensible Open Source CAx program")
set(CPACK_PACKAGE_VENDOR "FreeCAD development team")
if(WIN32)
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.Win32")
else(WIN32)
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.Linux")
endif(WIN32)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/copying.lib")
set(CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION_PATCH})
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
#for debian: 'cmake .. -DFREECAD_MAINTAINERS_BUILD=TRUE -DCPACK_GENERATOR="DEB"'
IF( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set(PKG_ARCH i386)
ELSE( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set(PKG_ARCH amd64)
ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python, oce | opencascade, libqtgui4, libcoin60, libxerces-c3.1, zlib1g, libboost-dev, libeigen2-dev")
set(CPACK_PACKAGE_CONTACT "<root@localhost>")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}_${PKG_ARCH}")
if(WIN32)
set(CPACK_GENERATOR "ZIP")
set(CPACK_SOURCE_GENERATOR "ZIP")
else(WIN32)
if( CPACK_GENERATOR STREQUAL "" )
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
endif()
endif(WIN32)
file(GLOB DOT ".*")
file(GLOB TILD "*~")
set(CPACK_SOURCE_IGNORE_FILES
"${DOT}"
"${TILD}"
".a$"
".am$"
".in$"
".bat$"
".o$"
".so$"
".m4$"
"/_build/"
"/_cmake/"
"/.deps/"
"/.svn/"
"/CMakeFiles/"
"/CVS/"
"/autom4te.cache/"
"/build/"
"/debian/"
"/debug/"
"/docs/"
"/m4/"
"/qt-build/"
"/CxImage/"
"/WindowsInstaller/"
"AdditionalInfo.txt$"
"CMakeCache.txt$"
"Makefile$"
"\\\\.sh$"
"_CPack_"
"config.h$"
"config.log$"
"config.status$"
"configure$"
"configure.ac$"
"Doxyfile"
"html$"
"stamp-h1$"
".swp$"
"tar.bz2"
"tar.gz"
"~$"
)
#set(CPACK_SOURCE_IGNORE_FILES
# ${CPACK_SOURCE_IGNORE_FILES}
# "/Pivy-0.5/"
#)
set(CPACK_SOURCE_STRIP_FILES "")
include(CPack)
#ADD_CUSTOM_TARGET(DIST make package_source)
endif(FREECAD_MAINTAINERS_BUILD AND NOT WIN32)
#add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
add_custom_target(dist-git
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(distdfsg-git
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR} --dfsg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
if(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
add_custom_target(distcheck-git
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR} --check
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(distcheckdfsg-git
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/Tools/makedist.py
--srcdir=${CMAKE_SOURCE_DIR} --bindir=${CMAKE_BINARY_DIR} --dfsg --check
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif(CMAKE_COMPILER_IS_GNUCXX OR MINGW)