File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -47,20 +47,30 @@ else()
4747		set (MIMALLOC_LIB_BASENAME "libmimalloc" )
4848	endif ()
4949	set (MALLOC_LIB "${MIMALLOC_SRC} /malloc-build/${MIMALLOC_LIB_BASENAME}${MIMALLOC_LIB_SUFFIX} " )
50- 	set (MIMALLOC_INCLUDE ${MIMALLOC_SRC} /include /)
50+ 	set (MIMALLOC_INCLUDE ${MIMALLOC_SRC} /malloc/ include /)
5151
52+ 	# To avoid recent clang versions complaining with "error: expansion of date or time macro is not 
53+ 	# reproducible" while building mimalloc, we force-set both variables. 
54+ 	string (TIMESTAMP DATE "%Y%m%d" )
55+ 	string (TIMESTAMP TIME "%H:%M" )
56+ 	set (MIMALLOC_EXTRA_CPPDEFS __DATE__="${DATE} " ,__TIME__="${TIME} " )
57+ 
58+ 	# We disable arch specific optimization because of issues with building with zig. Optimizations 
59+ 	# would be only effective on arm64. See MI_NO_OPT_ARCH=On. 
5260	ExternalProject_Add(
5361		malloc
5462		PREFIX  "${PROJECT_BINARY_DIR} /mimalloc-prefix" 
5563		URL "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.1.5.tar.gz" 
5664		URL_HASH "SHA256=1c6949032069d5ebea438ec5cedd602d06f40a92ddf0f0d9dcff0993e5f6635c" 
65+ 		LIST_SEPARATOR ","  # to pass MIMALLOC_EXTRA_CPPDEFS as list 
5766		CMAKE_ARGS -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} 
5867				   -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} 
5968				   -DMI_BUILD_SHARED=${BUILD_SHARED_LIBS} 
6069				   -DMI_BUILD_STATIC=${BUILD_STATIC} 
6170				   -DMI_BUILD_TESTS=Off 
6271				   -DMI_BUILD_OBJECT=Off 
63- 				   -DMI_OPT_ARCH=On 
72+ 				   -DMI_NO_OPT_ARCH=On 
73+ 				   -DMI_EXTRA_CPPDEFS=${MIMALLOC_EXTRA_CPPDEFS} 
6474		INSTALL_COMMAND "" 
6575		UPDATE_COMMAND "" 
6676		BUILD_BYPRODUCTS ${MALLOC_LIB} 
Original file line number Diff line number Diff line change @@ -15,10 +15,6 @@ See the License for the specific language governing permissions and
1515limitations under the License. 
1616*/ 
1717
18- #ifdef  HAS_MIMALLOC
19- #include  < mimalloc-new-delete.h> 
20- #endif 
21- 
2218#include  < stdio.h> 
2319#include  < string> 
2420
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments