summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-04-21 18:10:28 +0700
committerhathach <[email protected]>2023-04-21 18:10:28 +0700
commit0afe1b36842c1542293e2133212aa0cfca9608c8 (patch)
tree599a851be7b71aabb7b44c2a9ee324f3756648fe /examples
parent2ac289685aa5a93ac56d0e5705d8067a1f751bc6 (diff)
example run well with cmake for imxrt
Diffstat (limited to 'examples')
-rw-r--r--examples/device/board_test/CMakeLists.txt39
-rw-r--r--examples/device/cdc_msc/CMakeLists.txt2
-rw-r--r--examples/device/msc_dual_lun/CMakeLists.txt21
3 files changed, 18 insertions, 44 deletions
diff --git a/examples/device/board_test/CMakeLists.txt b/examples/device/board_test/CMakeLists.txt
index 835d15488..c48efdaa5 100644
--- a/examples/device/board_test/CMakeLists.txt
+++ b/examples/device/board_test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.17)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
@@ -27,37 +27,6 @@ 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 ()
+# 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})
diff --git a/examples/device/cdc_msc/CMakeLists.txt b/examples/device/cdc_msc/CMakeLists.txt
index 43b81ce23..7eddc2422 100644
--- a/examples/device/cdc_msc/CMakeLists.txt
+++ b/examples/device/cdc_msc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.17)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
diff --git a/examples/device/msc_dual_lun/CMakeLists.txt b/examples/device/msc_dual_lun/CMakeLists.txt
index 9188ab06c..dc8d5512c 100644
--- a/examples/device/msc_dual_lun/CMakeLists.txt
+++ b/examples/device/msc_dual_lun/CMakeLists.txt
@@ -1,28 +1,33 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.17)
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
target_sources(${PROJECT} PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
- ${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk_dual.c
- ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
- )
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk_dual.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
# Example include
target_include_directories(${PROJECT} PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/src
- )
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.