From 7d110e73e6b0651f73e8e5b165244f59e66fed87 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 16 Aug 2010 23:28:37 -0700 Subject: uhd: added the concept of installer path (along with local path) for package data --- host/lib/CMakeLists.txt | 10 ++++++++-- host/lib/constants.hpp.in | 6 ++---- host/lib/utils/paths.cpp | 8 ++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index b117b99ce..cbb68c725 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -53,8 +53,14 @@ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/utils/CMakeLists.txt) ######################################################################## # Append to the list of sources for lib uhd ######################################################################## -FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} FULL_PKG_DATA_DIR) -MESSAGE(STATUS "Full package data directory: ${FULL_PKG_DATA_DIR}") +FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} LOCAL_PKG_DATA_DIR) +MESSAGE(STATUS "Local package data directory: ${LOCAL_PKG_DATA_DIR}") + +IF(UNIX) + #on unix systems, installers will use this directory for the package data + FILE(TO_NATIVE_PATH /usr/${PKG_DATA_DIR} INSTALLER_PKG_DATA_DIR) + MESSAGE(STATUS "Installer package data directory: ${INSTALLER_PKG_DATA_DIR}") +ENDIF(UNIX) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/constants.hpp.in diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in index 2ed4e302f..4aedb6d4a 100644 --- a/host/lib/constants.hpp.in +++ b/host/lib/constants.hpp.in @@ -18,11 +18,9 @@ #ifndef INCLUDED_LIBUHD_CONSTANTS_HPP #define INCLUDED_LIBUHD_CONSTANTS_HPP -#include -#include - //these should be pre-processor macros to avoid static initialization issues #define UHD_VERSION_STRING "@CPACK_PACKAGE_VERSION@" -#define FULL_PKG_DATA_DIR "@FULL_PKG_DATA_DIR@" +#define LOCAL_PKG_DATA_DIR "@LOCAL_PKG_DATA_DIR@" +#define INSTALLER_PKG_DATA_DIR "@INSTALLER_PKG_DATA_DIR@" #endif /* INCLUDED_LIBUHD_CONSTANTS_HPP */ diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index 3f29945dd..6ad12d3cc 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -72,13 +72,17 @@ static std::vector get_env_paths(const std::string &var_name){ **********************************************************************/ std::vector get_image_paths(void){ std::vector paths = get_env_paths("UHD_IMAGE_PATH"); - paths.push_back(fs::path(FULL_PKG_DATA_DIR) / "images"); + paths.push_back(fs::path(LOCAL_PKG_DATA_DIR) / "images"); + if (not std::string(INSTALLER_PKG_DATA_DIR).empty()) + paths.push_back(fs::path(INSTALLER_PKG_DATA_DIR) / "images"); return paths; } std::vector get_module_paths(void){ std::vector paths = get_env_paths("UHD_MODULE_PATH"); - paths.push_back(fs::path(FULL_PKG_DATA_DIR) / "modules"); + paths.push_back(fs::path(LOCAL_PKG_DATA_DIR) / "modules"); + if (not std::string(INSTALLER_PKG_DATA_DIR).empty()) + paths.push_back(fs::path(INSTALLER_PKG_DATA_DIR) / "modules"); return paths; } -- cgit v1.2.3