Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb6c4080

Browse files
committed
Update mingw.rst
1 parentb01ec5d commitb6c4080

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

‎docs/source/examples/mingw.rst‎

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,119 @@ MinGW
22
=======
33

44
Lowlevel MinGW Tests
5+
6+
7+
Executable
8+
-----------
9+
10+
..code-block::cpp
11+
:linenos:
12+
:emphasize-lines: 2,6
13+
14+
// MINGW specialized Toolchain
15+
Toolchain_mingw mingw;
16+
17+
// MINGW specialized targets
18+
// Creates `Simple.exe`
19+
ExecutableTarget_mingw exetarget("Simple", mingw, "");
20+
exetarget.GlobSources("src");
21+
exetarget.AddIncludeDir("include", true);
22+
exetarget.Build();
23+
24+
// Build
25+
tf::Executor executor;
26+
executor.run(exetarget.GetTaskflow());
27+
executor.wait_for_all();
28+
29+
StaticLib
30+
----------
31+
32+
..code-block::cpp
33+
:linenos:
34+
:emphasize-lines: 2,6,13
35+
36+
// MINGW specialized Toolchain
37+
Toolchain_mingw mingw;
38+
39+
// MINGW specialized targets
40+
// Creates `librandom.lib`
41+
StaticTarget_mingw statictarget("librandom", mingw, "");
42+
statictarget.AddSource("src/random.cpp");
43+
statictarget.AddIncludeDir("include", true);
44+
statictarget.Build();
45+
46+
// MINGW specialized targets
47+
// Creates `Simple.exe`
48+
ExecutableTarget_mingw exetarget("Simple", mingw, "");
49+
exetarget.AddSource("src/main.cpp");
50+
exetarget.AddIncludeDir("include", true);
51+
exetarget.AddLibDep(statictarget);
52+
exetarget.Build();
53+
54+
// Build
55+
tf::Executor executor;
56+
tf::Taskflow taskflow;
57+
58+
// Setup your dependencies explicitly
59+
// Here statictarget needs to be built before exetarget
60+
auto statictargetTask = taskflow.composed_of(statictarget.GetTaskflow());
61+
auto exetargetTask = taskflow.composed_of(exetarget.GetTaskflow());
62+
exetargetTask.succeed(statictargetTask);
63+
64+
executor.run(taskflow);
65+
executor.wait_for_all();
66+
67+
DynamicLib
68+
-----------
69+
70+
..code-block::cpp
71+
:linenos:
72+
:emphasize-lines: 2,6,13
73+
74+
// MINGW specialized Toolchain
75+
Toolchain_mingw mingw;
76+
77+
// MINGW specialized targets
78+
// Creates `librandom.lib` and `librandom.lib.dll`
79+
DynamicTarget_mingw dynamictarget("librandom", mingw, "");
80+
dynamictarget.AddSource("src/random.cpp");
81+
dynamictarget.AddIncludeDir("include", true);
82+
dynamictarget.Build();
83+
84+
// MINGW specialized target
85+
// Creates `Simple.exe` which uses the above dynamic library
86+
ExecutableTarget_mingw exetarget("Simple", mingw, "");
87+
exetarget.AddSource("src/main.cpp");
88+
exetarget.AddIncludeDir("include", true);
89+
exetarget.AddLibDep(dynamictarget);
90+
exetarget.Build();
91+
92+
// Build
93+
tf::Executor executor;
94+
tf::Taskflow taskflow;
95+
96+
// Setup your dependencies explicitly
97+
// Here dynamictarget needs to be built before exetarget
98+
auto dynamictargetTask = taskflow.composed_of(dynamictarget.GetTaskflow());
99+
auto exetargetTask = taskflow.composed_of(exetarget.GetTaskflow());
100+
exetargetTask.succeed(dynamictargetTask);
101+
102+
executor.run(taskflow);
103+
executor.wait_for_all();
104+
105+
// Now that both your targets are built, copy the dynamictarget DLL to the exetarget location
106+
// This is required for your exetarget to run properly
107+
if (exetarget.IsBuilt()) {
108+
fs::path copy_to_path =
109+
exetarget.GetTargetBuildDir() / dynamictarget.GetTargetPath().filename();
110+
fs::remove_all(copy_to_path);
111+
fs::copy(dynamictarget.GetTargetPath(), copy_to_path);
112+
}
113+
114+
115+
..note::Our ``ExecutableTarget_mingw`` depends on ``DynamicTarget_mingw`` and requires the ``librandom.lib.dll`` file to be present in the same folder location as the executable when running.
116+
117+
PrecompileHeader
118+
-------------------
119+
120+
TODO

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp