1 2set_property (GLOBAL PROPERTY "PROJECT_LIB_EXTRA_CFLAGS") 3 4collector_create (PROJECT_LIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}") 5collect (PROJECT_LIB_DIRS "${CMAKE_CURRENT_BINARY_DIR}") 6collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include") 7collect (PROJECT_LIB_SOURCES version.c) 8 9 10add_subdirectory (virtio) 11add_subdirectory (rpmsg) 12add_subdirectory (remoteproc) 13if (WITH_VIRTIO_MMIO_DRV) 14add_subdirectory (virtio_mmio) 15endif (WITH_VIRTIO_MMIO_DRV) 16 17if (WITH_PROXY) 18 add_subdirectory (proxy) 19 add_subdirectory (service/rpmsg/rpc) 20endif (WITH_PROXY) 21 22set (OPENAMP_LIB open_amp) 23 24configure_file(version.h.in ${PROJECT_BINARY_DIR}/include/generated/openamp/version_def.h) 25collect (PROJECT_INC_DIRS " ${PROJECT_BINARY_DIR}/include/generated/openamp") 26 27if (NOT CMAKE_INSTALL_LIBDIR) 28 set (CMAKE_INSTALL_LIBDIR "lib") 29endif (NOT CMAKE_INSTALL_LIBDIR) 30 31collector_list (_include PROJECT_INC_DIRS) 32include_directories (${_include}) 33 34collector_list (_deps PROJECT_LIB_DEPS) 35 36get_property (_ecflags GLOBAL PROPERTY "PROJECT_LIB_EXTRA_CFLAGS") 37 38collector_list (_sources PROJECT_LIB_SOURCES) 39set_property (SOURCE ${_sources} 40 APPEND_STRING PROPERTY COMPILE_FLAGS " ${_ecflags}") 41 42# Build a shared library if so configured. 43if (WITH_ZEPHYR) 44 zephyr_library_named(${OPENAMP_LIB}) 45 add_dependencies(${ZEPHYR_CURRENT_LIBRARY} ${OFFSETS_H_TARGET}) 46 zephyr_library_sources(${_sources}) 47 zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 48else (WITH_ZEPHYR) 49 if (WITH_SHARED_LIB) 50 set (_lib ${OPENAMP_LIB}-shared) 51 add_library (${_lib} SHARED ${_sources}) 52 target_link_libraries (${_lib} ${_deps}) 53 install (TARGETS ${_lib} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) 54 set_target_properties (${_lib} PROPERTIES 55 OUTPUT_NAME "${OPENAMP_LIB}" 56 VERSION "${PROJECT_VERSION}" 57 SOVERSION "${PROJECT_VERSION_MAJOR}" 58 ) 59 endif (WITH_SHARED_LIB) 60 61 if (WITH_STATIC_LIB) 62 set (_lib ${OPENAMP_LIB}-static) 63 add_library (${_lib} STATIC ${_sources}) 64 install (TARGETS ${_lib} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 65 set_target_properties (${_lib} PROPERTIES 66 OUTPUT_NAME "${OPENAMP_LIB}" 67 ) 68 endif (WITH_STATIC_LIB) 69endif (WITH_ZEPHYR) 70 71install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/openamp" DESTINATION include) 72install (DIRECTORY "${PROJECT_BINARY_DIR}/include/generated/openamp" DESTINATION include) 73