MathGeoLib icon indicating copy to clipboard operation
MathGeoLib copied to clipboard

Build instructions for SSE + Emscripten.

Open juj opened this issue 11 years ago • 0 comments

MathGeoLib at http://clb.demon.fi/MathGeoLib/nightly/ is now worked to build with Emscripten juj/sse1 branch from https://github.com/juj/emscripten/tree/sse1 . It can be used to unit test and benchmark SSE support in Emscripten. A quick setup guide:

Setting up MathGeoLib:

  1. Set up Emscripten e.g. via emsdk and use the branch https://github.com/juj/emscripten/tree/sse1
  2. git clone https://github.com/juj/MathGeoLib.git

Build structure follows traditional CMake out-of-source builds, so to configure different build types, do the following in MathGeoLib root directory:

  1. mkdir new_directory_for_my_build
  2. cd new_directory_for_my_build
  3. cmake <options> ..

Where the cmake configure line with <options> is:

  • Build for native benchmark runs with SSE1 support (no SSE2 or newer, replace with -DMATH_SSE2=1 or e.g. -DMATH_AVX=1 for that):

    cmake -DMATH_TESTS_EXECUTABLE=1 -DMATH_SSE=1 -DCMAKE_BUILD_TYPE=Release ..
    
  • Build for native debug runs with SSE1 support:

    cmake -DMATH_TESTS_EXECUTABLE=1 -DMATH_SSE=1 -DCMAKE_BUILD_TYPE=Debug -DFAIL_USING_EXCEPTIONS=1 ..
    

To build with Emscripten, set up Emscripten first, e.g. via the Emscripten SDK, and have your Emscripten tools set up in PATH (source emsdk_env.sh/.bat in your shell if using emsdk), and then

  • Build for Emscripten benchmark runs with SSE1 support:

    emcmake cmake -DMATH_TESTS_EXECUTABLE=1 -DMATH_SSE=1 -DCMAKE_BUILD_TYPE=Release ..
    
  • Build for Emscripten debug runs with SSE1 support:

    emcmake cmake -DMATH_TESTS_EXECUTABLE=1 -DMATH_SSE=1 -DCMAKE_BUILD_TYPE=Debug -DFAIL_USING_EXCEPTIONS=1 ..
    

To build and run the output, do in native:

  1. make/mingw32-make/msbuild/xcodebuild depending on your OS and target IDE
  2. Run ./MathGeoLib

and in Emscripten:

  1. make/mingw32-make depending on your OS
  2. run generated MathGeoLib.html or if you want to run in shell, then the file MathGeoLib.js

(TODO: incorporate these into the main docs)

juj avatar Nov 21 '14 00:11 juj