Skip to content

Commit

Permalink
Build arm64 installer
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Koshura <[email protected]>
  • Loading branch information
AenBleidd committed Dec 4, 2024
1 parent ff7810b commit 2b2b8aa
Show file tree
Hide file tree
Showing 26 changed files with 151 additions and 126 deletions.
25 changes: 0 additions & 25 deletions 3rdParty/vcpkg_ports/configs/msbuild/ARM64/vcpkg.json

This file was deleted.

7 changes: 7 additions & 0 deletions 3rdParty/vcpkg_ports/configs/msbuild/installer/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "boinc-msbuild",
"dependencies":
[
"nlohmann-json"
]
}
26 changes: 26 additions & 0 deletions 3rdParty/vcpkg_ports/configs/msbuild/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "boinc-msbuild",
"dependencies":
[
{
"name": "curl",
"features": ["schannel"],
"default-features": false
},
{
"name": "openssl",
"features": ["ssl3", "weak-ssl-ciphers"],
"default-features": false
},
"rappture",
{
"name": "wxwidgets",
"features": ["webview"],
"default-features": false
},
"gtest",
"ftgl",
"opencl",
"nlohmann-json"
]
}
26 changes: 0 additions & 26 deletions 3rdParty/vcpkg_ports/configs/msbuild/x64/vcpkg.json

This file was deleted.

15 changes: 2 additions & 13 deletions installer/Binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,10 @@
#include "JsonHelper.h"

Binary::Binary(const nlohmann::json& json,
const std::filesystem::path& root_path) {
const std::filesystem::path& root_path, const std::string& platform,
const std::string& configuration) {
const std::string configuration_template = "%%CONFIGURATION%%";
const std::string configuration =
#ifdef _DEBUG
"Debug";
#else
"Release";
#endif
const std::string platform_template = "%%PLATFORM%%";
const std::string platform =
#ifdef _ARM64_
"ARM64";
#else
"x64";
#endif

JsonHelper::get(json, "Name", name);
JsonHelper::handle(json, "Path", [&](std::string p) {
Expand Down
3 changes: 2 additions & 1 deletion installer/Binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
class Binary : public Record {
public:
explicit Binary(const nlohmann::json& json,
const std::filesystem::path& root_path);
const std::filesystem::path& root_path, const std::string& platform,
const std::string& configuration);
~Binary() = default;
MSIHANDLE getRecord() const override;
private:
Expand Down
5 changes: 3 additions & 2 deletions installer/BinaryTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include "BinaryTable.h"

BinaryTable::BinaryTable(const nlohmann::json& json,
const std::filesystem::path& path) {
const std::filesystem::path& path, const std::string& platform,
const std::string& configuration) {
std::cout << "Loading BinaryTable..." << std::endl;

for (const auto& element : json) {
binaries.emplace_back(element, path);
binaries.emplace_back(element, path, platform, configuration);
}
}

Expand Down
3 changes: 2 additions & 1 deletion installer/BinaryTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
class BinaryTable : public Generator<Binary> {
public:
explicit BinaryTable(const nlohmann::json& json,
const std::filesystem::path& path);
const std::filesystem::path& path, const std::string& platform,
const std::string& configuration);
~BinaryTable() = default;
bool generate(MSIHANDLE hDatabase) override;
private:
Expand Down
9 changes: 6 additions & 3 deletions installer/DirectoryTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
DirectoryTable::DirectoryTable(const nlohmann::json& json,
const std::filesystem::path& root_path,
const std::filesystem::path& output_path,
const InstallerStrings& installerStrings) :
root_path (root_path), output_path(output_path) {
const InstallerStrings& installerStrings, const std::string& platform,
const std::string& configuration) :
root_path(root_path), output_path(output_path), platform(platform),
configuration(configuration) {
std::cout << "Loading DirectoryTable..." << std::endl;
for (const auto& directory : json) {
directories.emplace_back(directory, "", installerStrings);
Expand All @@ -51,7 +53,8 @@ bool DirectoryTable::generate(MSIHANDLE hDatabase) {
std::cerr << "Failed to generate CreateFolderTable" << std::endl;
return false;
}
if (!FileTable(directories, root_path, output_path).generate(hDatabase)) {
if (!FileTable(directories, root_path,
output_path, platform, configuration).generate(hDatabase)) {
std::cerr << "Failed to generate FileTable" << std::endl;
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion installer/DirectoryTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ class DirectoryTable : public Generator<Directory> {
explicit DirectoryTable(const nlohmann::json& json,
const std::filesystem::path& root_path,
const std::filesystem::path& output_path,
const InstallerStrings& installerStrings);
const InstallerStrings& installerStrings, const std::string& platform,
const std::string& configuration);
~DirectoryTable() = default;
bool generate(MSIHANDLE hDatabase) override;
private:
std::vector<Directory> directories{};
std::filesystem::path root_path{};
std::filesystem::path output_path{};
std::string platform{};
std::string configuration{};
};
18 changes: 4 additions & 14 deletions installer/FileTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,7 @@ size_t FileTable::GetFileSize(const std::string& filePath) {
std::filesystem::path FileTable::GetAbsolutePath(
const std::filesystem::path& filePath) {
const std::string configuration_template = "%%CONFIGURATION%%";
const std::string configuration =
#ifdef _DEBUG
"Debug";
#else
"Release";
#endif
const std::string platform_template = "%%PLATFORM%%";
const std::string platform =
#ifdef _ARM64_
"ARM64";
#else
"x64";
#endif

auto p = filePath.string();
auto index = p.find(configuration_template);
Expand All @@ -133,8 +121,10 @@ std::filesystem::path FileTable::GetAbsolutePath(

FileTable::FileTable(const std::vector<Directory>& directories,
const std::filesystem::path& root_path,
const std::filesystem::path& output_path) : root_path(root_path),
output_path(output_path) {
const std::filesystem::path& output_path, const std::string& platform,
const std::string& configuration) : root_path(root_path),
output_path(output_path), platform(platform),
configuration(configuration) {
int sequence = 0;
for (const auto& directory : directories) {
for (const auto& component : directory.getComponents()) {
Expand Down
5 changes: 4 additions & 1 deletion installer/FileTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class FileTable : public Generator<File> {
public:
explicit FileTable(const std::vector<Directory>& directories,
const std::filesystem::path& root_path,
const std::filesystem::path& output_path);
const std::filesystem::path& output_path, const std::string& platform,
const std::string& configuration);
~FileTable() = default;
bool generate(MSIHANDLE hDatabase) override;
private:
Expand All @@ -37,4 +38,6 @@ class FileTable : public Generator<File> {
std::vector<File> files{};
std::filesystem::path root_path{};
std::filesystem::path output_path{};
std::string platform{};
std::string configuration{};
};
15 changes: 2 additions & 13 deletions installer/Icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,10 @@
#include "JsonHelper.h"

Icon::Icon(const nlohmann::json& json,
const std::filesystem::path& root_path) {
const std::filesystem::path& root_path, const std::string& platform,
const std::string& configuration) {
const std::string configuration_template = "%%CONFIGURATION%%";
const std::string configuration =
#ifdef _DEBUG
"Debug";
#else
"Release";
#endif
const std::string platform_template = "%%PLATFORM%%";
const std::string platform =
#ifdef _ARM64_
"ARM64";
#else
"x64";
#endif

JsonHelper::get(json, "Name", name);
JsonHelper::handle(json, "Path", [&](std::string p) {
Expand Down
3 changes: 2 additions & 1 deletion installer/Icon.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
class Icon : public Record {
public:
explicit Icon(const nlohmann::json& json,
const std::filesystem::path& root_path);
const std::filesystem::path& root_path, const std::string& platform,
const std::string& configuration);
~Icon() = default;
MSIHANDLE getRecord() const override;
private:
Expand Down
5 changes: 3 additions & 2 deletions installer/IconTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include "IconTable.h"

IconTable::IconTable(const nlohmann::json& json,
const std::filesystem::path& path) {
const std::filesystem::path& path, const std::string& platform,
const std::string& configuration) {
std::cout << "Loading IconTable..." << std::endl;

for (const auto& item : json) {
values.emplace_back(item, path);
values.emplace_back(item, path, platform, configuration);
}
}

Expand Down
3 changes: 2 additions & 1 deletion installer/IconTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
class IconTable : public Generator<Icon> {
public:
explicit IconTable(const nlohmann::json& json,
const std::filesystem::path& path);
const std::filesystem::path& path, const std::string& platform,
const std::string& configuration);
~IconTable() = default;
bool generate(MSIHANDLE hDatabase) override;
private:
Expand Down
17 changes: 10 additions & 7 deletions installer/Installer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@

#include "Installer.h"

Installer::Installer(const std::filesystem::path& output_path) :
output_path(output_path) {
Installer::Installer(const std::filesystem::path& output_path,
const std::string& platform, const std::string& configuration) :
output_path(output_path), platform(platform),
configuration(configuration) {
}

bool Installer::load(const std::filesystem::path& json) {
Expand Down Expand Up @@ -76,8 +78,8 @@ bool Installer::load_from_json(const nlohmann::json& json,
{
try {
if (JsonHelper::exists(json, "Summary")) {
tables["Summary"] =std::make_shared<SummaryInformationTable>(
json["Summary"], installer_strings);
tables["Summary"] = std::make_shared<SummaryInformationTable>(
json["Summary"], installer_strings, platform);
}
if (JsonHelper::exists(json, "ActionText")) {
tables["ActionText"] = std::make_shared<ActionTextTable>(
Expand All @@ -99,7 +101,7 @@ bool Installer::load_from_json(const nlohmann::json& json,
}
if (JsonHelper::exists(json, "Binary")) {
tables["Binary"] = std::make_shared<BinaryTable>(
json["Binary"], path);
json["Binary"], path, platform, configuration);
}
if (JsonHelper::exists(json, "Checkbox")) {
tables["Checkbox"] = std::make_shared<CheckboxTable>(
Expand All @@ -115,7 +117,8 @@ bool Installer::load_from_json(const nlohmann::json& json,
}
if (JsonHelper::exists(json, "Directory")) {
tables["Directory"] = std::make_shared<DirectoryTable>(
json["Directory"], path, output_path, installer_strings);
json["Directory"], path, output_path, installer_strings,
platform, configuration);
}
if (JsonHelper::exists(json, "Error")) {
tables["Error"] = std::make_shared<ErrorTable>(json["Error"],
Expand All @@ -126,7 +129,7 @@ bool Installer::load_from_json(const nlohmann::json& json,
installer_strings);
}
if (JsonHelper::exists(json, "Icon")) {
tables["Icon"] = std::make_shared<IconTable>(json["Icon"], path);
tables["Icon"] = std::make_shared<IconTable>(json["Icon"], path, platform, configuration);
}
if (JsonHelper::exists(json, "InstallExecuteSequence")) {
tables["InstallExecuteSequence"] =
Expand Down
4 changes: 3 additions & 1 deletion installer/Installer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class Installer {
public:
explicit Installer(const std::filesystem::path& output_path);
explicit Installer(const std::filesystem::path& output_path, const std::string& platform, const std::string& configuration);
~Installer() = default;
bool load(const std::filesystem::path& json);
bool create_msi(const std::filesystem::path& msi);
Expand All @@ -39,4 +39,6 @@ class Installer {
std::map<std::string, std::shared_ptr<GeneratorTable>> tables{};
InstallerStrings installer_strings;
std::filesystem::path output_path{};
std::string platform;
std::string configuration;
};
12 changes: 10 additions & 2 deletions installer/SummaryInformationTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "SummaryInformationTable.h"

SummaryInformationTable::SummaryInformationTable(const nlohmann::json& json,
const InstallerStrings& installerStrings)
const InstallerStrings& installerStrings, const std::string& platform)
{
std::cout << "Loading SummaryInformationTable..." << std::endl;

Expand All @@ -42,7 +42,15 @@ SummaryInformationTable::SummaryInformationTable(const nlohmann::json& json,
summary[5] = JsonHelper::get<std::string>(json, "keywords");
summary[6] =
JsonHelper::get<std::string>(json, "comments", installerStrings);
summary[7] = JsonHelper::get<std::string>(json, "template");

auto tmplt = JsonHelper::get<std::string>(json, "template");
const std::string platform_template = "%%PLATFORM%%";
const auto index = tmplt.find(platform_template);
if (index != std::string::npos) {
tmplt.replace(index, platform_template.size(), platform == "ARM64" ? "Arm64" : platform);
}

summary[7] = tmplt;
summary[8] = JsonHelper::get<std::string>(json, "lastauthor");
summary[9] = GuidHelper::generate_guid();
summary[11] = fileTime;
Expand Down
2 changes: 1 addition & 1 deletion installer/SummaryInformationTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class SummaryInformationTable : public Generator<std::any> {
public:
explicit SummaryInformationTable(const nlohmann::json& json,
const InstallerStrings& installerStrings);
const InstallerStrings& installerStrings, const std::string& platform);
~SummaryInformationTable() = default;
bool generate(MSIHANDLE hDatabase) override;
private:
Expand Down
Loading

0 comments on commit 2b2b8aa

Please sign in to comment.