CMakeLists.txt 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #
  2. # Copyright (C) 2006-2022 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_misc.c" # included by ssl.c
  66. "./src/x509.c"
  67. "./src/x509_str.c"
  68. "./wolfcrypt/src/evp.c"
  69. "./wolfcrypt/src/misc.c"
  70. )
  71. register_component()
  72. # check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
  73. if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
  74. message(STATUS "")
  75. message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
  76. message(STATUS "")
  77. endif()
  78. # end multiple component check