-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, found #13, so you are already aware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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