mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-23 04:20:47 +00:00
clean up
This commit is contained in:
parent
b42d3e431c
commit
2ac289685a
examples/device
hw/bsp
@ -1,10 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
include(CMakePrintHelpers)
|
||||
|
||||
# default toolchain is gcc
|
||||
if (NOT TOOLCHAIN)
|
||||
set(TOOLCHAIN "gcc")
|
||||
endif ()
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
@ -16,54 +10,54 @@ project(${PROJECT} C CXX ASM)
|
||||
# Checks this example is valid for the family and initializes the project
|
||||
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Other family such as rp2040
|
||||
if(NOT FAMILY STREQUAL "espressif")
|
||||
add_executable(${PROJECT})
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
else ()
|
||||
# TOP is absolute path to root directory of TinyUSB git repo
|
||||
set(TOP "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# re-include family.cmake
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
${TOP}/src/device/usbd.c
|
||||
${TOP}/src/device/usbd_control.c
|
||||
${TOP}/src/class/audio/audio_device.c
|
||||
${TOP}/src/class/cdc/cdc_device.c
|
||||
${TOP}/src/class/dfu/dfu_device.c
|
||||
${TOP}/src/class/dfu/dfu_rt_device.c
|
||||
${TOP}/src/class/hid/hid_device.c
|
||||
${TOP}/src/class/midi/midi_device.c
|
||||
${TOP}/src/class/msc/msc_device.c
|
||||
${TOP}/src/class/net/ecm_rndis_device.c
|
||||
${TOP}/src/class/net/ncm_device.c
|
||||
${TOP}/src/class/usbtmc/usbtmc_device.c
|
||||
${TOP}/src/class/vendor/vendor_device.c
|
||||
${TOP}/src/class/video/video_device.c
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${TOP}/hw
|
||||
${TOP}/src
|
||||
)
|
||||
|
||||
|
||||
endif ()
|
||||
# Espressif has its own cmake build system
|
||||
if(FAMILY STREQUAL "espressif")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT})
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
else ()
|
||||
# TOP is absolute path to root directory of TinyUSB git repo
|
||||
set(TOP "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
||||
get_filename_component(TOP "${TOP}" REALPATH)
|
||||
|
||||
# re-include family.cmake
|
||||
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
||||
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
${TOP}/src/device/usbd.c
|
||||
${TOP}/src/device/usbd_control.c
|
||||
${TOP}/src/class/audio/audio_device.c
|
||||
${TOP}/src/class/cdc/cdc_device.c
|
||||
${TOP}/src/class/dfu/dfu_device.c
|
||||
${TOP}/src/class/dfu/dfu_rt_device.c
|
||||
${TOP}/src/class/hid/hid_device.c
|
||||
${TOP}/src/class/midi/midi_device.c
|
||||
${TOP}/src/class/msc/msc_device.c
|
||||
${TOP}/src/class/net/ecm_rndis_device.c
|
||||
${TOP}/src/class/net/ncm_device.c
|
||||
${TOP}/src/class/usbtmc/usbtmc_device.c
|
||||
${TOP}/src/class/vendor/vendor_device.c
|
||||
${TOP}/src/class/video/video_device.c
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${TOP}/hw
|
||||
${TOP}/src
|
||||
)
|
||||
endif ()
|
||||
|
@ -5,11 +5,16 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
|
||||
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
project(${PROJECT})
|
||||
project(${PROJECT} C CXX ASM)
|
||||
|
||||
# Checks this example is valid for the family and initializes the project
|
||||
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Espressif has its own cmake build system
|
||||
if(FAMILY STREQUAL "espressif")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT})
|
||||
|
||||
# Example source
|
||||
|
@ -1,4 +1,11 @@
|
||||
if (NOT TARGET _family_support_marker)
|
||||
include(CMakePrintHelpers)
|
||||
|
||||
# Default to gcc
|
||||
if(NOT DEFINED TOOLCHAIN)
|
||||
set(TOOLCHAIN gcc)
|
||||
endif()
|
||||
|
||||
add_library(_family_support_marker INTERFACE)
|
||||
|
||||
if (NOT FAMILY)
|
||||
|
@ -1,5 +1,7 @@
|
||||
# toolchain set up, include before project()
|
||||
|
||||
|
||||
if (NOT TARGET ${PROJECT})
|
||||
# toolchain set up, include before project()
|
||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m7 CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/../../../cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
else ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user