From 9f2ba8c56e473fa05a5f216260571f4269fc16cc Mon Sep 17 00:00:00 2001 From: Damian Wrobel Date: Mon, 14 Sep 2020 09:23:07 +0200 Subject: [PATCH] Install libraries as per GNU Coding Standards Includes GNUInstallDirs and uses LIBDIR (instead of hardcoded lib) to install libraries. Fixes packaging on aarch64 systems where LIBDIR=lib64 (not lib). Signed-off-by: Damian Wrobel --- CMakeLists.txt | 4 +++- containers/CMakeLists.txt | 2 +- helpers/dtoverlay/CMakeLists.txt | 2 +- host_applications/linux/libs/bcm_host/CMakeLists.txt | 2 +- host_applications/linux/libs/debug_sym/CMakeLists.txt | 4 ++-- host_applications/linux/libs/sm/CMakeLists.txt | 2 +- interface/khronos/CMakeLists.txt | 6 +++--- interface/mmal/CMakeLists.txt | 2 +- interface/mmal/components/CMakeLists.txt | 2 +- interface/mmal/core/CMakeLists.txt | 2 +- interface/mmal/util/CMakeLists.txt | 2 +- interface/mmal/vc/CMakeLists.txt | 2 +- interface/vchiq_arm/CMakeLists.txt | 2 +- interface/vcos/pthreads/CMakeLists.txt | 2 +- interface/vmcs_host/CMakeLists.txt | 2 +- middleware/openmaxil/CMakeLists.txt | 2 +- pkgconfig/bcm_host.pc.in | 2 +- pkgconfig/brcmegl.pc.in | 2 +- pkgconfig/brcmglesv2.pc.in | 2 +- pkgconfig/brcmvg.pc.in | 2 +- pkgconfig/mmal.pc.in | 2 +- pkgconfig/vcsm.pc.in | 2 +- 22 files changed, 27 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe67fc87..035b16fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ SET(PROJECT_VER_PATCH 0) SET(PROJECT_VER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}") SET(PROJECT_APIVER "${PROJECT_VER}") +include(GNUInstallDirs) + if(ARM64) set(BUILD_MMAL FALSE) set(BUILD_MMAL_APPS FALSE) @@ -125,7 +127,7 @@ if(PKG_CONFIG_FOUND) foreach(PCFILE bcm_host.pc brcmegl.pc brcmglesv2.pc brcmvg.pc vcsm.pc mmal.pc) configure_file("pkgconfig/${PCFILE}.in" "${PCFILE}" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PCFILE}" - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") + DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") endforeach() endif() # Remove cache entry, if one added by command line diff --git a/containers/CMakeLists.txt b/containers/CMakeLists.txt index 5570038c..3578fe80 100644 --- a/containers/CMakeLists.txt +++ b/containers/CMakeLists.txt @@ -66,7 +66,7 @@ set(packetizers_SRCS ${packetizers_SRCS} ${SOURCE_DIR}/h264/avc1_packetizer.c) add_library(containers ${LIBRARY_TYPE} ${core_SRCS} ${io_SRCS} ${net_SRCS} ${packetizers_SRCS}) target_link_libraries(containers vcos) -install(TARGETS containers DESTINATION lib) +install(TARGETS containers DESTINATION ${LIBDIR}) set(container_readers) set(container_writers) diff --git a/helpers/dtoverlay/CMakeLists.txt b/helpers/dtoverlay/CMakeLists.txt index b3bd30f1..5e1a3a4a 100644 --- a/helpers/dtoverlay/CMakeLists.txt +++ b/helpers/dtoverlay/CMakeLists.txt @@ -22,4 +22,4 @@ add_library (dtovl ${SHARED} target_link_libraries(dtovl fdt) -install (TARGETS dtovl DESTINATION lib) +install (TARGETS dtovl DESTINATION ${LIBDIR}) diff --git a/host_applications/linux/libs/bcm_host/CMakeLists.txt b/host_applications/linux/libs/bcm_host/CMakeLists.txt index 2f4beb93..e18d611c 100644 --- a/host_applications/linux/libs/bcm_host/CMakeLists.txt +++ b/host_applications/linux/libs/bcm_host/CMakeLists.txt @@ -19,5 +19,5 @@ add_library(bcm_host ${SHARED} bcm_host.c) target_link_libraries(bcm_host vcos vchostif) -install(TARGETS bcm_host DESTINATION lib) +install(TARGETS bcm_host DESTINATION ${LIBDIR}) diff --git a/host_applications/linux/libs/debug_sym/CMakeLists.txt b/host_applications/linux/libs/debug_sym/CMakeLists.txt index d437b995..40e0bc77 100644 --- a/host_applications/linux/libs/debug_sym/CMakeLists.txt +++ b/host_applications/linux/libs/debug_sym/CMakeLists.txt @@ -11,6 +11,6 @@ include_directories ( add_library(debug_sym ${SHARED} debug_sym.c) add_library(debug_sym_static STATIC debug_sym.c) -install(TARGETS debug_sym DESTINATION lib) -install(TARGETS debug_sym_static DESTINATION lib) +install(TARGETS debug_sym DESTINATION ${LIBDIR}) +install(TARGETS debug_sym_static DESTINATION ${LIBDIR}) install(FILES debug_sym.h DESTINATION include/interface/debug_sym) diff --git a/host_applications/linux/libs/sm/CMakeLists.txt b/host_applications/linux/libs/sm/CMakeLists.txt index 5ce5aca7..f85959bd 100644 --- a/host_applications/linux/libs/sm/CMakeLists.txt +++ b/host_applications/linux/libs/sm/CMakeLists.txt @@ -14,5 +14,5 @@ add_library(vcsm ${SHARED} user-vcsm.c) target_link_libraries(vcsm vcos) -install(TARGETS vcsm DESTINATION lib) +install(TARGETS vcsm DESTINATION ${LIBDIR}) install(FILES user-vcsm.h DESTINATION include/interface/vcsm) diff --git a/interface/khronos/CMakeLists.txt b/interface/khronos/CMakeLists.txt index 9ad615b8..97683049 100644 --- a/interface/khronos/CMakeLists.txt +++ b/interface/khronos/CMakeLists.txt @@ -78,8 +78,8 @@ target_link_libraries(GLESv2 EGL khrn_client vcos) target_link_libraries(WFC EGL) target_link_libraries(OpenVG EGL) -install(TARGETS EGL GLESv2 OpenVG WFC khrn_client DESTINATION lib) -install(TARGETS EGL_static GLESv2_static khrn_static DESTINATION lib) +install(TARGETS EGL GLESv2 OpenVG WFC khrn_client DESTINATION ${LIBDIR}) +install(TARGETS EGL_static GLESv2_static khrn_static DESTINATION ${LIBDIR}) # recommended names to use to avoid conflicts with mesa libs add_library(brcmEGL ${SHARED} ${EGL_SOURCE}) @@ -92,4 +92,4 @@ target_link_libraries(brcmGLESv2 brcmEGL khrn_client vcos) target_link_libraries(brcmWFC brcmEGL) target_link_libraries(brcmOpenVG brcmEGL) -install(TARGETS brcmEGL brcmGLESv2 brcmOpenVG brcmWFC DESTINATION lib) +install(TARGETS brcmEGL brcmGLESv2 brcmOpenVG brcmWFC DESTINATION ${LIBDIR}) diff --git a/interface/mmal/CMakeLists.txt b/interface/mmal/CMakeLists.txt index 46f149df..544f173b 100644 --- a/interface/mmal/CMakeLists.txt +++ b/interface/mmal/CMakeLists.txt @@ -16,7 +16,7 @@ add_subdirectory(client) target_link_libraries(mmal mmal_core mmal_util mmal_vc_client vcos mmal_components) -install(TARGETS mmal DESTINATION lib) +install(TARGETS mmal DESTINATION ${LIBDIR}) install(FILES mmal.h mmal_buffer.h diff --git a/interface/mmal/components/CMakeLists.txt b/interface/mmal/components/CMakeLists.txt index d65fa37d..5b929098 100644 --- a/interface/mmal/components/CMakeLists.txt +++ b/interface/mmal/components/CMakeLists.txt @@ -30,5 +30,5 @@ set(container_libs ${container_libs} containers) target_link_libraries(mmal_components ${container_libs} mmal_util) target_link_libraries(mmal_components mmal_core) -install(TARGETS mmal_components DESTINATION lib) +install(TARGETS mmal_components DESTINATION ${LIBDIR}) diff --git a/interface/mmal/core/CMakeLists.txt b/interface/mmal/core/CMakeLists.txt index de0bcb25..7f1adb86 100644 --- a/interface/mmal/core/CMakeLists.txt +++ b/interface/mmal/core/CMakeLists.txt @@ -13,7 +13,7 @@ add_library (mmal_core ${LIBRARY_TYPE} target_link_libraries (mmal_core vcos) -install(TARGETS mmal_core DESTINATION lib) +install(TARGETS mmal_core DESTINATION ${LIBDIR}) install(FILES mmal_buffer_private.h mmal_clock_private.h diff --git a/interface/mmal/util/CMakeLists.txt b/interface/mmal/util/CMakeLists.txt index b2a6858b..acabed6f 100644 --- a/interface/mmal/util/CMakeLists.txt +++ b/interface/mmal/util/CMakeLists.txt @@ -12,7 +12,7 @@ add_library (mmal_util ${LIBRARY_TYPE} target_link_libraries (mmal_util vcos) -install(TARGETS mmal_util DESTINATION lib) +install(TARGETS mmal_util DESTINATION ${LIBDIR}) install(FILES mmal_component_wrapper.h mmal_connection.h diff --git a/interface/mmal/vc/CMakeLists.txt b/interface/mmal/vc/CMakeLists.txt index d6e80db7..ecba8112 100644 --- a/interface/mmal/vc/CMakeLists.txt +++ b/interface/mmal/vc/CMakeLists.txt @@ -13,7 +13,7 @@ endif(BUILD_MMAL_APPS) include_directories ( ../../../host_applications/linux/libs/sm ) -install(TARGETS mmal_vc_client DESTINATION lib) +install(TARGETS mmal_vc_client DESTINATION ${LIBDIR}) install(FILES mmal_vc_api.h mmal_vc_api_drm.h diff --git a/interface/vchiq_arm/CMakeLists.txt b/interface/vchiq_arm/CMakeLists.txt index 7af383de..75080655 100644 --- a/interface/vchiq_arm/CMakeLists.txt +++ b/interface/vchiq_arm/CMakeLists.txt @@ -5,7 +5,7 @@ add_library(vchiq_arm SHARED # pull in VCHI cond variable emulation target_link_libraries(vchiq_arm vcos) -install(TARGETS vchiq_arm DESTINATION lib) +install(TARGETS vchiq_arm DESTINATION ${LIBDIR}) #install(FILES etc/10-vchiq.rules DESTINATION /etc/udev/rules.d) include_directories(../..) diff --git a/interface/vcos/pthreads/CMakeLists.txt b/interface/vcos/pthreads/CMakeLists.txt index 1d81ca3c..c6a80cf3 100644 --- a/interface/vcos/pthreads/CMakeLists.txt +++ b/interface/vcos/pthreads/CMakeLists.txt @@ -43,4 +43,4 @@ endif () #install(FILES ${HEADERS} DESTINATION include) -install(TARGETS vcos DESTINATION lib) +install(TARGETS vcos DESTINATION ${LIBDIR}) diff --git a/interface/vmcs_host/CMakeLists.txt b/interface/vmcs_host/CMakeLists.txt index cbef80c5..f61067f0 100755 --- a/interface/vmcs_host/CMakeLists.txt +++ b/interface/vmcs_host/CMakeLists.txt @@ -32,5 +32,5 @@ target_link_libraries(vchostif vchiq_arm vcos) #target_link_libraries(bufman WFC) -install(TARGETS ${INSTALL_TARGETS} DESTINATION lib) +install(TARGETS ${INSTALL_TARGETS} DESTINATION ${LIBDIR}) diff --git a/middleware/openmaxil/CMakeLists.txt b/middleware/openmaxil/CMakeLists.txt index 3e9c5f9d..6b6c36a6 100644 --- a/middleware/openmaxil/CMakeLists.txt +++ b/middleware/openmaxil/CMakeLists.txt @@ -49,4 +49,4 @@ else () endif () -install (TARGETS openmaxil DESTINATION lib) +install (TARGETS openmaxil DESTINATION ${LIBDIR}) diff --git a/pkgconfig/bcm_host.pc.in b/pkgconfig/bcm_host.pc.in index c7237c53..2988b42f 100644 --- a/pkgconfig/bcm_host.pc.in +++ b/pkgconfig/bcm_host.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: bcm_host diff --git a/pkgconfig/brcmegl.pc.in b/pkgconfig/brcmegl.pc.in index 5dd3d5b9..a45bf22a 100644 --- a/pkgconfig/brcmegl.pc.in +++ b/pkgconfig/brcmegl.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: brcmEGL diff --git a/pkgconfig/brcmglesv2.pc.in b/pkgconfig/brcmglesv2.pc.in index e0e36f5a..902fbf33 100644 --- a/pkgconfig/brcmglesv2.pc.in +++ b/pkgconfig/brcmglesv2.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: brcmGLESv2 diff --git a/pkgconfig/brcmvg.pc.in b/pkgconfig/brcmvg.pc.in index 763a44b0..98489ee4 100644 --- a/pkgconfig/brcmvg.pc.in +++ b/pkgconfig/brcmvg.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: brcmOpenVG diff --git a/pkgconfig/mmal.pc.in b/pkgconfig/mmal.pc.in index 37d344c4..1ffa4f51 100644 --- a/pkgconfig/mmal.pc.in +++ b/pkgconfig/mmal.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: MMAL diff --git a/pkgconfig/vcsm.pc.in b/pkgconfig/vcsm.pc.in index b12c56fc..6f762cbf 100644 --- a/pkgconfig/vcsm.pc.in +++ b/pkgconfig/vcsm.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: VCSM