From 906e68033528e53553537ab5c3ae1d9b689abc34 Mon Sep 17 00:00:00 2001 From: Lizzzka007 <gashchuk2011@mail.ru> Date: Thu, 26 Sep 2024 16:21:53 +0300 Subject: [PATCH] Cmake for vtune --- CMakeLists.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5343720..ca00565 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ option(USE_CXX "CXX build in mode" OFF) option(BUILD_DOC "Build documentation" OFF) option(SFX_CHECK_NAN "Build documentation" OFF) option(USE_CONFIG_PARSER "Build config parser" ON) +option(VTUNE_FLAGS " " OFF) include(FetchContent) @@ -177,6 +178,14 @@ endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") # set(CMAKE_Fortran_ARCHIVE_FINISH "$<CMAKE_RANLIB> -no_warning_for_no_symbols -c $<TARGET>") target_include_directories(sfx_lib PUBLIC ${CMAKE_BINARY_DIR}/modules/) +if(VTUNE_FLAGS) + target_compile_options(sfx + PUBLIC $<$<COMPILE_LANGUAGE:C>: -g -O2 -Xsprofile> + PUBLIC $<$<COMPILE_LANGUAGE:CXX>: -g -O2 -Xsprofile> + PUBLIC $<$<COMPILE_LANGUAGE:Fortran>: -g -O2>) +endif(VTUNE_FLAGS) +set(CMAKE_BUILD_TYPE Release) + if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") target_compile_options(sfx PUBLIC $<$<COMPILE_LANGUAGE:C>: -g >) @@ -184,11 +193,15 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") PUBLIC $<$<COMPILE_LANGUAGE:CXX>: -g >) target_compile_options(sfx PUBLIC $<$<COMPILE_LANGUAGE:CUDA>: -g >) - target_compile_options(sfx - PUBLIC $<$<COMPILE_LANGUAGE:Fortran>: -g -fbacktrace -ffpe-trap=zero,overflow,underflow >) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + target_compile_options(sfx + PUBLIC $<$<COMPILE_LANGUAGE:Fortran>: -g -traceback -check all -ftrapuv -debug all >) + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(sfx- + PUBLIC $<$<COMPILE_LANGUAGE:Fortran>: -g -fbacktrace -ffpe-trap=zero,overflow,underflow >) + endif() endif() - # copy data & configs on post build add_custom_command( TARGET sfx POST_BUILD -- GitLab