Properly set EMAR for Interprocedural Optimization#14
Conversation
|
Looks great, thanks @Skylion007 ! @mosra FYI, I do the -flto for Wonderland Engine, too (though, I set those at project level, not for compiling magnum). And faintly remember setting em-ar somewhere also. |
| set(CMAKE_C_COMPILER_AR "${CMAKE_AR}") | ||
| set(CMAKE_CXX_COMPILER_AR "${CMAKE_AR}") | ||
| set(CMAKE_C_COMPILER_RANLIB "${CMAKE_RANLIB}") | ||
| set(CMAKE_CXX_COMPILER_RANLIB "${CMAKE_RANLIB}") |
There was a problem hiding this comment.
I would have suspected that CMake initializes these automatically based on CMAKE_AR and CMAKE_RANLIB right after the toolchain file, but I assume that is not the case?
There was a problem hiding this comment.
@Squareys I wish. Emscriptem's toolchain does properly handle it, but Magnum's doesn't sadly.
| set(CMAKE_CXX_FLAGS_RELEASE_INIT "-DNDEBUG -O3") | ||
| set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-O3 --llvm-lto 1") | ||
| set(CMAKE_CXX_FLAGS_RELEASE_INIT "-DNDEBUG -O3 -flto") | ||
| set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-O3 --llvm-lto 1 -flto") |
There was a problem hiding this comment.
@mosra For your reference, here's the documentation for that: https://emscripten.org/docs/compiling/WebAssembly.html#backends
--llvm-lto 1 is for the deprecated fastcomp backend (removed in emsc 2.0.0), -flto(=full|thin) is the new way of achieving link-time optimization
There was a problem hiding this comment.
Also I was having trouble with the default build running into issues with ThinLTO. @Squareys have you gotten ThinLTO working with build? I got complaints from the wasm-ld.
|
Ping @mosra |
This properly sets the EMAR for InterproceduralOptimization as described here: emscripten-core/emscripten#11143 and here mosra/magnum#490