Skip to content

Commit f48442a

Browse files
committed
Make matplotplusplus optional via ENABLE_MATPLOTPP CMake flag
- Add ENABLE_MATPLOTPP option (default ON) to control matplotplusplus support - Wrap AdvancedPainter class and related code with #ifdef ENABLE_MATPLOTPP - Provide custom linspace() implementation when matplotplusplus is disabled - Remove unused matplot include from StrayCapacitance.cpp - Painter factory falls back to BasicPainter when matplotplusplus is disabled
1 parent ce68304 commit f48442a

7 files changed

Lines changed: 3048 additions & 3002 deletions

File tree

CMakeLists.txt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ option(HAVE_LAPACK "Use LAPACK" OFF)
6565
option(INCLUDE_PYMKF "Compile the Python interface" OFF)
6666
option(MATPLOTPP_BUILD_HIGH_RESOLUTION_WORLD_MAP "Compile high resolution maps for geoplots" OFF)
6767
option(ENABLE_NGSPICE "Enable ngspice integration for circuit simulation" OFF)
68+
option(ENABLE_MATPLOTPP "Enable matplotplusplus for AdvancedPainter" ON)
6869

6970
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
7071
message(STATUS "ngspice integration: ${ENABLE_NGSPICE}")
72+
message(STATUS "matplotplusplus support: ${ENABLE_MATPLOTPP}")
7173
message(STATUS "Embedding MAS Data: ${EMBED_MAS_DATA}")
7274
message(STATUS "Embedding MAS Cores: ${EMBED_MAS_CORES}")
7375
message(STATUS "Embedding MAS CoreShapes: ${EMBED_MAS_CORE_SHAPES}")
@@ -107,13 +109,16 @@ FetchContent_Declare(magic-enum
107109
FetchContent_MakeAvailable(magic-enum)
108110
include_directories("${CMAKE_BINARY_DIR}/_deps/magic-enum-src/include/magic_enum")
109111

110-
FetchContent_Declare(matplotplusplus
111-
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus
112-
GIT_TAG tags/v1.2.1)
113-
FetchContent_GetProperties(matplotplusplus)
114-
if(NOT matplotplusplus_POPULATED)
115-
FetchContent_MakeAvailable(matplotplusplus)
116-
# add_subdirectory(${matplotplusplus_SOURCE_DIR} ${matplotplusplus_BINARY_DIR} EXCLUDE_FROM_ALL)
112+
if(ENABLE_MATPLOTPP)
113+
FetchContent_Declare(matplotplusplus
114+
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus
115+
GIT_TAG tags/v1.2.1)
116+
FetchContent_GetProperties(matplotplusplus)
117+
if(NOT matplotplusplus_POPULATED)
118+
FetchContent_MakeAvailable(matplotplusplus)
119+
# add_subdirectory(${matplotplusplus_SOURCE_DIR} ${matplotplusplus_BINARY_DIR} EXCLUDE_FROM_ALL)
120+
endif()
121+
add_compile_definitions(ENABLE_MATPLOTPP)
117122
endif()
118123

119124
FetchContent_Declare(spline
@@ -401,7 +406,11 @@ message(${DATA_LIST})
401406
cmrc_add_resource_library(data ALIAS data::data NAMESPACE data ${DATA_LIST})
402407
target_link_libraries(MKF PUBLIC data::data)
403408

404-
target_link_libraries(MKF PUBLIC matplot rapidfuzz::rapidfuzz)
409+
if(ENABLE_MATPLOTPP)
410+
target_link_libraries(MKF PUBLIC matplot rapidfuzz::rapidfuzz)
411+
else()
412+
target_link_libraries(MKF PUBLIC rapidfuzz::rapidfuzz)
413+
endif()
405414
target_link_libraries(MKF PRIVATE nlohmann_json::nlohmann_json)
406415

407416
# Link ngspice if enabled

0 commit comments

Comments
 (0)