diff options
author | dimitri staessens <[email protected]> | 2017-08-17 14:51:47 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-08-17 14:51:47 +0000 |
commit | c7cb10810c447579cb20a8bc99049baeeb8e2065 (patch) | |
tree | df6a08516b7215dddb024ab1e44f23121d616487 /src/ipcpd/shim-eth-llc/CMakeLists.txt | |
parent | 44327027e32f5853995984a5bad9869b443898ca (diff) | |
parent | db218bbe19b66a382df5f665981b7b16f1901bc9 (diff) | |
download | ouroboros-c7cb10810c447579cb20a8bc99049baeeb8e2065.tar.gz ouroboros-c7cb10810c447579cb20a8bc99049baeeb8e2065.zip |
Merged in dstaesse/ouroboros/be-llc-bpf (pull request #556)
Be llc bpf
Diffstat (limited to 'src/ipcpd/shim-eth-llc/CMakeLists.txt')
-rw-r--r-- | src/ipcpd/shim-eth-llc/CMakeLists.txt | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/src/ipcpd/shim-eth-llc/CMakeLists.txt b/src/ipcpd/shim-eth-llc/CMakeLists.txt index 12bfb42e..21003cf0 100644 --- a/src/ipcpd/shim-eth-llc/CMakeLists.txt +++ b/src/ipcpd/shim-eth-llc/CMakeLists.txt @@ -17,31 +17,54 @@ find_path(NETMAP_C_INCLUDE_DIR HINTS /usr/include /usr/local/include ) -protobuf_generate_c(SHIM_ETH_LLC_PROTO_SRCS SHIM_ETH_LLC_PROTO_HDRS - shim_eth_llc_messages.proto) - -set(IPCP_SHIM_ETH_LLC_TARGET ipcpd-shim-eth-llc - CACHE STRING "IPCP_SHIM_ETH_LLC_TARGET") - -set(SHIM_ETH_LLC_SOURCES - # Add source files here - ${CMAKE_CURRENT_SOURCE_DIR}/main.c) +find_path(BPF_C_INCLUDE_DIR + net/bpf.h + HINTS /usr/include /usr/local/include + ) -add_executable(ipcpd-shim-eth-llc ${SHIM_ETH_LLC_SOURCES} ${IPCP_SOURCES} - ${SHIM_ETH_LLC_PROTO_SRCS}) -target_link_libraries(ipcpd-shim-eth-llc LINK_PUBLIC ouroboros - ${PROTOBUF_C_LIBRARY}) +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND + NOT BPF_C_INCLUDE_DIR STREQUAL "BPF_C_INCLUDE_DIR-NOTFOUND") + message(STATUS "Found Berkeley Packet Filter headers in ${BPF_C_INCLUDE_DIR}") + set(HAVE_BPF "1" CACHE STRING "Have Berkeley Packet Filter") +endif () -if (NOT ${NETMAP_C_INCLUDE_DIR} STREQUAL "NETMAP_C_INCLUDE_DIR-NOTFOUND") +if (NOT NETMAP_C_INCLUDE_DIR STREQUAL "NETMAP_C_INCLUDE_DIR-NOTFOUND") message(STATUS "Found netmap headers in ${NETMAP_C_INCLUDE_DIR}") - include_directories(${NETMAP_C_INCLUDE_DIR}) set(HAVE_NETMAP "1" CACHE STRING "Have netmap") test_and_set_c_compiler_flag_global(-std=c99) endif () -include(AddCompileFlags) -if (CMAKE_BUILD_TYPE MATCHES Debug) - add_compile_flags(ipcpd-shim-eth-llc -DCONFIG_OUROBOROS_DEBUG) -endif (CMAKE_BUILD_TYPE MATCHES Debug) +if (HAVE_NETMAP OR HAVE_BPF OR CMAKE_SYSTEM_NAME STREQUAL "Linux") + message(STATUS "Supported raw Ethernet API found, building shim-eth-llc") + protobuf_generate_c(SHIM_ETH_LLC_PROTO_SRCS SHIM_ETH_LLC_PROTO_HDRS + shim_eth_llc_messages.proto) + + set(SHIM_ETH_LLC_SOURCES + # Add source files here + ${CMAKE_CURRENT_SOURCE_DIR}/main.c + ) + + set(IPCP_SHIM_ETH_LLC_TARGET ipcpd-shim-eth-llc + CACHE STRING "IPCP_SHIM_ETH_LLC_TARGET") + + add_executable(ipcpd-shim-eth-llc ${SHIM_ETH_LLC_SOURCES} ${IPCP_SOURCES} + ${SHIM_ETH_LLC_PROTO_SRCS}) + + if (HAVE_BPF AND NOT APPLE) + target_include_directories(ipcpd-shim-eth-llc PUBLIC ${BPF_C_INCLUDE_DIR}) + endif () + + if (HAVE_NETMAP AND NOT APPLE) + target_include_directories(ipcpd-shim-eth-llc PUBLIC ${NETMAP_C_INCLUDE_DIR}) + endif () -install(TARGETS ipcpd-shim-eth-llc RUNTIME DESTINATION sbin) + target_link_libraries(ipcpd-shim-eth-llc LINK_PUBLIC ouroboros + ${PROTOBUF_C_LIBRARY}) + + include(AddCompileFlags) + if (CMAKE_BUILD_TYPE MATCHES Debug) + add_compile_flags(ipcpd-shim-eth-llc -DCONFIG_OUROBOROS_DEBUG) + endif (CMAKE_BUILD_TYPE MATCHES Debug) + + install(TARGETS ipcpd-shim-eth-llc RUNTIME DESTINATION sbin) +endif () |