2
0

CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #
  2. # Copyright (C) 2006-2024 wolfSSL Inc.
  3. #
  4. # This file is part of wolfSSL.
  5. #
  6. # wolfSSL is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # wolfSSL is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  19. #
  20. # cmake for wolfssl
  21. #
  22. cmake_minimum_required(VERSION 3.5)
  23. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
  24. set(CMAKE_CURRENT_SOURCE_DIR ".")
  25. set(WOLFSSL_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
  26. set(INCLUDE_PATH ${WOLFSSL_ROOT})
  27. set(COMPONENT_SRCDIRS "./src/"
  28. "./wolfcrypt/src/"
  29. "./wolfcrypt/src/port/Espressif/"
  30. "./wolfcrypt/src/port/atmel/"
  31. "./wolfcrypt/benchmark/"
  32. "./wolfcrypt/test/"
  33. # "$ENV{IDF_PATH}/components/soc/esp32s3/include/soc"
  34. )
  35. set(COMPONENT_REQUIRES lwip)
  36. # RTOS_IDF_PATH is typically:
  37. # "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
  38. # depending on the environment, we may need to swap backslashes with forward slashes
  39. string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
  40. # ESP-IDF after version 4.4x has a different RTOS directory structure
  41. string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
  42. if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
  43. set(COMPONENT_ADD_INCLUDEDIRS
  44. "."
  45. "./include"
  46. "${RTOS_IDF_PATH5}"
  47. "${WOLFSSL_ROOT}"
  48. )
  49. else()
  50. set(COMPONENT_ADD_INCLUDEDIRS
  51. "."
  52. "./include"
  53. "${RTOS_IDF_PATH}"
  54. "${WOLFSSL_ROOT}"
  55. )
  56. endif()
  57. if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
  58. list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
  59. endif()
  60. set(COMPONENT_SRCEXCLUDE
  61. "./src/bio.c"
  62. "./src/conf.c"
  63. "./src/misc.c"
  64. "./src/pk.c"
  65. "./src/ssl_asn1.c" # included by ssl.c
  66. "./src/ssl_bn.c" # included by ssl.c
  67. "./src/ssl_certman.c" # included by ssl.c
  68. "./src/ssl_crypto.c" # included by ssl.c
  69. "./src/ssl_load.c" # included by ssl.c
  70. "./src/ssl_misc.c" # included by ssl.c
  71. "./src/ssl_p7p12.c" # included by ssl.c
  72. "./src/ssl_sess.c" # included by ssl.c
  73. "./src/x509.c"
  74. "./src/x509_str.c"
  75. "./wolfcrypt/src/evp.c"
  76. "./wolfcrypt/src/misc.c"
  77. )
  78. register_component()
  79. # check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
  80. if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
  81. message(STATUS "")
  82. message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
  83. message(STATUS "")
  84. endif()
  85. # end multiple component check