Make examples standalone buildable via CMake

This commit is contained in:
graham sanderson
2021-06-10 10:11:20 -05:00
parent b34724215b
commit fd7b18a4f6
26 changed files with 101 additions and 97 deletions

View File

@@ -1,20 +1,17 @@
cmake_minimum_required(VERSION 3.5)
# use BOARD-Directory name for project id
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(PROJECT ${BOARD}-${PROJECT})
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
# TOP is absolute path to root directory of TinyUSB git repo
set(TOP "../../..")
get_filename_component(TOP "${TOP}" REALPATH)
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
project(${PROJECT})
# Checks this example is valid for the family and initializes the project
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
# Check for -DFAMILY=
if(FAMILY MATCHES "^esp32s[2-3]")
cmake_minimum_required(VERSION 3.5)
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
project(${PROJECT})
else()
message(FATAL_ERROR "Invalid FAMILY specified: ${FAMILY}")
endif()