/
CMakeLists.txt
309 lines (281 loc) · 7.27 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
if(WIN32)
add_definitions(-DFCApp)
add_definitions(-DBOOST_DYN_LINK)
endif(WIN32)
if(FREECAD_RELEASE_SEH)
add_definitions(-DHAVE_SEH)
endif(FREECAD_RELEASE_SEH)
# This causes some problems with the resource files to be found, especially with the StartPage
IF(RESOURCEDIR)
add_definitions(-DRESOURCEDIR="${RESOURCEDIR}")
ENDIF(RESOURCEDIR)
IF(DOCDIR)
add_definitions(-DDOCDIR="${DOCDIR}")
ENDIF(DOCDIR)
add_definitions(-DBOOST_${Boost_VERSION})
#if you want to use the old DAG structure uncomment this line
#add_definitions(-DUSE_OLD_DAG)
# -----------------------------------------------------------------------------
#write relevant cmake variables to a file for later access with python. Exported are all variables
#starting with BUILD. As the variable only exists if the user set it to ON a dict is useless, we
#use a python list for export.
set(_vars "const char CMakeVariables[] =\"cmake = [")
set(_delim "")
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
if (${_variableName})
STRING(REGEX MATCH "^[_]?[^_]*" _prefix "${_variableName}_")
if(${_prefix} STREQUAL "BUILD")
STRING(REPLACE "\\" "\\\\" _name ${_variableName})
set(_vars "${_vars}${_delim}\\n\"\n\"\\\"${_name}\\\"")
set(_delim ",")
endif()
endif ()
endforeach()
set(_vars "${_vars}]\\n\" \n;")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.hh "${_vars}" )
fc_copy_file_if_different(
"${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.hh"
"${CMAKE_CURRENT_BINARY_DIR}/CMakeScript.h"
)
# -----------------------------------------------------------------------------
include_directories(
${CMAKE_BINARY_DIR}/src
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${XercesC_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
)
set(FreeCADApp_LIBS
FreeCADBase
${Boost_LIBRARIES}
)
if (BUILD_QT5)
include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
)
list(APPEND FreeCADApp_LIBS
${Qt5Core_LIBRARIES}
${Qt5Xml_LIBRARIES}
)
else()
include_directories(
${QT_QTCORE_INCLUDE_DIR}
${QT_QTXML_INCLUDE_DIR}
)
list(APPEND FreeCADApp_LIBS
${QT_QTCORE_LIBRARY}
${QT_QTXML_LIBRARY}
)
endif()
generate_from_xml(DocumentPy)
generate_from_xml(DocumentObjectPy)
generate_from_xml(ExtensionPy)
generate_from_xml(ExtensionContainerPy)
generate_from_xml(DocumentObjectExtensionPy)
generate_from_xml(GroupExtensionPy)
generate_from_xml(LinkBaseExtensionPy)
generate_from_xml(DocumentObjectGroupPy)
generate_from_xml(GeoFeaturePy)
generate_from_xml(GeoFeatureGroupExtensionPy)
generate_from_xml(OriginGroupExtensionPy)
generate_from_xml(PartPy)
generate_from_xml(ComplexGeoDataPy)
generate_from_xml(PropertyContainerPy)
generate_from_xml(MaterialPy)
generate_from_py(FreeCADInit InitScript.h)
generate_from_py(FreeCADTest TestScript.h)
SET(FreeCADApp_XML_SRCS
ExtensionPy.xml
ExtensionContainerPy.xml
DocumentObjectExtensionPy.xml
GroupExtensionPy.xml
LinkBaseExtensionPy.xml
DocumentObjectGroupPy.xml
DocumentObjectPy.xml
GeoFeaturePy.xml
GeoFeatureGroupExtensionPy.xml
OriginGroupExtensionPy.xml
PartPy.xml
DocumentPy.xml
PropertyContainerPy.xml
ComplexGeoDataPy.xml
MaterialPy.xml
)
SOURCE_GROUP("XML" FILES ${FreeCADApp_XML_SRCS})
# The document stuff
SET(Document_CPP_SRCS
Annotation.cpp
Document.cpp
DocumentObject.cpp
Extension.cpp
ExtensionPyImp.cpp
DocumentObjectExtension.cpp
DocumentObjectExtensionPyImp.cpp
ExtensionContainer.cpp
ExtensionContainerPyImp.cpp
GroupExtension.cpp
GroupExtensionPyImp.cpp
DocumentObjectFileIncluded.cpp
DocumentObjectGroup.cpp
DocumentObjectGroupPyImp.cpp
GeoFeaturePyImp.cpp
DocumentObjectPyImp.cpp
DocumentObserver.cpp
DocumentObserverPython.cpp
DocumentPyImp.cpp
Expression.cpp
FeaturePython.cpp
FeatureTest.cpp
GeoFeature.cpp
GeoFeatureGroupExtensionPyImp.cpp
GeoFeatureGroupExtension.cpp
OriginGroupExtensionPyImp.cpp
OriginGroupExtension.cpp
PartPyImp.cpp
Part.cpp
Origin.cpp
Path.cpp
InventorObject.cpp
MeasureDistance.cpp
Placement.cpp
OriginFeature.cpp
Range.cpp
Transactions.cpp
TransactionalObject.cpp
VRMLObject.cpp
MaterialObject.cpp
MergeDocuments.cpp
TextDocument.cpp
Link.cpp
LinkBaseExtensionPyImp.cpp
)
SET(Document_HPP_SRCS
Annotation.h
Document.h
DocumentObject.h
Extension.h
ExtensionContainer.h
GroupExtension.h
DocumentObjectExtension.h
DocumentObjectFileIncluded.h
DocumentObjectGroup.h
DocumentObserver.h
DocumentObserverPython.h
Expression.h
ExpressionVisitors.h
FeatureCustom.h
FeaturePython.h
FeaturePythonPyImp.h
FeaturePythonPyImp.inl
FeatureTest.h
GeoFeature.h
GeoFeatureGroupExtension.h
OriginGroupExtension.h
Part.h
Origin.h
Path.h
InventorObject.h
MeasureDistance.h
Placement.h
OriginFeature.h
Range.h
Transactions.h
TransactionalObject.h
VRMLObject.h
MaterialObject.h
MergeDocuments.h
TextDocument.h
Link.h
)
SET(Document_SRCS
${Document_CPP_SRCS}
${Document_HPP_SRCS}
)
SOURCE_GROUP("Document" FILES ${Document_SRCS})
# The property stuff
SET(Properties_CPP_SRCS
DynamicProperty.cpp
ObjectIdentifier.cpp
Property.cpp
PropertyContainer.cpp
PropertyContainerPyImp.cpp
PropertyFile.cpp
PropertyGeo.cpp
PropertyLinks.cpp
PropertyPythonObject.cpp
PropertyStandard.cpp
PropertyUnits.cpp
PropertyExpressionEngine.cpp
)
SET(Properties_HPP_SRCS
DynamicProperty.h
ObjectIdentifier.h
Property.h
PropertyContainer.h
PropertyFile.h
PropertyGeo.h
PropertyLinks.h
PropertyPythonObject.h
PropertyStandard.h
PropertyUnits.h
PropertyExpressionEngine.h
)
SET(Properties_SRCS
${Properties_CPP_SRCS}
${Properties_HPP_SRCS}
)
SOURCE_GROUP("Properties" FILES ${Properties_SRCS})
SET(FreeCADApp_CPP_SRCS
${Document_CPP_SRCS}
${Properties_CPP_SRCS}
Application.cpp
ApplicationPy.cpp
Branding.cpp
ColorModel.cpp
ComplexGeoData.cpp
ComplexGeoDataPyImp.cpp
Enumeration.cpp
Material.cpp
MaterialPyImp.cpp
)
SET(FreeCADApp_HPP_SRCS
${Document_HPP_SRCS}
${Properties_HPP_SRCS}
Application.h
Branding.h
ColorModel.h
ComplexGeoData.h
Enumeration.h
Material.h
)
SET(FreeCADApp_SRCS
${FreeCADApp_CPP_SRCS}
${FreeCADApp_HPP_SRCS}
${FreeCADApp_XML_SRCS}
FreeCADInit.py
FreeCADTest.py
PreCompiled.cpp
PreCompiled.h
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
ADD_MSVC_PRECOMPILED_HEADER(FreeCADApp PreCompiled.h PreCompiled.cpp FreeCADApp_CPP_SRCS)
endif(FREECAD_USE_PCH)
add_library(FreeCADApp SHARED ${FreeCADApp_SRCS})
target_link_libraries(FreeCADApp ${FreeCADApp_LIBS})
add_dependencies(FreeCADApp fc_version)
SET_BIN_DIR(FreeCADApp FreeCADApp)
if(WIN32)
INSTALL(TARGETS FreeCADApp
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else(WIN32)
INSTALL(TARGETS FreeCADApp
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif(WIN32)