0029589: Configuration - allow MFC samples to be built when OCCT is linked statically
[occt.git] / samples / mfc / standard / mfcsample / CMakeLists.txt
1 cmake_minimum_required (VERSION 2.6)
2
3 project (mfcsample)
4
5 add_definitions(-DWINVER=0x0501 -D_AFXEXT -DUNICODE -D_UNICODE)
6
7 if (NOT BUILD_SHARED_LIBS AND WIN32)
8   add_definitions ("-DOCCT_STATIC_BUILD")
9 endif()
10
11 set (CMAKE_MFC_FLAG 2)
12
13 # mfcsample
14 set (mfcsample_SOURCE_FILES ${MFC_STANDARD_SAMPLES_DIR}/mfcsample/src/mfcsample.cpp
15                             ${MFC_STANDARD_SAMPLES_DIR}/mfcsample/src/StdAfx.cpp )
16
17 SET (MFC_STANDARD_COMMON_SAMPLES_DIR "${MFC_STANDARD_SAMPLES_DIR}/Common")
18 set (COMMON_SOURCE_FILES ${MFC_STANDARD_COMMON_SAMPLES_DIR}/AISDialogs.cpp
19                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dDoc.cpp
20                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dChildFrame.cpp
21                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dView.cpp
22                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dBaseDoc.cpp
23                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_App.cpp
24                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dDoc.cpp
25                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dChildFrame.cpp
26                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dView.cpp
27                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseDoc.cpp
28                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseChildFrame.cpp
29                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseView.cpp
30                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_MainFrame.cpp
31                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_StereoConfigDlg.cpp
32                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ParamsFacesPage.cpp
33                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ResultDialog.cpp
34                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/User_Cylinder.cxx
35                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ColoredMeshDlg.cpp
36                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/DimensionDlg.cpp
37                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgePage.cpp
38                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.cpp
39                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/RadiusParamsPage.cpp
40                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgesPage.cpp
41                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.cpp
42                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/AngleParamsVerticesPage.cpp)
43
44 # Common ImportExport
45 set (COMMON_IE_DIR          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ImportExport)
46 set (COMMON_IE_HEADER_FILES ${COMMON_IE_DIR}/ImportExport.h
47                             ${COMMON_IE_DIR}/SaveSTEPDlg.h )
48 set (COMMON_IE_SOURCE_FILES ${COMMON_IE_DIR}/ImportExport.cpp
49                             ${COMMON_IE_DIR}/SaveSTEPDlg.cpp )
50
51 # Common ISession2D
52 set (COMMON_ISESSION2D_DIR          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ISession2D)
53 set (COMMON_ISESSION2D_HEADER_FILES ${COMMON_ISESSION2D_DIR}/ISession2D_Shape.h )
54 set (COMMON_ISESSION2D_SOURCE_FILES ${COMMON_ISESSION2D_DIR}/ISession2D_Shape.cpp )
55
56 # Common Primitive
57 set (COMMON_PRIMITIVE_DIR          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/Primitive)
58 set (COMMON_PRIMITIVE_HEADER_FILES ${COMMON_PRIMITIVE_DIR}/Sample2D_Face.h
59                                    ${COMMON_PRIMITIVE_DIR}/Sample2D_Image.h
60                                    ${COMMON_PRIMITIVE_DIR}/Sample2D_Markers.h )
61 set (COMMON_PRIMITIVE_SOURCE_FILES ${COMMON_PRIMITIVE_DIR}/Sample2D_Face.cpp
62                                    ${COMMON_PRIMITIVE_DIR}/Sample2D_Image.cpp
63                                    ${COMMON_PRIMITIVE_DIR}/Sample2D_Markers.cpp )
64
65 # Common Resource2D
66 set (COMMON_RESOURCE2D_DIR          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/Resource2D)
67 set (COMMON_RESOURCE2D_HEADER_FILES ${COMMON_RESOURCE2D_DIR}/CircularGrid.h
68                                     ${COMMON_RESOURCE2D_DIR}/RectangularGrid.h )
69 set (COMMON_RESOURCE2D_SOURCE_FILES ${COMMON_RESOURCE2D_DIR}/CircularGrid.cpp
70                                     ${COMMON_RESOURCE2D_DIR}/RectangularGrid.cpp )
71
72 # Common headers
73 set (COMMON_HEADER_FILES ${MFC_STANDARD_COMMON_SAMPLES_DIR}/AISDialogs.h
74                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dDoc.h
75                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dChildFrame.h
76                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_2dView.h
77                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dBaseDoc.h
78                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_App.h
79                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dDoc.h
80                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dChildFrame.h
81                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_3dView.h
82                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseDoc.h
83                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseChildFrame.h
84                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_BaseView.h
85                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_MainFrame.h
86                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/OCC_StereoConfigDlg.h
87                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ParamsFacesPage.h
88                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ResultDialog.h
89                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/User_Cylinder.hxx
90                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/ColoredMeshDlg.h
91                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/DimensionDlg.h
92                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgePage.h
93                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.h
94                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/RadiusParamsPage.h
95                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsEdgesPage.h
96                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/LengthParamsVerticesPage.h
97                          ${MFC_STANDARD_COMMON_SAMPLES_DIR}/AngleParamsVerticesPage.h)
98
99
100 # Common resources
101 set (COMMON_RESOURCE_DIR   ${MFC_STANDARD_COMMON_SAMPLES_DIR}/res)
102 set (COMMON_RESOURCE_FILES ${COMMON_RESOURCE_DIR}/2dChildFrameTB.bmp
103                            ${COMMON_RESOURCE_DIR}/2dType.ico
104                            ${COMMON_RESOURCE_DIR}/3dChildFrameTB.bmp
105                            ${COMMON_RESOURCE_DIR}/3dType.ico
106                            ${COMMON_RESOURCE_DIR}/AIS_TB.bmp
107                            ${COMMON_RESOURCE_DIR}/coloredm.bmp
108                            ${COMMON_RESOURCE_DIR}/MainFrame.ico
109                            ${COMMON_RESOURCE_DIR}/occ_logo.bmp
110                            ${COMMON_RESOURCE_DIR}/OCC_Resource.rc)
111
112 # groups in the VS solution
113 source_group ( "Header Files" FILES   ${COMMON_HEADER_FILES}
114                                       ${COMMON_IE_HEADER_FILES}
115                                       ${COMMON_PRIMITIVE_HEADER_FILES}
116                                       ${COMMON_RESOURCE2D_HEADER_FILES}
117                                       ${COMMON_ISESSION2D_HEADER_FILES})
118
119 source_group ("Source Files" FILES    ${mfcsample_SOURCE_FILES}
120                                       ${COMMON_SOURCE_FILES}
121                                       ${COMMON_IE_SOURCE_FILES}
122                                       ${COMMON_PRIMITIVE_SOURCE_FILES}
123                                       ${COMMON_RESOURCE2D_SOURCE_FILES}
124                                       ${COMMON_ISESSION2D_SOURCE_FILES})
125
126 source_group ( "Resource Files" FILES ${COMMON_RESOURCE_FILES})
127
128 # mfcsample library
129 add_library ( mfcsample        ${mfcsample_SOURCE_FILES}
130                                ${COMMON_HEADER_FILES}
131                                ${COMMON_SOURCE_FILES}
132                                ${COMMON_IE_HEADER_FILES}
133                                ${COMMON_IE_SOURCE_FILES}
134                                ${COMMON_PRIMITIVE_HEADER_FILES}
135                                ${COMMON_PRIMITIVE_SOURCE_FILES}
136                                ${COMMON_RESOURCE2D_HEADER_FILES}
137                                ${COMMON_RESOURCE2D_SOURCE_FILES}
138                                ${COMMON_ISESSION2D_HEADER_FILES}
139                                ${COMMON_ISESSION2D_SOURCE_FILES}
140                                ${COMMON_RESOURCE_FILES})
141
142 set_property (TARGET mfcsample PROPERTY FOLDER Samples)
143
144 if (SINGLE_GENERATOR)
145   install (TARGETS mfcsample
146            RUNTIME DESTINATION "${INSTALL_DIR_BIN}"
147            ARCHIVE DESTINATION "${INSTALL_DIR_LIB}"
148            LIBRARY DESTINATION "${INSTALL_DIR_LIB}")
149 else()
150   install (TARGETS mfcsample
151            CONFIGURATIONS Release RelWithDebInfo
152            RUNTIME DESTINATION "${INSTALL_DIR_BIN}"
153            ARCHIVE DESTINATION "${INSTALL_DIR_LIB}"
154            LIBRARY DESTINATION "${INSTALL_DIR_LIB}")
155   install (TARGETS mfcsample
156            CONFIGURATIONS Debug
157            RUNTIME DESTINATION "${INSTALL_DIR_BIN}d"
158            ARCHIVE DESTINATION "${INSTALL_DIR_LIB}d"
159            LIBRARY DESTINATION "${INSTALL_DIR_LIB}d")
160 endif()
161
162 include_directories( ${CMAKE_BINARY_DIR}/inc
163                      ${MFC_STANDARD_COMMON_SAMPLES_DIR}
164                      ${COMMON_IE_DIR}
165                      ${COMMON_ISESSION2D_DIR}
166                      ${COMMON_PRIMITIVE_DIR}
167                      ${COMMON_RESOURCE2D_DIR})
168
169 # OCCT libraries for using
170 set (mfcsample_USED_LIBS  TKVRML
171                           TKSTL
172                           TKBRep
173                           TKIGES
174                           TKShHealing
175                           TKSTEP
176                           TKSTEPBase
177                           TKSTEP209
178                           TKSTEPAttr
179                           TKXSBase
180                           TKBool
181                           TKBO
182                           TKCAF
183                           TKCDF
184                           TKernel
185                           TKFeat
186                           TKFillet
187                           TKG2d
188                           TKG3d
189                           TKGeomAlgo
190                           TKGeomBase
191                           TKHLR
192                           TKMath
193                           TKOffset
194                           TKOpenGl
195                           TKPrim
196                           TKService
197                           TKTopAlgo
198                           TKMesh
199                           TKV3d
200                           ${CSF_OpenGlLibs})
201
202 target_link_libraries (mfcsample ${mfcsample_USED_LIBS})