# Copyright Rene Rivera 2016 # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) import feature ; import os ; import toolset ; import common ; import gcc ; import type ; feature.feature embind : off on : propagated ; feature.feature closure : off on full : propagated ; feature.feature link-optimization : off on full : propagated ; rule init ( version ? : command * : options * ) { command = [ common.get-invocation-command emscripten : emcc : $(command) ] ; # Determine the version if $(command) { local command-string = \"$(command)\" ; command-string = $(command-string:J=" ") ; version ?= [ MATCH "([0-9.]+)" : [ SHELL "$(command-string) --version" ] ] ; } local condition = [ common.check-init-parameters emscripten : version $(version) ] ; common.handle-options emscripten : $(condition) : $(command) : $(options) ; } feature.extend toolset : emscripten ; toolset.inherit-generators emscripten emscripten : gcc : gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch ; toolset.inherit-rules emscripten : gcc ; toolset.inherit-flags emscripten : gcc : off speed space off on off on full off all on off on off on off on ; type.set-generated-target-suffix EXE : emscripten : "js" ; type.set-generated-target-suffix OBJ : emscripten : "bc" ; type.set-generated-target-suffix STATIC_LIB : emscripten : "bc" ; toolset.flags emscripten.compile OPTIONS ; toolset.flags emscripten.compile OPTIONS ; toolset.flags emscripten.compile.c++ OPTIONS ; toolset.flags emscripten.compile OPTIONS off : -O0 ; toolset.flags emscripten.compile OPTIONS speed : -O3 ; toolset.flags emscripten.compile OPTIONS space : -Oz ; toolset.flags emscripten.link OPTIONS off : -O0 ; toolset.flags emscripten.link OPTIONS speed : -O3 ; toolset.flags emscripten.link OPTIONS space : -O3 ; toolset.flags emscripten.compile OPTIONS on : --profiling-funcs ; toolset.flags emscripten.compile OPTIONS off : -fno-inline ; toolset.flags emscripten.compile OPTIONS on : -Wno-inline ; toolset.flags emscripten.compile OPTIONS full : -Wno-inline ; toolset.flags emscripten.compile OPTIONS off : -w ; toolset.flags emscripten.compile OPTIONS on : -Wall ; toolset.flags emscripten.compile OPTIONS all : -Wall -pedantic ; toolset.flags emscripten.compile OPTIONS on : -Werror ; toolset.flags emscripten OPTIONS off : -g0 ; toolset.flags emscripten OPTIONS on : -g4 -s DEMANGLE_SUPPORT=1 ; toolset.flags emscripten OPTIONS off : -fno-rtti ; toolset.flags emscripten.link OPTIONS on : --bind ; toolset.flags emscripten.link OPTIONS on : --closure 1 ; toolset.flags emscripten.link OPTIONS full : --closure 2 ; toolset.flags emscripten.link OPTIONS off : --llvm-lto 0 ; toolset.flags emscripten.link OPTIONS on : --llvm-lto 1 ; toolset.flags emscripten.link OPTIONS full : --llvm-lto 3 ; actions compile.c { "$(CONFIG_COMMAND)" -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } actions compile.c++ { "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } actions archive { "$(CONFIG_COMMAND)" $(AROPTIONS) -o "$(<)" "$(>)" } toolset.flags emscripten.link USER_OPTIONS ; actions link bind LIBRARIES { "$(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) }