|
| 1 | +cmake_minimum_required(VERSION 2.8) |
| 2 | + |
| 3 | +# Include the directory itself as a path to include directories |
| 4 | +set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 5 | + |
| 6 | +PROJECT(milxBlend) |
| 7 | + |
| 8 | +FIND_PACKAGE(VTK REQUIRED) |
| 9 | +INCLUDE(${VTK_USE_FILE}) |
| 10 | + |
| 11 | +FIND_PACKAGE(ITK REQUIRED) |
| 12 | +INCLUDE(${ITK_USE_FILE}) |
| 13 | + |
| 14 | +#-------------------------------------------------------------------------------- |
| 15 | +# This sets the windows build that will need the special winmain@16 call. Qt provides |
| 16 | +# this for us in the qtmain.lib file. Using this cmake code will ensure we have it |
| 17 | +# linked into our build. Not needed on Unix/OS X/Linux which is why we have the |
| 18 | +# IF(WIN32) conditional. |
| 19 | +IF (WIN32) |
| 20 | + SET (QT_USE_QTMAIN TRUE) |
| 21 | +ENDIF (WIN32) |
| 22 | + |
| 23 | +#-------------------------------------------------------------------------------- |
| 24 | +# this command finds Qt4 libraries and sets all required variables |
| 25 | +# note that it's Qt4, not QT4 or qt4 |
| 26 | +#detect Qt version (depends on VTK-Qt) |
| 27 | +#VTK_QT_VERSION is declared in VTKConfig.cmake in VTK 6.1, vtkQt.cmake only available in out-of-source builds and not installed |
| 28 | +IF(VTK_QT_VERSION VERSION_GREATER "4") |
| 29 | + FIND_PACKAGE(Qt5Widgets REQUIRED QUIET) |
| 30 | + include_directories(${Qt5Widgets_INCLUDE_DIRS}) |
| 31 | + add_definitions(${Qt5Widgets_DEFINITIONS}) |
| 32 | + qt5_wrap_cpp(QVTKLibMocSrcs ${QVTKMocHeaders}) |
| 33 | + set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) |
| 34 | +ELSE(VTK_QT_VERSION VERSION_GREATER "4") |
| 35 | + FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtWebkit) |
| 36 | + INCLUDE(${QT_USE_FILE}) |
| 37 | +ENDIF(VTK_QT_VERSION VERSION_GREATER "4") |
| 38 | + |
| 39 | +set(MILXQT_DIR ${SMILI_SOURCE_DIR}) |
| 40 | +ADD_DEFINITIONS(-DMILX_DLL) #DLL Export MILX |
| 41 | +ADD_DEFINITIONS(-DMILX_PLUGIN_DLL) #DLL Export MILX |
| 42 | +IF(WIN32) |
| 43 | + SET(MILXQT_INSTALL_BINARY_DIR "C:/Program Files/MILX/lib") |
| 44 | +ELSE(WIN32) |
| 45 | + SET(MILXQT_INSTALL_BINARY_DIR /usr/local/lib) |
| 46 | +ENDIF(WIN32) |
| 47 | + |
| 48 | +#MILX-MSK Options |
| 49 | +IF(WIN32) |
| 50 | + set(MILX-MSK_DIR $ENV{PROGRAMFILES}/MILX_MSK) |
| 51 | +#~ message("${MILX-MSK_DIR}") |
| 52 | +ENDIF(WIN32) |
| 53 | +IF(UNIX) |
| 54 | + set(MILX-MSK_DIR /usr/local) |
| 55 | +ENDIF(UNIX) |
| 56 | + |
| 57 | +# Add Headers into List |
| 58 | +file(GLOB MILXQT_HEADERS ${MILXQT_DIR}/include/*.h) |
| 59 | +file(GLOB MILXQT_LIBS ${SMILI_BINARY_DIR}/lib/*${CMAKE_SHARED_LIBRARY_SUFFIX}*) |
| 60 | +file(GLOB MILXQT_PLUGINS ${SMILI_BINARY_DIR}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}*) |
| 61 | +file(GLOB PYTHONQT_LIBS ${PYTHONQT_DIR}/lib/*PythonQt*${CMAKE_SHARED_LIBRARY_SUFFIX}*) |
| 62 | +file(GLOB VTK_QT_LIBS ${VTK_LIBRARY_DIRS}/*Q*${CMAKE_SHARED_LIBRARY_SUFFIX}*) |
| 63 | +file(GLOB MSK_LIBS ${MILX-MSK_DIR}/lib/*${CMAKE_SHARED_LIBRARY_SUFFIX}*) |
| 64 | + |
| 65 | +include_directories (${MILXQT_INCLUDE_DIRS}) |
| 66 | +link_directories(${MILXQT_INSTALL_BINARY_DIR}) |
| 67 | + |
| 68 | +ADD_EXECUTABLE(milxBlend MACOSX_BUNDLE milxBlend.cpp) |
| 69 | +TARGET_LINK_LIBRARIES(milxBlend milx-Qt milx-SMILI ${QT_LIBRARIES} ${VTK_LIBRARIES} ${ITK_LIBRARIES}) |
| 70 | + |
| 71 | +IF(UNIX) |
| 72 | + configure_file(milxBlend.in "milxBlend" @ONLY) |
| 73 | + |
| 74 | + install(FILES "${PROJECT_BINARY_DIR}/milxBlend" DESTINATION "../../bin" |
| 75 | + PERMISSIONS WORLD_READ WORLD_EXECUTE) |
| 76 | +ENDIF(UNIX) |
| 77 | + |
| 78 | +# expand the command line wild-cards in msvc |
| 79 | +IF(MSVC) |
| 80 | + SET_TARGET_PROPERTIES(milxBlend PROPERTIES LINK_FLAGS "setargv.obj") |
| 81 | +ENDIF(MSVC) |
| 82 | + |
| 83 | +# Installs the executable |
| 84 | +INSTALL(TARGETS milxBlend |
| 85 | + BUNDLE DESTINATION . COMPONENT Runtime |
| 86 | + RUNTIME DESTINATION bin COMPONENT Runtime |
| 87 | + ) |
0 commit comments