Skip to content

Commit f86d701

Browse files
committed
Add output_dir setting. Create more links to src and obj dirs in storage.
1 parent 71695a0 commit f86d701

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/common/package_store.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "project.h"
3030
#include "resolver.h"
3131
#include "settings.h"
32+
#include "shell_link.h"
3233
#include "sqlite_database.h"
3334
#include "templates.h"
3435

@@ -273,7 +274,13 @@ void PackageStore::write_index() const
273274
{
274275
auto &sdb = getServiceDatabase();
275276
for (auto &cc : *this)
277+
{
276278
sdb.addInstalledPackage(cc.first);
279+
#ifdef _WIN32
280+
create_link(cc.first.getDirSrc(), directories.storage_dir_lnk / "src" / (cc.first.target_name + ".lnk"), "CPPAN link");
281+
create_link(cc.first.getDirObj(), directories.storage_dir_lnk / "obj" / (cc.first.target_name + ".lnk"), "CPPAN link");
282+
#endif
283+
}
277284
}
278285

279286
Config *PackageStore::add_config(std::unique_ptr<Config> &&config, bool created)

src/common/settings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ void Settings::load_main(const yaml &root, const SettingsType type)
146146
EXTRACT(storage_dir, String);
147147
EXTRACT(build_dir, String);
148148
EXTRACT(cppan_dir, String);
149+
EXTRACT(output_dir, String);
149150

150151
auto &p = root["proxy"];
151152
if (p.IsDefined())

src/common/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct Settings
6767
SettingsType build_dir_type{ SettingsType::System };
6868
path build_dir;
6969
path cppan_dir = ".cppan";
70+
path output_dir = "bin";
7071
// printer
7172
PrinterType printerType{ PrinterType::CMake };
7273
// do not check for new cppan version

src/common/shell_link.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818

1919
#include "filesystem.h"
2020

21-
bool create_link(const path &file, const path &link, const String &description);
21+
bool create_link(const path &file, const path &link, const String &description = String());

src/printers/cmake.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
#include <program.h>
2929
#include <resolver.h>
3030
#include <settings.h>
31-
32-
#ifdef _WIN32
33-
#include "shell_link.h"
34-
#endif
31+
#include <shell_link.h>
3532

3633
#include <boost/algorithm/string.hpp>
3734

@@ -825,7 +822,7 @@ endif()
825822

826823
// should be after flags
827824
config_section_title(ctx, "CPPAN include");
828-
ctx.addLine("set(CPPAN_BUILD_OUTPUT_DIR \"" + normalize_path(fs::current_path()) + "\")");
825+
ctx.addLine("set(CPPAN_BUILD_OUTPUT_DIR \"" + normalize_path(fs::current_path() / s.output_dir) + "\")");
829826
ctx.addLine("set(CPPAN_BUILD_SHARED_LIBS "s + (s.use_shared_libs ? "1" : "0") + ")");
830827
ctx.addLine("set(CPPAN_DISABLE_CHECKS "s + (bs.disable_checks ? "1" : "0") + ")");
831828
ctx.addLine("set(CPPAN_BUILD_VERBOSE "s + (s.build_system_verbose ? "1" : "0") + ")");

0 commit comments

Comments
 (0)