]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright Rene Rivera 2016 |
2 | # Distributed under the Boost Software License, Version 1.0. | |
3 | # (See accompanying file LICENSE_1_0.txt | |
4 | # or copy at http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | import feature ; | |
7 | import os ; | |
8 | import toolset ; | |
9 | import common ; | |
10 | import gcc ; | |
11 | import type ; | |
12 | ||
13 | feature.feature embind : off on : propagated ; | |
14 | feature.feature closure : off on full : propagated ; | |
15 | feature.feature link-optimization : off on full : propagated ; | |
16 | ||
17 | rule init ( version ? : command * : options * ) | |
18 | { | |
19 | command = [ common.get-invocation-command emscripten | |
20 | : emcc | |
21 | : $(command) ] ; | |
22 | ||
23 | # Determine the version | |
24 | local command-string = $(command:J=" ") ; | |
25 | if $(command) | |
26 | { | |
27 | version ?= [ MATCH "([0-9.]+)" | |
28 | : [ SHELL "$(command-string) --version" ] ] ; | |
29 | } | |
30 | ||
31 | local condition = [ common.check-init-parameters emscripten | |
32 | : version $(version) ] ; | |
33 | ||
34 | common.handle-options emscripten : $(condition) : $(command) : $(options) ; | |
35 | } | |
36 | ||
37 | feature.extend toolset : emscripten ; | |
38 | ||
39 | toolset.inherit-generators emscripten <toolset>emscripten | |
40 | : gcc | |
41 | : gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch | |
42 | ; | |
43 | toolset.inherit-rules emscripten : gcc ; | |
44 | toolset.inherit-flags emscripten : gcc | |
45 | : | |
46 | <optimization>off <optimization>speed <optimization>space | |
47 | <profiling>off <profiling>on | |
48 | <inlining>off <inlining>on <inlining>full | |
49 | <warnings>off <warnings>all <warnings>on | |
50 | <warnings-as-errors>off <warnings-as-errors>on | |
51 | <debug-symbols>off <debug-symbols>on | |
52 | <rtti>off <rtti>on | |
53 | ; | |
54 | ||
55 | type.set-generated-target-suffix EXE : <toolset>emscripten : "js" ; | |
56 | type.set-generated-target-suffix OBJ : <toolset>emscripten : "bc" ; | |
57 | type.set-generated-target-suffix STATIC_LIB : <toolset>emscripten : "bc" ; | |
58 | ||
59 | toolset.flags emscripten.compile OPTIONS <flags> ; | |
60 | toolset.flags emscripten.compile OPTIONS <cflags> ; | |
61 | toolset.flags emscripten.compile.c++ OPTIONS <cxxflags> ; | |
62 | ||
63 | toolset.flags emscripten.compile OPTIONS <optimization>off : -O0 ; | |
64 | toolset.flags emscripten.compile OPTIONS <optimization>speed : -O3 ; | |
65 | toolset.flags emscripten.compile OPTIONS <optimization>space : -Oz ; | |
66 | toolset.flags emscripten.link OPTIONS <optimization>off : -O0 ; | |
67 | toolset.flags emscripten.link OPTIONS <optimization>speed : -O3 ; | |
68 | toolset.flags emscripten.link OPTIONS <optimization>space : -O3 ; | |
69 | ||
70 | toolset.flags emscripten.compile OPTIONS <profiling>on : --profiling-funcs ; | |
71 | ||
72 | toolset.flags emscripten.compile OPTIONS <inlining>off : -fno-inline ; | |
73 | toolset.flags emscripten.compile OPTIONS <inlining>on : -Wno-inline ; | |
74 | toolset.flags emscripten.compile OPTIONS <inlining>full : -Wno-inline ; | |
75 | ||
76 | toolset.flags emscripten.compile OPTIONS <warnings>off : -w ; | |
77 | toolset.flags emscripten.compile OPTIONS <warnings>on : -Wall ; | |
78 | toolset.flags emscripten.compile OPTIONS <warnings>all : -Wall -pedantic ; | |
79 | toolset.flags emscripten.compile OPTIONS <warnings-as-errors>on : -Werror ; | |
80 | ||
81 | toolset.flags emscripten OPTIONS <debug-symbols>off : -g0 ; | |
82 | toolset.flags emscripten OPTIONS <debug-symbols>on : -g4 -s DEMANGLE_SUPPORT=1 ; | |
83 | toolset.flags emscripten OPTIONS <rtti>off : -fno-rtti ; | |
84 | ||
85 | toolset.flags emscripten.link OPTIONS <embind>on : --bind ; | |
86 | toolset.flags emscripten.link OPTIONS <closure>on : --closure 1 ; | |
87 | toolset.flags emscripten.link OPTIONS <closure>full : --closure 2 ; | |
88 | toolset.flags emscripten.link OPTIONS <link-optimization>off : --llvm-lto 0 ; | |
89 | toolset.flags emscripten.link OPTIONS <link-optimization>on : --llvm-lto 1 ; | |
90 | toolset.flags emscripten.link OPTIONS <link-optimization>full : --llvm-lto 3 ; | |
91 | ||
92 | actions compile.c | |
93 | { | |
94 | "$(CONFIG_COMMAND)" -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
95 | } | |
96 | ||
97 | actions compile.c++ | |
98 | { | |
99 | "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
100 | } | |
101 | ||
102 | actions archive | |
103 | { | |
104 | "$(CONFIG_COMMAND)" $(AROPTIONS) -o "$(<)" "$(>)" | |
105 | } | |
106 | ||
107 | toolset.flags emscripten.link USER_OPTIONS <linkflags> ; | |
108 | ||
109 | actions link bind LIBRARIES | |
110 | { | |
111 | "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) | |
112 | } |