-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathBoard.cmake
56 lines (46 loc) · 1.59 KB
/
Board.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
include(Utils)
set(WITH_BOARD_REVISION CACHE STRING "Board revision" )
function(add_board_subdirectory)
if(NOT ${ARGV0} STREQUAL "")
set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/${ARGV0})
else()
set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()
if(NOT DEFINED BOARD)
message(FATAL_ERROR "Board is not defined")
endif()
if (${BOARD} STREQUAL "bellpx" OR ${BOARD} STREQUAL "puretx")
add_subdirectory_if_exists(${ROOT_DIR}/rt1051)
elseif (${BOARD} STREQUAL "linux")
add_subdirectory_if_exists(${ROOT_DIR}/${BOARD})
else ()
message(FATAL_ERROR "Board unsupported")
endif ()
endfunction()
macro(select_board)
if(NOT DEFINED PRODUCT)
message(FATAL_ERROR "Cannot determine board without knowing the product")
endif()
set(BOARD_REVISION 1)
if(${PROJECT_TARGET} STREQUAL "TARGET_Linux")
set(BOARD linux)
elseif(${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
if(${PRODUCT} STREQUAL "PurePhone")
set(BOARD puretx)
set(BOARD_REVISION 7)
elseif(${PRODUCT} STREQUAL "BellHybrid")
set(BOARD bellpx)
else()
message(FATAL_ERROR "Unknown product: ${PRODUCT}")
endif()
else()
message(FATAL_ERROR "Unsupported target: ${PROJECT_TARGET}")
endif()
# overwrite board revision with user selection
if(NOT "${WITH_BOARD_REVISION}" STREQUAL "")
set(BOARD_REVISION ${WITH_BOARD_REVISION})
endif()
if("${BOARD}" STREQUAL "")
message(FATAL_ERROR "Cannot determine board selection.")
endif()
endmacro()