From 2cb2985539f066b972750e0c3a4fc1ded231368a Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Wed, 7 Apr 2021 06:24:29 -0400 Subject: [PATCH] Add CMake option to enable IPO (enabled by default). --- CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff26d4ba..538ad1a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,19 @@ option(STATIC_BUILD "Create static build" OFF) option(EXTERNAL_CHIPDB "Create build with pre-built chipdb binaries" OFF) option(WERROR "pass -Werror to compiler (used for CI)" OFF) option(PROFILER "Link against libprofiler" OFF) -if(ipo_supported) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +option(USE_IPO "Compile nextpnr with IPO" ON) + +if (USE_IPO) + if (ipo_supported) + message(STATUS "Building with IPO") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + else() + message(STATUS "IPO is not supported with this compiler") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) + endif() +else() + message(STATUS "Building without IPO") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) endif() if(WIN32 OR EXTERNAL_CHIPDB)