LNXSDK/Kha/Backends/Kinc-hxcpp/khacpp/toolchain/emscripten-toolchain.xml

172 lines
5.1 KiB
XML
Raw Normal View History

2025-01-22 16:18:30 +01:00
<xml>
<setup name="emscripten" />
<set name="HXCPP_LINK_EMSCRIPTEN_EXT" value=".js" unless="HXCPP_LINK_EMSCRIPTEN_EXT" />
<path name="${EMSCRIPTEN_SDK}" if="EMSCRIPTEN_SDK" />
<path name="${dir:EMSCRIPTEN_PYTHON}" if="EMSCRIPTEN_PYTHON" />
<set name="HXCPP_RANLIB" value="emranlib" />
<set name="HXCPP_AR" value="emar" />
<section if="windows_host">
<set name="HXCPP_RANLIB" value='python "${EMSCRIPTEN_SDK}/emranlib.py"' />
<set name="HXCPP_AR" value='python "${EMSCRIPTEN_SDK}/emar.py"' />
<set name="CXX" value='python "${EMSCRIPTEN_SDK}/emcc.py"' />
</section>
<set name="nostrip" value="1" if="emscripten"/>
<include name="toolchain/gcc-toolchain.xml"/>
<!-- EMCC TOOLS -->
<section unless="HXCPP_OPTIM_LEVEL" >
<!-- O2 generates stack-overflow when running unit tests - not sure what best default value is
But you may be able to adjust the node stack size ti fix this.
<set name="HXCPP_OPTIM_LEVEL" value="-O2" />
-->
<set name="HXCPP_OPTIM_LEVEL" value="-O1" />
<set name="HXCPP_OPTIM_LEVEL" value="-g" if="debug" />
</section>
<compiler id="emscripten" exe="emcc">
<exe name="${CXX}" if="CXX" />
<flag value="-c"/>
<flag value="-fvisibility=hidden"/>
<cppflag value="-frtti"/>
<pchflag value="-x" />
<pchflag value="c++-header" />
<cppflag value="--std=c++11" />
<flag value="${HXCPP_OPTIM_LEVEL}" />
<flag value="-fpic" if="HXCPP_EMSCRIPTEN_FPIC" />
<flag value="-fPIC" if="HXCPP_EMSCRIPTEN_FPIC" />
<flag value="-DEMSCRIPTEN"/>
<flag value="-DHXCPP_JS_PRIME" if="HXCPP_JS_PRIME" />
<flag value="-DHXCPP_MULTI_THREADED" if="HXCPP_MULTI_THREADED"/>
<flag value="-DHXCPP_BIG_ENDIAN" if="HXCPP_BIG_ENDIAN"/>
<flag value="-Wno-overflow" />
<cppflag value="-Wno-invalid-offsetof" />
<cppflag value="-Wno-return-type-c-linkage" />
<flag value="-Wno-parentheses" />
<flag value="-Wno-unknown-warning-option" />
<flag value="-Wno-null-dereference" />
<flag value="-Wno-unused-value" />
<flag value="-Wno-format-extra-args" />
<flag value="-Wno-bool-conversion" />
<flag value="-Wno-warn-absolute-paths" />
<include name="toolchain/common-defines.xml" />
<flag value="-I${HXCPP}/include"/>
<objdir value="obj/emscripten${OBJEXT}"/>
<outflag value="-o "/>
<ext value=".o"/>
</compiler>
<section unless="HXCPP_LINK_OPTIM_LEVEL" >
<!-- O2 generates dodgy 'else' statement - seems ok now
<set name="HXCPP_LINK_OPTIM_LEVEL" value="-O2" />
-->
<set name="HXCPP_LINK_OPTIM_LEVEL" value="-O2" />
<set name="HXCPP_LINK_OPTIM_LEVEL" value="-O1" if="HXCPP_DEBUG_LINK" />
<set name="HXCPP_LINK_OPTIM_LEVEL" value="-g" if="debug" />
</section>
<linker id="dll" exe="emcc">
<exe name="${CXX}" if="CXX" />
<fromfile value="" if="GCC_OLD" />
<flag value="-shared"/>
<flag value="-fpic" if="HXCPP_EMSCRIPTEN_FPIC" />
<flag value="-fPIC" if="HXCPP_EMSCRIPTEN_FPIC" />
<flag value="--bind" if="HXCPP_JS_PRIME" />
<!-- <flag value="-Wl,--unresolved-symbols=report-all"/> -->
<flag value="-Xlinker"/>
<flag value="--no-undefined" unless="HXCPP_ALLOW_UNDEFINED" />
<flag value="${HXCPP_LINK_OPTIM_LEVEL}"/>
<section if="HXCPP_LINK_TOTAL_MEMORY" >
<flag value="-s" />
<flag value="TOTAL_MEMORY=${HXCPP_LINK_TOTAL_MEMORY}" />
</section>
<section if="HXCPP_LINK_MEM_FILE" >
<flag value="--memory-init-file"/>
<flag value="${HXCPP_LINK_MEM_FILE}"/>
</section>
<!-- <flag value="-DBUILD_AS_SHARED_LIBRARY" /> -->
<!-- <lib name="-ldl"/> -->
<!-- <ext value=".js"/> -->
<ext value=".so"/>
<outflag value="-o "/>
</linker>
<linker id="exe" exe="emcc">
<exe name="${CXX}" if="CXX" />
<fromfile value="" if="GCC_OLD" />
<flag value="${HXCPP_LINK_OPTIM_LEVEL}" />
<section unless="HXCPP_LINK_NO_EXCEPTIONS" >
<flag value="-s" />
<flag value="DISABLE_EXCEPTION_CATCHING=0" />
</section>
<section if="HXCPP_LINK_MEMORY_GROWTH" >
<flag value="-s" />
<flag value="ALLOW_MEMORY_GROWTH=1" />
</section>
<section if="HXCPP_LINK_SAFE_HEAP" >
<flag value="-s" />
<flag value="SAFE_HEAP=1" />
</section>
<section if="HXCPP_LINK_TOTAL_MEMORY" >
<flag value="-s" />
<flag value="TOTAL_MEMORY=${HXCPP_LINK_TOTAL_MEMORY}" />
</section>
<section if="HXCPP_LINK_MEM_FILE" >
<flag value="--memory-init-file"/>
<flag value="${HXCPP_LINK_MEM_FILE}"/>
</section>
<section if="HXCPP_LINK_EMRUN" >
<flag value="--emrun" />
<flag value="-s" />
<flag value="DEMANGLE_SUPPORT=1" />
</section>
<section if="HXCPP_DEBUG_LINK" >
<flag value="-s" />
<flag value="DEMANGLE_SUPPORT=1" />
<flag value="-debug" />
</section>
<section if="WASM" >
<flag value="-s"/>
<flag value="WASM=1" />
</section>
<section if="BINARYEN_METHOD" >
<flag name="-s" />
<flag value="BINARYEN_METHOD='${BINARYEN_METHOD}'" />
</section>
<flag value="--bind" if="HXCPP_JS_PRIME" />
<!-- <lib name="-ldl"/> -->
<ext value="${HXCPP_LINK_EMSCRIPTEN_EXT}"/>
<outflag value="-o "/>
</linker>
</xml>