| 1 |
add_library(FreeCADApp SHARED) |
| 2 |
|
| 3 |
if(WIN32) |
| 4 |
add_definitions(-DFCApp) |
| 5 |
add_definitions(-DBOOST_DYN_LINK) |
| 6 |
endif(WIN32) |
| 7 |
|
| 8 |
if(BUILD_TRACY_FRAME_PROFILER) |
| 9 |
add_definitions(-DBUILD_TRACY_FRAME_PROFILER) |
| 10 |
endif() |
| 11 |
|
| 12 |
if(FREECAD_RELEASE_SEH) |
| 13 |
add_definitions(-DHAVE_SEH) |
| 14 |
endif(FREECAD_RELEASE_SEH) |
| 15 |
|
| 16 |
# This causes some problems with the resource files to be found, especially with the StartPage |
| 17 |
IF(RESOURCEDIR) |
| 18 |
add_definitions(-DRESOURCEDIR="${RESOURCEDIR}") |
| 19 |
ENDIF(RESOURCEDIR) |
| 20 |
|
| 21 |
IF(LIBRARYDIR) |
| 22 |
add_definitions(-DLIBRARYDIR="${LIBRARYDIR}") |
| 23 |
ENDIF(LIBRARYDIR) |
| 24 |
|
| 25 |
IF(DOCDIR) |
| 26 |
add_definitions(-DDOCDIR="${DOCDIR}") |
| 27 |
ENDIF(DOCDIR) |
| 28 |
|
| 29 |
# ----------------------------------------------------------------------------- |
| 30 |
|
| 31 |
#write relevant cmake variables to a file for later access with python. Exported are all variables |
| 32 |
#starting with BUILD. As the variable only exists if the user set it to ON a dict is useless, we |
| 33 |
#use a python list for export. |
| 34 |
set(_vars "const char CMakeVariables[] =\"cmake = [") |
| 35 |
set(_delim "") |
| 36 |
get_cmake_property(_variableNames VARIABLES) |
| 37 |
foreach (_variableName ${_variableNames}) |
| 38 |
if (${_variableName}) |
| 39 |
STRING(REGEX MATCH "^[_]?[^_]*" _prefix "${_variableName}_") |
| 40 |
if(${_prefix} STREQUAL "BUILD") |
| 41 |
STRING(REPLACE "\\" "\\\\" _name ${_variableName}) |
| 42 |
set(_vars "${_vars}${_delim}\\n\"\n\"\\\"${_name}\\\"") |
| 43 |
set(_delim ",") |
| 44 |
endif() |
| 45 |
endif () |
| 46 |
endforeach() |
| 47 |
set(_vars "${_vars}]\\n\" \n;") |
| 48 |
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.hh "${_vars}" ) |
| 49 |
|
| 50 |
fc_copy_file_if_different( |
| 51 |
"${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.hh" |
| 52 |
"${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.h" |
| 53 |
) |
| 54 |
|
| 55 |
# ----------------------------------------------------------------------------- |
| 56 |
|
| 57 |
target_include_directories( |
| 58 |
FreeCADApp |
| 59 |
PRIVATE |
| 60 |
${CMAKE_BINARY_DIR} |
| 61 |
${CMAKE_BINARY_DIR}/src |
| 62 |
${CMAKE_SOURCE_DIR}/src |
| 63 |
${CMAKE_CURRENT_BINARY_DIR} |
| 64 |
) |
| 65 |
|
| 66 |
target_include_directories( |
| 67 |
FreeCADApp |
| 68 |
SYSTEM |
| 69 |
PUBLIC |
| 70 |
${QtCore_INCLUDE_DIRS} |
| 71 |
${QtXml_INCLUDE_DIRS} |
| 72 |
) |
| 73 |
|
| 74 |
set(FreeCADApp_LIBS |
| 75 |
FreeCADBase |
| 76 |
${Boost_LIBRARIES} |
| 77 |
fmt::fmt |
| 78 |
) |
| 79 |
|
| 80 |
if(BUILD_TRACY_FRAME_PROFILER) |
| 81 |
list(APPEND FreeCADApp_LIBS TracyClient) |
| 82 |
endif() |
| 83 |
|
| 84 |
list(APPEND FreeCADApp_LIBS |
| 85 |
${QtCore_LIBRARIES} |
| 86 |
${QtXml_LIBRARIES} |
| 87 |
) |
| 88 |
|
| 89 |
generate_from_py(ApplicationDirectories) |
| 90 |
generate_from_py(Document) |
| 91 |
generate_from_py(DocumentObject) |
| 92 |
generate_from_py(Extension) |
| 93 |
generate_from_py(ExtensionContainer) |
| 94 |
generate_from_py(DocumentObjectExtension) |
| 95 |
generate_from_py(GroupExtension) |
| 96 |
generate_from_py(LinkBaseExtension) |
| 97 |
generate_from_py(DocumentObjectGroup) |
| 98 |
generate_from_py(GeoFeature) |
| 99 |
generate_from_py(GeoFeatureGroupExtension) |
| 100 |
generate_from_py(SuppressibleExtension) |
| 101 |
generate_from_py(Metadata) |
| 102 |
generate_from_py(OriginGroupExtension) |
| 103 |
generate_from_py(Part) |
| 104 |
generate_from_py(StringHasher) |
| 105 |
generate_from_py(StringID) |
| 106 |
|
| 107 |
generate_from_py(ComplexGeoData) |
| 108 |
generate_from_py(PropertyContainer) |
| 109 |
generate_from_py(Material) |
| 110 |
generate_from_py(MeasureManager) |
| 111 |
|
| 112 |
generate_embed_from_py(FreeCADInit InitScript.h) |
| 113 |
generate_embed_from_py(FreeCADTest TestScript.h) |
| 114 |
|
| 115 |
SET(FreeCADApp_Pyi_SRCS |
| 116 |
ApplicationDirectories.pyi |
| 117 |
Extension.pyi |
| 118 |
ExtensionContainer.pyi |
| 119 |
DocumentObjectExtension.pyi |
| 120 |
GroupExtension.pyi |
| 121 |
LinkBaseExtension.pyi |
| 122 |
Metadata.pyi |
| 123 |
DocumentObjectGroup.pyi |
| 124 |
DocumentObject.pyi |
| 125 |
GeoFeature.pyi |
| 126 |
GeoFeatureGroupExtension.pyi |
| 127 |
OriginGroupExtension.pyi |
| 128 |
SuppressibleExtension.pyi |
| 129 |
Part.pyi |
| 130 |
Document.pyi |
| 131 |
PropertyContainer.pyi |
| 132 |
ComplexGeoData.pyi |
| 133 |
Material.pyi |
| 134 |
MeasureManager.pyi |
| 135 |
StringHasher.pyi |
| 136 |
StringID.pyi |
| 137 |
) |
| 138 |
SOURCE_GROUP("Pyi" FILES ${FreeCADApp_Pyi_SRCS}) |
| 139 |
|
| 140 |
# The document stuff |
| 141 |
SET(Document_CPP_SRCS |
| 142 |
Annotation.cpp |
| 143 |
BackupPolicy.cpp |
| 144 |
Document.cpp |
| 145 |
DocumentObject.cpp |
| 146 |
Extension.cpp |
| 147 |
ExtensionPyImp.cpp |
| 148 |
DocumentObjectExtension.cpp |
| 149 |
DocumentObjectExtensionPyImp.cpp |
| 150 |
ExtensionContainer.cpp |
| 151 |
ExtensionContainerPyImp.cpp |
| 152 |
Graphviz.cpp |
| 153 |
GroupExtension.cpp |
| 154 |
GroupExtensionPyImp.cpp |
| 155 |
DocumentObjectFileIncluded.cpp |
| 156 |
DocumentObjectGroup.cpp |
| 157 |
DocumentObjectGroupPyImp.cpp |
| 158 |
GeoFeaturePyImp.cpp |
| 159 |
DocumentObjectPyImp.cpp |
| 160 |
DocumentObserver.cpp |
| 161 |
DocumentObserverPython.cpp |
| 162 |
DocumentPyImp.cpp |
| 163 |
Expression.cpp |
| 164 |
ExpressionTokenizer.cpp |
| 165 |
FeaturePython.cpp |
| 166 |
FeatureTest.cpp |
| 167 |
GeoFeature.cpp |
| 168 |
GeoFeatureGroupExtensionPyImp.cpp |
| 169 |
GeoFeatureGroupExtension.cpp |
| 170 |
ImagePlane.cpp |
| 171 |
OriginGroupExtensionPyImp.cpp |
| 172 |
OriginGroupExtension.cpp |
| 173 |
SuppressibleExtensionPyImp.cpp |
| 174 |
SuppressibleExtension.cpp |
| 175 |
PartPyImp.cpp |
| 176 |
Part.cpp |
| 177 |
Origin.cpp |
| 178 |
Path.cpp |
| 179 |
InventorObject.cpp |
| 180 |
Placement.cpp |
| 181 |
ProjectFile.cpp |
| 182 |
Datums.cpp |
| 183 |
Range.cpp |
| 184 |
Transactions.cpp |
| 185 |
TransactionalObject.cpp |
| 186 |
VRMLObject.cpp |
| 187 |
MaterialObject.cpp |
| 188 |
MergeDocuments.cpp |
| 189 |
TextDocument.cpp |
| 190 |
Link.cpp |
| 191 |
LinkBaseExtensionPyImp.cpp |
| 192 |
VarSet.cpp |
| 193 |
License.h |
| 194 |
) |
| 195 |
|
| 196 |
SET(Document_HPP_SRCS |
| 197 |
Annotation.h |
| 198 |
BackupPolicy.h |
| 199 |
Document.h |
| 200 |
DocumentObject.h |
| 201 |
Extension.h |
| 202 |
ExtensionContainer.h |
| 203 |
GroupExtension.h |
| 204 |
DocumentObjectExtension.h |
| 205 |
DocumentObjectFileIncluded.h |
| 206 |
DocumentObjectGroup.h |
| 207 |
DocumentObserver.h |
| 208 |
DocumentObserverPython.h |
| 209 |
Expression.h |
| 210 |
ExpressionParser.h |
| 211 |
ExpressionTokenizer.h |
| 212 |
ExpressionVisitors.h |
| 213 |
FeatureCustom.h |
| 214 |
FeaturePython.h |
| 215 |
FeaturePythonPyImp.h |
| 216 |
FeaturePythonPyImp.inl |
| 217 |
FeatureTest.h |
| 218 |
GeoFeature.h |
| 219 |
GeoFeatureGroupExtension.h |
| 220 |
ImagePlane.h |
| 221 |
OriginGroupExtension.h |
| 222 |
SuppressibleExtension.h |
| 223 |
Part.h |
| 224 |
Origin.h |
| 225 |
Path.h |
| 226 |
InventorObject.h |
| 227 |
Placement.h |
| 228 |
ProjectFile.h |
| 229 |
Datums.h |
| 230 |
Range.h |
| 231 |
Transactions.h |
| 232 |
TransactionalObject.h |
| 233 |
VRMLObject.h |
| 234 |
MaterialObject.h |
| 235 |
MergeDocuments.h |
| 236 |
TextDocument.h |
| 237 |
VarSet.h |
| 238 |
Link.h |
| 239 |
) |
| 240 |
SET(Document_SRCS |
| 241 |
${Document_CPP_SRCS} |
| 242 |
${Document_HPP_SRCS} |
| 243 |
) |
| 244 |
SOURCE_GROUP("Document" FILES ${Document_SRCS}) |
| 245 |
|
| 246 |
# The property stuff |
| 247 |
SET(Properties_CPP_SRCS |
| 248 |
DynamicProperty.cpp |
| 249 |
ObjectIdentifier.cpp |
| 250 |
Property.cpp |
| 251 |
PropertyContainer.cpp |
| 252 |
PropertyContainerPyImp.cpp |
| 253 |
PropertyFile.cpp |
| 254 |
PropertyGeo.cpp |
| 255 |
PropertyLinks.cpp |
| 256 |
PropertyPythonObject.cpp |
| 257 |
PropertyStandard.cpp |
| 258 |
PropertyUnits.cpp |
| 259 |
PropertyExpressionEngine.cpp |
| 260 |
) |
| 261 |
SET(Properties_HPP_SRCS |
| 262 |
DynamicProperty.h |
| 263 |
ObjectIdentifier.h |
| 264 |
Property.h |
| 265 |
PropertyContainer.h |
| 266 |
PropertyFile.h |
| 267 |
PropertyGeo.h |
| 268 |
PropertyLinks.h |
| 269 |
PropertyPythonObject.h |
| 270 |
PropertyStandard.h |
| 271 |
PropertyUnits.h |
| 272 |
PropertyExpressionEngine.h |
| 273 |
PropertyOverrides.h |
| 274 |
) |
| 275 |
SET(Properties_SRCS |
| 276 |
${Properties_CPP_SRCS} |
| 277 |
${Properties_HPP_SRCS} |
| 278 |
) |
| 279 |
SOURCE_GROUP("Properties" FILES ${Properties_SRCS}) |
| 280 |
|
| 281 |
SET(FreeCADApp_CPP_SRCS |
| 282 |
${Document_CPP_SRCS} |
| 283 |
${Properties_CPP_SRCS} |
| 284 |
Application.cpp |
| 285 |
ApplicationDirectories.cpp |
| 286 |
ApplicationDirectoriesPyImp.cpp |
| 287 |
ApplicationPy.cpp |
| 288 |
AutoTransaction.cpp |
| 289 |
Branding.cpp |
| 290 |
CleanupProcess.cpp |
| 291 |
ColorModel.cpp |
| 292 |
ComplexGeoData.cpp |
| 293 |
ComplexGeoDataPyImp.cpp |
| 294 |
ElementMap.cpp |
| 295 |
Enumeration.cpp |
| 296 |
IndexedName.cpp |
| 297 |
MappedElement.cpp |
| 298 |
MappedName.cpp |
| 299 |
Material.cpp |
| 300 |
MaterialPyImp.cpp |
| 301 |
MeasureManager.cpp |
| 302 |
MeasureManagerPyImp.cpp |
| 303 |
Metadata.cpp |
| 304 |
MetadataPyImp.cpp |
| 305 |
ElementNamingUtils.cpp |
| 306 |
SafeMode.cpp |
| 307 |
Services.cpp |
| 308 |
StringHasher.cpp |
| 309 |
StringHasherPyImp.cpp |
| 310 |
StringIDPyImp.cpp |
| 311 |
) |
| 312 |
|
| 313 |
SET(FreeCADApp_HPP_SRCS |
| 314 |
${Document_HPP_SRCS} |
| 315 |
${Properties_HPP_SRCS} |
| 316 |
Application.h |
| 317 |
ApplicationDirectories.h |
| 318 |
AutoTransaction.h |
| 319 |
Branding.h |
| 320 |
CleanupProcess.h |
| 321 |
ColorModel.h |
| 322 |
ComplexGeoData.h |
| 323 |
ElementMap.h |
| 324 |
Enumeration.h |
| 325 |
IndexedName.h |
| 326 |
MappedName.h |
| 327 |
MappedElement.h |
| 328 |
Material.h |
| 329 |
MeasureManager.h |
| 330 |
Metadata.h |
| 331 |
ElementNamingUtils.h |
| 332 |
Services.h |
| 333 |
StringHasher.h |
| 334 |
) |
| 335 |
|
| 336 |
# auto-generate resource file with all available translations |
| 337 |
set (FreeCADApp_TR_QRC ${CMAKE_CURRENT_BINARY_DIR}/Resources/App_translation.qrc) |
| 338 |
qt_find_and_add_translation(QM_SRCS "Resources/translations/*_*.ts" |
| 339 |
${CMAKE_CURRENT_BINARY_DIR}/Resources/translations) |
| 340 |
qt_create_resource_file(${FreeCADApp_TR_QRC} ${QM_SRCS}) |
| 341 |
qt_add_resources(FreeCADApp_QRC_SRCS ${FreeCADApp_TR_QRC}) |
| 342 |
|
| 343 |
SET(FreeCADApp_SRCS |
| 344 |
${FreeCADApp_QRC_SRCS} |
| 345 |
${FreeCADApp_CPP_SRCS} |
| 346 |
${FreeCADApp_HPP_SRCS} |
| 347 |
${FreeCADApp_Pyi_SRCS} |
| 348 |
FreeCADInit.py |
| 349 |
FreeCADTest.py |
| 350 |
PreCompiled.h |
| 351 |
) |
| 352 |
|
| 353 |
if(FREECAD_USE_PCH) |
| 354 |
target_precompile_headers(FreeCADApp PRIVATE |
| 355 |
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h"> |
| 356 |
) |
| 357 |
endif(FREECAD_USE_PCH) |
| 358 |
|
| 359 |
target_sources(FreeCADApp PRIVATE ${FreeCADApp_SRCS}) |
| 360 |
target_link_libraries(FreeCADApp ${FreeCADApp_LIBS}) |
| 361 |
|
| 362 |
if (MSVC) |
| 363 |
target_compile_definitions(FreeCADApp PRIVATE WIN32_LEAN_AND_MEAN) |
| 364 |
target_compile_options(FreeCADApp PRIVATE /wd4251 /wd4273 /wd4275) |
| 365 |
endif() |
| 366 |
|
| 367 |
if (FREECAD_WARN_ERROR) |
| 368 |
target_compile_warn_error(FreeCADApp) |
| 369 |
endif() |
| 370 |
|
| 371 |
add_dependencies(FreeCADApp fc_version) |
| 372 |
|
| 373 |
SET_BIN_DIR(FreeCADApp FreeCADApp) |
| 374 |
|
| 375 |
if(WIN32) |
| 376 |
INSTALL(TARGETS FreeCADApp |
| 377 |
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
| 378 |
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 379 |
) |
| 380 |
else(WIN32) |
| 381 |
INSTALL(TARGETS FreeCADApp |
| 382 |
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 383 |
) |
| 384 |
endif(WIN32) |