CMakeLists.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright (c) 2023 HPMicro
  2. # SPDX-License-Identifier: BSD-3-Clause
  3. if(NOT DEFINED NX_INCLUDE_USER_DEFINE_FILE)
  4. sdk_compile_definitions(-DNX_INCLUDE_USER_DEFINE_FILE=1)
  5. endif()
  6. cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
  7. if(NOT DEFINED THREADX_ARCH)
  8. message(FATAL_ERROR "Error: THREADX_ARCH not defined")
  9. endif()
  10. if(NOT DEFINED THREADX_TOOLCHAIN)
  11. message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined")
  12. endif()
  13. if(${NXD_ENABLE_AZURE_IOT})
  14. message(STATUS "NXD_ENABLE_AZURE_IOT - defined")
  15. endif()
  16. # A place for generated/copied include files (no need to change)
  17. set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
  18. # Pick up the port specific stuff first
  19. if(DEFINED NETXDUO_CUSTOM_PORT)
  20. add_subdirectory(${NETXDUO_CUSTOM_PORT} netxduo_port)
  21. else()
  22. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
  23. endif()
  24. # Then the common files
  25. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
  26. # Check wether use default TCP ack N packets
  27. if (NOT DEFINED NETX_TCP_ACK_EVERY_N_PACKETS)
  28. sdk_compile_definitions(-DNX_TCP_ACK_EVERY_N_PACKETS=2)
  29. else()
  30. sdk_compile_definitions("-DNX_TCP_ACK_EVERY_N_PACKETS=${NETX_TCP_ACK_EVERY_N_PACKETS}")
  31. endif()
  32. # Pick up the apps directory containing the protocol and app-layer components
  33. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/addons)
  34. # Network security and crypto components
  35. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/crypto_libraries)
  36. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/nx_secure)
  37. # Utility components
  38. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/utility)
  39. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/hpmicro_driver)
  40. # If the user provided an override, copy it to the custom directory
  41. if (NOT NX_USER_FILE)
  42. message(STATUS "Using default nx_user.h file")
  43. set(NX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/common/inc/nx_user_sample.h)
  44. else()
  45. message(STATUS "Using custom nx_user.h file from ${NX_USER_FILE}")
  46. endif()
  47. # set include file path to place configure file
  48. set(generated_file_path "${__build_dir}/generated")
  49. set(CUSTOM_INC_DIR ${generated_file_path}/include)
  50. message(STATUS "copy nx_user.h to " ${CUSTOM_INC_DIR})
  51. configure_file(${NX_USER_FILE} ${CUSTOM_INC_DIR}/nx_user.h COPYONLY)
  52. sdk_inc(${CUSTOM_INC_DIR})