CMakeLists.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
  2. # Set up the project
  3. project(guix
  4. VERSION 6.0.0
  5. LANGUAGES C ASM
  6. )
  7. if(NOT DEFINED THREADX_ARCH)
  8. message(FATAL_ERROR "Error: THREADX_ARCH not defined")
  9. endif()
  10. if(NOT DEFINED THREADX_TOOLCHAIN)
  11. message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined")
  12. endif()
  13. # Define our target library and an alias for consumers
  14. add_library(${PROJECT_NAME})
  15. add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
  16. # Define any required dependencies between this library and others
  17. target_link_libraries(${PROJECT_NAME} PUBLIC
  18. "azrtos::threadx"
  19. )
  20. # A place for generated/copied include files (no need to change)
  21. set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
  22. # Pick up the port specific stuff first
  23. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
  24. # Then the common files
  25. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
  26. # Include the user's override file if required
  27. if (NOT GX_USER_FILE)
  28. message(STATUS "Using default gx_user.h file")
  29. set(GX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/common/inc/gx_user_sample.h)
  30. else()
  31. message(STATUS "Using custom gx_user.h file from ${GX_USER_FILE}")
  32. endif()
  33. configure_file(${GX_USER_FILE} ${CUSTOM_INC_DIR}/gx_user.h COPYONLY)
  34. target_include_directories(${PROJECT_NAME}
  35. PUBLIC
  36. ${CUSTOM_INC_DIR}
  37. )
  38. target_compile_definitions(${PROJECT_NAME} PUBLIC "GX_INCLUDE_USER_DEFINE_FILE" )
  39. # Enable a build target that produces a ZIP file of all sources
  40. set(CPACK_SOURCE_GENERATOR "ZIP")
  41. set(CPACK_SOURCE_IGNORE_FILES
  42. \\.git/
  43. \\.github/
  44. _build/
  45. \\.git
  46. \\.gitattributes
  47. \\.gitignore
  48. ".*~$"
  49. )
  50. set(CPACK_VERBATIM_VARIABLES YES)
  51. include(CPack)