1cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) 2 3# Set up the project 4project(usbx 5 LANGUAGES C ASM 6) 7 8if(NOT DEFINED THREADX_ARCH) 9 message(FATAL_ERROR "Error: THREADX_ARCH not defined") 10endif() 11if(NOT DEFINED THREADX_TOOLCHAIN) 12 message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined") 13endif() 14 15# Define our target library and an alias for consumers 16add_library(${PROJECT_NAME}) 17add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME}) 18 19# Define any required dependencies between this library and others 20target_link_libraries(${PROJECT_NAME} PUBLIC 21 "azrtos::threadx" 22 "azrtos::filex" 23 "azrtos::netxduo" 24) 25 26# A place for generated/copied include files 27set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc) 28 29# Pick up the port specific stuff first 30if(DEFINED USBX_CUSTOM_PORT) 31 add_subdirectory(${USBX_CUSTOM_PORT} usbx_port) 32else() 33 add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN}) 34endif() 35 36# Then the common files 37add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common) 38 39 40 41 42# If the user provided an override, copy it to the custom directory 43if (NOT UX_USER_FILE) 44 message(STATUS "Using default ux_user.h file") 45 set(UX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/common/core/inc/ux_user_sample.h) 46else() 47 message(STATUS "Using custom ux_user.h file from ${UX_USER_FILE}") 48endif() 49configure_file(${UX_USER_FILE} ${CUSTOM_INC_DIR}/ux_user.h COPYONLY) 50target_include_directories(${PROJECT_NAME} 51 PUBLIC 52 ${CUSTOM_INC_DIR} 53) 54target_compile_definitions(${PROJECT_NAME} PUBLIC "UX_INCLUDE_USER_DEFINE_FILE" ) 55 56# Enable a build target that produces a ZIP file of all sources 57set(CPACK_SOURCE_GENERATOR "ZIP") 58set(CPACK_SOURCE_IGNORE_FILES 59 \\.git/ 60 \\.github/ 61 _build/ 62 \\.git 63 \\.gitattributes 64 \\.gitignore 65 ".*~$" 66) 67set(CPACK_VERBATIM_VARIABLES YES) 68include(CPack)