mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Optimize release builds: LTO, -O3, visibility, micro-perf fixes
- CMakeLists.txt: enable LTO for Release, add -O3 and -fvisibility=hidden - scene: addMesh uses std::move, removeMesh takes const shared_ptr& - entity: std::move entity into map instead of copy - clouds: cosf/sinf instead of cos/sin (float math, avoids double promotion) - game_screen: reserve trainer spell vector before push_back loop - warden_module/emulator: replace std::endl (121 stream flushes) with '\n'
This commit is contained in:
parent
eacecddfb0
commit
7ab25c63c9
8 changed files with 167 additions and 152 deletions
|
|
@ -384,6 +384,20 @@ else()
|
|||
target_compile_options(wowee PRIVATE -Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
# Release build optimizations
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT _ipo_supported OUTPUT _ipo_error)
|
||||
if(_ipo_supported)
|
||||
set_property(TARGET wowee PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
||||
endif()
|
||||
if(NOT MSVC)
|
||||
# -O3: more aggressive inlining and auto-vectorization vs CMake's default -O2
|
||||
target_compile_options(wowee PRIVATE $<$<CONFIG:Release>:-O3>)
|
||||
# -fvisibility=hidden: keeps all symbols internal by default, shrinks binary
|
||||
# and gives the linker and optimizer more freedom to dead-strip and inline
|
||||
target_compile_options(wowee PRIVATE $<$<CONFIG:Release>:-fvisibility=hidden -fvisibility-inlines-hidden>)
|
||||
endif()
|
||||
|
||||
# Copy assets to build directory
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets
|
||||
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue