Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

CMakeLists.txt 10.8 KB
Newer Older
1 2 3 4 5
## Version: $Id$
##
######################################################################
##
### Commentary:
6
##
7
######################################################################
8
##
9
### Change Log:
10
##
11
######################################################################
12 13
##
### Code:
14 15 16 17 18 19 20 21

project(dtkWidgets)

## #################################################################
## Input
## #################################################################

set(${PROJECT_NAME}_HEADERS
22 23
  dtkApplication.h
  dtkDistributedGuiApplication.h
24 25 26 27 28
  dtkNotifiable.h
  dtkNotification.h
  dtkNotificationDisplay.h
  dtkNotificationEvent.h
  dtkNotificationQueue.h
29
  dtkObjectEditor.h
30 31
  dtkPropertyEditor.h
  dtkPropertyEditorFactory.h
32 33 34 35
  dtkRecentFilesMenu.h
  dtkScreenMenu.h
  dtkSpacer.h
  dtkSplitter.h
36
  dtkToolBox.h
37 38 39 40 41 42 43 44 45 46 47 48
  dtkViewController
  dtkViewController.h
  dtkViewLayout
  dtkViewLayout.h
  dtkViewLayoutItem
  dtkViewLayoutItem.h
  dtkViewList
  dtkViewList.h
  dtkViewListControl
  dtkViewListControl.h
  dtkViewManager
  dtkViewManager.h
49 50
  dtkViewWidget
  dtkViewWidget.h
51
  dtkWidgets
52 53
  dtkWidgetsLogView.h
  dtkWidgetsLogView_p.h
54 55 56 57 58 59 60 61 62
  dtkWidgetsTag.h
  dtkWidgetsTagCloud.h
  dtkWidgetsTagCloudController.h
  dtkWidgetsTagCloudDesc.h
  dtkWidgetsTagCloudItem.h
  dtkWidgetsTagCloudLayout.h
  dtkWidgetsTagCloudList.h
  dtkWidgetsTagCloudScope.h
  dtkWidgetsTagCloudScopeItem.h
63
  dtkWidgetsTagCloudView.h
64
  dtkWidgetFactory.h
65
  dtkWidgetFactory.tpp)
66

67 68 69 70
if(DTK_BUILD_SCRIPT)
  set(${PROJECT_NAME}_HEADERS ${${PROJECT_NAME}_HEADERS} dtkInterpreter.h)
endif(DTK_BUILD_SCRIPT)

71
set(${PROJECT_NAME}_SOURCES
72 73
  dtkApplication.cpp
  dtkDistributedGuiApplication.cpp
74 75 76 77
  dtkNotification.cpp
  dtkNotificationDisplay.cpp
  dtkNotificationEvent.cpp
  dtkNotificationQueue.cpp
78
  dtkObjectEditor.cpp
79 80
  dtkPropertyEditor.cpp
  dtkPropertyEditorFactory.cpp
81 82 83 84
  dtkRecentFilesMenu.cpp
  dtkScreenMenu.cpp
  dtkSpacer.cpp
  dtkSplitter.cpp
85
  dtkToolBox.cpp
86 87 88 89 90 91
  dtkViewController.cpp
  dtkViewLayout.cpp
  dtkViewLayoutItem.cpp
  dtkViewList.cpp
  dtkViewListControl.cpp
  dtkViewManager.cpp
92
  dtkViewWidget.cpp
93
  dtkWidgetsLogView.cpp
94 95 96 97 98 99 100 101 102
  dtkWidgetsTag.cpp
  dtkWidgetsTagCloud.cpp
  dtkWidgetsTagCloudController.cpp
  dtkWidgetsTagCloudDesc.cpp
  dtkWidgetsTagCloudItem.cpp
  dtkWidgetsTagCloudLayout.cpp
  dtkWidgetsTagCloudList.cpp
  dtkWidgetsTagCloudScope.cpp
  dtkWidgetsTagCloudScopeItem.cpp
103
  dtkWidgetsTagCloudView.cpp)
104

105 106 107 108
if(DTK_BUILD_SCRIPT)
  set(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} dtkInterpreter.cpp)
endif(DTK_BUILD_SCRIPT)

109
set(${PROJECT_NAME}_SOURCES_RCC
110
  dtkNotification.qrc
111 112
  dtkWidgetsTagCloud.qrc)

113 114 115 116 117 118
## #################################################################
## Wrapping
## #################################################################

set(${PROJECT_NAME}_SOURCES_WRAP)

119
if(DTK_BUILD_WRAPPERS)
120 121 122

  set(${PROJECT_NAME}_WRAP_DEPENDS ${${PROJECT_NAME}_HEADERS})

123 124 125 126
  if(SIP_FOUND)
    set(${PROJECT_NAME}_SIP_WRAPPERS
      sip${PROJECT_NAME}dtkViewController.cpp
      sip${PROJECT_NAME}dtkViewManager.cpp
Julien Wintz's avatar
Julien Wintz committed
127 128 129
      sip${PROJECT_NAME}dtkViewWidget.cpp
      sip${PROJECT_NAME}dtkViewLayout.cpp
      sip${PROJECT_NAME}dtkViewLayoutItem.cpp)
130
    dtk_wrap_sip(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkWidgets ${CMAKE_SOURCE_DIR}/sip/dtkWidgets/dtkWidgetsmod.sip "${${PROJECT_NAME}_SIP_WRAPPERS}" "${${PROJECT_NAME}_WRAP_DEPENDS}")
131 132 133 134 135 136
  endif(SIP_FOUND)

  if(SWIG_FOUND)
    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dtkWidgets.i ${CMAKE_BINARY_DIR}/dtkWidgets.i COPYONLY)

    if (DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND)
Julien Wintz's avatar
Julien Wintz committed
137
      dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets python ${PROJECT_SOURCE_DIR}/dtkWidgets.i "${${PROJECT_NAME}_WRAP_DEPENDS}" "${CMAKE_SOURCE_DIR}/src;${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_SOURCE_DIR}/wrp/dtkBase;${CMAKE_SOURCE_DIR}/wrp/dtkWidgets;${CMAKE_SOURCE_DIR}/wrp/QtCore;${CMAKE_SOURCE_DIR}/wrp/QtWidgets")
138
    endif()
139
    if (DTK_WRAPPING_TCL AND TCL_FOUND)
140
      dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets tcl ${PROJECT_SOURCE_DIR}/dtkWidgets.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
141
    endif()
142
    if (DTK_WRAPPING_CSHARP)
143
      dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets csharp ${PROJECT_SOURCE_DIR}/dtkWidgets.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
144 145
    endif()
  endif(SWIG_FOUND)
146 147
endif()

148 149 150 151 152 153 154 155 156
## #################################################################
## Build rules
## #################################################################

qt5_add_resources(${PROJECT_NAME}_SOURCES_QRC ${${PROJECT_NAME}_SOURCES_RCC})

add_library(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES_QRC}
  ${${PROJECT_NAME}_SOURCES}
157
  ${${PROJECT_NAME}_SOURCES_WRAP}
158 159
  ${${PROJECT_NAME}_HEADERS})

160
target_link_libraries(${PROJECT_NAME}
161
  dtkCore
162 163
  dtkLog
  dtkDistributed)
164

165 166 167 168
if(DTK_BUILD_SCRIPT)
  target_link_libraries(${PROJECT_NAME} dtkScript)
endif(DTK_BUILD_SCRIPT)

169
if(DTK_BUILD_WRAPPERS)
170 171 172 173 174 175 176 177 178

 if (DTK_WRAPPING_TCL AND TCL_FOUND)
   target_link_libraries(${PROJECT_NAME} ${TCL_LIBRARY})
 endif()

  if(DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND)
      target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
  endif()

179
endif(DTK_BUILD_WRAPPERS)
180

181 182 183 184
## ###################################################################
## Link rules
## ###################################################################

185 186 187
target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Gui)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
188

189 190 191 192
## ###################################################################
## Target properties
## ###################################################################

193 194 195 196
if(NOT SIP_FOUND)
  set_target_properties(${PROJECT_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
  set_target_properties(${PROJECT_NAME} PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
endif()
197 198 199
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_RPATH 0)
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
200 201
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION   ${dtk_VERSION}
                                                 SOVERSION ${dtk_VERSION_MAJOR})
202 203 204 205 206

## #################################################################
## Export header file
## #################################################################

207
generate_export_header(${PROJECT_NAME} EXPORT_FILE_NAME "${PROJECT_NAME}Export.h")
208 209 210 211 212 213 214 215 216 217

add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
  COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Export.h" "${CMAKE_BINARY_DIR}"
  COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}Export.h" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Export")

set(${PROJECT_NAME}_HEADERS
  ${${PROJECT_NAME}_HEADERS}
 "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Export"
 "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Export.h")

218 219 220 221 222 223
## #################################################################
## Handling of generated script modules
## #################################################################

set(${PROJECT_NAME}_MODULES)

224 225 226 227 228 229 230 231
if(DTK_BUILD_WRAPPERS AND SIP_FOUND)
    add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
      DEPENDS ${PROJECT_SOURCE_DIR}/dtkWidgets.i
      COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/modules
      COMMENT "-- Moving python modules to ${CMAKE_BINARY_DIR}/modules")

    if(APPLE)
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
Julien Wintz's avatar
Julien Wintz committed
232 233
        DEPENDS ${PROJECT_SOURCE_DIR}/dtkWidgets.i
        COMMAND ln -sf ../lib/libdtkWidgets.dylib dtkWidgets.so
234 235
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/modules)

Julien Wintz's avatar
Julien Wintz committed
236
      set(${PROJECT_NAME}_MODULES ${${PROJECT_NAME}_MODULES} ${CMAKE_BINARY_DIR}/modules/dtkWidget.so)
237 238 239 240
    endif(APPLE)

    if(UNIX AND NOT APPLE)
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
Julien Wintz's avatar
Julien Wintz committed
241 242
        DEPENDS ${PROJECT_SOURCE_DIR}/dtkWidgets.i
        COMMAND ln -fs ../${CMAKE_INSTALL_LIBDIR}/libdtkWidgets.so dtkWidgets.so
243 244
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/modules)

Julien Wintz's avatar
Julien Wintz committed
245
      set(${PROJECT_NAME}_MODULES ${${PROJECT_NAME}_MODULES} ${CMAKE_BINARY_DIR}/modules/dtkWidgets.so)
246 247 248 249
    endif(UNIX AND NOT APPLE)

endif(DTK_BUILD_WRAPPERS AND SIP_FOUND)

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
if(DTK_BUILD_WRAPPERS AND SWIG_FOUND)

  if(DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND )

    add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
      DEPENDS ${PROJECT_SOURCE_DIR}/dtkWidgets.i
      COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/modules
      COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${${PROJECT_NAME}_BINARY_DIR}/dtkwidgets.py ${CMAKE_BINARY_DIR}/modules
      COMMENT "-- Moving python modules to ${CMAKE_BINARY_DIR}/modules")

    set(${PROJECT_NAME}_MODULES ${CMAKE_BINARY_DIR}/modules/dtkwidgets.py)

    if(APPLE)
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
        DEPENDS ${PROJECT_SOURCE_DIR}/dtkWidgets.i
        COMMAND ln -sf ../lib/libdtkWidgets.dylib _dtkwidgets.so
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/modules)

      set(${PROJECT_NAME}_MODULES ${${PROJECT_NAME}_MODULES} ${CMAKE_BINARY_DIR}/modules/_dtkwidgets.so)
    endif(APPLE)

    if(UNIX AND NOT APPLE)
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
        DEPENDS ${PROJECT_SOURCE_DIR}/dtkWidgets.i
        COMMAND ln -fs ../${CMAKE_INSTALL_LIBDIR}/libdtkWidgets.so _dtkwidgets.so
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/modules)

      set(${PROJECT_NAME}_MODULES ${${PROJECT_NAME}_MODULES} ${CMAKE_BINARY_DIR}/modules/_dtkwidgets.so)
    endif(UNIX AND NOT APPLE)

  endif(DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND )

  if (DTK_WRAPPING_CSHARP)

    file(GLOB DTK_CSHARP_SOURCES "${${PROJECT_NAME}_BINARY_DIR}/*.cs")

    foreach(DTK_CSHARP_SOURCE ${DTK_CSHARP_SOURCES})
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
        DEPENDS ${PROJECT_SOURCE_DIR}/dtkWidgets.i
        COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${DTK_CSHARP_SOURCE} ${CMAKE_BINARY_DIR}/modules
        COMMENT "-- Moving csharp ${DTK_CSHARP_SOURCE} source to ${CMAKE_BINARY_DIR}/modules")
    endforeach(DTK_CSHARP_SOURCE ${DTK_CSHARP_SOURCES})
  endif (DTK_WRAPPING_CSHARP)

endif(DTK_BUILD_WRAPPERS AND SWIG_FOUND)

296 297 298 299 300 301 302 303
## ###################################################################
## Install rules - files
## ###################################################################

install(FILES ${${PROJECT_NAME}_HEADERS}
  DESTINATION include/${PROJECT_NAME}
    COMPONENT widgets)

304 305 306
install(FILES ${${PROJECT_NAME}_MODULES} DESTINATION modules)
install(FILES ${CMAKE_BINARY_DIR}/dtkWidgets.i DESTINATION include/swig)

307 308 309 310 311 312 313 314
## ###################################################################
## Install rules - targets
## ###################################################################

install(TARGETS ${PROJECT_NAME}
    DESTINATION ${CMAKE_INSTALL_LIBDIR}
      COMPONENT widgets
         EXPORT dtkDepends)
315 316 317

######################################################################
### CMakeLists.txt ends here