1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
// file : build2/cc/link -*- C++ -*-
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#ifndef BUILD2_CC_LINK
#define BUILD2_CC_LINK
#include <set>
#include <build2/types>
#include <build2/utility>
#include <build2/rule>
#include <build2/bin/target>
#include <build2/cc/types>
#include <build2/cc/common>
namespace build2
{
namespace cc
{
class link: public rule, virtual common
{
public:
link (data&&);
virtual match_result
match (action, target&, const string& hint) const;
virtual recipe
apply (action, target&, const match_result&) const;
target_state
perform_update (action, target&) const;
target_state
perform_clean (action, target&) const;
private:
friend class compile;
void
process_libraries (scope&,
lorder,
const dir_paths&,
file&,
bool,
const function<bool (file&, bool)>&,
const function<void (file*, const string&, bool)>&,
const function<void (file&,
const string&,
bool,
bool)>&,
bool = false) const;
void
append_libraries (strings&, file&, bool, scope&, lorder) const;
void
hash_libraries (sha256&, file&, bool, scope&, lorder) const;
void
rpath_libraries (strings&, target&, scope&, lorder, bool) const;
// Windows rpath emulation (windows-rpath.cxx).
//
struct windows_dll
{
const string& dll;
const string* pdb; // NULL if none.
string pdb_storage;
bool operator< (const windows_dll& y) const {return dll < y.dll;}
};
using windows_dlls = std::set<windows_dll>;
timestamp
windows_rpath_timestamp (file&, scope&, lorder) const;
windows_dlls
windows_rpath_dlls (file&, scope&, lorder) const;
void
windows_rpath_assembly (file&, scope&, lorder,
const string&,
timestamp,
bool) const;
file&
resolve_library (name,
scope&,
lorder,
const dir_paths&,
optional<dir_paths>&) const;
dir_paths
extract_library_dirs (scope&) const;
bool
pkgconfig_extract (scope&,
bin::lib&,
bin::liba*,
bin::libs*,
const string*,
const string&,
const dir_path&,
const dir_paths&) const;
// Alternative search logic for VC (msvc.cxx).
//
bin::liba*
msvc_search_static (const process_path&,
const dir_path&,
const prerequisite_key&) const;
bin::libs*
msvc_search_shared (const process_path&,
const dir_path&,
const prerequisite_key&) const;
target*
search_library (const dir_paths& sysd,
optional<dir_paths>& usrd,
prerequisite& p) const
{
if (p.target == nullptr) // First check the cache.
p.target = search_library (sysd, usrd, p.key ());
return p.target;
}
target*
search_library (const dir_paths&,
optional<dir_paths>&,
const prerequisite_key&) const;
// Windows-specific (windows-manifest.cxx).
//
path
windows_manifest (file&, bool rpath_assembly) const;
private:
const string rule_id;
};
}
}
#endif // BUILD2_CC_LINK
|