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