<commit_before>
#=========================================================
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4 FATAL_ERROR)
if(WIN32 OR NOT EXISTS /dev/urandom)
  CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
endif()

#=========================================================
#RTK = Reconstruction toolkit
PROJECT(RTK)
#=========================================================

#=========================================================
#Support for the CTest dashboard testing system
INCLUDE(CTest)
INCLUDE(cmake/RTKExternalData.cmake)
#=========================================================

## Tell CMake to be quiet
CMAKE_POLICY (SET CMP0003 NEW)
if(POLICY CMP0054)
  CMAKE_POLICY (SET CMP0054 NEW)
endif()

## Default to release
IF (NOT CMAKE_BUILD_TYPE)
  SET (CMAKE_BUILD_TYPE Release)
ENDIF (NOT CMAKE_BUILD_TYPE)

IF(BUILD_TESTING)
  ENABLE_TESTING()
ENDIF(BUILD_TESTING)
#=========================================================

#=========================================================
SET(RTK_VERSION_MAJOR "1")
SET(RTK_VERSION_MINOR "2")
SET(RTK_VERSION_PATCH "0")

#=========================================================

#=========================================================
# Help function to debug CMake
MACRO (DD in)
  MESSAGE(${in}=[${${in}}])
ENDMACRO(DD)
#=========================================================

#=========================================================
# Output directories.
IF(NOT LIBRARY_OUTPUT_PATH)
  SET (LIBRARY_OUTPUT_PATH ${RTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(NOT LIBRARY_OUTPUT_PATH)
IF(NOT EXECUTABLE_OUTPUT_PATH)
  SET (EXECUTABLE_OUTPUT_PATH ${RTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)

SET(RTK_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}")
SET(RTK_EXECUTABLE_PATH "${EXECUTABLE_OUTPUT_PATH}")
SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})

#=========================================================
# Remove some MS Visual c++ flags
IF(MSVC)
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
ENDIF(MSVC)

# Flag required for shared libraries
IF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
  SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
  SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
ENDIF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
#=========================================================

#=========================================================
# Find ITK (required)
FIND_PACKAGE(ITK 4.2.0 REQUIRED)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR "Cannot build without ITK. Set ITK_DIR.")
ENDIF(ITK_FOUND)

# GPU optional dependencies
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

option(RTK_USE_OPENCL "Use OpenCL for RTK" OFF)
if(RTK_USE_OPENCL)
  FIND_PACKAGE(OpenCL REQUIRED)
  IF(OPENCL_LIBRARIES AND OPENCL_INCLUDE_DIRS)
    INCLUDE_DIRECTORIES(${OPENCL_INCLUDE_DIRS})
    SET(OPENCL_FOUND TRUE)
  ELSE(OPENCL_LIBRARIES AND OPENCL_INCLUDE_DIRS)
    SET(OPENCL_FOUND FALSE)
  ENDIF(OPENCL_LIBRARIES AND OPENCL_INCLUDE_DIRS)
endif()

FIND_PACKAGE(CUDA_wrap)
if(CUDA_FOUND)
  SET(RTK_USE_CUDA_DEFAULT ON)
else()
  SET(RTK_USE_CUDA_DEFAULT OFF)
endif()
option(RTK_USE_CUDA "Use CUDA for RTK" ${RTK_USE_CUDA_DEFAULT})

IF(RTK_USE_CUDA)
  IF(NOT CUDA_FOUND)
    FIND_PACKAGE(CUDA_wrap REQUIRED)
  ENDIF()
  INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS})
  SET(RTK_CUDA_PROJECTIONS_SLAB_SIZE "16" CACHE STRING "Number of projections processed simultaneously in CUDA forward and back projections")
ENDIF()

# Find BZIP2 (required for Varian HNC)
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
  INCLUDE_DIRECTORIES(${BZIP_INCLUDE_DIRS})
ELSE(BZIP2_FOUND)
  MESSAGE(FATAL_ERROR "Cannot build without bzip2.")<commit_msg>Correction of spelling of bzip2 include dir<commit_after>
#=========================================================
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4 FATAL_ERROR)
if(WIN32 OR NOT EXISTS /dev/urandom)
  CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
endif()

#=========================================================
#RTK = Reconstruction toolkit
PROJECT(RTK)
#=========================================================

#=========================================================
#Support for the CTest dashboard testing system
INCLUDE(CTest)
INCLUDE(cmake/RTKExternalData.cmake)
#=========================================================

## Tell CMake to be quiet
CMAKE_POLICY (SET CMP0003 NEW)
if(POLICY CMP0054)
  CMAKE_POLICY (SET CMP0054 NEW)
endif()

## Default to release
IF (NOT CMAKE_BUILD_TYPE)
  SET (CMAKE_BUILD_TYPE Release)
ENDIF (NOT CMAKE_BUILD_TYPE)

IF(BUILD_TESTING)
  ENABLE_TESTING()
ENDIF(BUILD_TESTING)
#=========================================================

#=========================================================
SET(RTK_VERSION_MAJOR "1")
SET(RTK_VERSION_MINOR "2")
SET(RTK_VERSION_PATCH "0")

#=========================================================

#=========================================================
# Help function to debug CMake
MACRO (DD in)
  MESSAGE(${in}=[${${in}}])
ENDMACRO(DD)
#=========================================================

#=========================================================
# Output directories.
IF(NOT LIBRARY_OUTPUT_PATH)
  SET (LIBRARY_OUTPUT_PATH ${RTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
ENDIF(NOT LIBRARY_OUTPUT_PATH)
IF(NOT EXECUTABLE_OUTPUT_PATH)
  SET (EXECUTABLE_OUTPUT_PATH ${RTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)

SET(RTK_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}")
SET(RTK_EXECUTABLE_PATH "${EXECUTABLE_OUTPUT_PATH}")
SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})

#=========================================================
# Remove some MS Visual c++ flags
IF(MSVC)
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
ENDIF(MSVC)

# Flag required for shared libraries
IF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
  SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
  SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
ENDIF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
#=========================================================

#=========================================================
# Find ITK (required)
FIND_PACKAGE(ITK 4.2.0 REQUIRED)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR "Cannot build without ITK. Set ITK_DIR.")
ENDIF(ITK_FOUND)

# GPU optional dependencies
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

option(RTK_USE_OPENCL "Use OpenCL for RTK" OFF)
if(RTK_USE_OPENCL)
  FIND_PACKAGE(OpenCL REQUIRED)
  IF(OPENCL_LIBRARIES AND OPENCL_INCLUDE_DIRS)
    INCLUDE_DIRECTORIES(${OPENCL_INCLUDE_DIRS})
    SET(OPENCL_FOUND TRUE)
  ELSE(OPENCL_LIBRARIES AND OPENCL_INCLUDE_DIRS)
    SET(OPENCL_FOUND FALSE)
  ENDIF(OPENCL_LIBRARIES AND OPENCL_INCLUDE_DIRS)
endif()

FIND_PACKAGE(CUDA_wrap)
if(CUDA_FOUND)
  SET(RTK_USE_CUDA_DEFAULT ON)
else()
  SET(RTK_USE_CUDA_DEFAULT OFF)
endif()
option(RTK_USE_CUDA "Use CUDA for RTK" ${RTK_USE_CUDA_DEFAULT})

IF(RTK_USE_CUDA)
  IF(NOT CUDA_FOUND)
    FIND_PACKAGE(CUDA_wrap REQUIRED)
  ENDIF()
  INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS})
  SET(RTK_CUDA_PROJECTIONS_SLAB_SIZE "16" CACHE STRING "Number of projections processed simultaneously in CUDA forward and back projections")
ENDIF()

# Find BZIP2 (required for Varian HNC)
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
  INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
ELSE(BZIP2_FOUND)
  MESSAGE(FATAL_ERROR "Cannot build without bzip2.")
{'fraction_non_alphanumeric': 0.2844342037890425, 'fraction_numerical': 0.010752688172043012, 'mean_word_length': 9.348344370860927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '54065', 'n_tokens_mistral': 2899, 'n_tokens_neox': 2601, 'n_words': 499}