FreeCAD

Форк
0
/
InitializeFreeCADBuildOptions.cmake 
184 строки · 10.4 Кб
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("Libpack NOT found.\nIf you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.")
59
            message(STATUS "Visit: https://github.com/FreeCAD/FreeCAD-Libpack/releases/ for Windows libpack downloads.")
60
        endif()
61
    else(MSVC)
62
        option(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." OFF)
63
        set(FREECAD_LIBPACK_DIR ""  CACHE PATH  "Directory of the FreeCAD LibPack")
64
    endif(MSVC)
65

66
    ChooseQtVersion()
67

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

75
    configure_file(${CMAKE_SOURCE_DIR}/src/QtOpenGL.h.cmake ${CMAKE_BINARY_DIR}/src/QtOpenGL.h)
76

77
    option(BUILD_DESIGNER_PLUGIN "Build and install the designer plugin" OFF)
78

79
    if(APPLE)
80
        option(FREECAD_CREATE_MAC_APP "Create app bundle on install" OFF)
81

82
        if(FREECAD_CREATE_MAC_APP)
83
            install(
84
                DIRECTORY ${CMAKE_SOURCE_DIR}/src/MacAppBundle/FreeCAD.app/
85
                DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app
86
            )
87

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

96
            set(CMAKE_INSTALL_PREFIX
97
                ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents)
98
            set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib )
99
        endif(FREECAD_CREATE_MAC_APP)
100
        set(CMAKE_MACOSX_RPATH TRUE )
101
    endif(APPLE)
102

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

141
    if(MSVC)
142
        option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" ON)
143
        option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF) # 3/5/2021 current LibPack uses non-C++17 FLANN
144
        option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
145
    elseif(APPLE)
146
        find_library(3DCONNEXIONCLIENT_FRAMEWORK 3DconnexionClient)
147
        if(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
148
            option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." ON)
149
        else(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
150
            option(FREECAD_USE_3DCONNEXION "Use the 3D connexion SDK to support 3d mouse." OFF)
151
        endif(IS_DIRECTORY ${3DCONNEXIONCLIENT_FRAMEWORK})
152
    else(MSVC)
153
        set(FREECAD_USE_3DCONNEXION OFF )
154
    endif(MSVC)
155
    if(NOT MSVC)
156
        option(BUILD_FEM_NETGEN "Build the FreeCAD FEM module with the NETGEN mesher" OFF)
157
        option(FREECAD_USE_PCL "Build the features that use PCL libs" OFF)
158
    endif(NOT MSVC)
159

160
    # if this is set override some options
161
    if (FREECAD_BUILD_DEBIAN)
162
        set(FREECAD_USE_EXTERNAL_ZIPIOS ON )
163
        # A Debian package for SMESH doesn't exist
164
        #set(FREECAD_USE_EXTERNAL_SMESH ON )
165
    endif (FREECAD_BUILD_DEBIAN)
166

167
    if(BUILD_FEM)
168
        set(BUILD_SMESH ON )
169
    endif()
170

171
    # for Windows the minimum required cmake version is 3.4.3 to build the Path module
172
    if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.4.3)
173
        message(WARNING "Disable Path, requires cmake >= 3.4.3 in order to build this module")
174
        set(BUILD_PATH OFF )
175
    endif()
176

177
    # force build directory to be different to source directory
178
    if (BUILD_FORCE_DIRECTORY)
179
        if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
180
            message(FATAL_ERROR "The build directory (${CMAKE_BINARY_DIR}) must be different to the source directory (${CMAKE_SOURCE_DIR}).\n"
181
                                "Please choose another build directory! Or disable the option BUILD_FORCE_DIRECTORY.")
182
        endif()
183
    endif()
184
endmacro(InitializeFreeCADBuildOptions)
185

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

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

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

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