From de6119e1169c215b38be6a2aae27766840fafc99 Mon Sep 17 00:00:00 2001 From: Ivan Pravdin Date: Wed, 4 Feb 2026 15:38:52 -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 | 6 ++++++ src/build.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2c0bc07..53af0929 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,11 @@ if(MORPHO_BUILD_GEOMETRY) target_compile_definitions(morpho PUBLIC MORPHO_INCLUDE_GEOMETRY) endif() +# Build with profiler +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 4c5f4bb3..7a04d687 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