GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 1
Functions: 0.0% 0 / 0 / 1
Branches: -% 0 / 0 / 0

src/linker/ExternalLinkerInterface.h
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <filesystem>
6 #include <string>
7 #include <vector>
8
9 namespace spice::compiler {
10
11 // Forward declarations
12 struct CliOptions;
13
14 class ExternalLinkerInterface {
15 public:
16 // Constructors
17 explicit ExternalLinkerInterface(const CliOptions &cliOptions);
18
19 // Avoid copies
20 ExternalLinkerInterface(const ExternalLinkerInterface &) = delete;
21 ExternalLinkerInterface &operator=(const ExternalLinkerInterface &) = delete;
22
23 // Public methods
24 void prepare();
25 void run() const;
26 void cleanup() const;
27 void addFileToLinkage(const std::filesystem::path &path);
28 void addLinkerFlag(const std::string &flag);
29 void addAdditionalSourcePath(std::filesystem::path additionalSource);
30 void requestLibMathLinkage();
31 [[nodiscard]] const std::vector<std::string> &getLinkerFlags() const { return linkerFlags; }
32 [[nodiscard]] const std::vector<std::filesystem::path> &getLinkedFiles() const { return linkedFiles; }
33
34 // Public members
35 std::filesystem::path outputPath;
36
37 private:
38 // Private methods
39 void link() const;
40 void archive() const;
41
42 // Members
43 const CliOptions &cliOptions;
44 std::vector<std::filesystem::path> linkedFiles;
45 std::vector<std::string> linkerFlags;
46 bool linkLibMath = false;
47 };
48
49 } // namespace spice::compiler
50