External_CTK.cmake 1.89 KB
Newer Older
1
2
3
#-----------------------------------------------------------------------------
# Get and build CTK
if (Slicer3_USE_QT)
4
5
6
7
8
9

  # Sanity checks
  if(DEFINED CTK_DIR AND NOT EXISTS ${CTK_DIR})
    message(FATAL_ERROR "CTK_DIR variable is defined but corresponds to non-existing directory")
  endif()
  
10
11
  set(proj CTK)
  
12
13
14
  if(NOT DEFINED CTK_DIR)
#    message(STATUS "Adding project:${proj}")
    ExternalProject_Add(${proj}
15
      GIT_REPOSITORY "${git_protocol}://github.com/commontk/CTK.git"
16
17
18
19
20
21
22
23
24
25
26
27
28
29
      SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
      BINARY_DIR ${proj}-build
      CMAKE_GENERATOR ${gen}
      CMAKE_ARGS
        -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
        -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
        -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
        -DBUILD_TESTING:BOOL=OFF
        -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
        -DVTK_DIR:PATH=${VTK_DIR}
        -DPYTHON_LIBRARY:FILEPATH=${slicer_PYTHON_LIBRARY}
        -DPYTHON_INCLUDE_DIR:PATH=${slicer_PYTHON_INCLUDE}
        -DCTK_LIB_Widgets:BOOL=ON
        -DCTK_LIB_Visualization/VTK/Widgets:BOOL=ON
30
        -DCTK_LIB_Scripting/Python/Core:BOOL=${Slicer3_USE_PYTHONQT}
31
32
33
        -DCTK_LIB_Scripting/Python/Widgets:BOOL=${Slicer3_USE_PYTHONQT}
        -DCTK_LIB_PluginFramework:BOOL=OFF
        -DCTK_PLUGIN_org.commontk.eventbus:BOOL=OFF
34
        -Dgit_EXECUTABLE:FILEPATH=${git_EXECUTABLE}
35
      INSTALL_COMMAND ""
36
37
      DEPENDS 
        ${CTK_DEPENDENCIES}
38
39
      )
    set(CTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
40
41
42
43
44
45
46
47
48
49
50
    
  else()
    # The project is provided using CTK_DIR, nevertheless since other project may depend on CTK, 
    # let's add an 'empty' one
    ExternalProject_Add(${proj}
      SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
      BINARY_DIR ${proj}-build
      DOWNLOAD_COMMAND "" 
      CONFIGURE_COMMAND ""
      BUILD_COMMAND ""
      INSTALL_COMMAND ""
51
52
      DEPENDS 
        ${CTK_DEPENDENCIES}
53
      )
54
  endif()
55
endif()