I think it's not enough to provide a different compiler path to cmake, since this is a cross-compiling scenario, so a whole cmake-toolchian is needed.
The emscripten SDK has one under "cmake/Modules/Platform/Emscripten.cmake", but trying assimp via (e.g.): cmake -DCMAKE_TOOLCHAIN_FILE=~/scratch/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake .. ...creates a Makefile, but then fails to compile (looks like some configuration problem). Using my own cmake-toolchain file (part of fips here: https://github.com/floooh/fips/blob/master/cmake-toolchains/emscripten.toolchain.cmake) compilation goes pretty far (lots of warnings though), until it bails out in glTFExporter.cpp: /Users/floh/projects/fips-assimp/assimp/code/glTFExporter.cpp:585:35: error: ordered comparison between pointer and zero ('aiVector3D *' (aka 'aiVector3t<float> *') and 'int') if(comp_allow && (aim->mNormals > 0)) idx_srcdata_normal = b->byteLength;// Store index of normals array. ...so it looks like it's not done with a simple cross-compile, but needs some code changes too to be compatible with latest clang. There's an open ticket in the assimp repo about emscripten-cmake support: https://github.com/assimp/assimp/issues/1133 Might be worth pinging there. Cheers, -Floh. On Thursday, 27 February 2020 08:48:25 UTC+1, キャロウ マーク wrote: > > I am trying to build libassimp with Emscripten. I don’t believe there is a > port. If there is, I’d be delighted. > > I started with > > emconfigure cmake ../assimp > > and got > > System LLVM compiler cannot be used to build with Emscripten! Check > Emscripten's LLVM toolchain location in .emscripten configuration file, > and > make sure to point CMAKE_C_COMPILER to where emcc is located. > > I thought emconfigure was supposed to set up the cross-compilation tool > chain. What did I do wrong? > > I then tried > > cmake -D > CMAKE_C_COMPILER=/Users/mark/Projects/github/emsdk/upstream/emscripten/emcc > -D ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT=No -D > ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT=No -D ASSIMP_BUILD_OBJ_IMPORTER > ../assimp > > which seemed to work, giving only warnings about not being able to build a > shared library so building a static library and not finding “rt”. However > there are no make files. The directory has only CMakeCache.txt and the > directory CMakeFiles. > > Regards > > -Mark > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/49446f72-200f-4dc6-9a18-7ef7d9c8b678%40googlegroups.com.
