<commit_before>cmake_minimum_required(VERSION 2.8)

set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})

# infer path for Torch7
string (REGEX REPLACE "(.*)lib/luarocks/rocks.*" "\\1" TORCH_PREFIX "${CMAKE_INSTALL_PREFIX}" )
message (STATUS "Found Torch7, installed in: " ${TORCH_PREFIX})

find_package (Torch REQUIRED)
find_package (JPEG QUIET)
find_package (PNG QUIET)

set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

if (JPEG_FOUND)
    include_directories (${JPEG_INCLUDE_DIR} ${TORCH_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
    add_library (jpeg SHARED jpeg.c)
    target_link_libraries (jpeg ${TORCH_LIBRARIES} ${JPEG_LIBRARIES})
    install_targets (/lib jpeg)
else (JPEG_FOUND)
    message ("WARNING: Could not find JPEG libraries, JPEG wrapper will not be installed")
endif (JPEG_FOUND)

if (PNG_FOUND)
    include_directories (${PNG_INCLUDE_DIR} ${TORCH_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
    add_library (png SHARED png.c)
    target_link_libraries (png ${TORCH_LIBRARIES} ${PNG_LIBRARIES})
    install_targets (/lib png)
else (PNG_FOUND)
    message ("WARNING: Could not find PNG libraries, PNG wrapper will not be installed")
endif (PNG_FOUND)

include_directories (${TORCH_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
add_library (image SHARED image.c)
link_directories (${TORCH_LIBRARY_DIR})
target_link_libraries (image ${TORCH_LIBRARIES})

install_files(/lua/image init.lua)<commit_msg>make it work with vanilla torch7 installation under dev directory<commit_after>cmake_minimum_required(VERSION 2.8)

set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})

IF(${CMAKE_PROJECT_NAME} STREQUAL "Torch")
  SET(TORCH_LIBRARIES TH luaT)
  SET(TORCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
ELSE(${CMAKE_PROJECT_NAME} STREQUAL "Torch")
  # infer path for Torch7
  string (REGEX REPLACE "(.*)lib/luarocks/rocks.*" "\\1" TORCH_PREFIX "${CMAKE_INSTALL_PREFIX}" )
  message (STATUS "Found Torch7, installed in: " ${TORCH_PREFIX})
  
  find_package (Torch REQUIRED)
ENDIF(${CMAKE_PROJECT_NAME} STREQUAL "Torch")

find_package (JPEG QUIET)
find_package (PNG QUIET)

set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

if (JPEG_FOUND)
    include_directories (${JPEG_INCLUDE_DIR} ${TORCH_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
    add_library (jpeg SHARED jpeg.c)
    target_link_libraries (jpeg ${TORCH_LIBRARIES} ${JPEG_LIBRARIES})
    install_targets (/lib jpeg)
else (JPEG_FOUND)
    message ("WARNING: Could not find JPEG libraries, JPEG wrapper will not be installed")
endif (JPEG_FOUND)

if (PNG_FOUND)
    include_directories (${PNG_INCLUDE_DIR} ${TORCH_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
    add_library (png SHARED png.c)
    target_link_libraries (png ${TORCH_LIBRARIES} ${PNG_LIBRARIES})
    install_targets (/lib png)
else (PNG_FOUND)
    message ("WARNING: Could not find PNG libraries, PNG wrapper will not be installed")
endif (PNG_FOUND)

include_directories (${TORCH_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
add_library (image SHARED image.c)
link_directories (${TORCH_LIBRARY_DIR})
target_link_libraries (image ${TORCH_LIBRARIES})

install_files(/lua/image init.lua)
{'fraction_non_alphanumeric': 0.10764686576960945, 'fraction_numerical': 0.0036101083032490976, 'mean_word_length': 6.5632754342431765, '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': '2169764', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1102, 'n_words': 256}