CPack: Debian package
This commit is contained in:
parent
0c67cb6cb3
commit
bab4a51ebb
8 changed files with 44 additions and 43 deletions
|
@ -174,11 +174,6 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||||
|
|
||||||
# Create a version string suitable for file names
|
|
||||||
string(REPLACE " " "_" PROJECT_VERSION_SAFE "${PROJECT_VERSION}")
|
|
||||||
string(REPLACE "(" "" PROJECT_VERSION_SAFE "${PROJECT_VERSION_SAFE}")
|
|
||||||
string(REPLACE ")" "" PROJECT_VERSION_SAFE "${PROJECT_VERSION_SAFE}")
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CPACK_GENERATOR DragNDrop ${CPACK_GENERATOR})
|
set(CPACK_GENERATOR DragNDrop ${CPACK_GENERATOR})
|
||||||
|
@ -186,19 +181,20 @@ if(UNIX)
|
||||||
set(CPACK_DMG_FORMAT "UDBZ")
|
set(CPACK_DMG_FORMAT "UDBZ")
|
||||||
set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
|
set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
|
||||||
set(CPACK_SYSTEM_NAME "OSX")
|
set(CPACK_SYSTEM_NAME "OSX")
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-osx_git-${PROJECT_VERSION_SAFE}")
|
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
|
||||||
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cockatrice/resources/appicon.icns")
|
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cockatrice/resources/appicon.icns")
|
||||||
else()
|
else()
|
||||||
# linux
|
# linux
|
||||||
set(CPACK_GENERATOR DEB ${CPACK_GENERATOR})
|
set(CPACK_GENERATOR DEB ${CPACK_GENERATOR})
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}/${PROJECT_VERSION_SAFE}")
|
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
|
||||||
set(CPACK_STRIP_FILES "bin/${PROJECT_NAME}")
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||||
set(CPACK_SOURCE_STRIP_FILES "")
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5multimedia5-plugins")
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_git-${PROJECT_VERSION_SAFE}")
|
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://github.com/Cockatrice/Cockatrice")
|
||||||
endif()
|
endif()
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR})
|
set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR})
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_git-${PROJECT_VERSION_SAFE}")
|
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
|
||||||
|
|
||||||
# Configure file with custom definitions for NSIS.
|
# Configure file with custom definitions for NSIS.
|
||||||
configure_file(
|
configure_file(
|
||||||
|
|
|
@ -3,7 +3,7 @@ set(VERSION_STRING_H "${PROJECT_BINARY_DIR}/version_string.h")
|
||||||
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
|
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
|
||||||
|
|
||||||
set( hstring "extern const char *VERSION_STRING\;\n" )
|
set( hstring "extern const char *VERSION_STRING\;\n" )
|
||||||
set( cppstring "const char * VERSION_STRING = \"${PROJECT_VERSION}\"\;\n")
|
set( cppstring "const char * VERSION_STRING = \"${PROJECT_VERSION_FRIENDLY}\"\;\n")
|
||||||
|
|
||||||
file(WRITE ${PROJECT_BINARY_DIR}/version_string.cpp.txt ${cppstring} )
|
file(WRITE ${PROJECT_BINARY_DIR}/version_string.cpp.txt ${cppstring} )
|
||||||
file(WRITE ${PROJECT_BINARY_DIR}/version_string.h.txt ${hstring} )
|
file(WRITE ${PROJECT_BINARY_DIR}/version_string.h.txt ${hstring} )
|
||||||
|
|
|
@ -1,20 +1,40 @@
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
if(GIT_FOUND)
|
if(GIT_FOUND)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} log -1 --date=short "--pretty=%h (%cd)"
|
COMMAND ${GIT_EXECUTABLE} log -1 --date=short "--pretty=%h"
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
RESULT_VARIABLE res_var
|
RESULT_VARIABLE res_var
|
||||||
OUTPUT_VARIABLE GIT_COM_ID
|
OUTPUT_VARIABLE GIT_COM_ID
|
||||||
)
|
)
|
||||||
if( NOT ${res_var} EQUAL 0 )
|
if( NOT ${res_var} EQUAL 0 )
|
||||||
set( GIT_COMMIT_ID "git commit id unknown")
|
set( GIT_COMMIT_ID "unknown")
|
||||||
message( WARNING "Git failed (not a repo, or no tags). Build will not contain git revision info." )
|
message( WARNING "Git failed (not a repo, or no tags). Build will not contain git revision info." )
|
||||||
endif()
|
endif()
|
||||||
string( REPLACE "\n" "" GIT_COMMIT_ID "${GIT_COM_ID}" )
|
string( REPLACE "\n" "" GIT_COMMIT_ID "${GIT_COM_ID}" )
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} log -1 --date=short "--pretty=%cd"
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
RESULT_VARIABLE res_var
|
||||||
|
OUTPUT_VARIABLE GIT_COM_DATE
|
||||||
|
)
|
||||||
|
if( NOT ${res_var} EQUAL 0 )
|
||||||
|
set( GIT_COMMIT_DATE "unknown")
|
||||||
|
set( GIT_COMMIT_DATE_FRIENDLY "unknown")
|
||||||
|
message( WARNING "Git failed (not a repo, or no tags). Build will not contain git revision info." )
|
||||||
|
endif()
|
||||||
|
string( REPLACE "\n" "" GIT_COMMIT_DATE_FRIENDLY "${GIT_COM_DATE}" )
|
||||||
|
string( REPLACE "-" "" GIT_COMMIT_DATE "${GIT_COMMIT_DATE_FRIENDLY}" )
|
||||||
else()
|
else()
|
||||||
set( GIT_COMMIT_ID "unknown (git not found!)")
|
set( GIT_COMMIT_ID "unknown")
|
||||||
|
set( GIT_COMMIT_DATE "unknown")
|
||||||
|
set( GIT_COMMIT_DATE_FRIENDLY "unknown")
|
||||||
message( WARNING "Git not found. Build will not contain git revision info." )
|
message( WARNING "Git not found. Build will not contain git revision info." )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PROJECT_VERSION_MAJOR ${GIT_COMMIT_ID})
|
set(PROJECT_VERSION_MAJOR "0")
|
||||||
set(PROJECT_VERSION ${GIT_COMMIT_ID} )
|
set(PROJECT_VERSION_MINOR "0")
|
||||||
|
set(PROJECT_VERSION_PATCH "1~git${GIT_COMMIT_DATE}.${GIT_COMMIT_ID}")
|
||||||
|
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
|
set(PROJECT_VERSION_FRIENDLY "${GIT_COMMIT_ID} (${GIT_COMMIT_DATE_FRIENDLY})")
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,6 @@ SET(cockatrice_SOURCES
|
||||||
${VERSION_STRING_CPP}
|
${VERSION_STRING_CPP}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
|
||||||
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/cockatrice/translations\\")
|
|
||||||
endif (UNIX AND NOT APPLE)
|
|
||||||
|
|
||||||
set(cockatrice_RESOURCES cockatrice.qrc)
|
set(cockatrice_RESOURCES cockatrice.qrc)
|
||||||
|
|
||||||
IF(UPDATE_TRANSLATIONS)
|
IF(UPDATE_TRANSLATIONS)
|
||||||
|
|
|
@ -54,11 +54,7 @@ QSystemTrayIcon *trayIcon;
|
||||||
ThemeManager *themeManager;
|
ThemeManager *themeManager;
|
||||||
|
|
||||||
const QString translationPrefix = "cockatrice";
|
const QString translationPrefix = "cockatrice";
|
||||||
#ifdef TRANSLATION_PATH
|
QString translationPath;
|
||||||
QString translationPath = TRANSLATION_PATH;
|
|
||||||
#else
|
|
||||||
QString translationPath = QString();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
static void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
static void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
||||||
|
@ -136,13 +132,13 @@ int main(int argc, char *argv[])
|
||||||
QCoreApplication::setOrganizationDomain("cockatrice.de");
|
QCoreApplication::setOrganizationDomain("cockatrice.de");
|
||||||
QCoreApplication::setApplicationName("Cockatrice");
|
QCoreApplication::setApplicationName("Cockatrice");
|
||||||
|
|
||||||
if (translationPath.isEmpty()) {
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
translationPath = qApp->applicationDirPath() + "/../Resources/translations";
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
translationPath = app.applicationDirPath() + "/translations";
|
translationPath = qApp->applicationDirPath() + "/translations";
|
||||||
|
#else // linux
|
||||||
|
translationPath = qApp->applicationDirPath() + "/../share/cockatrice/translations";
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
rng = new RNG_SFMT;
|
rng = new RNG_SFMT;
|
||||||
settingsCache = new SettingsCache;
|
settingsCache = new SettingsCache;
|
||||||
|
|
|
@ -24,10 +24,6 @@ SET(oracle_SOURCES
|
||||||
../cockatrice/src/qt-json/json.cpp
|
../cockatrice/src/qt-json/json.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
|
||||||
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/oracle/translations\\")
|
|
||||||
endif (UNIX AND NOT APPLE)
|
|
||||||
|
|
||||||
set(oracle_RESOURCES oracle.qrc)
|
set(oracle_RESOURCES oracle.qrc)
|
||||||
|
|
||||||
IF(UPDATE_TRANSLATIONS)
|
IF(UPDATE_TRANSLATIONS)
|
||||||
|
|
|
@ -14,11 +14,7 @@ SettingsCache *settingsCache;
|
||||||
ThemeManager *themeManager;
|
ThemeManager *themeManager;
|
||||||
|
|
||||||
const QString translationPrefix = "oracle";
|
const QString translationPrefix = "oracle";
|
||||||
#ifdef TRANSLATION_PATH
|
QString translationPath;
|
||||||
QString translationPath = TRANSLATION_PATH;
|
|
||||||
#else
|
|
||||||
QString translationPath = QString();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void installNewTranslator()
|
void installNewTranslator()
|
||||||
{
|
{
|
||||||
|
@ -44,13 +40,13 @@ int main(int argc, char *argv[])
|
||||||
// this can't be changed, as it influences the default savepath for cards.xml
|
// this can't be changed, as it influences the default savepath for cards.xml
|
||||||
QCoreApplication::setApplicationName("Cockatrice");
|
QCoreApplication::setApplicationName("Cockatrice");
|
||||||
|
|
||||||
if (translationPath.isEmpty()) {
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
translationPath = qApp->applicationDirPath() + "/../Resources/translations";
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
translationPath = app.applicationDirPath() + "/translations";
|
translationPath = qApp->applicationDirPath() + "/translations";
|
||||||
|
#else // linux
|
||||||
|
translationPath = qApp->applicationDirPath() + "/../share/cockatrice/translations";
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
settingsCache = new SettingsCache;
|
settingsCache = new SettingsCache;
|
||||||
themeManager = new ThemeManager;
|
themeManager = new ThemeManager;
|
||||||
|
|
|
@ -10,6 +10,7 @@ if [[ $TRAVIS_OS_NAME == "osx" && $QT4 == 0 ]]; then
|
||||||
fi
|
fi
|
||||||
if [[ $TRAVIS_OS_NAME == "linux" && $QT4 == 0 ]]; then
|
if [[ $TRAVIS_OS_NAME == "linux" && $QT4 == 0 ]]; then
|
||||||
prefix="-DCMAKE_PREFIX_PATH=`echo /opt/qt5*/lib/cmake/`"
|
prefix="-DCMAKE_PREFIX_PATH=`echo /opt/qt5*/lib/cmake/`"
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`echo /opt/qt5*/lib/`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $BUILDTYPE == "Debug" ]]; then
|
if [[ $BUILDTYPE == "Debug" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue