From 30c1a9fb57c2e68afaecf0a923e90a0187780299 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:02:25 +0500 Subject: [PATCH] cmake: add option for pollyhedral optimization. --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c44c8cae..9412d493 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ option(USE_NOVGUI_SCOREBOARD "Prefer non-VGUI Scoreboard when USE_VGUI is enable option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) option(BUILD_CLIENT "Build client dll" ON) option(BUILD_SERVER "Build server dll" ON) +option(POLLY "Enable pollyhedral optimization" OFF) if(CMAKE_SIZEOF_VOID_P EQUAL 4 OR ((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") @@ -177,3 +178,11 @@ endif() if(NOT BUILD_SERVER AND NOT BUILD_CLIENT) message(FATAL_ERROR "Nothing to build") endif() + +if(POLLY) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options(-mllvm -polly) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options(-fgraphite-identity -floop-interchange -floop-block) + endif() +endif()