1file(READ ${OPENAMP_ROOT_DIR}/VERSION ver)
2
3string(REGEX MATCH "VERSION_MAJOR = ([0-9]*)" _ ${ver})
4set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
5
6string(REGEX MATCH "VERSION_MINOR = ([0-9]*)" _ ${ver})
7set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_1})
8
9string(REGEX MATCH "VERSION_PATCH = ([0-9]*)" _ ${ver})
10set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_1})
11
12set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
13
14message(STATUS "open-amp version: ${PROJECT_VERSION} (${OPENAMP_ROOT_DIR})")
15
16if (NOT DEFINED CMAKE_BUILD_TYPE)
17  set (CMAKE_BUILD_TYPE Debug)
18endif (NOT DEFINED CMAKE_BUILD_TYPE)
19
20if (NOT CMAKE_INSTALL_LIBDIR)
21  set (CMAKE_INSTALL_LIBDIR "lib")
22endif (NOT CMAKE_INSTALL_LIBDIR)
23
24if (NOT CMAKE_INSTALL_BINDIR)
25  set (CMAKE_INSTALL_BINDIR "bin")
26endif (NOT CMAKE_INSTALL_BINDIR)
27
28set (_host "${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_HOST_SYSTEM_PROCESSOR}")
29message ("-- Host:    ${_host}")
30
31set (_target "${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
32message ("-- Target:  ${_target}")
33
34if (NOT DEFINED MACHINE)
35  set (MACHINE "Generic")
36endif (NOT DEFINED MACHINE)
37message ("-- Machine: ${MACHINE}")
38
39string (TOLOWER ${CMAKE_SYSTEM_NAME}      PROJECT_SYSTEM)
40string (TOUPPER ${CMAKE_SYSTEM_NAME}      PROJECT_SYSTEM_UPPER)
41string (TOLOWER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR)
42string (TOUPPER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR_UPPER)
43string (TOLOWER ${MACHINE}                PROJECT_MACHINE)
44string (TOUPPER ${MACHINE}                PROJECT_MACHINE_UPPER)
45
46# Select which components are in the openamp lib
47option (WITH_PROXY          "Build with proxy(access device controlled by other processor)" ON)
48option (WITH_APPS           "Build with sample applications" OFF)
49option (WITH_PROXY_APPS     "Build with proxy sample applications" OFF)
50if (WITH_APPS)
51  if (WITH_PROXY)
52    set (WITH_PROXY_APPS ON)
53  endif (WITH_PROXY)
54endif (WITH_APPS)
55
56# LOAD_FW only allowed for R5, otherwise turn off
57if (NOT ${MACHINE} STREQUAL "zynqmp_r5")
58 set (WITH_LOAD_FW OFF)
59endif(NOT ${MACHINE} STREQUAL "zynqmp_r5")
60
61option (WITH_VIRTIO_DRIVER "Build with virtio driver (front end)  enabled" ON)
62option (WITH_VIRTIO_DEVICE "Build with virtio device (back end)  enabled" ON)
63option (WITH_VIRTIO_MASTER "Build with virtio driver (front end)  enabled" OFF)
64option (WITH_VIRTIO_SLAVE "Build with virtio device (back end)  enabled" OFF)
65
66if (WITH_VIRTIO_MASTER)
67  message(DEPRECATION "deprecated cmake option replaced by WITH_VIRTIO_DRIVER" ...)
68endif (WITH_VIRTIO_MASTER)
69if (WITH_VIRTIO_SLAVE)
70  message(DEPRECATION "deprecated cmake option replaced by WITH_VIRTIO_DEVICE" ...)
71endif (WITH_VIRTIO_SLAVE)
72
73if (NOT WITH_VIRTIO_DRIVER AND NOT WITH_VIRTIO_MASTER)
74	add_definitions(-DVIRTIO_DEVICE_ONLY)
75endif (NOT WITH_VIRTIO_DRIVER AND NOT WITH_VIRTIO_MASTER)
76
77if (NOT WITH_VIRTIO_DEVICE AND NOT WITH_VIRTIO_SLAVE)
78	add_definitions(-DVIRTIO_DRIVER_ONLY)
79endif (NOT WITH_VIRTIO_DEVICE AND NOT WITH_VIRTIO_SLAVE)
80
81option (WITH_DCACHE_VRINGS "Build with vrings cache operations enabled" OFF)
82
83if (WITH_DCACHE_VRINGS)
84  add_definitions(-DVIRTIO_CACHED_VRINGS)
85endif (WITH_DCACHE_VRINGS)
86
87option (WITH_DCACHE_BUFFERS "Build with vrings cache operations enabled" OFF)
88
89if (WITH_DCACHE_BUFFERS)
90  add_definitions(-DVIRTIO_CACHED_BUFFERS)
91endif (WITH_DCACHE_BUFFERS)
92
93option (WITH_DCACHE_RSC_TABLE "Build with resource table cache operations enabled" OFF)
94
95if (WITH_DCACHE_RSC_TABLE)
96  add_definitions(-DVIRTIO_CACHED_RSC_TABLE)
97endif (WITH_DCACHE_RSC_TABLE)
98
99# Set the complication flags
100set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
101
102option (WITH_STATIC_LIB "Build with a static library" ON)
103
104if ("${PROJECT_SYSTEM}" STREQUAL "linux")
105  option (WITH_SHARED_LIB "Build with a shared library" ON)
106endif ("${PROJECT_SYSTEM}" STREQUAL "linux")
107
108if (WITH_ZEPHYR)
109  option (WITH_ZEPHYR_LIB "Build open-amp as a zephyr library" OFF)
110endif (WITH_ZEPHYR)
111
112option (WITH_LIBMETAL_FIND "Check Libmetal library can be found" ON)
113
114if (DEFINED RPMSG_BUFFER_SIZE)
115  add_definitions( -DRPMSG_BUFFER_SIZE=${RPMSG_BUFFER_SIZE} )
116endif (DEFINED RPMSG_BUFFER_SIZE)
117
118option (WITH_DOC "Build with documentation" OFF)
119
120message ("-- C_FLAGS : ${CMAKE_C_FLAGS}")
121