Added initial definitions.

This commit is contained in:
Martin Rotter 2013-06-03 22:20:23 +02:00
parent c85e5a44a0
commit 1cd3addabd
2 changed files with 49 additions and 5 deletions

View File

@ -25,10 +25,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
# Obtain revision number if available.
message(STATUS "[rssguard] Obtaining revision number.")
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
find_package(Git)
if(GIT_FOUND)
message(STATUS "[rssguard] Git is installed. Obtaining revision number.")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
@ -43,11 +44,13 @@ else(EXISTS "${PROJECT_SOURCE_DIR}/.git")
set(APP_REVISION STABLE)
endif(EXISTS "${PROJECT_SOURCE_DIR}/.git")
message(STATUS "[rssguard] Revision number obtained: " ${APP_REVISION} ".")
# Configure internal C++ defines.
# configure_file (
# ${PROJECT_SOURCE_DIR}/src/defs.h.in
# ${CMAKE_CURRENT_BINARY_DIR}/src/defs.h
# )
configure_file (
${PROJECT_SOURCE_DIR}/src/defs.h.in
${CMAKE_CURRENT_BINARY_DIR}/src/defs.h
)
# Configure executable "properties" for Windows.
# if(WIN32)

41
src/defs.h.in Normal file
View File

@ -0,0 +1,41 @@
#ifndef DEFS_H
#define DEFS_H
#define CMAKE_VERSION "@CMAKE_VERSION@"
#define CMAKE_SYSTEM "@CMAKE_SYSTEM@"
#define APP_NAME "@APP_NAME@"
#define APP_LOW_NAME "@APP_LOW_NAME@"
#define APP_LOW_H_NAME ".@APP_LOW_NAME@"
#define APP_AUTHORS "@APP_AUTHOR@"
#define APP_URL "@APP_URL@"
#define APP_VERSION "@APP_VERSION@"
#define APP_CFG_PATH "data/config/config.ini"
#define APP_CFG_GUI "gui"
#define APP_CFG_GEN "main"
#define APP_CFG_CALC "calculator"
#define APP_CFG_LANG "language"
#define APP_DB_PATH "data/storage/database.db"
#define APP_PREFIX "@CMAKE_INSTALL_PREFIX@"
#define APP_REVISION "@APP_REVISION@"
// TODO: OS/2 support missing. No way to test this w/o OS/2 machine.
#if defined(Q_OS_LINUX)
#define APP_LANG_PATH APP_PREFIX + QString("/share/qonverter/l10n")
#define APP_SKIN_PATH APP_PREFIX + QString("/share/qonverter/skins")
#define APP_INFO_PATH APP_PREFIX + QString("/share/qonverter/information")
#elif defined(Q_OS_MAC)
#define APP_LANG_PATH QApplication::applicationDirPath() + "/../Resources/l10n"
#define APP_SKIN_PATH QApplication::applicationDirPath() + "/../Resources/skins"
#define APP_PLUGIN_PATH QApplication::applicationDirPath() + "/../Resources/plugins"
#define APP_INFO_PATH QApplication::applicationDirPath() + "/../Resources/information"
#elif defined(Q_OS_WIN) || defined(Q_OS_OS2)
#define APP_LANG_PATH QApplication::applicationDirPath() + QString("/l10n")
#define APP_SKIN_PATH QApplication::applicationDirPath() + QString("/skins")
#define APP_INFO_PATH QApplication::applicationDirPath()
#endif
#endif // DEFS_H