Add cmake option for -ftime-trace

This commit is contained in:
Jean Pierre Cimalando 2021-04-25 05:49:45 +02:00
parent 41ab126549
commit cd1e4567f2
2 changed files with 14 additions and 0 deletions

View file

@ -39,6 +39,7 @@ option_ex (SFIZZ_USE_SYSTEM_ABSEIL "Use Abseil libraries preinstalled on system"
option_ex (SFIZZ_USE_SYSTEM_SIMDE "Use SIMDe libraries preinstalled on system" OFF)
option_ex (SFIZZ_STATIC_DEPENDENCIES "Link dependencies statically" OFF)
option_ex (SFIZZ_RELEASE_ASSERTS "Forced assertions in release builds" OFF)
option_ex (SFIZZ_PROFILE_BUILD "Profile the build time" OFF)
# The fixed number of controller parameters
set(SFIZZ_NUM_CCS 512)

View file

@ -1,4 +1,5 @@
include(CMakeDependentOption)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(GNUWarnings)
@ -22,6 +23,18 @@ elseif((SFIZZ_LV2_UI OR SFIZZ_VST OR SFIZZ_AU OR SFIZZ_VST2) AND CMAKE_CXX_STAND
set(CMAKE_CXX_STANDARD 14)
endif()
# Set build profiling options
if(SFIZZ_PROFILE_BUILD)
check_c_compiler_flag("-ftime-trace" SFIZZ_HAVE_CFLAG_FTIME_TRACE)
check_cxx_compiler_flag("-ftime-trace" SFIZZ_HAVE_CXXFLAG_FTIME_TRACE)
if(SFIZZ_HAVE_CFLAG_FTIME_TRACE)
add_compile_options("$<$<COMPILE_LANGUAGE:C>:-ftime-trace>")
endif()
if(SFIZZ_HAVE_CXXFLAG_FTIME_TRACE)
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-ftime-trace>")
endif()
endif()
# Process sources as UTF-8
if(MSVC)
add_compile_options("/utf-8")