diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a4e3d67..b56c3e2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,8 @@ target_include_directories(mimalloc-obj PUBLIC $ ) -install(TARGETS mimalloc-obj EXPORT mimalloc DESTINATION ${mi_install_dir}) +# seems to lead to cmake warnings/errors on some systems, disable for now :-( +# install(TARGETS mimalloc-obj EXPORT mimalloc DESTINATION ${mi_install_dir}) install(FILES $ DESTINATION ${mi_install_dir} diff --git a/cmake/mimalloc-config.cmake b/cmake/mimalloc-config.cmake index b7ced994..12da076e 100644 --- a/cmake/mimalloc-config.cmake +++ b/cmake/mimalloc-config.cmake @@ -1 +1,2 @@ include(${CMAKE_CURRENT_LIST_DIR}/mimalloc.cmake) +get_filename_component(MIMALLOC_TARGET_DIR "${CMAKE_CURRENT_LIST_DIR}" PATH) diff --git a/include/mimalloc-atomic.h b/include/mimalloc-atomic.h index 3fe30474..c8fd2ac1 100644 --- a/include/mimalloc-atomic.h +++ b/include/mimalloc-atomic.h @@ -157,15 +157,15 @@ static inline uint32_t mi_atomic_subtract32(volatile uint32_t* p, uint32_t sub) } static inline bool mi_atomic_compare_exchange32(volatile uint32_t* p, uint32_t exchange, uint32_t compare) { MI_USING_STD - return atomic_compare_exchange_weak_explicit((volatile _Atomic(uint32_t)*)p, &compare, exchange, memory_order_relaxed, memory_order_seq_cst); + return atomic_compare_exchange_weak_explicit((volatile _Atomic(uint32_t)*)p, &compare, exchange, memory_order_release, memory_order_relaxed); } static inline bool mi_atomic_compare_exchange(volatile uintptr_t* p, uintptr_t exchange, uintptr_t compare) { MI_USING_STD - return atomic_compare_exchange_weak_explicit((volatile atomic_uintptr_t*)p, &compare, exchange, memory_order_relaxed, memory_order_seq_cst); + return atomic_compare_exchange_weak_explicit((volatile atomic_uintptr_t*)p, &compare, exchange, memory_order_release, memory_order_relaxed); } static inline uintptr_t mi_atomic_exchange(volatile uintptr_t* p, uintptr_t exchange) { MI_USING_STD - return atomic_exchange_explicit((volatile atomic_uintptr_t*)p, exchange, memory_order_relaxed); + return atomic_exchange_explicit((volatile atomic_uintptr_t*)p, exchange, memory_order_acquire); } static inline uintptr_t mi_atomic_read(volatile uintptr_t* p) { MI_USING_STD diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a9efaff9..42d4a2f4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -31,7 +31,7 @@ target_link_libraries(static-override PUBLIC mimalloc-static) add_executable(static-override-cxx main-override.cpp) target_link_libraries(static-override-cxx PUBLIC mimalloc-static) -# and with a static object file; need to link with pthread explicitly :-( -add_executable(static-override-obj main-override.c $) -target_include_directories(static-override-obj PUBLIC $) +# and with a static object file +add_executable(static-override-obj main-override.c ${MIMALLOC_TARGET_DIR}/mimalloc.o) +target_include_directories(static-override-obj PUBLIC ${MIMALLOC_TARGET_DIR}/include) target_link_libraries(static-override-obj PUBLIC pthread)