summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <hramrach@gmail.com>2012-05-07 16:07:16 +0200
committerJosé Fonseca <jose.r.fonseca@gmail.com>2012-05-12 12:11:22 +0100
commit96851e094e4e9f07cd3c95c924f86dc94dfd9dfd (patch)
treeea37718913e1fe7a4c293826138437d9b76d4989
parent3db3b2f03af32da02faa59b9bcbdd0e2879e280a (diff)
Add multiarch support.
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
-rw-r--r--CMakeLists.txt21
-rw-r--r--common/trace_resource.cpp2
-rw-r--r--common/trace_tools_trace.cpp2
3 files changed, 21 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70ebd872..61a3a337 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,21 +202,37 @@ endif ()
# also avoids missing/inconsistent declarations in system headers.
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/khronos)
+
##############################################################################
# Installation directories
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ # Debian multiarch support
+ execute_process(COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
+ OUTPUT_VARIABLE ARCH_SUBDIR
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+endif()
+
if (WIN32 OR APPLE)
# On Windows/MacOSX, applications are usually installed on a directory of
# their own
set (DOC_INSTALL_DIR doc)
set (LIB_INSTALL_DIR lib)
+ set (LIB_ARCH_INSTALL_DIR lib)
else ()
set (DOC_INSTALL_DIR share/doc/${CMAKE_PROJECT_NAME})
set (LIB_INSTALL_DIR lib/${CMAKE_PROJECT_NAME})
+ if (ARCH_SUBDIR)
+ set (LIB_ARCH_INSTALL_DIR lib/${ARCH_SUBDIR}/${CMAKE_PROJECT_NAME})
+ else ()
+ set (LIB_ARCH_INSTALL_DIR lib/${CMAKE_PROJECT_NAME})
+ endif ()
endif ()
set (SCRIPTS_INSTALL_DIR ${LIB_INSTALL_DIR}/scripts)
-set (WRAPPER_INSTALL_DIR ${LIB_INSTALL_DIR}/wrappers)
+set (WRAPPER_INSTALL_DIR ${LIB_ARCH_INSTALL_DIR}/wrappers)
# Expose the binary/install directories to source
#
@@ -226,7 +242,8 @@ set (WRAPPER_INSTALL_DIR ${LIB_INSTALL_DIR}/wrappers)
add_definitions(
-DAPITRACE_BINARY_DIR="${CMAKE_BINARY_DIR}"
-DAPITRACE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
- -DAPITRACE_LIB_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}"
+ -DAPITRACE_SCRIPTS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${SCRIPTS_INSTALL_DIR}"
+ -DAPITRACE_WRAPPERS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${WRAPPER_INSTALL_DIR}"
)
diff --git a/common/trace_resource.cpp b/common/trace_resource.cpp
index 8b29cfb7..8a1f56cb 100644
--- a/common/trace_resource.cpp
+++ b/common/trace_resource.cpp
@@ -69,7 +69,7 @@ findScript(const char *scriptFilename)
#ifndef _WIN32
// Try absolute install directory
- scriptPath = APITRACE_LIB_INSTALL_DIR "/scripts";
+ scriptPath = APITRACE_SCRIPTS_INSTALL_DIR;
scriptPath.join(scriptFilename);
if (scriptPath.exists()) {
return scriptPath;
diff --git a/common/trace_tools_trace.cpp b/common/trace_tools_trace.cpp
index cad2b0ae..5c88a256 100644
--- a/common/trace_tools_trace.cpp
+++ b/common/trace_tools_trace.cpp
@@ -84,7 +84,7 @@ findWrapper(const char *wrapperFilename)
#ifndef _WIN32
// Try absolute install directory
- wrapperPath = APITRACE_LIB_INSTALL_DIR "/wrappers";
+ wrapperPath = APITRACE_WRAPPERS_INSTALL_DIR;
wrapperPath.join(wrapperFilename);
if (wrapperPath.exists()) {
return wrapperPath;