aboutsummaryrefslogtreecommitdiff
path: root/project/cmake
diff options
context:
space:
mode:
authorwsnipex <wsnipex@a1.net>2015-04-06 18:04:21 +0200
committerwsnipex <wsnipex@a1.net>2015-04-09 13:44:56 +0200
commit0e243bc650551cc8f9892fd38ba4f60f7ce5b103 (patch)
tree181399148f766f53399e95de5bbcc5a0fbed7ae7 /project/cmake
parentd30fb060bda2981e34d49a8108509ab192939e31 (diff)
[binary addons] use multi arch install paths
Diffstat (limited to 'project/cmake')
-rw-r--r--project/cmake/scripts/common/addon-helpers.cmake7
-rw-r--r--project/cmake/scripts/common/prepare-env.cmake9
-rw-r--r--project/cmake/scripts/linux/UseMultiArch.cmake44
3 files changed, 58 insertions, 2 deletions
diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake
index b94df2aebd..fa42b4b184 100644
--- a/project/cmake/scripts/common/addon-helpers.cmake
+++ b/project/cmake/scripts/common/addon-helpers.cmake
@@ -76,7 +76,12 @@ macro (build_addon target prefix libs)
ENDIF(WIN32)
add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
ELSE(PACKAGE_ZIP OR PACKAGE_TGZ)
- INSTALL(TARGETS ${target} DESTINATION lib/kodi/addons/${target})
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ include(UseMultiArch)
+ else()
+ set(CMAKE_INSTALL_LIBDIR "lib")
+ endif()
+ INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/kodi/addons/${target})
INSTALL(DIRECTORY ${target} DESTINATION share/kodi/addons)
ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ)
endmacro()
diff --git a/project/cmake/scripts/common/prepare-env.cmake b/project/cmake/scripts/common/prepare-env.cmake
index 5e773e21d6..a616ed8400 100644
--- a/project/cmake/scripts/common/prepare-env.cmake
+++ b/project/cmake/scripts/common/prepare-env.cmake
@@ -56,8 +56,15 @@ set(APP_LIBDIR "${prefix}/lib")
# generate the proper kodi-config.cmake file
configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${KODI_LIB_DIR}/kodi-config.cmake @ONLY)
+
# copy cmake helpers to lib/kodi
-file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake DESTINATION ${KODI_LIB_DIR})
+file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake
+ ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake
+ DESTINATION ${KODI_LIB_DIR})
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ file(COPY ${APP_ROOT}/project/cmake/scripts/linux/UseMultiArch.cmake DESTINATION ${KODI_LIB_DIR})
+endif()
# generate xbmc-config.cmake for backwards compatibility to xbmc
configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY)
diff --git a/project/cmake/scripts/linux/UseMultiArch.cmake b/project/cmake/scripts/linux/UseMultiArch.cmake
new file mode 100644
index 0000000000..ce6b3e3b28
--- /dev/null
+++ b/project/cmake/scripts/linux/UseMultiArch.cmake
@@ -0,0 +1,44 @@
+# - Multiarch support in object code library directories
+#
+# This module sets the following variable
+# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu
+# depending on the platform; use this path
+# for platform-specific binaries.
+#
+# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform;
+# use this path for architecture-independent
+# files.
+#
+# Note that it will override the results of GNUInstallDirs if included after
+# that module.
+
+# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu;
+# Fedora put module files in lib64/ too, but Debian uses lib/ for that
+if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND
+ "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND
+ NOT "${CORE_SYSTEM_NAME}" STREQUAL "android")
+ # Debian or Ubuntu?
+ if (EXISTS "/etc/debian_version")
+ set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ set (_libdir_noarch "lib")
+ else (EXISTS "/etc/debian_version")
+ # 64-bit system?
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set (_libdir_noarch "lib64")
+ else (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set (_libdir_noarch "lib")
+ endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set (_libdir_def "${_libdir_noarch}")
+ endif (EXISTS "/etc/debian_version")
+else ()
+ set (_libdir_def "lib")
+ set (_libdir_noarch "lib")
+endif ()
+
+# let the user override if somewhere else is desirable
+set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries")
+set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files")
+mark_as_advanced (
+ CMAKE_INSTALL_LIBDIR
+ CMAKE_INSTALL_LIBDIR_NOARCH
+ )