Browse Source

`library` also knows its base dir

default_compile_flags
vector-of-bool 5 years ago
parent
commit
fc356f8f68
2 changed files with 7 additions and 4 deletions
  1. +2
    -2
      src/dds/library.cpp
  2. +5
    -2
      src/dds/library.hpp

+ 2
- 2
src/dds/library.cpp View File

library library::from_directory(path_ref lib_dir, std::string_view name) { library library::from_directory(path_ref lib_dir, std::string_view name) {
auto [sources, inc_dir, src_dir] = collect_pf_sources(lib_dir); auto [sources, inc_dir, src_dir] = collect_pf_sources(lib_dir);


auto lib = library(name, std::move(sources));;
auto lib = library(lib_dir, name, std::move(sources));


if (fs::exists(inc_dir)) { if (fs::exists(inc_dir)) {
lib._pub_inc_dir = inc_dir; lib._pub_inc_dir = inc_dir;
lib._priv_inc_dir = src_dir; lib._priv_inc_dir = src_dir;
} }
} else { } else {
lib._pub_inc_dir = src_dir;
lib._pub_inc_dir = src_dir;
lib._priv_inc_dir = src_dir; lib._priv_inc_dir = src_dir;
} }



+ 5
- 2
src/dds/library.hpp View File

}; };


class library { class library {
fs::path _base_dir;
std::string _name; std::string _name;
source_list _sources; source_list _sources;
fs::path _pub_inc_dir; fs::path _pub_inc_dir;
fs::path _priv_inc_dir; fs::path _priv_inc_dir;


library(std::string_view name, source_list&& src)
: _name(name)
library(path_ref dir, std::string_view name, source_list&& src)
: _base_dir(dir)
, _name(name)
, _sources(std::move(src)) {} , _sources(std::move(src)) {}


public: public:
return from_directory(path, path.filename().string()); return from_directory(path, path.filename().string());
} }


path_ref base_dir() const noexcept { return _base_dir; }
path_ref public_include_dir() const noexcept { return _pub_inc_dir; } path_ref public_include_dir() const noexcept { return _pub_inc_dir; }
path_ref private_include_dir() const noexcept { return _priv_inc_dir; } path_ref private_include_dir() const noexcept { return _priv_inc_dir; }



Loading…
Cancel
Save