From 0b94b47f7256af41ea03108786cf739470ba0ccd Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 25 Aug 2015 21:25:13 +0200 Subject: [PATCH] Servatrice portable + cmake options Use -DPORTABLE=1 to build a portable version --- cockatrice/CMakeLists.txt | 5 +++++ oracle/CMakeLists.txt | 5 +++++ servatrice/CMakeLists.txt | 5 +++++ servatrice/src/settingscache.cpp | 8 +++++--- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index ee0a2e88..54c6bb1a 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -333,3 +333,8 @@ Data = Resources\") install(FILES ${WIN32SSLRUNTIME_LIBRARIES} DESTINATION ./) endif() endif() +#Compile a portable version, default off +option(PORTABLE "portable build" OFF) +IF(PORTABLE) +add_definitions(-DPORTABLE_BUILD) +endif() diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index ee0c5877..b95f146a 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -238,3 +238,8 @@ Translations = Resources/translations\") fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.exe\" \"\${QTPLUGINS}\" \"${libSearchDirs}\") " COMPONENT Runtime) endif() +#Compile a portable version, default off +option(PORTABLE "portable build" OFF) +IF(PORTABLE) +add_definitions(-DPORTABLE_BUILD) +endif() diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 6fa529ff..047a3f53 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -194,3 +194,8 @@ Translations = Resources/translations\") fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/servatrice.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) endif() +#Compile a portable version, default off +option(PORTABLE "portable build" OFF) +IF(PORTABLE) +add_definitions(-DPORTABLE_BUILD) +endif() diff --git a/servatrice/src/settingscache.cpp b/servatrice/src/settingscache.cpp index b2b74d74..1adad629 100644 --- a/servatrice/src/settingscache.cpp +++ b/servatrice/src/settingscache.cpp @@ -15,9 +15,11 @@ SettingsCache::SettingsCache(const QString & fileName, QSettings::Format format, QString SettingsCache::guessConfigurationPath(QString & specificPath) { - const QString fileName="servatrice.ini"; + const QString fileName="servatrice.ini"; + #ifdef PORTABLE_BUILD + return fileName; + #endif QString guessFileName; - // specific path if(!specificPath.isEmpty() && QFile::exists(specificPath)) return specificPath; @@ -40,4 +42,4 @@ QString SettingsCache::guessConfigurationPath(QString & specificPath) guessFileName = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/" + fileName; #endif return guessFileName; -} \ No newline at end of file +}