From 2a14e7c98b2e22ef5668df0aadf181d04c4c852e Mon Sep 17 00:00:00 2001 From: Tanmay Shah Date: Thu, 13 Jun 2024 07:28:08 -0700 Subject: [PATCH] examples: legacy_apps: build success demos - Remove version control information - Add cmake infra to find open_amp library - fix open_amp and libmetal library linking Signed-off-by: Tanmay Shah --- examples/legacy_apps/CMakeLists.txt | 31 ++++- examples/legacy_apps/cmake/collect.cmake | 38 ++++++ examples/legacy_apps/cmake/depends.cmake | 32 +++++ .../cmake/modules/FindLibmetal.cmake | 31 +++++ .../cmake/modules/Findopen_amp.cmake | 30 +++++ examples/legacy_apps/cmake/options.cmake | 118 ++++++++++++++++++ .../cmake/platforms/cross_generic_gcc.cmake | 11 ++ .../cmake/platforms/cross_linux_gcc.cmake | 7 ++ .../cmake/platforms/zynq7_generic.cmake | 6 + .../cmake/platforms/zynq7_linux.cmake | 4 + .../cmake/platforms/zynqmp_a53_generic.cmake | 4 + .../cmake/platforms/zynqmp_linux.cmake | 5 + .../cmake/platforms/zynqmp_r5_generic.cmake | 8 ++ examples/legacy_apps/cmake/syscheck.cmake | 13 ++ .../legacy_apps/examples/echo/CMakeLists.txt | 8 +- .../examples/linux_rpc_demo/CMakeLists.txt | 8 +- .../examples/load_fw/CMakeLists.txt | 1 + .../examples/matrix_multiply/CMakeLists.txt | 8 +- .../examples/nocopy_echo/CMakeLists.txt | 9 +- .../examples/rpc_demo/CMakeLists.txt | 7 +- .../examples/rpmsg_sample_echo/CMakeLists.txt | 8 +- examples/legacy_apps/tests/msg/CMakeLists.txt | 8 +- 22 files changed, 370 insertions(+), 25 deletions(-) create mode 100644 examples/legacy_apps/cmake/collect.cmake create mode 100644 examples/legacy_apps/cmake/depends.cmake create mode 100644 examples/legacy_apps/cmake/modules/FindLibmetal.cmake create mode 100644 examples/legacy_apps/cmake/modules/Findopen_amp.cmake create mode 100644 examples/legacy_apps/cmake/options.cmake create mode 100644 examples/legacy_apps/cmake/platforms/cross_generic_gcc.cmake create mode 100644 examples/legacy_apps/cmake/platforms/cross_linux_gcc.cmake create mode 100644 examples/legacy_apps/cmake/platforms/zynq7_generic.cmake create mode 100644 examples/legacy_apps/cmake/platforms/zynq7_linux.cmake create mode 100644 examples/legacy_apps/cmake/platforms/zynqmp_a53_generic.cmake create mode 100644 examples/legacy_apps/cmake/platforms/zynqmp_linux.cmake create mode 100644 examples/legacy_apps/cmake/platforms/zynqmp_r5_generic.cmake create mode 100644 examples/legacy_apps/cmake/syscheck.cmake diff --git a/examples/legacy_apps/CMakeLists.txt b/examples/legacy_apps/CMakeLists.txt index d918256..9eb35cc 100644 --- a/examples/legacy_apps/CMakeLists.txt +++ b/examples/legacy_apps/CMakeLists.txt @@ -1,13 +1,36 @@ +cmake_minimum_required (VERSION 3.0.2) +if (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) +endif() + +if (POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() + +set (APPS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set (APPS_SHARE_DIR "${CMAKE_CURRENT_BINARY_DIR}/share") + +list (APPEND CMAKE_MODULE_PATH + "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms") + +include (syscheck) +project (osr_legacy_apps C) + +include (CheckIncludeFiles) +include (CheckCSourceCompiles) +include (collect) +include (options) +include (depends) +enable_testing () + collector_create (APP_COMMON_SOURCES "") collector_create (APP_LIB_DIRS "") collector_create (APP_INC_DIRS "") collector_create (APP_LIB_DEPS "") collector_create (APP_EXTRA_C_FLAGS "") -set (APPS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -set (APPS_SHARE_DIR "${CMAKE_CURRENT_BINARY_DIR}/share") - collect (APP_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include") add_subdirectory (machine) diff --git a/examples/legacy_apps/cmake/collect.cmake b/examples/legacy_apps/cmake/collect.cmake new file mode 100644 index 0000000..9c3e495 --- /dev/null +++ b/examples/legacy_apps/cmake/collect.cmake @@ -0,0 +1,38 @@ +function (collector_create name base) + set_property (GLOBAL PROPERTY "COLLECT_${name}_LIST") + set_property (GLOBAL PROPERTY "COLLECT_${name}_BASE" "${base}") +endfunction (collector_create) + +function (collector_list var name) + get_property (_list GLOBAL PROPERTY "COLLECT_${name}_LIST") + set (${var} "${_list}" PARENT_SCOPE) +endfunction (collector_list) + +function (collector_base var name) + get_property (_base GLOBAL PROPERTY "COLLECT_${name}_BASE") + set (${var} "${_base}" PARENT_SCOPE) +endfunction (collector_base) + +function (collect name) + collector_base (_base ${name}) + string(COMPARE NOTEQUAL "${_base}" "" _is_rel) + set (_list) + foreach (s IN LISTS ARGN) + if (_is_rel) + get_filename_component (s "${s}" ABSOLUTE) + file (RELATIVE_PATH s "${_base}" "${s}") + else (_is_rel) + get_filename_component (ts "${s}" ABSOLUTE) + if (EXISTS "${ts}") + set (s "${ts}") + endif (EXISTS "${ts}") + endif (_is_rel) + list (APPEND _list "${s}") + endforeach () + set_property (GLOBAL APPEND PROPERTY "COLLECT_${name}_LIST" "${_list}") +endfunction (collect) + +# Create global collectors +collector_create (PROJECT_INC_DIRS "") +collector_create (PROJECT_LIB_DIRS "") +collector_create (PROJECT_LIB_DEPS "") diff --git a/examples/legacy_apps/cmake/depends.cmake b/examples/legacy_apps/cmake/depends.cmake new file mode 100644 index 0000000..98c697c --- /dev/null +++ b/examples/legacy_apps/cmake/depends.cmake @@ -0,0 +1,32 @@ +if (WITH_DOC) + find_package (Doxygen) +endif (WITH_DOC) + +if (WITH_LIBMETAL_FIND) + find_package (Libmetal REQUIRED) + collect (PROJECT_INC_DIRS "${LIBMETAL_INCLUDE_DIR}") + collect (PROJECT_LIB_DIRS "${LIBMETAL_LIB_DIR}") + collect (PROJECT_LIB_DEPS "${LIBMETAL_LIB}") +endif (WITH_LIBMETAL_FIND) + +if (WITH_OPENAMP_FIND) + find_package (open_amp REQUIRED) + collect (PROJECT_INC_DIRS "${OPENAMP_INCLUDE_DIR}") + collect (PROJECT_LIB_DIRS "${OPENAMP_LIB_DIR}") + collect (PROJECT_LIB_DEPS "${OPENAMP_LIB}") + endif (WITH_OPENAMP_FIND) + +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + check_include_files (stdatomic.h HAVE_STDATOMIC_H) + check_include_files (fcntl.h HAVE_FCNTL_H) +else ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set (_saved_cmake_required_flags ${CMAKE_REQUIRED_FLAGS}) + set (CMAKE_REQUIRED_FLAGS "-c") + check_include_files (stdatomic.h HAVE_STDATOMIC_H) + check_include_files (fcntl.h HAVE_FCNTL_H) + set (CMAKE_REQUIRED_FLAGS ${_saved_cmake_required_flags}) +endif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + +if (NOT HAVE_FCNTL_H) + unset (WITH_PROXY CACHE) +endif (NOT HAVE_FCNTL_H) diff --git a/examples/legacy_apps/cmake/modules/FindLibmetal.cmake b/examples/legacy_apps/cmake/modules/FindLibmetal.cmake new file mode 100644 index 0000000..7f7719a --- /dev/null +++ b/examples/legacy_apps/cmake/modules/FindLibmetal.cmake @@ -0,0 +1,31 @@ +# FindLibmetal +# -------- +# +# Find Libmetal +# +# Find the native Libmetal includes and library this module defines +# +# :: +# +# LIBMETAL_INCLUDE_DIR, where to find metal/sysfs.h, etc. +# LIBSYSFS_LIB_DIR, where to find libmetal library. + +# FIX ME, CMAKE_FIND_ROOT_PATH doesn't work +# even use the following +# set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) +# set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) +# set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) +find_path(LIBMETAL_INCLUDE_DIR NAMES metal/sys.h PATHS ${CMAKE_FIND_ROOT_PATH}) +find_library(LIBMETAL_LIB NAMES metal PATHS ${CMAKE_FIND_ROOT_PATH}) +get_filename_component(LIBMETAL_LIB_DIR ${LIBMETAL_LIB} DIRECTORY) + +# handle the QUIETLY and REQUIRED arguments and set HUGETLBFS_FOUND to TRUE if +# all listed variables are TRUE +include (FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS (Libmetal DEFAULT_MSG LIBMETAL_LIB LIBMETAL_INCLUDE_DIR) + +if (LIBMETAL_FOUND) + set (LIBMETAL_LIBS ${LIBMETAL_LIB}) +endif (LIBMETAL_FOUND) + +mark_as_advanced (LIBMETAL_LIB LIBMETAL_INCLUDE_DIR LIBMETAL_LIB_DIR) diff --git a/examples/legacy_apps/cmake/modules/Findopen_amp.cmake b/examples/legacy_apps/cmake/modules/Findopen_amp.cmake new file mode 100644 index 0000000..c0bdbb9 --- /dev/null +++ b/examples/legacy_apps/cmake/modules/Findopen_amp.cmake @@ -0,0 +1,30 @@ +# Finidopen_amp +# -------- +# +# Find open_amp +# +# Find the native open_amp includes and library this module defines +# +# :: +# +# OPENAMP_INCLUDE_DIR, where to find metal/sysfs.h, etc. + +# FIX ME, CMAKE_FIND_ROOT_PATH doesn't work +# even use the following +# set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) +# set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) +# set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) +find_path(OPENAMP_INCLUDE_DIR NAMES openamp/ PATHS ${CMAKE_FIND_ROOT_PATH}) +find_library(OPENAMP_LIB NAMES open_amp PATHS ${CMAKE_FIND_ROOT_PATH}) +get_filename_component(OPENAMP_LIB_DIR ${OPENAMP_LIB} DIRECTORY) + +# handle the QUIETLY and REQUIRED arguments and set HUGETLBFS_FOUND to TRUE if +# all listed variables are TRUE +include (FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS (open_amp DEFAULT_MSG OPENAMP_LIB OPENAMP_INCLUDE_DIR) + +if (OPENAMP_FOUND) + set (OPENAMP_LIBS ${OPENAMP_LIB}) +endif (OPENAMP_FOUND) + +mark_as_advanced (OPENAMP_LIB OPENAMP_INCLUDE_DIR OPENAMP_LIB_DIR) diff --git a/examples/legacy_apps/cmake/options.cmake b/examples/legacy_apps/cmake/options.cmake new file mode 100644 index 0000000..5d036bb --- /dev/null +++ b/examples/legacy_apps/cmake/options.cmake @@ -0,0 +1,118 @@ +if (NOT DEFINED CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE Debug) +endif (NOT DEFINED CMAKE_BUILD_TYPE) + +if (NOT CMAKE_INSTALL_LIBDIR) + set (CMAKE_INSTALL_LIBDIR "lib") +endif (NOT CMAKE_INSTALL_LIBDIR) + +if (NOT CMAKE_INSTALL_BINDIR) + set (CMAKE_INSTALL_BINDIR "bin") +endif (NOT CMAKE_INSTALL_BINDIR) + +set (_host "${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_HOST_SYSTEM_PROCESSOR}") +message ("-- Host: ${_host}") + +set (_target "${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}") +message ("-- Target: ${_target}") + +if (NOT DEFINED MACHINE) + set (MACHINE "Generic") +endif (NOT DEFINED MACHINE) +message ("-- Machine: ${MACHINE}") + +string (TOLOWER ${CMAKE_SYSTEM_NAME} PROJECT_SYSTEM) +string (TOUPPER ${CMAKE_SYSTEM_NAME} PROJECT_SYSTEM_UPPER) +string (TOLOWER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR) +string (TOUPPER ${CMAKE_SYSTEM_PROCESSOR} PROJECT_PROCESSOR_UPPER) +string (TOLOWER ${MACHINE} PROJECT_MACHINE) +string (TOUPPER ${MACHINE} PROJECT_MACHINE_UPPER) + +# Select which components are in the openamp lib +option (WITH_PROXY "Build with proxy(access device controlled by other processor)" ON) +option (WITH_APPS "Build with sample applications" OFF) +option (WITH_PROXY_APPS "Build with proxy sample applications" OFF) +if (WITH_APPS) + if (WITH_PROXY) + set (WITH_PROXY_APPS ON) + endif (WITH_PROXY) +endif (WITH_APPS) + +# LOAD_FW only allowed for R5, otherwise turn off +if (NOT ${MACHINE} STREQUAL "zynqmp_r5") + set (WITH_LOAD_FW OFF) +endif(NOT ${MACHINE} STREQUAL "zynqmp_r5") + +option (WITH_VIRTIO_DRIVER "Build with virtio driver (front end) enabled" ON) +option (WITH_VIRTIO_DEVICE "Build with virtio device (back end) enabled" ON) + + +if (NOT WITH_VIRTIO_DRIVER) + add_definitions(-DVIRTIO_DRIVER_SUPPORT=0) +else (NOT WITH_VIRTIO_DRIVER) + add_definitions(-DVIRTIO_DRIVER_SUPPORT=1) +endif (NOT WITH_VIRTIO_DRIVER) + +if (NOT WITH_VIRTIO_DEVICE) + add_definitions(-DVIRTIO_DEVICE_SUPPORT=0) +else (NOT WITH_VIRTIO_DEVICE) + add_definitions(-DVIRTIO_DEVICE_SUPPORT=1) +endif (NOT WITH_VIRTIO_DEVICE) + +option (WITH_VIRTIO_MMIO_DRV "Build with virtio mmio driver support enabled" OFF) + +if (WITH_VIRTIO_MMIO_DRV) + add_definitions(-DWITH_VIRTIO_MMIO_DRV) +endif (WITH_VIRTIO_MMIO_DRV) + +option (WITH_DCACHE "Build with all cache operations enabled" OFF) + +if (WITH_DCACHE) + add_definitions(-DVIRTIO_USE_DCACHE) +endif (WITH_DCACHE) + +option (WITH_DCACHE_VRINGS "Build with vrings cache operations enabled" OFF) + +if (WITH_DCACHE_VRINGS) + add_definitions(-DVIRTIO_CACHED_VRINGS) + message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...) +endif (WITH_DCACHE_VRINGS) + +option (WITH_DCACHE_BUFFERS "Build with buffers cache operations enabled" OFF) + +if (WITH_DCACHE_BUFFERS) + add_definitions(-DVIRTIO_CACHED_BUFFERS) + message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...) +endif (WITH_DCACHE_BUFFERS) + +option (WITH_DCACHE_RSC_TABLE "Build with resource table cache operations enabled" OFF) + +if (WITH_DCACHE_RSC_TABLE) + add_definitions(-DVIRTIO_CACHED_RSC_TABLE) + message(DEPRECATION "deprecated cmake option replaced by WITH_DCACHE" ...) +endif (WITH_DCACHE_RSC_TABLE) + +# Set the complication flags +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") + +option (WITH_STATIC_LIB "Build with a static library" ON) + +if ("${PROJECT_SYSTEM}" STREQUAL "linux") + option (WITH_SHARED_LIB "Build with a shared library" ON) +endif ("${PROJECT_SYSTEM}" STREQUAL "linux") + +if (WITH_ZEPHYR) + option (WITH_ZEPHYR_LIB "Build open-amp as a zephyr library" OFF) +endif (WITH_ZEPHYR) + +option (WITH_LIBMETAL_FIND "Check Libmetal library can be found" ON) + +option (WITH_OPENAMP_FIND "Check libopen_amp library can be found" ON) + +if (DEFINED RPMSG_BUFFER_SIZE) + add_definitions( -DRPMSG_BUFFER_SIZE=${RPMSG_BUFFER_SIZE} ) +endif (DEFINED RPMSG_BUFFER_SIZE) + +option (WITH_DOC "Build with documentation" OFF) + +message ("-- C_FLAGS : ${CMAKE_C_FLAGS}") diff --git a/examples/legacy_apps/cmake/platforms/cross_generic_gcc.cmake b/examples/legacy_apps/cmake/platforms/cross_generic_gcc.cmake new file mode 100644 index 0000000..862ec25 --- /dev/null +++ b/examples/legacy_apps/cmake/platforms/cross_generic_gcc.cmake @@ -0,0 +1,11 @@ +set (CMAKE_SYSTEM_NAME "Generic" CACHE STRING "") + +set (CMAKE_C_COMPILER "${CROSS_PREFIX}gcc") +set (CMAKE_CXX_COMPILER "${CROSS_PREFIX}g++") +# _exit is in the BSP rather than in libgcc, leaving this out +# causes errors in try_compile on ARM generic. +set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "") +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER CACHE STRING "") +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER CACHE STRING "") diff --git a/examples/legacy_apps/cmake/platforms/cross_linux_gcc.cmake b/examples/legacy_apps/cmake/platforms/cross_linux_gcc.cmake new file mode 100644 index 0000000..4d372d4 --- /dev/null +++ b/examples/legacy_apps/cmake/platforms/cross_linux_gcc.cmake @@ -0,0 +1,7 @@ +set (CMAKE_SYSTEM_NAME "Linux") +set (CMAKE_C_COMPILER "${CROSS_PREFIX}gcc") +set (CMAKE_CXX_COMPILER "${CROSS_PREFIX}g++") + +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) diff --git a/examples/legacy_apps/cmake/platforms/zynq7_generic.cmake b/examples/legacy_apps/cmake/platforms/zynq7_generic.cmake new file mode 100644 index 0000000..e526704 --- /dev/null +++ b/examples/legacy_apps/cmake/platforms/zynq7_generic.cmake @@ -0,0 +1,6 @@ +set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "") +set (MACHINE "zynq7" CACHE STRING "") +set (CROSS_PREFIX "arm-none-eabi-" CACHE STRING "") +set (CMAKE_C_FLAGS "-mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard" CACHE STRING "") + +include (cross_generic_gcc) diff --git a/examples/legacy_apps/cmake/platforms/zynq7_linux.cmake b/examples/legacy_apps/cmake/platforms/zynq7_linux.cmake new file mode 100644 index 0000000..5986b56 --- /dev/null +++ b/examples/legacy_apps/cmake/platforms/zynq7_linux.cmake @@ -0,0 +1,4 @@ +set (CMAKE_SYSTEM_PROCESSOR "arm") +set (CROSS_PREFIX "arm-xilinx-linux-gnueabi-") + +include (cross-linux-gcc) diff --git a/examples/legacy_apps/cmake/platforms/zynqmp_a53_generic.cmake b/examples/legacy_apps/cmake/platforms/zynqmp_a53_generic.cmake new file mode 100644 index 0000000..606a4dc --- /dev/null +++ b/examples/legacy_apps/cmake/platforms/zynqmp_a53_generic.cmake @@ -0,0 +1,4 @@ +set (CMAKE_SYSTEM_PROCESSOR "arm64") +set (CROSS_PREFIX "aarch64-none-elf-") + +include (cross_generic_gcc) diff --git a/examples/legacy_apps/cmake/platforms/zynqmp_linux.cmake b/examples/legacy_apps/cmake/platforms/zynqmp_linux.cmake new file mode 100644 index 0000000..03c6069 --- /dev/null +++ b/examples/legacy_apps/cmake/platforms/zynqmp_linux.cmake @@ -0,0 +1,5 @@ +set (CMAKE_SYSTEM_PROCESSOR "arm64") +set (CROSS_PREFIX "aarch64-linux-gnu-") +set (MACHINE "zynqmp" CACHE STRING "") + +include (cross_linux_gcc) diff --git a/examples/legacy_apps/cmake/platforms/zynqmp_r5_generic.cmake b/examples/legacy_apps/cmake/platforms/zynqmp_r5_generic.cmake new file mode 100644 index 0000000..4b856c6 --- /dev/null +++ b/examples/legacy_apps/cmake/platforms/zynqmp_r5_generic.cmake @@ -0,0 +1,8 @@ +set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "") +set (MACHINE "zynqmp_r5" CACHE STRING "") +set (CROSS_PREFIX "armr5-none-eabi-" CACHE STRING "") + +# Xilinx SDK version earlier than 2017.2 use mfloat-abi=soft by default to generate libxil +set (CMAKE_C_FLAGS "-mfloat-abi=hard -mfpu=vfpv3-d16 -mcpu=cortex-r5" CACHE STRING "") + +include (cross_generic_gcc) diff --git a/examples/legacy_apps/cmake/syscheck.cmake b/examples/legacy_apps/cmake/syscheck.cmake new file mode 100644 index 0000000..b503b69 --- /dev/null +++ b/examples/legacy_apps/cmake/syscheck.cmake @@ -0,0 +1,13 @@ +# use "Generic" as CMAKE_SYSTEM_NAME + +if (WITH_ZEPHYR) + set (CMAKE_SYSTEM_NAME "Generic" CACHE STRING "") + string (TOLOWER "Zephyr" PROJECT_SYSTEM) + string (TOUPPER "Zephyr" PROJECT_SYSTEM_UPPER) + if (NOT WITH_ZEPHYR_LIB) + include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) + endif () + if (CONFIG_CPU_CORTEX_M) + set (MACHINE "cortexm" CACHE STRING "") + endif (CONFIG_CPU_CORTEX_M) +endif (WITH_ZEPHYR) diff --git a/examples/legacy_apps/examples/echo/CMakeLists.txt b/examples/legacy_apps/examples/echo/CMakeLists.txt index f01de6e..894e7fe 100644 --- a/examples/legacy_apps/examples/echo/CMakeLists.txt +++ b/examples/legacy_apps/examples/echo/CMakeLists.txt @@ -25,20 +25,22 @@ foreach (_app rpmsg-echo-ping rpmsg-echo) if (WITH_SHARED_LIB) add_executable (${_app}-shared ${_sources}) - target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + target_compile_options (${_app}-shared PRIVATE "-fPIC") + target_link_libraries (${_app}-shared ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) if (${PROJECT_SYSTEM} STREQUAL "linux") add_executable (${_app}-static ${_sources}) - target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + target_compile_options (${_app}-static PRIVATE "-static") + target_link_libraries (${_app}-static ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else (${PROJECT_SYSTEM}) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") - target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group -static ${OPENAMP_LIB} ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (${PROJECT_SYSTEM} STREQUAL "linux" ) diff --git a/examples/legacy_apps/examples/linux_rpc_demo/CMakeLists.txt b/examples/legacy_apps/examples/linux_rpc_demo/CMakeLists.txt index f10cb89..a2430bb 100644 --- a/examples/legacy_apps/examples/linux_rpc_demo/CMakeLists.txt +++ b/examples/legacy_apps/examples/linux_rpc_demo/CMakeLists.txt @@ -27,20 +27,22 @@ foreach (_app ${app_list}) if (WITH_SHARED_LIB) add_executable (${_app}-shared ${_sources}) - target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + target_compile_options (${_app}-shared PRIVATE "-fPIC") + target_link_libraries (${_app}-shared ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) if (${PROJECT_SYSTEM} STREQUAL "linux") add_executable (${_app}-static ${_sources}) - target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + target_compile_options (${_app}-static PRIVATE "-static") + target_link_libraries (${_app}-static ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else (${PROJECT_SYSTEM}) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") - target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group -static ${OPENAMP_LIB} ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (${PROJECT_SYSTEM} STREQUAL "linux" ) endif (WITH_STATIC_LIB) diff --git a/examples/legacy_apps/examples/load_fw/CMakeLists.txt b/examples/legacy_apps/examples/load_fw/CMakeLists.txt index 041126e..9db6e2d 100644 --- a/examples/legacy_apps/examples/load_fw/CMakeLists.txt +++ b/examples/legacy_apps/examples/load_fw/CMakeLists.txt @@ -28,6 +28,7 @@ foreach (_app load_fw) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") + target_compile_options (${_app}.out PRIVATE "-static") target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections -T"${CMAKE_CURRENT_SOURCE_DIR}/lscript.ld" -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/examples/legacy_apps/examples/matrix_multiply/CMakeLists.txt b/examples/legacy_apps/examples/matrix_multiply/CMakeLists.txt index 8914e17..7ce4ad7 100644 --- a/examples/legacy_apps/examples/matrix_multiply/CMakeLists.txt +++ b/examples/legacy_apps/examples/matrix_multiply/CMakeLists.txt @@ -19,20 +19,22 @@ foreach (_app matrix_multiply matrix_multiplyd) if (WITH_SHARED_LIB) add_executable (${_app}-shared ${_sources}) - target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + target_compile_options (${_app}-shared PRIVATE "-fPIC") + target_link_libraries (${_app}-shared ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) if (${PROJECT_SYSTEM} STREQUAL "linux") add_executable (${_app}-static ${_sources}) - target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + target_compile_options (${_app}-static PRIVATE "-static") + target_link_libraries (${_app}-static ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else (${PROJECT_SYSTEM}) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") - target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group -static ${OPENAMP_LIB} ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (${PROJECT_SYSTEM} STREQUAL "linux" ) diff --git a/examples/legacy_apps/examples/nocopy_echo/CMakeLists.txt b/examples/legacy_apps/examples/nocopy_echo/CMakeLists.txt index d82efdf..898d9f7 100644 --- a/examples/legacy_apps/examples/nocopy_echo/CMakeLists.txt +++ b/examples/legacy_apps/examples/nocopy_echo/CMakeLists.txt @@ -25,20 +25,23 @@ foreach (_app rpmsg-nocopy-ping rpmsg-nocopy-echo) if (WITH_SHARED_LIB) add_executable (${_app}-shared ${_sources}) - target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + target_compile_options (${_app}-shared PRIVATE "-fPIC") + target_link_libraries (${_app}-shared ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) if (${PROJECT_SYSTEM} STREQUAL "linux") add_executable (${_app}-static ${_sources}) - target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + target_compile_options (${_app}-static PRIVATE "-static") + target_link_libraries (${_app}-static ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else (${PROJECT_SYSTEM}) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") - target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + target_compile_options (${_app}.out PRIVATE "-static") + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group -static ${OPENAMP_LIB} ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (${PROJECT_SYSTEM} STREQUAL "linux" ) diff --git a/examples/legacy_apps/examples/rpc_demo/CMakeLists.txt b/examples/legacy_apps/examples/rpc_demo/CMakeLists.txt index 5d5655d..cb22472 100644 --- a/examples/legacy_apps/examples/rpc_demo/CMakeLists.txt +++ b/examples/legacy_apps/examples/rpc_demo/CMakeLists.txt @@ -29,20 +29,21 @@ foreach (_app ${app_list}) if (WITH_SHARED_LIB) add_executable (${_app}-shared ${_sources}) - target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + target_link_libraries (${_app}-shared -shared ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) if (${PROJECT_SYSTEM} STREQUAL "linux") add_executable (${_app}-static ${_sources}) - target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + target_compile_options (${_app}-static PRIVATE "-static") + target_link_libraries (${_app}-static ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else (${PROJECT_SYSTEM}) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") - target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group -static ${OPENAMP_LIB} ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (${PROJECT_SYSTEM} STREQUAL "linux" ) endif (WITH_STATIC_LIB) diff --git a/examples/legacy_apps/examples/rpmsg_sample_echo/CMakeLists.txt b/examples/legacy_apps/examples/rpmsg_sample_echo/CMakeLists.txt index eda1111..f6f0aaa 100644 --- a/examples/legacy_apps/examples/rpmsg_sample_echo/CMakeLists.txt +++ b/examples/legacy_apps/examples/rpmsg_sample_echo/CMakeLists.txt @@ -21,20 +21,22 @@ foreach (_app rpmsg-sample-echo rpmsg-sample-ping) if (WITH_SHARED_LIB) add_executable (${_app}-shared ${_sources}) - target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + target_compile_options (${_app}-shared PRIVATE "-fPIC") + target_link_libraries (${_app}-shared ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) if (${PROJECT_SYSTEM} STREQUAL "linux") add_executable (${_app}-static ${_sources}) - target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + target_compile_options (${_app}-static PRIVATE "-static") + target_link_libraries (${_app}-static ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else (${PROJECT_SYSTEM}) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") - target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group -static ${OPENAMP_LIB} ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (${PROJECT_SYSTEM} STREQUAL "linux" ) diff --git a/examples/legacy_apps/tests/msg/CMakeLists.txt b/examples/legacy_apps/tests/msg/CMakeLists.txt index a583fd0..286518a 100644 --- a/examples/legacy_apps/tests/msg/CMakeLists.txt +++ b/examples/legacy_apps/tests/msg/CMakeLists.txt @@ -31,20 +31,22 @@ foreach (_app msg-test-rpmsg-ping msg-test-rpmsg-nocopy-ping msg-test-rpmsg-noco if (WITH_SHARED_LIB) add_executable (${_app}-shared ${_sources}) - target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) + target_compile_options (${_app}-shared PRIVATE "-fPIC") + target_link_libraries (${_app}-shared -shared ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (WITH_SHARED_LIB) if (WITH_STATIC_LIB) if (${PROJECT_SYSTEM} STREQUAL "linux") add_executable (${_app}-static ${_sources}) - target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) + target_compile_options (${_app}-static PRIVATE "-static") + target_link_libraries (${_app}-static ${OPENAMP_LIB} ${_deps}) install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) else (${PROJECT_SYSTEM}) add_executable (${_app}.out ${_sources}) set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") - target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) + target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group -static ${OPENAMP_LIB} ${_deps} -Wl,--end-group) install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (${PROJECT_SYSTEM} STREQUAL "linux" )