X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2FCMakeLists.txt;h=d3f3eac3c053bd57d3c988e6f288f5007b7174f7;hb=18327be5d;hp=4f6ed67a3da3cf72caaac26336cc7483b39862c0;hpb=34931eb47124ef78a3aa9575930e848a78c9618b;p=vpp.git diff --git a/src/plugins/nat/CMakeLists.txt b/src/plugins/nat/CMakeLists.txt index 4f6ed67a3da..d3f3eac3c05 100644 --- a/src/plugins/nat/CMakeLists.txt +++ b/src/plugins/nat/CMakeLists.txt @@ -11,71 +11,187 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(CMAKE_VERBOSE_MAKEFILE ON) + +add_vpp_library(nat + SOURCES + lib/ipfix_logging.c + lib/nat_syslog.c + lib/alloc.c + + INSTALL_HEADERS + lib/ipfix_logging.h + lib/nat_syslog.h + lib/alloc.h +) + add_vpp_plugin(nat SOURCES nat.c - nat_api.c - in2out.c + nat44_api.c in2out_ed.c - out2in.c out2in_ed.c - nat_ipfix_logging.c - nat_det.c - nat_det_in2out.c - nat_det_out2in.c - nat_reass.c nat_dpo.c nat44_cli.c nat44_handoff.c nat44_hairpinning.c nat44_classify.c - nat64.c - nat64_cli.c - nat64_in2out.c - nat64_out2in.c - nat64_db.c - dslite_dpo.c - dslite.c - dslite_in2out.c - dslite_out2in.c - dslite_cli.c - dslite_ce_encap.c - dslite_ce_decap.c - nat66.c - nat66_cli.c - nat66_in2out.c - nat66_out2in.c nat_affinity.c nat_format.c - nat_syslog.c - nat_ha.c + nat44-ei/nat44_ei.c + nat44-ei/nat44_ei_ha.c + nat44-ei/nat44_ei_in2out.c + nat44-ei/nat44_ei_out2in.c MULTIARCH_SOURCES - dslite_ce_decap.c - dslite_ce_encap.c - dslite_in2out.c - dslite_out2in.c - in2out.c in2out_ed.c + out2in_ed.c nat44_classify.c nat44_hairpinning.c nat44_handoff.c - nat64_in2out.c - nat64_out2in.c - nat66_in2out.c - nat66_out2in.c - nat_det_in2out.c - nat_det_out2in.c - out2in.c - out2in_ed.c + nat44-ei/nat44_ei_in2out.c + nat44-ei/nat44_ei_out2in.c API_FILES - nat.api + nat44.api + nat_types.api - API_TEST_SOURCES - nat_test.c + LINK_LIBRARIES nat +) - INSTALL_HEADERS - nat_all_api_h.h - nat_msg_enum.h +add_vpp_plugin(dslite + SOURCES + dslite/dslite_api.c + dslite/dslite_dpo.c + dslite/dslite.c + dslite/dslite_in2out.c + dslite/dslite_out2in.c + dslite/dslite_cli.c + dslite/dslite_ce_encap.c + dslite/dslite_ce_decap.c + + MULTIARCH_SOURCES + dslite/dslite_ce_decap.c + dslite/dslite_ce_encap.c + dslite/dslite_in2out.c + dslite/dslite_out2in.c + + API_FILES + dslite/dslite.api + + LINK_LIBRARIES nat +) + +add_vpp_plugin(nat66 + SOURCES + nat66/nat66.c + nat66/nat66_cli.c + nat66/nat66_api.c + nat66/nat66_in2out.c + nat66/nat66_out2in.c + + MULTIARCH_SOURCES + nat66/nat66_in2out.c + nat66/nat66_out2in.c + + API_FILES + nat66/nat66.api + nat_types.api + + LINK_LIBRARIES nat +) + +add_vpp_plugin(det44 + SOURCES + det44/det44.c + det44/det44_cli.c + det44/det44_api.c + det44/det44_in2out.c + det44/det44_out2in.c + + MULTIARCH_SOURCES + det44/det44_in2out.c + det44/det44_out2in.c + + API_FILES + det44/det44.api + nat_types.api + + LINK_LIBRARIES nat +) + +add_vpp_plugin(nat64 + SOURCES + nat64/nat64.c + nat64/nat64_db.c + nat64/nat64_cli.c + nat64/nat64_api.c + nat64/nat64_in2out.c + nat64/nat64_out2in.c + + MULTIARCH_SOURCES + nat64/nat64_in2out.c + nat64/nat64_out2in.c + + API_FILES + nat64/nat64.api + nat_types.api + + LINK_LIBRARIES nat +) + +add_vpp_plugin(pnat + SOURCES + pnat/pnat.c + pnat/pnat_cli.c + pnat/pnat_api.c + pnat/pnat_node.c + + API_FILES + pnat/pnat.api +) + +# Unit tests +add_vpp_executable(test_pnat + SOURCES + pnat/pnat_test.c + pnat/pnat_node.c + pnat/pnat.c + ../../vnet/ip/ip_checksum.c + LINK_LIBRARIES vppinfra vlib + NO_INSTALL +) + +if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.13" AND "${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") + set(TARGET_NAME test_pnat) + set(COV_SOURCES ${CMAKE_SOURCE_DIR}/plugins/nat/pnat/pnat.c ${CMAKE_SOURCE_DIR}/plugins/nat/pnat/pnat_node.h ${CMAKE_SOURCE_DIR}/plugins/nat/pnat/pnat_node.c) + + message("Building with llvm Code Coverage Tools ${TARGET_NAME}") + target_compile_options(${TARGET_NAME} PRIVATE -fprofile-instr-generate -fcoverage-mapping) + target_link_options(${TARGET_NAME} PRIVATE -fprofile-instr-generate -fcoverage-mapping) + target_compile_options(${TARGET_NAME} PRIVATE -fsanitize=address) + target_link_options(${TARGET_NAME} PRIVATE -fsanitize=address) + + # llvm-cov + add_custom_target(${TARGET_NAME}-ccov-preprocessing + COMMAND LLVM_PROFILE_FILE=${TARGET_NAME}.profraw $ + COMMAND llvm-profdata merge -sparse ${TARGET_NAME}.profraw -o ${TARGET_NAME}.profdata + DEPENDS ${TARGET_NAME}) + + add_custom_target(${TARGET_NAME}-ccov-show + COMMAND llvm-cov show $ -instr-profile=${TARGET_NAME}.profdata -show-line-counts-or-regions ${COV_SOURCES} + DEPENDS ${TARGET_NAME}-ccov-preprocessing) + + add_custom_target(${TARGET_NAME}-ccov-report + COMMAND llvm-cov report -show-functions $ -instr-profile=${TARGET_NAME}.profdata ${COV_SOURCES} + DEPENDS ${TARGET_NAME}-ccov-preprocessing) + + add_custom_target(${TARGET_NAME}-ccov + COMMAND llvm-cov show $ -instr-profile=${TARGET_NAME}.profdata -show-line-counts-or-regions -output-dir=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET_NAME}-llvm-cov -format="html" ${COV_SOURCES} + DEPENDS ${TARGET_NAME}-ccov-preprocessing) + + add_custom_command(TARGET ${TARGET_NAME}-ccov POST_BUILD + COMMAND ; + COMMENT "Open ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET_NAME}-llvm-cov/index.html in your browser to view the coverage report." ) +endif()