Kaynağa Gözat

Generate libman files for the export root

default_compile_flags
vector-of-bool 5 yıl önce
ebeveyn
işleme
00190c7a18
4 değiştirilmiş dosya ile 36 ekleme ve 9 silme
  1. +20
    -3
      src/dds/build.cpp
  2. +8
    -3
      src/dds/lm_parse.cpp
  3. +5
    -1
      src/dds/lm_parse.hpp
  4. +3
    -2
      toolchain.dds

+ 20
- 3
src/dds/build.cpp Dosyayı Görüntüle

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

#include <dds/lm_parse.hpp>
#include <dds/logging.hpp>
#include <dds/proc.hpp>
#include <dds/toolchain.hpp>
@@ -157,15 +158,31 @@ void generate_export(const build_params& params,
spdlog::info("Generating library export: {}", export_root.string());
fs::remove_all(export_root);
fs::create_directories(export_root);
fs::copy_file(archive_file, export_root / archive_file.filename());
const auto archive_dest = export_root / archive_file.filename();
fs::copy_file(archive_file, archive_dest);

auto header_root = params.root / "include";
auto header_root = params.root / "include";
const auto header_dest = export_root / "include";
if (!fs::is_directory(header_root)) {
header_root = params.root / "src";
}
if (fs::is_directory(header_root)) {
copy_headers(header_root, export_root / "include", sources);
copy_headers(header_root, header_dest, sources);
}

std::vector<lm_pair> lm_pairs;
lm_pairs.emplace_back("Type", "Package");
lm_pairs.emplace_back("Name", params.export_name);
lm_pairs.emplace_back("Namespace", params.export_name);
lm_pairs.emplace_back("Library", "lib.lml");
lm_write_pairs(export_root / "package.lmp", lm_pairs);

lm_pairs.clear();
lm_pairs.emplace_back("Type", "Library");
lm_pairs.emplace_back("Name", params.export_name);
lm_pairs.emplace_back("Path", fs::relative(archive_dest, export_root).string());
lm_pairs.emplace_back("Include-Path", fs::relative(header_dest, export_root).string());
lm_write_pairs(export_root / "lib.lml", lm_pairs);
}

std::vector<fs::path> compile_sources(source_list sources,

+ 8
- 3
src/dds/lm_parse.cpp Dosyayı Görüntüle

@@ -91,6 +91,11 @@ dds::lm_kv_pairs dds::lm_parse_string(std::string_view s) {
return lm_kv_pairs(std::move(pairs));
}

dds::lm_kv_pairs dds::lm_parse_file(fs::path fpath) {
return lm_parse_string(slurp_file(fpath));
}
dds::lm_kv_pairs dds::lm_parse_file(fs::path fpath) { return lm_parse_string(slurp_file(fpath)); }

void dds::lm_write_pairs(fs::path fpath, const std::vector<lm_pair>& pairs) {
auto fstream = open(fpath, std::ios::out | std::ios::binary);
for (auto& pair : pairs) {
fstream << pair.key() << ": " << pair.value() << '\n';
}
}

+ 5
- 1
src/dds/lm_parse.hpp Dosyayı Görüntüle

@@ -109,7 +109,11 @@ inline kv_pair_iterator::kv_pair_iterator(base_iter it, base_iter end, std::stri

lm_kv_pairs lm_parse_string(std::string_view);
lm_kv_pairs lm_parse_file(std::filesystem::path);
void lm_write_pairs(std::filesystem::path, lm_kv_pairs);
void lm_write_pairs(std::filesystem::path, const std::vector<lm_pair>&);

inline void lm_write_pairs(const std::filesystem::path& fpath, const lm_kv_pairs& pairs) {
lm_write_pairs(fpath, pairs.items());
}

} // namespace dds


+ 3
- 2
toolchain.dds Dosyayı Görüntüle

@@ -1,8 +1,9 @@
Include-Template: -I <PATH>
Include-Template: -isystem <PATH>
Define-Template: -D <DEF>
Warning-Flags: -Wall -Wextra -Wshadow -Werror

Compile-C-Template: gcc-8 <FLAGS> -g -fPIC -fdiagnostics-color -O0 -c <FILE> -o <OUT>
Compile-C++-Template: g++-8 <FLAGS> -g -fPIC -fdiagnostics-color -O0 -std=c++17 -c <FILE> -o <OUT>
Create-Archive-Template: ar rcs <ARCHIVE> <OBJECTS>

Archive-Suffix: .a
Archive-Suffix: .a

Yükleniyor…
İptal
Kaydet