CMakeLists.txt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
  2. # Set up the project
  3. project(filex
  4. LANGUAGES C ASM
  5. )
  6. option(FX_STANDALONE_ENABLE "Enable Filex in standalone mode" OFF)
  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. if(NOT FX_STANDALONE_ENABLE)
  18. target_link_libraries(${PROJECT_NAME} PUBLIC
  19. "azrtos::threadx"
  20. )
  21. endif()
  22. # A place for generated/copied include files (no need to change)
  23. set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
  24. # Pick up the port specific stuff first
  25. if(DEFINED FILEX_CUSTOM_PORT)
  26. add_subdirectory(${FILEX_CUSTOM_PORT} filex_port)
  27. else()
  28. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
  29. endif()
  30. # Then the common files
  31. add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
  32. # Include the user's override file if required
  33. if (NOT FX_USER_FILE)
  34. message(STATUS "Using default fx_user.h file")
  35. set(FX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/common/inc/fx_user_sample.h)
  36. else()
  37. message(STATUS "Using custom fx_user.h file from ${FX_USER_FILE}")
  38. endif()
  39. configure_file(${FX_USER_FILE} ${CUSTOM_INC_DIR}/fx_user.h COPYONLY)
  40. target_include_directories(${PROJECT_NAME}
  41. PUBLIC
  42. ${CUSTOM_INC_DIR}
  43. )
  44. if(NOT FX_STANDALONE_ENABLE)
  45. target_compile_definitions(${PROJECT_NAME} PUBLIC "FX_INCLUDE_USER_DEFINE_FILE" )
  46. else()
  47. target_compile_definitions(${PROJECT_NAME} PUBLIC "FX_INCLUDE_USER_DEFINE_FILE" -DFX_STANDALONE_ENABLE)
  48. endif()
  49. # Enable a build target that produces a ZIP file of all sources
  50. set(CPACK_SOURCE_GENERATOR "ZIP")
  51. set(CPACK_SOURCE_IGNORE_FILES
  52. \\.git/
  53. \\.github/
  54. _build/
  55. \\.git
  56. \\.gitattributes
  57. \\.gitignore
  58. ".*~$"
  59. )
  60. set(CPACK_VERBATIM_VARIABLES YES)
  61. include(CPack)