<commit_before>cmake_minimum_required(VERSION 2.8.11)
project(optical-flow-filter)


#################################################
# MACROS
#################################################

macro (add_sources)
    file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_src ${ARGN})
        if (_relPath)
            list (APPEND SRCS "${_relPath}/${_src}")
        else()
            list (APPEND SRCS "${_src}")
        endif()
    endforeach()
    if (_relPath)
        # propagate SRCS to parent directory
        set (SRCS ${SRCS} PARENT_SCOPE)
    endif()
endmacro()


macro (add_gpu_sources)
    file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_src ${ARGN})
        # message(STATUS "source: " ${_src})
        if (_relPath)
            list (APPEND GPU_SRCS "${_relPath}/${_src}")
        else()
            list (APPEND GPU_SRCS "${_src}")
        endif()
    endforeach()
    if (_relPath)
        # propagate SRCS to parent directory
        set (GPU_SRCS ${GPU_SRCS} PARENT_SCOPE)
    endif()
    # message(STATUS "gpu sources: " ${GPU_SRCS})
endmacro()



#################################################
# LIBRARY SETTINGS
#################################################
set (LIBRARY_OUTPUT_PATH   "lib")

#################################################
# INCLUDE SETTINGS
#################################################
include_directories("${PROJECT_SOURCE_DIR}/include")


#################################################
# COMPILER SETTINGS
#################################################
set (CMAKE_CXX_COMPILER         "g++")
set (CMAKE_CXX_FLAGS            "-std=c++11 -flto -O2 -Wall")


#################################################
# SOURCE FILES SETTINGS
#################################################
# process the CMakeLists.txt file at src/ folder
# it should add all the source files in the folder
add_subdirectory(src)


#################################################
# CUDA SETTINGS
#################################################
find_package(CUDA REQUIRED)
if (CUDA_FOUND)
    
    message(STATUS "found CUDA")

    # NVCC compiler flags
    set(CUDA_NVCC_FLAGS             "-std=c++11")
    set(CUDA_PROPAGATE_HOST_FLAGS OFF)    

endif(CUDA_FOUND)


#################################################
# TARGETS
#################################################

if(CUDA_FOUND)

    message(STATUS "GPU sources: ${GPU_SRCS}")
    
    # flowfilter_gpu library with CUDA implementation
    cuda_add_library(flowfilter_gpu SHARED ${GPU_SRCS})

endif(CUDA_FOUND)

<commit_msg>Added Install commands to install .so and header files<commit_after>cmake_minimum_required(VERSION 2.8.11)
project(optical-flow-filter)


#################################################
# MACROS
#################################################

macro (add_sources)
    file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_src ${ARGN})
        if (_relPath)
            list (APPEND SRCS "${_relPath}/${_src}")
        else()
            list (APPEND SRCS "${_src}")
        endif()
    endforeach()
    if (_relPath)
        # propagate SRCS to parent directory
        set (SRCS ${SRCS} PARENT_SCOPE)
    endif()
endmacro()


macro (add_gpu_sources)
    file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_src ${ARGN})
        # message(STATUS "source: " ${_src})
        if (_relPath)
            list (APPEND GPU_SRCS "${_relPath}/${_src}")
        else()
            list (APPEND GPU_SRCS "${_src}")
        endif()
    endforeach()
    if (_relPath)
        # propagate SRCS to parent directory
        set (GPU_SRCS ${GPU_SRCS} PARENT_SCOPE)
    endif()
    # message(STATUS "gpu sources: " ${GPU_SRCS})
endmacro()


#################################################
# LIBRARY SETTINGS
#################################################
set (LIBRARY_OUTPUT_PATH   "lib")

#################################################
# INCLUDE SETTINGS
#################################################
include_directories("${PROJECT_SOURCE_DIR}/include")


#################################################
# COMPILER SETTINGS
#################################################
set (CMAKE_CXX_COMPILER         "g++")
set (CMAKE_CXX_FLAGS            "-std=c++11 -flto -O2 -Wall")


#################################################
# SOURCE FILES SETTINGS
#################################################
# process the CMakeLists.txt file at src/ folder
# it should add all the source files in the folder
add_subdirectory(src)


#################################################
# CUDA SETTINGS
#################################################
find_package(CUDA REQUIRED)
if (CUDA_FOUND)
    
    message(STATUS "found CUDA")

    # NVCC compiler flags
    set(CUDA_NVCC_FLAGS             "-std=c++11")
    set(CUDA_PROPAGATE_HOST_FLAGS OFF)    


    message(STATUS "GPU sources: ${GPU_SRCS}")
    message(STATUS "HEADER FILES: ${HEADER_LIST}")
    
    # flowfilter_gpu library with CUDA implementation
    cuda_add_library(flowfilter_gpu SHARED ${GPU_SRCS})

    # install
    install(
        TARGETS flowfilter_gpu
        LIBRARY DESTINATION lib
    )

    # install header files
    install(
        DIRECTORY include/flowfilter
        DESTINATION include
    )

endif(CUDA_FOUND)
{'fraction_non_alphanumeric': 0.3214020771513353, 'fraction_numerical': 0.0033382789317507417, 'mean_word_length': 4.185576923076923, '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': '4282374', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1495, 'n_words': 334}