1cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
2
3# Set up the project
4project(threadx_smp
5    VERSION 6.0.0
6    LANGUAGES C ASM
7)
8
9if(NOT DEFINED THREADX_ARCH)
10    message(FATAL_ERROR "Error: THREADX_ARCH not defined")
11endif()
12if(NOT DEFINED THREADX_TOOLCHAIN)
13    message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined")
14endif()
15
16set(PROJECT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../..)
17
18# Define our target library and an alias for consumers
19add_library(${PROJECT_NAME})
20add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
21
22# A place for generated/copied include files (no need to change)
23set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
24
25# Pick up the port specific variables and apply them
26add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports_smp/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
27
28# Pick up the common stuff
29add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common_smp)
30
31
32
33
34# If the user provided an override, copy it to the custom directory
35if (NOT TX_USER_FILE)
36    message(STATUS "Using default tx_user.h file")
37    set(TX_USER_FILE ${PROJECT_DIR}/common_smp/inc/tx_user_sample.h)
38else()
39    message(STATUS "Using custom tx_user.h file from ${TX_USER_FILE}")
40endif()
41configure_file(${TX_USER_FILE} ${CUSTOM_INC_DIR}/tx_user.h COPYONLY)
42target_include_directories(${PROJECT_NAME}
43    PUBLIC
44    ${CUSTOM_INC_DIR}
45)
46target_compile_definitions(${PROJECT_NAME} PUBLIC "TX_INCLUDE_USER_DEFINE_FILE" )
47
48# Enable a build target that produces a ZIP file of all sources
49set(CPACK_SOURCE_GENERATOR "ZIP")
50set(CPACK_SOURCE_IGNORE_FILES
51  \\.git/
52  \\.github/
53  _build/
54  \\.git
55  \\.gitattributes
56  \\.gitignore
57  ".*~$"
58)
59set(CPACK_VERBATIM_VARIABLES YES)
60include(CPack)