[CMake] Using CMake to build an Emscripten output?

Eric Wing ewmailing at gmail.com
Tue Nov 4 20:20:06 EST 2014


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/


More information about the CMake mailing list