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) 63 64 65if (NOT WITH_VIRTIO_DRIVER) 66 add_definitions(-DVIRTIO_DRIVER_SUPPORT=0) 67else (NOT WITH_VIRTIO_DRIVER) 68 add_definitions(-DVIRTIO_DRIVER_SUPPORT=1) 69endif (NOT WITH_VIRTIO_DRIVER) 70 71if (NOT WITH_VIRTIO_DEVICE) 72 add_definitions(-DVIRTIO_DEVICE_SUPPORT=0) 73else (NOT WITH_VIRTIO_DEVICE) 74 add_definitions(-DVIRTIO_DEVICE_SUPPORT=1) 75endif (NOT WITH_VIRTIO_DEVICE) 76 77option (WITH_VIRTIO_MMIO_DRV "Build with virtio mmio driver support enabled" OFF) 78 79if (WITH_VIRTIO_MMIO_DRV) 80 add_definitions(-DWITH_VIRTIO_MMIO_DRV) 81endif (WITH_VIRTIO_MMIO_DRV) 82 83option (WITH_DCACHE "Build with all cache operations enabled" OFF) 84 85if (WITH_DCACHE) 86 add_definitions(-DVIRTIO_USE_DCACHE) 87endif (WITH_DCACHE) 88 89option (WITH_DCACHE_VRINGS "Build with vrings cache operations enabled" OFF) 90 91if (WITH_DCACHE_VRINGS) 92 add_definitions(-DVIRTIO_CACHED_VRINGS) 93 message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...) 94endif (WITH_DCACHE_VRINGS) 95 96option (WITH_DCACHE_BUFFERS "Build with buffers cache operations enabled" OFF) 97 98if (WITH_DCACHE_BUFFERS) 99 add_definitions(-DVIRTIO_CACHED_BUFFERS) 100 message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...) 101endif (WITH_DCACHE_BUFFERS) 102 103option (WITH_DCACHE_RSC_TABLE "Build with resource table cache operations enabled" OFF) 104 105if (WITH_DCACHE_RSC_TABLE) 106 add_definitions(-DVIRTIO_CACHED_RSC_TABLE) 107 message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...) 108endif (WITH_DCACHE_RSC_TABLE) 109 110# Set the complication flags 111set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") 112 113option (WITH_STATIC_LIB "Build with a static library" ON) 114 115if ("${PROJECT_SYSTEM}" STREQUAL "linux") 116 option (WITH_SHARED_LIB "Build with a shared library" ON) 117endif ("${PROJECT_SYSTEM}" STREQUAL "linux") 118 119if (WITH_ZEPHYR) 120 option (WITH_ZEPHYR_LIB "Build open-amp as a zephyr library" OFF) 121endif (WITH_ZEPHYR) 122 123option (WITH_LIBMETAL_FIND "Check Libmetal library can be found" ON) 124 125if (DEFINED RPMSG_BUFFER_SIZE) 126 add_definitions( -DRPMSG_BUFFER_SIZE=${RPMSG_BUFFER_SIZE} ) 127endif (DEFINED RPMSG_BUFFER_SIZE) 128 129option (WITH_DOC "Build with documentation" OFF) 130 131message ("-- C_FLAGS : ${CMAKE_C_FLAGS}") 132