<commit_before>Project(irtkCUcommonLib)

cmake_minimum_required(VERSION 2.6)

#if IRTK_SOURCE_DIR is set, we are building within the IRTK source tree
if(IRTK_SOURCE_DIR)
SET(BUILD_OUT_OF_IRTK_TREE FALSE)
else(IRTK_SOURCE_DIR)
SET(BUILD_OUT_OF_IRTK_TREE TRUE)
endif(IRTK_SOURCE_DIR)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ./cmake)

if (WIN32)
  # for msvc 8 deprecated warning removal
  add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
  add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
  add_definitions(-D_CRT_SECURE_NO_DEPRECATE_GLOBALS)
  add_definitions(-DWIN32 -D_WIN32)
  add_definitions(-DNOMINMAX)

  #set(CMAKE_DEBUG_POSTFIX "D")

  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT.lib;libcmtd.lib")
endif(WIN32)

# check if we have c++11
set(CMAKE_CXX_COMPILER_TMP ${CMAKE_CXX_COMPILER})
set(CMAKE_CXX_COMPILER ${CUDA_NVCC_EXECUTABLE})
include (cmake/CheckCxxFeatures.cmake)
cxx_check_feature ("c++11" "nullptr" "N2431" HAVE_CXX11_NULLPTR "${ADDITIONAL_DEFINITIONS}")
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_TMP})

if(HAVE_CXX11_NULLPTR)
add_definitions(-DHAVE_CXX11_NULLPTR)
else(HAVE_CXX11_NULLPTR)
message("WARNING: your nvcc does not support c++11 yet. Using own nullptr implementation!")
endif(HAVE_CXX11_NULLPTR)

if (WIN32)
  add_definitions(-DGL_GLEXT_PROTOTYPES -bigobj)
endif()

# Cuda:
set(CUDA_BUILD_EMULATION OFF CACHE BOOL "enable emulation mode")
find_package(CUDA REQUIRED)
include_directories(${CUDA_INCLUDE_DIRS})
#todo make smarter
if (NOT CUDA_SDK_ROOT_DIR AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc/helper_cuda.h")
  set (CUDA_SDK_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}/samples" CACHE PATH "Path to CUDA SDK (toolkit samples)." FORCE)
endif ()
include_directories(${CUDA_SDK_ROOT_DIR}/common/inc)

if( ${CUDA_VERSION} VERSION_LESS "5")
MESSAGE(INFO "Building with CUDA < 5.0")
else()
MESSAGE(STATUS "Building with CUDA >= 5.0")
# we build for all useful compute capabilities (C.P > 2.0)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-use_fast_math;")
#untested for CP < 2.0
#set(CUDA_NVCC_FLAGS "-gencode;arch=compute_12,code=sm_12;-use_fast_math;")
endif()

include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_SDK_ROOT_DIR}/common/inc)

if(BUILD_OUT_OF_IRTK_TREE)
<commit_msg>Use CMake WARNING message to display warning regarding nvcc nullptr missing.<commit_after>Project(irtkCUcommonLib)

cmake_minimum_required(VERSION 2.6)

#if IRTK_SOURCE_DIR is set, we are building within the IRTK source tree
if(IRTK_SOURCE_DIR)
SET(BUILD_OUT_OF_IRTK_TREE FALSE)
else(IRTK_SOURCE_DIR)
SET(BUILD_OUT_OF_IRTK_TREE TRUE)
endif(IRTK_SOURCE_DIR)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ./cmake)

if (WIN32)
  # for msvc 8 deprecated warning removal
  add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
  add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
  add_definitions(-D_CRT_SECURE_NO_DEPRECATE_GLOBALS)
  add_definitions(-DWIN32 -D_WIN32)
  add_definitions(-DNOMINMAX)

  #set(CMAKE_DEBUG_POSTFIX "D")

  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT.lib;libcmtd.lib")
endif(WIN32)

# check if we have c++11
set(CMAKE_CXX_COMPILER_TMP ${CMAKE_CXX_COMPILER})
set(CMAKE_CXX_COMPILER ${CUDA_NVCC_EXECUTABLE})
include (cmake/CheckCxxFeatures.cmake)
cxx_check_feature ("c++11" "nullptr" "N2431" HAVE_CXX11_NULLPTR "${ADDITIONAL_DEFINITIONS}")
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_TMP})

if(HAVE_CXX11_NULLPTR)
  add_definitions(-DHAVE_CXX11_NULLPTR)
else(HAVE_CXX11_NULLPTR)
  message(WARNING "Your nvcc does not support c++11 yet. Using own nullptr implementation!")
endif(HAVE_CXX11_NULLPTR)

if (WIN32)
  add_definitions(-DGL_GLEXT_PROTOTYPES -bigobj)
endif()

# Cuda:
set(CUDA_BUILD_EMULATION OFF CACHE BOOL "enable emulation mode")
find_package(CUDA REQUIRED)
include_directories(${CUDA_INCLUDE_DIRS})
#todo make smarter
if (NOT CUDA_SDK_ROOT_DIR AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc/helper_cuda.h")
  set (CUDA_SDK_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}/samples" CACHE PATH "Path to CUDA SDK (toolkit samples)." FORCE)
endif ()
include_directories(${CUDA_SDK_ROOT_DIR}/common/inc)

if( ${CUDA_VERSION} VERSION_LESS "5")
MESSAGE(INFO "Building with CUDA < 5.0")
else()
MESSAGE(STATUS "Building with CUDA >= 5.0")
# we build for all useful compute capabilities (C.P > 2.0)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-use_fast_math;")
#untested for CP < 2.0
#set(CUDA_NVCC_FLAGS "-gencode;arch=compute_12,code=sm_12;-use_fast_math;")
endif()

include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_SDK_ROOT_DIR}/common/inc)

if(BUILD_OUT_OF_IRTK_TREE)

{'fraction_non_alphanumeric': 0.11008403361344538, 'fraction_numerical': 0.024369747899159664, 'mean_word_length': 8.716326530612244, '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': '6315035', 'n_tokens_mistral': 2094, 'n_tokens_neox': 1923, 'n_words': 320}