CMakeLists.txt 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. # "$ENV{IDF_PATH}/components/soc/esp32s3/include/soc"
  32. )
  33. set(COMPONENT_REQUIRES lwip)
  34. # RTOS_IDF_PATH is typically:
  35. # "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
  36. # depending on the environment, we may need to swap backslashes with forward slashes
  37. string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
  38. # ESP-IDF after version 4.4x has a different RTOS directory structure
  39. string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
  40. if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
  41. set(COMPONENT_ADD_INCLUDEDIRS
  42. "."
  43. "./include"
  44. "${RTOS_IDF_PATH5}"
  45. "${WOLFSSL_ROOT}"
  46. )
  47. else()
  48. set(COMPONENT_ADD_INCLUDEDIRS
  49. "."
  50. "./include"
  51. "${RTOS_IDF_PATH}"
  52. "${WOLFSSL_ROOT}"
  53. )
  54. endif()
  55. if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
  56. list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
  57. endif()
  58. set(COMPONENT_SRCEXCLUDE
  59. "./src/bio.c"
  60. "./src/conf.c"
  61. "./src/misc.c"
  62. "./src/pk.c"
  63. "./src/x509.c"
  64. "./src/x509_str.c"
  65. "./wolfcrypt/src/evp.c"
  66. "./wolfcrypt/src/misc.c"
  67. )
  68. register_component()
  69. # check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
  70. if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
  71. message(STATUS "")
  72. message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
  73. message(STATUS "")
  74. endif()
  75. # end multiple component check