Skip to content

Commit 0d97381

Browse files
committed
Enabled LTO (Link Time Optimization) except for gui.
- LTO-on causes a crash due to Qt used in gui library. Signed-off-by: Jaehyun Kim <[email protected]>
1 parent 3e894e4 commit 0d97381

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ cmake_policy(SET CMP0077 NEW)
2121
# Let AUTOMOC and AUTOUIC process GENERATED files.
2222
cmake_policy(SET CMP0071 NEW)
2323

24-
# Interfers with Qt so off by default.
25-
option(LINK_TIME_OPTIMIZATION "Flag to control link time optimization: off by default" OFF)
26-
27-
if (LINK_TIME_OPTIMIZATION)
28-
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
29-
endif()
3024

3125
# Allow to use external shared boost libraries
3226
option(USE_SYSTEM_BOOST "Use system shared Boost libraries" OFF)
@@ -55,6 +49,15 @@ project(OpenROAD VERSION 1
5549
LANGUAGES CXX
5650
)
5751

52+
# LTO setting must come after project() for proper compiler detection
53+
option(LINK_TIME_OPTIMIZATION "Flag to control link time optimization: on by default" ON)
54+
if (LINK_TIME_OPTIMIZATION)
55+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
56+
message(STATUS "LTO is enabled")
57+
else()
58+
message(STATUS "LTO is disabled: ${LTO_ERROR}")
59+
endif()
60+
5861
set(OPENROAD_HOME ${PROJECT_SOURCE_DIR})
5962
set(OPENROAD_SHARE ${CMAKE_INSTALL_PREFIX}/share/openroad)
6063

src/gui/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ if (Qt5_FOUND AND BUILD_GUI)
8585
OpenSTA
8686
)
8787

88+
# Disable LTO for gui. LTO causes a crash with Qt plugin loading
89+
set_target_properties(gui PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
90+
8891
messages(
8992
TARGET gui
9093
)

0 commit comments

Comments
 (0)