I would strongly recommend just using emcc, and not managing those flags manually. But, it is possible.
- Alon On Tue, Sep 16, 2014 at 9:14 PM, Robert Tweed <fistful.of.spann...@gmail.com > wrote: > Thanks, that's an interesting idea. I might try fiddling with individual > LLVM optimisations using this approach at some point further down the line. > As per my reply to Bruce, using --lllvm-opt 2 instead of -O2 seems to be > doing what I want, and keeps things simple for now. > > I somewhat prefer the "no hidden magic" of this method compared to letting > emcc do everything, even if there's a lot of flags to keep track of. > > - Robert > > > On 16/09/2014 22:31, Chad Austin wrote: > > For a given example .cpp file, here are the options we pass to clang: > > third-party/clang-binaries/linux/clang+llvm-3.4.2-x86_64-unknown-ubuntu10.04/bin/clang++ > -o > build/emscripten/northstar/src/northstar/SubSystemRender/Render/pysRenderManager.bc > -c -std=c++11 -fno-exceptions -U__STRICT_ANSI__ -target le32-unknown-nacl > -nostdinc -Wno-#warnings -Wno-error=unused-variable -Werror -Os > -fno-threadsafe-statics -fvisibility=hidden -fvisibility-inlines-hidden > -Xclang -nostdinc++ -Xclang -nobuiltininc -Xclang -nostdsysteminc -Xclang > -isystemthird-party/emscripten/system/include/compat -Xclang > -isystemthird-party/emscripten/system/include/libc -Xclang > -isystemthird-party/emscripten/system/include/libcxx -emit-llvm > -fno-vectorize -fno-slp-vectorize -DGLEW_STATIC -DEMSCRIPTEN > -D__EMSCRIPTEN__ -D__STDC__ -D__IEEE_LITTLE_ENDIAN > -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -DGMTL_NO_METAPROG > -DNORTHSTAR_PHYSICS -Ithird-party/emscripten/system/include > -Ibuild/emscripten/northstar/third-party/emscripten/system/include > -Ibuildsystem/third-party/emscripten/system/include -Ithird-party/gmtl > -Ithird-party/rapidjson -Ithird-party/bullet/src -Ithird-party/glew -Isrc > src/northstar/SubSystemRender/Render/RenderManager.cpp > > Not all of them will be relevant to you, of course, but now you can see > how it can work. > > In the end, we use llvm-link to combine all the .bcs into one, and then > llvm's opt command to run optimizations. (We hand-pick which LLVM passes > to use.) > > Finally, we run emcc to turn the resulting .bc file into a .js file. > > On Tue, Sep 16, 2014 at 1:32 AM, Robert Tweed < > fistful.of.spann...@gmail.com> wrote: > >> I'm using emcc for both stages. I didn't know you could use clang >> directly. Which options are you using? Do you just add emscripten's include >> directory to the include path so it can find emscripten.h, or is there a >> lot more to do besides that to make it work? >> >> - Robert >> >> >> On 15/09/2014 19:16, Chad Austin wrote: >> >> Are you using emcc or clang to do the .cpp -> .bc compilation? If you >> use clang directly, you may have some additional control over the build >> options. >> >> We do exactly what it sounds like you want, but by only invoking emcc at >> the final .bc -> .js step. >> >> >> On Mon, Sep 15, 2014 at 3:59 AM, Robert Tweed < >> fistful.of.spann...@gmail.com> wrote: >> >>> Hi list, >>> >>> Using make, I want to be able to produce two different versions of the >>> final output JS: one completely optimised and minified; the other that is >>> fully indented, commented and readable. >>> >>> Ideally, I would run a compile step from *.cpp -> *.bc, then I would run >>> a link step which specifies the optimisation level for that target (either >>> full, or none). But, there's a problem with that. >>> >>> If I compile the intermediate step without the -O2 option, my final >>> "optimised and minified" script is about 500K (this is with options "-O2 >>> --closure 1" in the link step). OTOH, if I do include the -O2 option in the >>> first compile pass, my output is down to 100K (quite a significant >>> difference) but my "fully readable" script is now minified as well. >>> >>> Is there any way around this without having to compile from scratch each >>> time, or maintain two separate sets of intermediate files (which largely >>> defeats the purpose)? >>> >>> TIA, >>> >>> - Robert >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to emscripten-discuss+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Chad Austin >> Technical Director, IMVU >> http://engineering.imvu.com <http://www.imvu.com/members/Chad/> >> http://chadaustin.me >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to emscripten-discuss+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to emscripten-discuss+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Chad Austin > Technical Director, IMVU > http://engineering.imvu.com <http://www.imvu.com/members/Chad/> > http://chadaustin.me > > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.