From a2a117f089aa1b8241612e4cf01c282232477352 Mon Sep 17 00:00:00 2001 From: Ivan Pravdin Date: Wed, 4 Feb 2026 15:13:56 -0500 Subject: [PATCH] Add CMake option to build with profiler Add option to CMakeLists.txt to build with/without Morpho profiler without manually chaging build.h --- CMakeLists.txt | 5 +++++ src/build.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ac527cf..6e8d7240 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ option(MORPHO_GCSTRESSTEST "Stress tests the garbage collector" OFF) option(MORPHO_BUILD_LINALG "Builds with linear algebra" ON) option(MORPHO_BUILD_SPARSE "Builds with sparse matrix support" ON) option(MORPHO_BUILD_GEOMETRY "Builds with geometry library" ON) +option(MORPHO_BUILD_PROFILER "Builds with profiler" OFF) #------------------------------------------------------------------------------- # Process options @@ -53,6 +54,10 @@ if(MORPHO_BUILD_GEOMETRY) target_compile_definitions(morpho PUBLIC MORPHO_INCLUDE_GEOMETRY) endif() +if(MORPHO_BUILD_PROFILER) +target_compile_definitions(morpho PUBLIC _DEBUG_PROFILER) +endif() + #------------------------------------------------------------------------------- # BLAS and LAPACK #------------------------------------------------------------------------------- diff --git a/src/build.h b/src/build.h index 9c8e12c7..395794f2 100644 --- a/src/build.h +++ b/src/build.h @@ -185,4 +185,6 @@ //#define MORPHO_OPCODE_USAGE /** @brief Buiild with profile support */ -#define MORPHO_PROFILER +#ifdef _DEBUG_PROFILER + #define MORPHO_PROFILER +#endif