45 lines
1.1 KiB
CMake
Raw Normal View History

2021-01-23 00:59:50 +07:00
# use directory name for project id
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
# TOP is absolute path to root directory of TinyUSB git repo
set(TOP "../../..")
get_filename_component(TOP "${TOP}" REALPATH)
# 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-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-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
)
# Example defines
target_compile_definitions(${PROJECT} PUBLIC
CFG_TUSB_OS=OPT_OS_PICO
)
2021-01-24 00:44:17 +07:00
target_link_libraries(${PROJECT} pico_stdlib)
pico_add_extra_outputs(${PROJECT})
2021-01-24 00:12:20 +07:00
else()
message(FATAL_ERROR "Invalid FAMILY specified")
endif()