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