Compiling CGAL application with emscripten

466 views
Skip to first unread message

Kunza Rizvi

unread,
Feb 2, 2021, 4:42:09 AM2/2/21
to emscripten-discuss
I am trying to compile a CGAL application on the web using emscripten and web assembly. According to the emscripten documentation, external libraries must be compiled to bitcode first. I am not sure how to achieve that since CGAL has quite a large number of include files. Since I am a beginner in CGAL, I'd appreciate some help and guidance regarding the steps required for CGAL to web compilation.

Sam Clegg

unread,
Feb 2, 2021, 9:12:18 PM2/2/21
to emscripte...@googlegroups.com
You should be able to compile to a library just like you would on a native platform.  i.e. compile each source to an object files and combine them into a library using `emar`,  Then link that library into your final program.

We don't recommend using bitcode (at least not aside from LTO where it's an implementation detail) these days.  Can I ask where you saw the instructions to compile to bitcode?

cheers,
sam

On Tue, Feb 2, 2021 at 1:42 AM Kunza Rizvi <kunza...@gmail.com> wrote:
I am trying to compile a CGAL application on the web using emscripten and web assembly. According to the emscripten documentation, external libraries must be compiled to bitcode first. I am not sure how to achieve that since CGAL has quite a large number of include files. Since I am a beginner in CGAL, I'd appreciate some help and guidance regarding the steps required for CGAL to web compilation.

--
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-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/5c8d6de6-0f73-4b69-ab04-8c0d27436e51n%40googlegroups.com.

Kunza Rizvi

unread,
Feb 3, 2021, 2:09:09 AM2/3/21
to emscripten-discuss
I found the conversion to bitcode on a blog post, stackoverflow and the emscripten documentation (though the documentaton did not explicitly state CGAL in particular) 
Here are the corresponding links:
https://stackoverflow.com/questions/31214387/using-emscripten-with-cmake-in-a-simple-project

I looked further into the problem and found that web assembly does not support rounding modes which might break most functions in CGAL. Do you know any work-around for this? I want to use CGAL for basic mesh-related computations in a hole detection and hole filling related project. 

Alon Zakai

unread,
Feb 4, 2021, 4:35:49 PM2/4/21
to emscripte...@googlegroups.com
Thanks, the docs do look a little out of date. I opened https://github.com/emscripten-core/emscripten/pull/13417 for that now.

Reply all
Reply to author
Forward
0 new messages