GHS-MULTI-Determine.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #Setup Green Hills MULTI specific compilation information
  4. if(CMAKE_HOST_UNIX)
  5. set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
  6. else()
  7. set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
  8. endif()
  9. mark_as_advanced(GHS_OS_ROOT)
  10. set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
  11. mark_as_advanced(GHS_OS_DIR)
  12. set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
  13. mark_as_advanced(GHS_OS_DIR_OPTION)
  14. #set GHS_OS_DIR if not set by user
  15. if(NOT GHS_OS_DIR)
  16. if(EXISTS ${GHS_OS_ROOT})
  17. #get all directories in root directory
  18. FILE(GLOB GHS_CANDIDATE_OS_DIRS
  19. LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
  20. FILE(GLOB GHS_CANDIDATE_OS_FILES
  21. LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
  22. if(GHS_CANDIDATE_OS_FILES)
  23. list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
  24. endif ()
  25. #filter based on platform name
  26. if(GHS_TARGET_PLATFORM MATCHES "integrity")
  27. list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z]")
  28. else() #fall-back for standalone
  29. unset(GHS_CANDIDATE_OS_DIRS)
  30. set(GHS_OS_DIR "IGNORE")
  31. endif()
  32. if(GHS_CANDIDATE_OS_DIRS)
  33. list(SORT GHS_CANDIDATE_OS_DIRS)
  34. list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
  35. string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
  36. endif()
  37. #update cache with new value
  38. set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
  39. endif()
  40. endif()
  41. set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
  42. set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
  43. mark_as_advanced(GHS_CUSTOMIZATION)
  44. set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
  45. mark_as_advanced(GHS_GPJ_MACROS)