<commit_before>option(WITH_SWIG "Use swig to build python bindings" ON)

find_package(SWIG)
find_package(PythonLibs)

if (NOT SWIG_FOUND)
    message("SWIG not found: Python bindings will not be built")
elseif(NOT PYTHONLIBS_FOUND)
    message("Python not found: Python bindings will not be built")
elseif (WITH_SWIG)
    include(${SWIG_USE_FILE})
    include_directories(${PYTHON_INCLUDE_PATH})
    include_directories(${CMAKE_CURRENT_SOURCE_DIR})
    # Global swig flags

    if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.8)
        message("CMake version < 3.8: using legacy swig commands")
        set(CMAKE_SWIG_FLAGS "")
        swig_add_module(rina python rlite.i)
        set_source_files_properties(cdap.i PROPERTIES CPLUSPLUS ON)
        set_source_files_properties(cdap.i PROPERTIES SWIG_FLAGS "-c++")
        swig_add_module(cdap python cdap.i)
    else()
        swig_add_library(rina LANGUAGE python SOURCES rlite.i)
        set_property(SOURCE cdap.i PROPERTY CPLUSPLUS ON)
        swig_add_library(cdap LANGUAGE python SOURCES cdap.i)
    endif()

    # Tell the build system to link the _rina.so python module against
    # the librina-api.so library
    swig_link_libraries(rina ${PYTHON_LIBRARIES} rina-api)

    # Tell the build system to link the _cdap.so python module against
    # the librina-api.so library
    swig_link_libraries(cdap ${PYTHON_LIBRARIES} cdap)

    # Installation directives<commit_msg>swig: fix compilation issue on gcc8<commit_after>option(WITH_SWIG "Use swig to build python bindings" ON)

find_package(SWIG)
find_package(PythonLibs)

if (NOT SWIG_FOUND)
    message("SWIG not found: Python bindings will not be built")
elseif(NOT PYTHONLIBS_FOUND)
    message("Python not found: Python bindings will not be built")
elseif (WITH_SWIG)
    include(${SWIG_USE_FILE})
    include_directories(${PYTHON_INCLUDE_PATH})
    include_directories(${CMAKE_CURRENT_SOURCE_DIR})
    # Global swig flags

    if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.8)
        message("CMake version < 3.8: using legacy swig commands")
        set(CMAKE_SWIG_FLAGS "")
        swig_add_module(rina python rlite.i)
        set_source_files_properties(cdap.i PROPERTIES CPLUSPLUS ON)
        set_source_files_properties(cdap.i PROPERTIES SWIG_FLAGS "-c++")
        swig_add_module(cdap python cdap.i)
    else()
        swig_add_library(rina LANGUAGE python SOURCES rlite.i)
        set_property(SOURCE cdap.i PROPERTY CPLUSPLUS ON)
        swig_add_library(cdap LANGUAGE python SOURCES cdap.i)
    endif()

    # Hack for gcc8, where swigh code does not compile with the
    # stringop-truncation warning enabled.
    set_target_properties(${SWIG_MODULE_cdap_REAL_NAME} PROPERTIES COMPILE_FLAGS "-Wno-stringop-truncation")
    set_target_properties(${SWIG_MODULE_rina_REAL_NAME} PROPERTIES COMPILE_FLAGS "-Wno-stringop-truncation")

    # Tell the build system to link the _rina.so python module against
    # the librina-api.so library
    swig_link_libraries(rina ${PYTHON_LIBRARIES} rina-api)

    # Tell the build system to link the _cdap.so python module against
    # the librina-api.so library
    swig_link_libraries(cdap ${PYTHON_LIBRARIES} cdap)

    # Installation directives
{'fraction_non_alphanumeric': 0.07953144266337854, 'fraction_numerical': 0.0030826140567200987, 'mean_word_length': 4.158982511923688, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2620722', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1097, 'n_words': 266}