Line |
Branch |
Exec |
Source |
1 |
|
|
// Copyright (c) 2021-2024 ChilliBits. All rights reserved. |
2 |
|
|
|
3 |
|
|
#pragma once |
4 |
|
|
|
5 |
|
|
#include <filesystem> |
6 |
|
|
#include <string> |
7 |
|
|
#include <vector> |
8 |
|
|
|
9 |
|
|
#include <driver/Driver.h> |
10 |
|
|
|
11 |
|
|
namespace spice::compiler { |
12 |
|
|
|
13 |
|
|
class ExternalLinkerInterface { |
14 |
|
|
public: |
15 |
|
|
// Constructors |
16 |
|
390 |
explicit ExternalLinkerInterface(const CliOptions &cliOptions) : outputPath(cliOptions.outputPath), cliOptions(cliOptions){}; |
17 |
|
|
|
18 |
|
|
// Public methods |
19 |
|
|
void prepare(); |
20 |
|
|
void link() const; |
21 |
|
|
void addObjectFilePath(const std::string &objectFilePath); |
22 |
|
|
void addLinkerFlag(const std::string &flag); |
23 |
|
|
void addAdditionalSourcePath(std::filesystem::path additionalSource); |
24 |
|
|
|
25 |
|
|
// Public members |
26 |
|
|
std::filesystem::path outputPath; |
27 |
|
|
|
28 |
|
|
private: |
29 |
|
|
// Members |
30 |
|
|
const CliOptions &cliOptions; |
31 |
|
|
std::vector<std::string> objectFilePaths; |
32 |
|
|
std::vector<std::string> linkerFlags = { |
33 |
|
|
// "-flto", // Enable LTO |
34 |
|
|
}; |
35 |
|
|
}; |
36 |
|
|
|
37 |
|
|
} // namespace spice::compiler |
38 |
|
|
|