2021-01-22 18:59:50 +01:00
|
|
|
# use directory name for project id
|
|
|
|
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
2021-01-26 06:46:24 +01:00
|
|
|
set(PROJECT ${BOARD}-${PROJECT})
|
2021-01-22 18:59:50 +01:00
|
|
|
|
2020-04-07 08:42:48 +02:00
|
|
|
# TOP is absolute path to root directory of TinyUSB git repo
|
|
|
|
set(TOP "../../..")
|
|
|
|
get_filename_component(TOP "${TOP}" REALPATH)
|
|
|
|
|
2021-01-22 08:58:32 +01:00
|
|
|
# Check for -DFAMILY=
|
2021-01-23 18:12:20 +01:00
|
|
|
if(FAMILY STREQUAL "esp32s2")
|
2021-01-23 18:44:17 +01:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
2021-03-18 13:53:39 +01:00
|
|
|
|
2021-01-23 18:12:20 +01:00
|
|
|
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
|
|
|
project(${PROJECT})
|
2021-01-22 18:12:10 +01:00
|
|
|
|
2021-01-23 18:12:20 +01:00
|
|
|
elseif(FAMILY STREQUAL "rp2040")
|
2021-01-23 18:44:17 +01:00
|
|
|
cmake_minimum_required(VERSION 3.12)
|
2021-03-18 13:53:39 +01:00
|
|
|
|
2021-04-11 08:37:07 +02:00
|
|
|
include(${TOP}/hw/bsp/${FAMILY}/pico_sdk_import.cmake)
|
2021-01-23 18:44:17 +01:00
|
|
|
project(${PROJECT})
|
|
|
|
add_executable(${PROJECT})
|
|
|
|
|
2021-01-23 18:12:20 +01:00
|
|
|
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
2021-01-22 18:12:10 +01:00
|
|
|
|
2021-01-23 18:12:20 +01:00
|
|
|
# Example source
|
|
|
|
target_sources(${PROJECT} PUBLIC
|
2021-01-23 18:44:17 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
2021-01-23 18:12:20 +01:00
|
|
|
)
|
2021-01-22 18:59:50 +01:00
|
|
|
|
2021-01-23 18:12:20 +01:00
|
|
|
# Example include
|
|
|
|
target_include_directories(${PROJECT} PUBLIC
|
2021-01-23 18:44:17 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
2021-01-23 18:12:20 +01:00
|
|
|
)
|
2021-01-22 18:12:10 +01:00
|
|
|
|
2021-01-25 07:28:23 +01:00
|
|
|
# Example defines
|
|
|
|
target_compile_definitions(${PROJECT} PUBLIC
|
|
|
|
CFG_TUSB_OS=OPT_OS_PICO
|
|
|
|
)
|
|
|
|
|
2021-01-23 18:12:20 +01:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
2021-01-22 18:12:10 +01:00
|
|
|
endif()
|