Hi,
Thanks for this "experimental" PoC !
ps: I re-open the
https://github.com/google/or-tools/issues/1670 but currently it is not scheduled for the foreseeable future (i.e. just keep it in the backlog)
Few comments for myself (and sorry, I should have done this feedback 20 days ago when you reply in the issue):
* Basically use the CMake based build with an emscripten CMAKE_TOOLCHAIN_FILE -> GOOD
ed: While we still not support cmake toolchain files (i.e. not tested and out of our current scope), it is the way to go to support Android NDK and emscripten in the near future..
So any clean patch (i.e. without breaking change) to ease this future usage will be reviewed and integrated if possible !
note: For Glog why did we need to use "HAVE_SYMBOLIZE 0" ? and the hack of raw_looging -> provide a clean patch to glog to better support toolchain and/or emscripten target should be better IMHO...
note: For Protobuf, it should be better to check for CMAKE_CROSSCOMPILING and in this case disable the build of the protoc binary during the fetch_content() (i.e. set protobuf_BUILD_PROTOC_BINARIES=OFF when CMAKE_CROSSCOMPILING is true using generator expression ?) AND build an HOST version instead...
Then we can replace the protobuf::protoc by a host_protoc alias target etc...
* According to the emscripten doc:
> The preprocessor define __EMSCRIPTEN__ is always defined when compiling programs with Emscripten.
* Using make_third_party, i.e. the Make based build, to retrieve all dependencies headers is not a "clean" CMake way to say the least ;)
Also I don't deeply understand why you should do it...
note: Our goal is to replace (i.e. remove) the Makefile based build by the CMake based build...
* Instead of modifying the default value of few CMake options you should pass it in your call to CMake.
i.e. in cmake-build.sh:
```diff
- cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN_CMAKE_PATH} ..
+ cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN_CMAKE_PATH} -DBUILD_DEPS=ON -DBUILD_SAMPLES=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF ..
```
* wasn-build.sh should be refactored as a CMake file using a function and you shouldn't have to list by hand all dependent libraries of ortools (out of sync and should be already provided by the target attribute)
note: need to check if there is already an "emscripten" CMake module providing this kind of tools (i.e. wrapper function for "emcc" and "emscripten") on the internet...