浏览代码

Drop all `sroot` mentions

default_compile_flags
vector-of-bool 5 年前
父节点
当前提交
ace5335011
共有 6 个文件被更改,包括 18 次插入36 次删除
  1. +4
    -4
      src/dds/build/plan.cpp
  2. +2
    -3
      src/dds/build/plan.hpp
  3. +0
    -3
      src/dds/build/sroot.cpp
  4. +0
    -20
      src/dds/build/sroot.hpp
  5. +1
    -3
      src/dds/deps.cpp
  6. +11
    -3
      src/dds/library.hpp

+ 4
- 4
src/dds/build/plan.cpp 查看文件

@@ -14,7 +14,7 @@

using namespace dds;

library_plan library_plan::create(const library& root, const sroot_build_params& params) {
library_plan library_plan::create(const library& lib, const library_build_params& params) {
std::vector<compile_file_plan> compile_files;
std::vector<create_archive_plan> create_archives;
std::vector<create_exe_plan> link_executables;
@@ -23,7 +23,7 @@ library_plan library_plan::create(const library& root, const sroot_build_params&
std::vector<source_file> test_sources;
std::vector<source_file> lib_sources;

auto src_dir = root.src_dir();
auto src_dir = lib.src_dir();
if (src_dir.exists()) {
auto all_sources = src_dir.sources();
auto to_compile = all_sources | ranges::views::filter([&](const source_file& sf) {
@@ -35,7 +35,7 @@ library_plan library_plan::create(const library& root, const sroot_build_params&
for (const auto& sfile : to_compile) {
compile_file_plan cf_plan;
cf_plan.source = sfile;
cf_plan.qualifier = params.main_name;
cf_plan.qualifier = lib.name();
cf_plan.rules = params.compile_rules;
compile_files.push_back(std::move(cf_plan));
if (sfile.kind == source_kind::test) {
@@ -57,7 +57,7 @@ library_plan library_plan::create(const library& root, const sroot_build_params&
ar_plan.in_sources = lib_sources //
| ranges::views::transform([](auto&& sf) { return sf.path; }) //
| ranges::to_vector;
ar_plan.name = params.main_name;
ar_plan.name = lib.name();
ar_plan.out_dir = params.out_subdir;
create_archives.push_back(std::move(ar_plan));
}

+ 2
- 3
src/dds/build/plan.hpp 查看文件

@@ -2,7 +2,6 @@

#include <dds/build/compile.hpp>
#include <dds/build/params.hpp>
#include <dds/build/sroot.hpp>
#include <dds/library.hpp>

#include <dds/toolchain.hpp>
@@ -28,14 +27,14 @@ struct library_plan {
std::vector<create_exe_plan> link_executables;
fs::path out_subdir;

static library_plan create(const library& lib, const sroot_build_params& params);
static library_plan create(const library& lib, const library_build_params& params);
};

struct build_plan {
std::vector<library_plan> create_libraries;

// static build_plan generate(const build_params& params);
void add_library(const library& lib, const sroot_build_params& params) {
void add_library(const library& lib, const library_build_params& params) {
create_libraries.push_back(library_plan::create(lib, params));
}


+ 0
- 3
src/dds/build/sroot.cpp 查看文件

@@ -1,3 +0,0 @@
#include "./sroot.hpp"

using namespace dds;

+ 0
- 20
src/dds/build/sroot.hpp 查看文件

@@ -1,20 +0,0 @@
#pragma once

#include <dds/build/compile.hpp>
#include <dds/build/source_dir.hpp>
#include <dds/util/fs.hpp>

#include <vector>

namespace dds {

struct sroot_build_params {
std::string main_name;
fs::path out_subdir;
bool build_tests = false;
bool build_apps = false;
std::vector<fs::path> rt_link_libraries;
shared_compile_file_rules compile_rules;
};

} // namespace dds

+ 1
- 3
src/dds/deps.cpp 查看文件

@@ -1,6 +1,5 @@
#include "./deps.hpp"

#include <dds/build/sroot.hpp>
#include <dds/repo/repo.hpp>
#include <dds/sdist.hpp>
#include <dds/util/string.hpp>
@@ -100,8 +99,7 @@ void add_sdist_to_dep_plan(build_plan& plan, const sdist& sd, const sdist_index_
auto lib = dds::library::from_directory(sd.path);
shared_compile_file_rules comp_rules = lib.base_compile_rules();
add_dep_includes(comp_rules, sd.manifest, sd_idx);
sroot_build_params params;
params.main_name = sd.manifest.name;
library_build_params params;
params.compile_rules = comp_rules;
plan.add_library(lib, params);
}

+ 11
- 3
src/dds/library.hpp 查看文件

@@ -1,8 +1,8 @@
#pragma once

#include <dds/library_manifest.hpp>
#include <dds/build/source_dir.hpp>
#include <dds/build/compile.hpp>
#include <dds/build/source_dir.hpp>
#include <dds/library_manifest.hpp>
#include <dds/source.hpp>

#include <optional>
@@ -44,8 +44,16 @@ public:
fs::path public_include_dir() const noexcept;
fs::path private_include_dir() const noexcept;

const source_list& all_sources() const noexcept { return _sources; }
const source_list& all_sources() const noexcept { return _sources; }
shared_compile_file_rules base_compile_rules() const noexcept;
};

struct library_build_params {
fs::path out_subdir;
bool build_tests = false;
bool build_apps = false;
std::vector<fs::path> rt_link_libraries;
shared_compile_file_rules compile_rules;
};

} // namespace dds

正在加载...
取消
保存