FreeCAD

Форк
0
/
InitializeFreeCADBuildOptions.cmake 
200 строк · 11.1 Кб
1
macro(InitializeFreeCADBuildOptions)
2
    # ==============================================================================
3
    # =================   All the options for the build process    =================
4
    # ==============================================================================
5

6
    option(BUILD_FORCE_DIRECTORY "The build directory must be different to the source directory." OFF)
7
    option(BUILD_GUI "Build FreeCAD Gui. Otherwise you have only the command line and the Python import module." ON)
8
    option(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF)
9
    option(FREECAD_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bundled." OFF)
10
    option(FREECAD_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF)
11
    option(FREECAD_USE_EXTERNAL_FMT "Use system installed fmt library if available instead of fetching the source." ON)
12
    option(FREECAD_USE_EXTERNAL_ONDSELSOLVER "Use system installed OndselSolver instead of git submodule." OFF)
13
    option(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" ON)
14
    option(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF)
15
    option(BUILD_WITH_CONDA "Set ON if you build FreeCAD with conda" OFF)
16
    option(BUILD_DYNAMIC_LINK_PYTHON "If OFF extension-modules do not link against python-libraries" ON)
17
    option(INSTALL_TO_SITEPACKAGES "If ON the freecad root namespace (python) is installed into python's site-packages" ON)
18
    option(OCCT_CMAKE_FALLBACK "disable usage of occt-config files" OFF)
19
    if (WIN32 OR APPLE)
20
        option(FREECAD_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." OFF)
21
    else()
22
        option(FREECAD_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." ON)
23
    endif()
24

25
    # == Win32 is default behaviour use the LibPack copied in Source tree ==========
26
    if(MSVC)
27
        option(FREECAD_RELEASE_PDB "Create PDB files for Release version." ON)
28
        option(FREECAD_RELEASE_SEH "Enable Structured Exception Handling for Release version." ON)
29
        option(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." ON)
30
        option(FREECAD_USE_PCH "Activate precompiled headers where it's used." ON)
31

32
        if (DEFINED ENV{FREECAD_LIBPACK_DIR})
33
            set(FREECAD_LIBPACK_DIR $ENV{FREECAD_LIBPACK_DIR} CACHE PATH  "Directory of the FreeCAD LibPack")
34
            message(STATUS "Found libpack env variable: ${FREECAD_LIBPACK_DIR}")
35
        else()
36
            set(FREECAD_LIBPACK_DIR ${CMAKE_SOURCE_DIR} CACHE PATH  "Directory of the FreeCAD LibPack")
37
        endif()
38

39
        set(LIBPACK_FOUND OFF )
40
        if (EXISTS ${FREECAD_LIBPACK_DIR}/plugins/imageformats/qsvg.dll)
41
            set(LIBPACK_FOUND ON )
42
            set(COPY_LIBPACK_BIN_TO_BUILD OFF )
43
            # Create install commands for dependencies for INSTALL target in FreeCAD solution
44
            option(FREECAD_INSTALL_DEPEND_DIRS "Create install dependency commands for the INSTALL target found
45
                in the FreeCAD solution." ON)
46
            # Copy libpack smaller dependency folders to build folder per user request - if non-existent at destination
47
            if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/imageformats/qsvg.dll)
48
                option(FREECAD_COPY_DEPEND_DIRS_TO_BUILD "Copy smaller libpack dependency directories to build directory." OFF)
49
            endif()
50
            # Copy libpack 'bin' directory contents to build 'bin' per user request - only IF NOT EXISTS already
51
            if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/DLLs)
52
                set(COPY_LIBPACK_BIN_TO_BUILD ON )
53
                option(FREECAD_COPY_LIBPACK_BIN_TO_BUILD "Copy larger libpack dependency 'bin' folder to the build directory." OFF)
54
                # Copy only the minimum number of files to get a working application
55
                option(FREECAD_COPY_PLUGINS_BIN_TO_BUILD "Copy plugins to the build directory." OFF)
56
            endif()
57
        else()
58
            message(WARNING Could not locate ${FREECAD_LIBPACK_DIR}/plugins/imageformats/qsvg.dll)
59
            message("Libpack NOT found.\nIf you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.")
60
            message(STATUS "Visit: https://github.com/FreeCAD/FreeCAD-Libpack/releases/ for Windows libpack downloads.")
61
        endif()
62
    elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
63
        option(FREECAD_WARN_ERROR "Make all warnings into errors. " OFF)
64
    else(MSVC)
65
        option(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." OFF)
66
        set(FREECAD_LIBPACK_DIR ""  CACHE PATH  "Directory of the FreeCAD LibPack")
67
    endif(MSVC)
68

69
    ChooseQtVersion()
70

71
    # https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/
72
    set(FREECAD_USE_OCC_VARIANT "Community Edition"  CACHE STRING  "Official OpenCASCADE version or community edition")
73
    set_property(CACHE FREECAD_USE_OCC_VARIANT PROPERTY STRINGS
74
                 "Official Version"
75
                 "Community Edition"
76
    )
77

78
    configure_file(${CMAKE_SOURCE_DIR}/src/QtOpenGL.h.cmake ${CMAKE_BINARY_DIR}/src/QtOpenGL.h)
79

80
    option(BUILD_DESIGNER_PLUGIN "Build and install the designer plugin" OFF)
81

82
    if(APPLE)
83
        option(FREECAD_CREATE_MAC_APP "Create app bundle on install" OFF)
84

85
        if(FREECAD_CREATE_MAC_APP)
86
            install(
87
                DIRECTORY ${CMAKE_SOURCE_DIR}/src/MacAppBundle/FreeCAD.app/
88
                DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app
89
            )
90

91
            # It should be safe to assume we've got sed on OSX...
92
            install(CODE "
93
                execute_process(COMMAND
94
                    sed -i \"\" -e s/VERSION_STRING_FROM_CMAKE/${PACKAGE_VERSION}/
95
                    -e s/NAME_STRING_FROM_CMAKE/${PROJECT_NAME}/
96
                    ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents/Info.plist)
97
                   ")
98

99
            set(CMAKE_INSTALL_PREFIX
100
                ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents)
101
            set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib )
102
        endif(FREECAD_CREATE_MAC_APP)
103
        set(CMAKE_MACOSX_RPATH TRUE )
104
    endif(APPLE)
105

106
    option(BUILD_FEM "Build the FreeCAD FEM module" ON)
107
    option(BUILD_SANDBOX "Build the FreeCAD Sandbox module which is only for testing purposes" OFF)
108
    option(BUILD_TEMPLATE "Build the FreeCAD template module which is only for testing purposes" OFF)
109
    option(BUILD_ADDONMGR "Build the FreeCAD addon manager module" ON)
110
    option(BUILD_BIM "Build the FreeCAD BIM module" ON)
111
    option(BUILD_DRAFT "Build the FreeCAD draft module" ON)
112
    option(BUILD_DRAWING "Build the FreeCAD drawing module" OFF)
113
    option(BUILD_HELP "Build the FreeCAD help module" ON)
114
    option(BUILD_IDF "Build the FreeCAD idf module" ON)
115
    option(BUILD_IMPORT "Build the FreeCAD import module" ON)
116
    option(BUILD_INSPECTION "Build the FreeCAD inspection module" ON)
117
    option(BUILD_JTREADER "Build the FreeCAD jt reader module" OFF)
118
    option(BUILD_MATERIAL "Build the FreeCAD material module" ON)
119
    option(BUILD_MESH "Build the FreeCAD mesh module" ON)
120
    option(BUILD_MESH_PART "Build the FreeCAD mesh part module" ON)
121
    option(BUILD_FLAT_MESH "Build the FreeCAD flat mesh module" ON)
122
    option(BUILD_OPENSCAD "Build the FreeCAD openscad module" ON)
123
    option(BUILD_PART "Build the FreeCAD part module" ON)
124
    option(BUILD_PART_DESIGN "Build the FreeCAD part design module" ON)
125
    option(BUILD_CAM "Build the FreeCAD CAM module" ON)
126
    option(BUILD_ASSEMBLY "Build the FreeCAD Assembly module" ON)
127
    option(BUILD_PLOT "Build the FreeCAD plot module" ON)
128
    option(BUILD_POINTS "Build the FreeCAD points module" ON)
129
    option(BUILD_REVERSEENGINEERING "Build the FreeCAD reverse engineering module" ON)
130
    option(BUILD_ROBOT "Build the FreeCAD robot module" ON)
131
    option(BUILD_SHOW "Build the FreeCAD Show module (helper module for visibility automation)" ON)
132
    option(BUILD_SKETCHER "Build the FreeCAD sketcher module" ON)
133
    option(BUILD_SPREADSHEET "Build the FreeCAD spreadsheet module" ON)
134
    option(BUILD_START "Build the FreeCAD start module" ON)
135
    option(BUILD_TEST "Build the FreeCAD test module" ON)
136
    option(BUILD_MEASURE "Build the FreeCAD Measure module" ON)
137
    option(BUILD_TECHDRAW "Build the FreeCAD Technical Drawing module" ON)
138
    option(BUILD_TUX "Build the FreeCAD Tux module" ON)
139
    option(BUILD_WEB "Build the FreeCAD Web module" ON)
140
    option(BUILD_SURFACE "Build the FreeCAD surface module" ON)
141
    option(BUILD_VR "Build the FreeCAD Oculus Rift support (need Oculus SDK 4.x or higher)" OFF)
142
    option(BUILD_CLOUD "Build the FreeCAD cloud module" OFF)
143
    option(ENABLE_DEVELOPER_TESTS "Build the FreeCAD unit tests suit" ON)
144

145
    if(MSVC)
146
        set(FREECAD_3DCONNEXION_SUPPORT "NavLib" CACHE STRING "Select version of the 3Dconnexion device integration")
147
        set_property(CACHE FREECAD_3DCONNEXION_SUPPORT PROPERTY STRINGS "NavLib" "Raw input")
148
    else(MSVC)
149
        set(FREECAD_3DCONNEXION_SUPPORT "Raw input")
150
    endif(MSVC)
151

152
    if(MSVC)
153
        option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" ON)
154
        option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF) # 3/5/2021 current LibPack uses non-C++17 FLANN
155
        option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
156
    elseif(APPLE)
157
        find_library(3DCONNEXIONCLIENT_FRAMEWORK 3DconnexionClient)
158
        if(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
159
            option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
160
        else(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
161
            option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." OFF)
162
        endif(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
163
    else(MSVC)
164
        set(FREECAD_USE_3DCONNEXION OFF )
165
    endif(MSVC)
166
    if(NOT MSVC)
167
        option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" OFF)
168
        option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF)
169
    endif(NOT MSVC)
170

171
    if(FREECAD_3DCONNEXION_SUPPORT STREQUAL "NavLib" AND FREECAD_USE_3DCONNEXION)
172
        set(FREECAD_USE_3DCONNEXION_NAVLIB ON)
173
        set(FREECAD_USE_3DCONNEXION OFF)
174
    endif()
175

176
    # if this is set override some options
177
    if (FREECAD_BUILD_DEBIAN)
178
        set(FREECAD_USE_EXTERNAL_ZIPIOS ON )
179
        # A Debian package for SMESH doesn't exist
180
        #set(FREECAD_USE_EXTERNAL_SMESH ON )
181
    endif (FREECAD_BUILD_DEBIAN)
182

183
    if(BUILD_FEM)
184
        set(BUILD_SMESH ON )
185
    endif()
186

187
    # for Windows the minimum required cmake version is 3.4.3 to build the CAM module
188
    if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.4.3)
189
        message(WARNING "Disable CAM, requires cmake >= 3.4.3 in order to build this module")
190
        set(BUILD_CAM OFF )
191
    endif()
192

193
    # force build directory to be different to source directory
194
    if (BUILD_FORCE_DIRECTORY)
195
        if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
196
            message(FATAL_ERROR "The build directory (${CMAKE_BINARY_DIR}) must be different to the source directory (${CMAKE_SOURCE_DIR}).\n"
197
                                "Please choose another build directory! Or disable the option BUILD_FORCE_DIRECTORY.")
198
        endif()
199
    endif()
200
endmacro(InitializeFreeCADBuildOptions)
201

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.