[CMake] Using CMake to build an Emscripten output?

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Fri Nov 7 20:13:49 EST 2014


Hi Eric,

While I don't have yet an example dealing with assets, here is an example
of project using emscripten. See https://github.com/commontk/dcmjs

May be you could re-use the macro "em_add_tracked_link_flag" like it is
done for --pre-js, etc .... See [1]

Hth
Jc

[1]
https://github.com/kripken/emscripten/blob/fe95de75315496bca817090cb65095b6731f59a2/cmake/Modules/Platform/Emscripten.cmake#L220-239

On Tue, Nov 4, 2014 at 8:20 PM, Eric Wing <ewmailing at gmail.com> wrote:

> Not that I really have time to fix this, but I was experimenting with
> my C based codebase to see if I could compile it with Emscripten so it
> could run in a browser.
>
> After working around a lot of scary compiler bugs, I got it to work.
> But I invoked the build process by hand. So the next thing on my mind
> is how to leverage CMake (since all my other platforms use it
> already).
>
> My incantation for my test project is pretty straight foward and looks
> very much like a clang invocation. The major difference is that all my
> assets needed to be part of the compile process using the
> --preload-file flag. (A minor difference is the output file ends in
> .html)
>
>
>  ~/Source/GIT/emscripten/emcc -O2 --js-opts 0 -g4 CircularQueue.c
> TimeTicker.c  main_c.c  -I/opt/local/emscripten/include
> -I/opt/local/emscripten/include/SDL2  -I
> /opt/local/emscripten/include/chipmunk
> /opt/local/emscripten/lib/libSDL2_ttf.a
> /opt/local/emscripten/lib/libfreetype.a
> /opt/local/emscripten/lib/libSDL2_image.a
> /opt/local/emscripten/lib/libpng.a /opt/local/emscripten/lib/libz.a
> /opt/local/emscripten/lib/libALmixer.a
> /opt/local/emscripten/lib/libchipmunk.a
> /opt/local/emscripten/lib/libSDL2.a   -o FlappyBlurrr.html
> --preload-file fly2.png --preload-file fly1.png  --preload-file
> fly0.png  --preload-file VeraMono.ttf --preload-file
> gamecontrollerdb.txt --preload-file coin_ding.wav  --preload-file
> background.png --preload-file bush.png  --preload-file clouds.png
> --preload-file ground.png --preload-file pipe_bottom.png
> --preload-file pipe_top.png --preload-file
> davedes_fastsimplechop5b.wav --preload-file
> LeftHook_SoundBible_com-516660386.wav --preload-file SlideWhistle.wav
> --preload-file 14609__man__swosh.wav --preload-file acknowtt.ttf
> --preload-file MedalBackground.png --preload-file
> momoko_Bronze_Medallion.png --preload-file momoko_Silver_Medallion.png
> --preload-file momoko_Gold_Medallion.png --preload-file
> momoko_Platinum_Medallion.png --preload-file Placeholder_Medallion.png
> --preload-file playbutton.png --preload-file quitbutton.png
> --preload-file 04B_19__.TTF -s ASSERTIONS=1
>
>
> Anybody used CMake with Emscripten for this purpose? Or any thoughts
> on what I should do? (I also have some concerns the preload-file list
> is going to get too long. Perhaps I'm missing something with
> Emscripten.)
>
>
> Thanks,
> Eric
> --
> Beginning iPhone Games Development
> http://playcontrol.net/iphonegamebook/
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141107/4aefa419/attachment.html>


More information about the CMake mailing list