Using Boost with Emscripten

前端 未结 6 1900
广开言路
广开言路 2020-12-07 18:08

I have a c++ project I would like to convert to a web application. For this purpose, I would like to use Emscripten to build the project.

The project uses some exter

6条回答
  •  误落风尘
    2020-12-07 18:25

    UPDATE for emsdk:

    After a lot of trial and error, I was able to get emscripten 1.39 to compile Boost 1.71 in the following way:

    Install emsdk if you haven't already from https://emscripten.org/docs/getting_started/downloads.html

    Navigate to the emsdk install folder and do

    ./emsdk install latest && ./emsdk activate latest && source ./emsdk_env.sh
    

    Navigate to the directory where you want to clone the Boost repo and run

    git clone --recursive https://github.com/boostorg/boost.git
    

    You can add the argument '--jobs N' where N is the number of processes to clone submodules with (this will go a lot faster if you do this).

    cd boost
    

    Now use the bootstrap script to create the boost-build executable b2

    ./bootstrap.sh
    

    Finally, as your emsdk is already activated from the step above, you can build Boost using emconfigure to configure everything as it needs to be for calls to gcc to use emscripten instead

    emconfigure ./b2 toolset=gcc --prefix= --build-dir=
    

    Now to install the includes and libs to your chosen prefix directory, run

    emconfigure ./b2 toolset=gcc --prefix= --build-dir= install
    

提交回复
热议问题