<commit_before>PROJECT(SlicerVmtk4)
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.2)
#-----------------------------------------------------------------------------

if(POLICY CMP0016)
  CMAKE_POLICY(SET CMP0016 NEW)
endif()
if(POLICY CMP0017)
  CMAKE_POLICY(SET CMP0017 OLD)
endif()

#-----------------------------------------------------------------------------
# Prerequisites
#-----------------------------------------------------------------------------
IF(NOT Slicer_SOURCE_DIR)
  FIND_PACKAGE(Slicer REQUIRED)
  INCLUDE(${Slicer_USE_FILE})
ENDIF()

#-----------------------------------------------------------------------------
# Module name (usually identique to the directory name)
#-----------------------------------------------------------------------------
SET(EXTENSION_NAME SlicerVmtk4)

#-----------------------------------------------------------------------------
# Superbuild Option - Enabled by default
#-----------------------------------------------------------------------------
OPTION(SlicerVmtk4_SUPERBUILD "Build SlicerVmtk4 and the projects it depends on via SuperBuild.cmake." ON)
MARK_AS_ADVANCED(SlicerVmtk4_SUPERBUILD)

#-----------------------------------------------------------------------------
# Additional C/CXX flags
#-----------------------------------------------------------------------------
SET(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional ${EXTENSION_NAME} C Flags")
SET(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional ${EXTENSION_NAME} CXX Flags")

#-----------------------------------------------------------------------------
# CPack for SlicerVmtk4
#-----------------------------------------------------------------------------
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${CMAKE_BINARY_DIR};SlicerVmtk4;ALL;/")

#-----------------------------------------------------------------------------
# CPack for VMTK, has to be before superbuild call
#-----------------------------------------------------------------------------
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${VMTK_DIR};VMTK;RuntimeLibraries;/")

INCLUDE(SlicerEnableExtensionTesting)

#-----------------------------------------------------------------------------
# Superbuild script
#-----------------------------------------------------------------------------
IF(SlicerVmtk4_SUPERBUILD)
  INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
  RETURN()
ENDIF()

#-----------------------------------------------------------------------------
# Extension description
#-----------------------------------------------------------------------------
SET(EXTENSION_HOMEPAGE "http://slicer.vmtk.org/")
SET(EXTENSION_CATEGORY "Vascular Modeling Toolkit")
SET(EXTENSION_STATUS "Beta")
SET(EXTENSION_DESCRIPTION "The Vascular Modeling Toolkit as a 3D Slicer4 extension.")

SET(EXTENSION_LICENSE_FILE ${Slicer_LICENSE_FILE})
SET(EXTENSION_README_FILE ${Slicer_README_FILE})

SET(qt_module_export_directive "Q_SLICER_QTMODULES_VMTK4_EXPORT")

#-----------------------------------------------------------------------------
# Sources
#-----------------------------------------------------------------------------

# Additional includes - Current_{source,binary} and Slicer_{Libs,Base} already included
SET(qt_module_include_directories
  )

# Source files
SET(qt_module_SRCS
  qSlicerVmtk4Module.cxx
  qSlicerVmtk4Module.h
  )

# Headers that should run through moc
SET(qt_module_MOC_SRCS
  qSlicerVmtk4Module.h
  )

# UI files
SET(qt_module_UI_SRCS
)

# Link against VMTK
LINK_DIRECTORIES(
  ${CMAKE_BINARY_DIR}/${Slicer_QTLOADABLEMODULES_LIB_DIR}
)

# TODO VMTK should expose a VMTK_LIBRARIES variable
SET(VMTK_LIBRARIES
  vtkvmtkCommon
  vtkvmtkSegmentation
  vtkvmtkDifferentialGeometry
  vtkvmtkComputationalGeometry
  vtkvmtkMisc
  vtkvmtkIO
  vtkvmtkITK
  )

SET(VMTK_PYTHON_LIBRARIES)
FOREACH(lib ${VMTK_LIBRARIES})
  LIST(APPEND VMTK_PYTHON_LIBRARIES ${lib}PythonD)
ENDFOREACH()

# Additional Target libraries
SET(qt_module_target_libraries
  ${VMTK_LIBRARIES}
  ${VMTK_PYTHON_LIBRARIES}
  )

# Resources
SET(qt_module_resources
  )

#-----------------------------------------------------------------------------
# Include Python Modules
#-----------------------------------------------------------------------------
ADD_SUBDIRECTORY(Modules)


#-----------------------------------------------------------------------------
# Build
#-----------------------------------------------------------------------------

# patch until JC fixes the macro :)
set(Slicer_INSTALL_QTLOADABLEMODULES_BIN_DIR ${Slicer_QTLOADABLEMODULES_BIN_DIR})
set(Slicer_INSTALL_QTLOADABLEMODULES_LIB_DIR ${Slicer_QTLOADABLEMODULES_LIB_DIR})

slicerMacroBuildQtModule(
  NAME ${EXTENSION_NAME}
  EXPORT_DIRECTIVE ${qt_module_export_directive}
  INCLUDE_DIRECTORIES ${qt_module_include_directories}
  SRCS ${qt_module_SRCS}
  MOC_SRCS ${qt_module_MOC_SRCS}
  UI_SRCS ${qt_module_UI_SRCS}
  TARGET_LIBRARIES ${qt_module_target_libraries}
  RESOURCES ${qt_module_resources}
  )

set(EXTENSION_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/SlicerVmtk4-build)
message(XX ${EXTENSION_BINARY_DIR})

#-----------------------------------------------------------------------------
# Generate extension description file '<EXTENSION_NAME>.s4ext'
#-----------------------------------------------------------------------------
IF(NOT Slicer_SOURCE_DIR)
  INCLUDE(SlicerFunctionGenerateExtensionDescription)
  slicerFunctionGenerateExtensionDescription(
    EXTENSION_NAME ${EXTENSION_NAME}
    EXTENSION_CATEGORY ${EXTENSION_CATEGORY} 
    EXTENSION_STATUS ${EXTENSION_STATUS}
    EXTENSION_HOMEPAGE ${EXTENSION_HOMEPAGE}
    EXTENSION_DESCRIPTION ${EXTENSION_DESCRIPTION}
    DESTINATION_DIR ${CMAKE_CURRENT_BINARY_DIR}
    SLICER_WC_REVISION ${Slicer_WC_REVISION}
    SLICER_WC_ROOT ${Slicer_WC_ROOT}
    )
  INCLUDE(${Slicer_EXTENSION_CPACK})
ENDIF()

#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if(BUILD_TESTING)
  #add_subdirectory(Testing)
endif()
<commit_msg>Adopted Slicer4's new extension infrastructure.<commit_after>#
# SlicerVmtk4: The Vascular Modeling Toolkit in 3D Slicer 4
#
# http://slicer.vmtk.org
#

#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.2)
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
#-----------------------------------------------------------------------------
if(POLICY CMP0016)
  CMAKE_POLICY(SET CMP0016 NEW)
endif()
if(POLICY CMP0017)
  CMAKE_POLICY(SET CMP0017 OLD)
endif()

#-----------------------------------------------------------------------------
# Module name (usually identique to the directory name)
#-----------------------------------------------------------------------------
set(EXTENSION_NAME SlicerVmtk4)
set(EXTENSION_BUILD_SUBDIRECTORY ${EXTENSION_NAME}-build)

#-----------------------------------------------------------------------------
# Prerequisites
#-----------------------------------------------------------------------------
if(NOT Slicer_SOURCE_DIR)
  find_package(Slicer REQUIRED)

  # Additional C/CXX flags - Should be defined before including Slicer_USE_FILE
  set(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional ${EXTENSION_NAME} C Flags")
  set(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional ${EXTENSION_NAME} CXX Flags")

  include(${Slicer_USE_FILE})

  include(SlicerEnableExtensionTesting)

  find_package(Git REQUIRED)
endif()

#-----------------------------------------------------------------------------
# Superbuild
#-----------------------------------------------------------------------------
option(${EXTENSION_NAME}_SUPERBUILD "Build ${EXTENSION_NAME} and the projects it depends on via SuperBuild.cmake." ON)
mark_as_advanced(${EXTENSION_NAME}_SUPERBUILD)
if(${EXTENSION_NAME}_SUPERBUILD)
  include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
  return()
endif()

#-----------------------------------------------------------------------------
# Include Python Modules
#-----------------------------------------------------------------------------
add_subdirectory(Modules)

#-----------------------------------------------------------------------------
# Extension description
#-----------------------------------------------------------------------------
set(EXTENSION_HOMEPAGE "http://slicer.vmtk.org/")
set(EXTENSION_CATEGORY "Vascular Modeling Toolkit")
set(EXTENSION_STATUS "Beta")
set(EXTENSION_DESCRIPTION "The Vascular Modeling Toolkit as a 3D Slicer4 extension.")
set(EXTENSION_DEPENDS "NA")

set(EXTENSION_LICENSE_FILE ${Slicer_LICENSE_FILE})
set(EXTENSION_README_FILE ${Slicer_README_FILE})

#-----------------------------------------------------------------------------
# Sources
#-----------------------------------------------------------------------------
set(qt_module_export_directive "Q_SLICER_QTMODULES_VMTK4_EXPORT")

# Additional includes - Current_{source,binary} and Slicer_{Libs,Base} already included
set(qt_module_include_directories
  )

# Source files
set(qt_module_SRCS
  qSlicerVmtk4Module.cxx
  qSlicerVmtk4Module.h
  )

# Headers that should run through moc
set(qt_module_MOC_SRCS
  qSlicerVmtk4Module.h
  )

# UI files
set(qt_module_UI_SRCS
)

# Link against VMTK lib
link_directories(
  ${CMAKE_BINARY_DIR}/${Slicer_QTLOADABLEMODULES_LIB_DIR}
)

# configure VMTK targets
set(VMTK_LIBRARIES
  vtkvmtkCommon
  vtkvmtkSegmentation
  vtkvmtkDifferentialGeometry
  vtkvmtkComputationalGeometry
  vtkvmtkMisc
  vtkvmtkIO
  vtkvmtkITK
  )

set(VMTK_PYTHON_LIBRARIES)
foreach(lib ${VMTK_LIBRARIES})
  list(APPEND VMTK_PYTHON_LIBRARIES ${lib}PythonD)
endforeach()

# Additional Target libraries
set(qt_module_target_libraries
  ${VMTK_LIBRARIES}
  ${VMTK_PYTHON_LIBRARIES}
  )

# Resources
set(qt_module_resources
  )

#-----------------------------------------------------------------------------
# Build
#-----------------------------------------------------------------------------
slicerMacroBuildQtModule(
  NAME ${EXTENSION_NAME}
  EXPORT_DIRECTIVE ${qt_module_export_directive}
  INCLUDE_DIRECTORIES ${qt_module_include_directories}
  SRCS ${qt_module_SRCS}
  MOC_SRCS ${qt_module_MOC_SRCS}
  UI_SRCS ${qt_module_UI_SRCS}
  TARGET_LIBRARIES ${qt_module_target_libraries}
  RESOURCES ${qt_module_resources}
  )

#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if(BUILD_TESTING)
  #add_subdirectory(Testing)
endif()

#-----------------------------------------------------------------------------
# Generate extension description file '<EXTENSION_NAME>.s4ext'
#-----------------------------------------------------------------------------
include(SlicerFunctionGenerateExtensionDescription)
slicerFunctionGenerateExtensionDescription(
  EXTENSION_NAME ${EXTENSION_NAME}
  EXTENSION_BUILD_SUBDIRECTORY ${EXTENSION_BUILD_SUBDIRECTORY}
  EXTENSION_CATEGORY ${EXTENSION_CATEGORY}
  EXTENSION_STATUS ${EXTENSION_STATUS}
  EXTENSION_HOMEPAGE ${EXTENSION_HOMEPAGE}
  EXTENSION_DESCRIPTION ${EXTENSION_DESCRIPTION}
  EXTENSION_DEPENDS ${EXTENSION_DEPENDS}
  DESTINATION_DIR ${CMAKE_CURRENT_BINARY_DIR}
  SLICER_WC_REVISION ${Slicer_WC_REVISION}
  SLICER_WC_ROOT ${Slicer_WC_ROOT}
  )

#-----------------------------------------------------------------------------
# Packaging
#-----------------------------------------------------------------------------
# Current project
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${CMAKE_BINARY_DIR};${EXTENSION_NAME};ALL;/")
# External projects
#set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${<EP>_DIR};<EP>;RuntimeLibraries;/")
INCLUDE(${Slicer_EXTENSION_CPACK})

{'fraction_non_alphanumeric': 0.39368508516825923, 'fraction_numerical': 0.005650186954715413, 'mean_word_length': 1.427591770875353, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5078345', 'n_tokens_mistral': 3418, 'n_tokens_neox': 3284, 'n_words': 487}