diff --git a/CMakeLists.txt b/CMakeLists.txt index fdc61c061..b178462e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,9 @@ set(MultiMC_CHANLIST_URL "" CACHE STRING "URL for the channel list.") # Notification URL set(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.") +# The metadata server +set(MultiMC_META_URL "https://meta.multimc.org/v1/" CACHE STRING "URL to fetch MultiMC's meta files from.") + # paste.ee API key set(MultiMC_PASTE_EE_API_KEY "utLvciUouSURFzfjPxLBf5W4ISsUX4pwBDF7N1AfZ" CACHE STRING "API key you can get from paste.ee when you register an account") @@ -264,6 +267,7 @@ add_subdirectory(libraries/classparser) # google analytics library ############################### Built Artifacts ############################### +add_subdirectory(buildconfig) add_subdirectory(api/logic) add_subdirectory(api/gui) diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt index cf9f9a17e..50eff4ba4 100644 --- a/api/logic/CMakeLists.txt +++ b/api/logic/CMakeLists.txt @@ -119,8 +119,6 @@ set(NET_SOURCES net/PasteUpload.cpp net/PasteUpload.h net/Sink.h - net/URLConstants.cpp - net/URLConstants.h net/Validator.h ) @@ -491,7 +489,7 @@ set_target_properties(MultiMC_logic PROPERTIES CXX_VISIBILITY_PRESET hidden VISI generate_export_header(MultiMC_logic) # Link -target_link_libraries(MultiMC_logic systeminfo MultiMC_quazip MultiMC_classparser ${NBT_NAME} ${ZLIB_LIBRARIES}) +target_link_libraries(MultiMC_logic systeminfo MultiMC_quazip MultiMC_classparser ${NBT_NAME} ${ZLIB_LIBRARIES} BuildConfig) target_link_libraries(MultiMC_logic Qt5::Core Qt5::Xml Qt5::Network Qt5::Concurrent) # Mark and export headers diff --git a/api/logic/meta/BaseEntity.cpp b/api/logic/meta/BaseEntity.cpp index 697beb563..31d79aa39 100644 --- a/api/logic/meta/BaseEntity.cpp +++ b/api/logic/meta/BaseEntity.cpp @@ -24,6 +24,8 @@ #include "Env.h" #include "Json.h" +#include "BuildConfig.h" + class ParsingValidator : public Net::Validator { public: /* con/des */ @@ -76,7 +78,7 @@ Meta::BaseEntity::~BaseEntity() QUrl Meta::BaseEntity::url() const { - return QUrl("https://meta.multimc.org/v1/").resolved(localFilename()); + return QUrl(BuildConfig.META_URL).resolved(localFilename()); } bool Meta::BaseEntity::loadLocalFile() diff --git a/api/logic/minecraft/AssetsUtils.cpp b/api/logic/minecraft/AssetsUtils.cpp index f94f68b11..680890808 100644 --- a/api/logic/minecraft/AssetsUtils.cpp +++ b/api/logic/minecraft/AssetsUtils.cpp @@ -27,7 +27,7 @@ #include "FileSystem.h" #include "net/Download.h" #include "net/ChecksumValidator.h" -#include "net/URLConstants.h" +#include "BuildConfig.h" namespace { QSet collectPathsFromDir(QString dirPath) @@ -308,7 +308,7 @@ QString AssetObject::getLocalPath() QUrl AssetObject::getUrl() { - return URLConstants::RESOURCE_BASE + getRelPath(); + return BuildConfig.RESOURCE_BASE + getRelPath(); } QString AssetObject::getRelPath() diff --git a/api/logic/minecraft/Library.cpp b/api/logic/minecraft/Library.cpp index 9ff8dcdc9..b3c7657c3 100644 --- a/api/logic/minecraft/Library.cpp +++ b/api/logic/minecraft/Library.cpp @@ -5,6 +5,7 @@ #include #include #include +#include void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32, @@ -171,7 +172,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads( if (m_repositoryURL.isEmpty()) { - return URLConstants::LIBRARY_BASE + raw_storage; + return BuildConfig.LIBRARY_BASE + raw_storage; } if(m_repositoryURL.endsWith('/')) diff --git a/api/logic/minecraft/Library.h b/api/logic/minecraft/Library.h index 014f67454..acdd6c9c6 100644 --- a/api/logic/minecraft/Library.h +++ b/api/logic/minecraft/Library.h @@ -12,7 +12,6 @@ #include "Rule.h" #include "minecraft/OpSys.h" #include "GradleSpecifier.h" -#include "net/URLConstants.h" #include "MojangDownloadInfo.h" #include "multimc_logic_export.h" diff --git a/api/logic/minecraft/MinecraftUpdate.cpp b/api/logic/minecraft/MinecraftUpdate.cpp index ca3e76179..68dd437d6 100644 --- a/api/logic/minecraft/MinecraftUpdate.cpp +++ b/api/logic/minecraft/MinecraftUpdate.cpp @@ -25,7 +25,6 @@ #include "BaseInstance.h" #include "minecraft/PackProfile.h" #include "minecraft/Library.h" -#include "net/URLConstants.h" #include #include "update/FoldersTask.h" diff --git a/api/logic/minecraft/OneSixVersionFormat.cpp b/api/logic/minecraft/OneSixVersionFormat.cpp index a0b6fd0e7..7ac9e2db6 100644 --- a/api/logic/minecraft/OneSixVersionFormat.cpp +++ b/api/logic/minecraft/OneSixVersionFormat.cpp @@ -198,7 +198,10 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc // FIXME: this will eventually break... else { - lib->setAbsoluteUrl(URLConstants::getLegacyJarUrl(out->minecraftVersion)); + out->addProblem( + ProblemSeverity::Error, + QObject::tr("URL for the main jar could not be determined - Mojang removed the server that we used as fallback.") + ); } out->mainJar = lib; } diff --git a/api/logic/minecraft/auth/YggdrasilTask.cpp b/api/logic/minecraft/auth/YggdrasilTask.cpp index 71f5d950f..570fe1ea4 100644 --- a/api/logic/minecraft/auth/YggdrasilTask.cpp +++ b/api/logic/minecraft/auth/YggdrasilTask.cpp @@ -25,7 +25,7 @@ #include -#include +#include #include @@ -42,7 +42,7 @@ void YggdrasilTask::executeTask() // Get the content of the request we're going to send to the server. QJsonDocument doc(getRequestContent()); - QUrl reqUrl(URLConstants::AUTH_BASE + getEndpoint()); + QUrl reqUrl(BuildConfig.AUTH_BASE + getEndpoint()); QNetworkRequest netRequest(reqUrl); netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); diff --git a/api/logic/minecraft/update/FMLLibrariesTask.cpp b/api/logic/minecraft/update/FMLLibrariesTask.cpp index 850130a1a..85993e814 100644 --- a/api/logic/minecraft/update/FMLLibrariesTask.cpp +++ b/api/logic/minecraft/update/FMLLibrariesTask.cpp @@ -4,6 +4,7 @@ #include "FMLLibrariesTask.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" +#include "BuildConfig.h" FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst) { @@ -63,7 +64,7 @@ void FMLLibrariesTask::executeTask() for (auto &lib : fmlLibsToProcess) { auto entry = metacache->resolveEntry("fmllibs", lib.filename); - QString urlString = (lib.ours ? URLConstants::FMLLIBS_OUR_BASE_URL : URLConstants::FMLLIBS_FORGE_BASE_URL) + lib.filename; + QString urlString = (lib.ours ? BuildConfig.FMLLIBS_OUR_BASE_URL : BuildConfig.FMLLIBS_FORGE_BASE_URL) + lib.filename; dljob->addNetAction(Net::Download::makeCached(QUrl(urlString), entry)); } diff --git a/api/logic/modplatform/legacy_ftb/PackFetchTask.cpp b/api/logic/modplatform/legacy_ftb/PackFetchTask.cpp index 43c1e6f8e..c2ef64362 100644 --- a/api/logic/modplatform/legacy_ftb/PackFetchTask.cpp +++ b/api/logic/modplatform/legacy_ftb/PackFetchTask.cpp @@ -2,7 +2,7 @@ #include "PrivatePackManager.h" #include -#include "net/URLConstants.h" +#include namespace LegacyFTB { @@ -13,11 +13,11 @@ void PackFetchTask::fetch() NetJob *netJob = new NetJob("LegacyFTB::ModpackFetch"); - QUrl publicPacksUrl = QUrl(URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/modpacks.xml"); + QUrl publicPacksUrl = QUrl(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/modpacks.xml"); qDebug() << "Downloading public version info from" << publicPacksUrl.toString(); netJob->addNetAction(Net::Download::makeByteArray(publicPacksUrl, &publicModpacksXmlFileData)); - QUrl thirdPartyUrl = QUrl(URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/thirdparty.xml"); + QUrl thirdPartyUrl = QUrl(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/thirdparty.xml"); qDebug() << "Downloading thirdparty version info from" << thirdPartyUrl.toString(); netJob->addNetAction(Net::Download::makeByteArray(thirdPartyUrl, &thirdPartyModpacksXmlFileData)); @@ -30,7 +30,7 @@ void PackFetchTask::fetch() void PackFetchTask::fetchPrivate(const QStringList & toFetch) { - QString privatePackBaseUrl = URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/%1.xml"; + QString privatePackBaseUrl = BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1.xml"; for (auto &packCode: toFetch) { diff --git a/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp b/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp index a3f35154c..9bf6c76ac 100644 --- a/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp +++ b/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp @@ -9,7 +9,7 @@ #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" #include "minecraft/GradleSpecifier.h" -#include "net/URLConstants.h" +#include "BuildConfig.h" #include @@ -38,11 +38,11 @@ void PackInstallTask::downloadPack() QString url; if(m_pack.type == PackType::Private) { - url = QString(URLConstants::LEGACY_FTB_CDN_BASE_URL + "privatepacks/%1").arg(packoffset); + url = QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "privatepacks/%1").arg(packoffset); } else { - url = QString(URLConstants::LEGACY_FTB_CDN_BASE_URL + "modpacks/%1").arg(packoffset); + url = QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "modpacks/%1").arg(packoffset); } job->addNetAction(Net::Download::makeCached(url, entry)); archivePath = entry->getFullPath(); @@ -210,4 +210,4 @@ bool PackInstallTask::abort() return false; } -} \ No newline at end of file +} diff --git a/api/logic/net/URLConstants.cpp b/api/logic/net/URLConstants.cpp deleted file mode 100644 index 9a4d920b9..000000000 --- a/api/logic/net/URLConstants.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "URLConstants.h" - -namespace URLConstants { - -QString getLegacyJarUrl(QString version) -{ - return AWS_DOWNLOAD_VERSIONS + getJarPath(version); -} - -QString getJarPath(QString version) -{ - return version + "/" + version + ".jar"; -} - - -} diff --git a/api/logic/net/URLConstants.h b/api/logic/net/URLConstants.h deleted file mode 100644 index ebc495bb3..000000000 --- a/api/logic/net/URLConstants.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2013-2019 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -namespace URLConstants -{ -const QString AWS_DOWNLOAD_VERSIONS("https://s3.amazonaws.com/Minecraft.Download/versions/"); -const QString RESOURCE_BASE("https://resources.download.minecraft.net/"); -const QString LIBRARY_BASE("https://libraries.minecraft.net/"); -const QString SKINS_BASE("https://crafatar.com/skins/"); -const QString AUTH_BASE("https://authserver.mojang.com/"); -const QString MOJANG_STATUS_URL("https://status.mojang.com/check"); -const QString IMGUR_BASE_URL("https://api.imgur.com/3/"); -const QString FMLLIBS_OUR_BASE_URL("https://files.multimc.org/fmllibs/"); -const QString FMLLIBS_FORGE_BASE_URL("https://files.minecraftforge.net/fmllibs/"); -const QString TRANSLATIONS_BASE_URL("https://files.multimc.org/translations/"); - -const QString LEGACY_FTB_CDN_BASE_URL("https://dist.creeper.host/FTB2/"); - -QString getJarPath(QString version); -QString getLegacyJarUrl(QString version); -} diff --git a/api/logic/screenshots/ImgurAlbumCreation.cpp b/api/logic/screenshots/ImgurAlbumCreation.cpp index 3d32f597c..ff9ec6fde 100644 --- a/api/logic/screenshots/ImgurAlbumCreation.cpp +++ b/api/logic/screenshots/ImgurAlbumCreation.cpp @@ -6,13 +6,13 @@ #include #include -#include "net/URLConstants.h" +#include "BuildConfig.h" #include "Env.h" #include ImgurAlbumCreation::ImgurAlbumCreation(QList screenshots) : NetAction(), m_screenshots(screenshots) { - m_url = URLConstants::IMGUR_BASE_URL + "album.json"; + m_url = BuildConfig.IMGUR_BASE_URL + "album.json"; m_status = Job_NotStarted; } diff --git a/api/logic/screenshots/ImgurUpload.cpp b/api/logic/screenshots/ImgurUpload.cpp index 74165869b..1585b0615 100644 --- a/api/logic/screenshots/ImgurUpload.cpp +++ b/api/logic/screenshots/ImgurUpload.cpp @@ -8,13 +8,13 @@ #include #include -#include "net/URLConstants.h" +#include "BuildConfig.h" #include "Env.h" #include ImgurUpload::ImgurUpload(ScreenshotPtr shot) : NetAction(), m_shot(shot) { - m_url = URLConstants::IMGUR_BASE_URL + "upload.json"; + m_url = BuildConfig.IMGUR_BASE_URL + "upload.json"; m_status = Job_NotStarted; } diff --git a/api/logic/status/StatusChecker.cpp b/api/logic/status/StatusChecker.cpp index f18ed3649..2a4091c68 100644 --- a/api/logic/status/StatusChecker.cpp +++ b/api/logic/status/StatusChecker.cpp @@ -15,12 +15,12 @@ #include "StatusChecker.h" -#include - #include #include +#include + StatusChecker::StatusChecker() { @@ -43,7 +43,7 @@ void StatusChecker::reloadStatus() // qDebug() << "Reloading status."; NetJob* job = new NetJob("Status JSON"); - job->addNetAction(Net::Download::makeByteArray(URLConstants::MOJANG_STATUS_URL, &dataSink)); + job->addNetAction(Net::Download::makeByteArray(BuildConfig.MOJANG_STATUS_URL, &dataSink)); QObject::connect(job, &NetJob::succeeded, this, &StatusChecker::statusDownloadFinished); QObject::connect(job, &NetJob::failed, this, &StatusChecker::statusDownloadFailed); m_statusNetJob.reset(job); diff --git a/api/logic/translations/TranslationsModel.cpp b/api/logic/translations/TranslationsModel.cpp index 43b3e75fd..adb3fa98d 100644 --- a/api/logic/translations/TranslationsModel.cpp +++ b/api/logic/translations/TranslationsModel.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "Json.h" #include "POTranslator.h" @@ -606,7 +606,7 @@ void TranslationsModel::downloadTranslation(QString key) MetaEntryPtr entry = ENV.metacache()->resolveEntry("translations", "mmc_" + key + ".qm"); entry->setStale(true); - auto dl = Net::Download::makeCached(QUrl(URLConstants::TRANSLATIONS_BASE_URL + lang->file_name), entry); + auto dl = Net::Download::makeCached(QUrl(BuildConfig.TRANSLATIONS_BASE_URL + lang->file_name), entry); auto rawHash = QByteArray::fromHex(lang->file_sha1.toLatin1()); dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawHash)); dl->m_total_progress = lang->file_size; diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 53c218668..1d5b8e04e 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -1,8 +1,5 @@ project(application) -######## Configure the file with build properties ######## -configure_file("${PROJECT_SOURCE_DIR}/BuildConfig.cpp.in" "${PROJECT_BINARY_DIR}/BuildConfig.cpp") - ################################ FILES ################################ ######## Sources and headers ######## @@ -11,8 +8,6 @@ SET(MULTIMC_SOURCES main.cpp MultiMC.h MultiMC.cpp - BuildConfig.h - ${PROJECT_BINARY_DIR}/BuildConfig.cpp UpdateController.cpp UpdateController.h diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 48b9ed474..00c370844 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include @@ -772,7 +772,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow for (auto profile : account->profiles()) { auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); - auto action = Net::Download::makeCached(QUrl(URLConstants::SKINS_BASE + profile.id + ".png"), meta); + auto action = Net::Download::makeCached(QUrl(BuildConfig.SKINS_BASE + profile.id + ".png"), meta); skin_dls.append(action); meta->setStale(true); } diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index a8d264981..eeab500eb 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -45,7 +45,6 @@ #include #include "icons/IconList.h" #include "net/HttpMetaCache.h" -#include "net/URLConstants.h" #include "Env.h" #include "java/JavaUtils.h" diff --git a/application/pages/global/AccountListPage.cpp b/application/pages/global/AccountListPage.cpp index 0453ae005..3c900fabf 100644 --- a/application/pages/global/AccountListPage.cpp +++ b/application/pages/global/AccountListPage.cpp @@ -22,7 +22,6 @@ #include #include "net/NetJob.h" -#include "net/URLConstants.h" #include "Env.h" #include "dialogs/ProgressDialog.h" @@ -34,6 +33,8 @@ #include "MultiMC.h" +#include "BuildConfig.h" + AccountListPage::AccountListPage(QWidget *parent) : QMainWindow(parent), ui(new Ui::AccountListPage) { @@ -170,7 +171,7 @@ void AccountListPage::addAccount(const QString &errMsg) for (AccountProfile profile : account->profiles()) { auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); - auto action = Net::Download::makeCached(QUrl(URLConstants::SKINS_BASE + profile.id + ".png"), meta); + auto action = Net::Download::makeCached(QUrl(BuildConfig.SKINS_BASE + profile.id + ".png"), meta); job->addNetAction(action); meta->setStale(true); } diff --git a/application/pages/modplatform/legacy_ftb/ListModel.cpp b/application/pages/modplatform/legacy_ftb/ListModel.cpp index 105db25a2..32596fb3f 100644 --- a/application/pages/modplatform/legacy_ftb/ListModel.cpp +++ b/application/pages/modplatform/legacy_ftb/ListModel.cpp @@ -10,7 +10,7 @@ #include #include -#include "net/URLConstants.h" +#include namespace LegacyFTB { @@ -218,7 +218,7 @@ void ListModel::requestLogo(QString file) MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0))); NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file)); - job->addNetAction(Net::Download::makeCached(QUrl(QString(URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry)); + job->addNetAction(Net::Download::makeCached(QUrl(QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry)); auto fullPath = entry->getFullPath(); QObject::connect(job, &NetJob::finished, this, [this, file, fullPath] diff --git a/application/pages/modplatform/twitch/TwitchModel.cpp b/application/pages/modplatform/twitch/TwitchModel.cpp index d9358941f..9e3c3ad22 100644 --- a/application/pages/modplatform/twitch/TwitchModel.cpp +++ b/application/pages/modplatform/twitch/TwitchModel.cpp @@ -10,8 +10,6 @@ #include #include -#include "net/URLConstants.h" - namespace Twitch { ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) diff --git a/application/BuildConfig.cpp.in b/buildconfig/BuildConfig.cpp.in similarity index 96% rename from application/BuildConfig.cpp.in rename to buildconfig/BuildConfig.cpp.in index a1d236b24..86ea83ee3 100644 --- a/application/BuildConfig.cpp.in +++ b/buildconfig/BuildConfig.cpp.in @@ -1,7 +1,7 @@ #include "BuildConfig.h" #include -Config BuildConfig; +const Config BuildConfig; Config::Config() { @@ -33,6 +33,7 @@ Config::Config() VERSION_STR = "@MultiMC_VERSION_STRING@"; NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@"; PASTE_EE_KEY = "@MultiMC_PASTE_EE_API_KEY@"; + META_URL = "@MultiMC_META_URL@"; } QString Config::printableVersionString() const diff --git a/application/BuildConfig.h b/buildconfig/BuildConfig.h similarity index 67% rename from application/BuildConfig.h rename to buildconfig/BuildConfig.h index 77c42dd40..a80af3d23 100644 --- a/application/BuildConfig.h +++ b/buildconfig/BuildConfig.h @@ -60,6 +60,23 @@ public: */ QString PASTE_EE_KEY; + /** + * MultiMC Metadata repository URL prefix + */ + QString META_URL; + + QString RESOURCE_BASE = "https://resources.download.minecraft.net/"; + QString LIBRARY_BASE = "https://libraries.minecraft.net/"; + QString SKINS_BASE = "https://crafatar.com/skins/"; + QString AUTH_BASE = "https://authserver.mojang.com/"; + QString MOJANG_STATUS_URL = "https://status.mojang.com/check"; + QString IMGUR_BASE_URL = "https://api.imgur.com/3/"; + QString FMLLIBS_OUR_BASE_URL = "https://files.multimc.org/fmllibs/"; + QString FMLLIBS_FORGE_BASE_URL = "https://files.minecraftforge.net/fmllibs/"; + QString TRANSLATIONS_BASE_URL = "https://files.multimc.org/translations/"; + + QString LEGACY_FTB_CDN_BASE_URL = "https://dist.creeper.host/FTB2/"; + /** * \brief Converts the Version to a string. * \return The version number in string format (major.minor.revision.build). @@ -67,4 +84,4 @@ public: QString printableVersionString() const; }; -extern Config BuildConfig; +extern const Config BuildConfig; diff --git a/buildconfig/CMakeLists.txt b/buildconfig/CMakeLists.txt new file mode 100644 index 000000000..de4fd3501 --- /dev/null +++ b/buildconfig/CMakeLists.txt @@ -0,0 +1,11 @@ +######## Configure the file with build properties ######## + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/BuildConfig.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/BuildConfig.cpp") + +add_library(BuildConfig STATIC + BuildConfig.h + ${CMAKE_CURRENT_BINARY_DIR}/BuildConfig.cpp +) + +target_link_libraries(BuildConfig Qt5::Core) +target_include_directories(BuildConfig PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")