<commit_before>cmake_minimum_required(VERSION 2.8)

project(rinalite)

# Compiler checks
message(STATUS "C Compiler: ${CMAKE_C_COMPILER}")
message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}")

if(CMAKE_C_COMPILER STREQUAL "CMAKE_C_COMPILER-NOTFOUND")
	message(FATAL_ERROR "Cannot find C compiler")
endif()

if(CMAKE_CXX_COMPILER STREQUAL "CMAKE_CXX_COMPILER-NOTFOUND")
	message(FATAL_ERROR "Cannot find C++ compiler")
endif()

# Some globbing and headers include
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

file(GLOB RINA_HEADERS "include/rina/*.h")
file(GLOB UIPCP_GPB_PROTOFILES "user/uipcp-gpb/*.proto")

message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "INCLUDE_DIR: ${INCLUDE_DIR}")
message(STATUS "RINA HEADERS: ${RINA_HEADERS}")

add_definitions("-Wall")

include_directories(${INCLUDE_DIR})

# External dependencies
find_package(Threads REQUIRED)
find_package(Protobuf REQUIRED)

# Protocol buffer processing
protobuf_generate_cpp(CDAP_GPB_SRC CDAP_GPB_HDR user/CDAP.proto)
protobuf_generate_cpp(UIPCP_GPB_SRC UIPCP_GPB_HDR ${UIPCP_GPB_PROTOFILES})

# Libraries generated by the project
add_library(rinalite SHARED user/rinalite-utils.c user/rina-kernel-numtables.c user/rina-conf-numtables.c user/rinalite-evloop.c user/pending_queue.c user/rinalite-appl.c)
add_library(rinalite-cdap SHARED user/cdap.cpp ${CDAP_GPB_SRC} ${CDAP_GPB_HDR})
add_library(rinalite-conf SHARED user/rinalite-conf.c)
add_library(uipcp-rib STATIC user/uipcp-rib.cpp user/uipcp-codecs.cpp ${UIPCP_GPB_SRC} ${UIPCP_GPB_HDR})

target_link_libraries(rinalite ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(rinalite-cdap rinalite ${PROTOBUF_LIBRARY})
target_link_libraries(rinalite-conf rinalite)
target_link_libraries(uipcp-rib rinalite-cdap rinalite-conf)

message(STATUS "Adding include dir ${CMAKE_CURRENT_BINARY_DIR} to rinalite-cdap target")
target_include_directories(rinalite-cdap PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

# Executables generated by the project
add_executable(rinaperf user/rinaperf.c)
add_executable(rinalite-uipcps user/uipcp-container.c user/uipcp-unix.c)
add_executable(rina-config user/rina-config.c)
add_executable(test-cdap user/test-cdap.cpp)

target_link_libraries(rinaperf rinalite)
target_link_libraries(rinalite-uipcps rinalite rinalite-conf uipcp-rib)
target_link_libraries(rina-config rinalite rinalite-conf)
target_link_libraries(test-cdap rinalite-cdap)

# Installation directives
install(TARGETS rinaperf rinalite-uipcps rina-config DESTINATION usr/bin)
install(TARGETS rinalite rinalite-cdap rinalite-conf DESTINATION usr/lib)
install(FILES ${RINA_HEADERS} DESTINATION include/rina)
<commit_msg>cmake: add protobuf-compiler check<commit_after>cmake_minimum_required(VERSION 2.8)

project(rinalite)

# Compiler checks
message(STATUS "C Compiler: ${CMAKE_C_COMPILER}")
message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}")

if(CMAKE_C_COMPILER STREQUAL "CMAKE_C_COMPILER-NOTFOUND")
	message(FATAL_ERROR "Cannot find C compiler")
endif()

if(CMAKE_CXX_COMPILER STREQUAL "CMAKE_CXX_COMPILER-NOTFOUND")
	message(FATAL_ERROR "Cannot find C++ compiler")
endif()

# Some globbing and headers include
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

file(GLOB RINA_HEADERS "include/rina/*.h")
file(GLOB UIPCP_GPB_PROTOFILES "user/uipcp-gpb/*.proto")

message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "INCLUDE_DIR: ${INCLUDE_DIR}")
message(STATUS "RINA HEADERS: ${RINA_HEADERS}")

add_definitions("-Wall")

include_directories(${INCLUDE_DIR})

# External dependencies
find_package(Threads REQUIRED)
find_package(Protobuf REQUIRED)

if(PROTOBUF_PROTOC_EXECUTABLE STREQUAL "PROTOBUF_PROTOC_EXECUTABLE-NOTFOUND")
	message(FATAL_ERROR "Cannot find protocol buffer compiler")
endif()

# Protocol buffer processing
protobuf_generate_cpp(CDAP_GPB_SRC CDAP_GPB_HDR user/CDAP.proto)
protobuf_generate_cpp(UIPCP_GPB_SRC UIPCP_GPB_HDR ${UIPCP_GPB_PROTOFILES})

# Libraries generated by the project
add_library(rinalite SHARED user/rinalite-utils.c user/rina-kernel-numtables.c user/rina-conf-numtables.c user/rinalite-evloop.c user/pending_queue.c user/rinalite-appl.c)
add_library(rinalite-cdap SHARED user/cdap.cpp ${CDAP_GPB_SRC} ${CDAP_GPB_HDR})
add_library(rinalite-conf SHARED user/rinalite-conf.c)
add_library(uipcp-rib STATIC user/uipcp-rib.cpp user/uipcp-codecs.cpp ${UIPCP_GPB_SRC} ${UIPCP_GPB_HDR})

target_link_libraries(rinalite ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(rinalite-cdap rinalite ${PROTOBUF_LIBRARY})
target_link_libraries(rinalite-conf rinalite)
target_link_libraries(uipcp-rib rinalite-cdap rinalite-conf)

message(STATUS "Adding include dir ${CMAKE_CURRENT_BINARY_DIR} to rinalite-cdap target")
target_include_directories(rinalite-cdap PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

# Executables generated by the project
add_executable(rinaperf user/rinaperf.c)
add_executable(rinalite-uipcps user/uipcp-container.c user/uipcp-unix.c)
add_executable(rina-config user/rina-config.c)
add_executable(test-cdap user/test-cdap.cpp)

target_link_libraries(rinaperf rinalite)
target_link_libraries(rinalite-uipcps rinalite rinalite-conf uipcp-rib)
target_link_libraries(rina-config rinalite rinalite-conf)
target_link_libraries(test-cdap rinalite-cdap)

# Installation directives
install(TARGETS rinaperf rinalite-uipcps rina-config DESTINATION usr/bin)
install(TARGETS rinalite rinalite-cdap rinalite-conf DESTINATION usr/lib)
install(FILES ${RINA_HEADERS} DESTINATION include/rina)

{'fraction_non_alphanumeric': 0.1002729754322111, 'fraction_numerical': 0.0007279344858962694, 'mean_word_length': 8.74468085106383, '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': '3044752', 'n_tokens_mistral': 2190, 'n_tokens_neox': 2098, 'n_words': 342}