CMakeLists.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. cmake_minimum_required(VERSION 3.5)
  2. include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
  3. # Check for -DFAMILY=
  4. if(FAMILY MATCHES "^esp32s[2-3]")
  5. # use BOARD-Directory name for project id
  6. get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
  7. set(PROJECT ${BOARD}-${PROJECT})
  8. # TOP is absolute path to root directory of TinyUSB git repo
  9. set(TOP "../../..")
  10. get_filename_component(TOP "${TOP}" REALPATH)
  11. project(${PROJECT})
  12. else()
  13. # gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
  14. family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
  15. project(${PROJECT})
  16. # Checks this example is valid for the family and initializes the project
  17. family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
  18. add_executable(${PROJECT})
  19. # Example source
  20. target_sources(${PROJECT} PUBLIC
  21. ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
  22. )
  23. # Example include
  24. target_include_directories(${PROJECT} PUBLIC
  25. ${CMAKE_CURRENT_SOURCE_DIR}/src
  26. )
  27. # Configure compilation flags and libraries for the example... see the corresponding function
  28. # in hw/bsp/FAMILY/family.cmake for details.
  29. family_configure_device_example(${PROJECT})
  30. endif()