File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -89,13 +89,23 @@ if(NOT Boost_FOUND)
8989 message (FATAL_ERROR "Boost (${BOOST_MIN_VERSION} or higher) is mandatory." )
9090 endif ()
9191endif ()
92+
9293sofa_find_package(Boost QUIET REQUIRED)
9394
95+ option (SOFA_USE_MIMALLOC "Use mimalloc to replace malloc (known to be more efficient, especially with MSVC)" OFF )
96+ if (SOFA_USE_MIMALLOC)
97+ sofa_find_package(mimalloc REQUIRED)
98+ endif ()
99+
94100add_library (${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} )
95101
96102target_link_libraries (${PROJECT_NAME} PUBLIC Sofa.Config)
97103target_link_libraries (${PROJECT_NAME} PUBLIC Boost::boost)
98104
105+ if (mimalloc_FOUND)
106+ target_link_libraries (${PROJECT_NAME} PUBLIC mimalloc)
107+ endif ()
108+
99109set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework ) # IDE folder
100110
101111sofa_create_package_with_targets(
Original file line number Diff line number Diff line change 2323
2424#include <sofa/config.h>
2525
26+ #cmakedefine01 SOFA_TYPE_HAVE_MIMALLOC
27+
2628#define SOFATYPE_VERSION @PROJECT_VERSION@
2729
2830#ifdef SOFA_BUILD_SOFA_TYPE
Original file line number Diff line number Diff line change 2323
2424#include < iostream>
2525
26+ #if SOFA_TYPE_HAVE_MIMALLOC == 1
27+ #include < mimalloc.h>
28+ #endif
29+
30+
2631namespace sofa ::type
2732{
2833
@@ -33,6 +38,9 @@ SOFA_TYPE_API void init()
3338{
3439 if (!s_initialized)
3540 {
41+ #if SOFA_TYPE_HAVE_MIMALLOC == 1
42+ mi_version ();
43+ #endif
3644 s_initialized = true ;
3745 }
3846}
You can’t perform that action at this time.
0 commit comments