Skip to content

Commit

Permalink
Move to VCPKG.
Browse files Browse the repository at this point in the history
* Use CMake with presets to generate USVFS solution.
* Use preset when building super repository.
* Allow overriding VCPKG_ROOT with [paths] entry.
* Remove gamebryo and nuget specific stuff.
* Remove cmake command. Add done log.
* Use VCPKG from VS if no VCPKG_ROOT or path setting.
  • Loading branch information
Holt59 committed Oct 12, 2024
1 parent 237bd6a commit e043237
Show file tree
Hide file tree
Showing 15 changed files with 281 additions and 392 deletions.
1 change: 1 addition & 0 deletions mob.ini
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ install_licenses =
install_pythoncore =
install_translations =
vs =
vcpkg =
qt_install =
qt_bin =
qt_translations =
Expand Down
70 changes: 0 additions & 70 deletions src/cmd/cmake.cpp

This file was deleted.

21 changes: 0 additions & 21 deletions src/cmd/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,27 +367,6 @@ namespace mob {
std::vector<fs::path> get_repos() const;
};

// runs cmake in a directory with the same parameters as `build` would
//
class cmake_command : public command {
public:
cmake_command();
meta_t meta() const override;

protected:
clipp::group do_group() override;
int do_run() override;
std::string do_doc() override;

private:
std::string gen_;
std::string cmd_;
bool x64_ = true;
bool debug_ = false;
std::string prefix_;
std::string path_;
};

// lists the inis found by mob
//
class inis_command : public command {
Expand Down
3 changes: 2 additions & 1 deletion src/core/conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ namespace mob {
set_path_if_empty("pf_x86", find_program_files_x86);
set_path_if_empty("pf_x64", find_program_files_x64);
set_path_if_empty("vs", find_vs);
set_path_if_empty("vcpkg", find_vcpkg); // set after vs as it will use the VS
set_path_if_empty("qt_install", find_qt);
set_path_if_empty("temp_dir", find_temp_dir);
set_path_if_empty("patches", find_in_root("patches"));
Expand All @@ -530,7 +531,7 @@ namespace mob {
resolve_path("install", p.prefix(), "install");
resolve_path("install_installer", p.install(), "installer");
resolve_path("install_bin", p.install(), "bin");
resolve_path("install_libs", p.install(), "libs");
resolve_path("install_libs", p.install(), "lib");
resolve_path("install_pdbs", p.install(), "pdb");
resolve_path("install_dlls", p.install_bin(), "dlls");
resolve_path("install_loot", p.install_bin(), "loot");
Expand Down
1 change: 1 addition & 0 deletions src/core/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ namespace mob {
VALUE(install_translations);

VALUE(vs);
VALUE(vcpkg);
VALUE(qt_install);
VALUE(qt_bin);
VALUE(qt_translations);
Expand Down
18 changes: 18 additions & 0 deletions src/core/paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,24 @@ namespace mob {
}
}

fs::path find_vcpkg()
{
const auto env_path = this_env::get().get("VCPKG_ROOT");

if (!env_path.empty()) {
return fs::absolute(env_path);
}

const auto vs_path = conf().path().vs();
const auto vcpkg_vs_path = vs_path / "VC" / "vcpkg";
if (!exists(vcpkg_vs_path)) {
gcx().bail_out(context::conf, "vcpkg is not part of VS installation at {}",
vs_path);
}

return vcpkg_vs_path;
}

fs::path find_qt()
{
// check from the ini first
Expand Down
5 changes: 5 additions & 0 deletions src/core/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace mob {
//
fs::path find_vs();

// returns the absolute path to VCPKG root directory to be used as VCPKG_ROOT when
// building
//
fs::path find_vcpkg();

// returns the absolute path to Qt's root directory, the one that contains
// bin, include, etc.; bails if not found
//
Expand Down
88 changes: 33 additions & 55 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,33 @@ namespace mob {

// third-party tasks

add_task<parallel_tasks>()
.add_task<sevenz>()
.add_task<zlib>()
.add_task<gtest>()
.add_task<libbsarch>()
.add_task<libloot>()
.add_task<openssl>()
.add_task<bzip2>()
.add_task<directxtex>();

add_task<parallel_tasks>()
.add_task<tasks::python>()
.add_task<lz4>()
.add_task<spdlog>();

add_task<parallel_tasks>()
.add_task<boost>()
.add_task<boost_di>()
.add_task<sip>();

add_task<parallel_tasks>()
.add_task<pyqt>()
.add_task<pybind11>()
.add_task<usvfs>()
.add_task<stylesheets>()
.add_task<licenses>()
.add_task<explorerpp>();
// add_task<parallel_tasks>()
// .add_task<sevenz>()
// .add_task<zlib>()
// .add_task<gtest>()
// .add_task<libbsarch>()
// .add_task<libloot>()
// .add_task<openssl>()
// .add_task<bzip2>()
// .add_task<directxtex>();

// add_task<parallel_tasks>()
// .add_task<tasks::python>()
// .add_task<lz4>()
// .add_task<spdlog>();

// add_task<parallel_tasks>()
// .add_task<boost>()
// .add_task<boost_di>()
// .add_task<sip>();

// add_task<parallel_tasks>()
// .add_task<pyqt>()
// .add_task<pybind11>()
// .add_task<usvfs>()
// .add_task<stylesheets>()
// .add_task<licenses>()
// .add_task<explorerpp>();

// super tasks

Expand All @@ -61,9 +61,9 @@ namespace mob {
// most of the alternate names below are from the transifex slugs, which
// are sometimes different from the project names, for whatever reason

add_task<parallel_tasks>()
.add_task<mo>("cmake_common")
.add_task<mo>("modorganizer-uibase");
add_task<parallel_tasks>().add_task<usvfs>().add_task<mo>("cmake_common");

add_task<mo>("modorganizer-uibase");

add_task<parallel_tasks>()
.add_task<mo>("modorganizer-archive")
Expand All @@ -72,30 +72,9 @@ namespace mob {
.add_task<mo>("modorganizer-bsatk")
.add_task<mo>("modorganizer-nxmhandler")
.add_task<mo>("modorganizer-helper")
.add_task<mo>("githubpp")
.add_task<mo>("modorganizer-game_gamebryo")
.add_task<mo>({"modorganizer-bsapacker", "bsa_packer"})
.add_task<mo>("modorganizer-preview_bsa");

// the gamebryo flag must be set for all game plugins that inherit from
// the gamebryo classes; this will merge the .ts file from gamebryo with
// the one from the specific plugin
add_task<parallel_tasks>()
.add_task<mo>("modorganizer-game_oblivion", mo::gamebryo)
.add_task<mo>("modorganizer-game_nehrim", mo::gamebryo)
.add_task<mo>("modorganizer-game_fallout3", mo::gamebryo)
.add_task<mo>("modorganizer-game_fallout4", mo::gamebryo)
.add_task<mo>("modorganizer-game_fallout4vr", mo::gamebryo)
.add_task<mo>("modorganizer-game_fallout76", mo::gamebryo)
.add_task<mo>("modorganizer-game_falloutnv", mo::gamebryo)
.add_task<mo>("modorganizer-game_morrowind", mo::gamebryo)
.add_task<mo>("modorganizer-game_skyrim", mo::gamebryo)
.add_task<mo>("modorganizer-game_skyrimse", mo::gamebryo)
.add_task<mo>("modorganizer-game_skyrimvr", mo::gamebryo)
.add_task<mo>("modorganizer-game_starfield", mo::gamebryo)
.add_task<mo>("modorganizer-game_ttw", mo::gamebryo)
.add_task<mo>("modorganizer-game_enderal", mo::gamebryo)
.add_task<mo>("modorganizer-game_enderalse", mo::gamebryo);
.add_task<mo>("modorganizer-preview_bsa")
.add_task<mo>("modorganizer-game_bethesda");

add_task<parallel_tasks>()
.add_task<mo>({"modorganizer-tool_inieditor", "inieditor"})
Expand All @@ -109,7 +88,7 @@ namespace mob {
.add_task<mo>("modorganizer-installer_quick")
.add_task<mo>("modorganizer-installer_fomod")
.add_task<mo>("modorganizer-installer_fomod_csharp")
.add_task<mo>("modorganizer-installer_omod", mo::nuget)
.add_task<mo>("modorganizer-installer_omod")
.add_task<mo>("modorganizer-installer_wizard")
.add_task<mo>("modorganizer-bsa_extractor")
.add_task<mo>("modorganizer-plugin_python");
Expand Down Expand Up @@ -147,7 +126,6 @@ namespace mob {
std::make_unique<list_command>(),
std::make_unique<release_command>(),
std::make_unique<git_command>(),
std::make_unique<cmake_command>(),
std::make_unique<inis_command>(),
std::make_unique<tx_command>()};

Expand Down
Loading

0 comments on commit e043237

Please sign in to comment.