From eb0081382b16114de189f529ad59c6cd8441287e Mon Sep 17 00:00:00 2001 From: Jo Bates <29763794+jbatez@users.noreply.github.com> Date: Sat, 1 Feb 2025 17:04:46 -0800 Subject: [PATCH 1/4] support MI_OPT_ARCH when targeting multiple CMAKE_OSX_ARCHITECTURES --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c766ce3a..e30c40c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,7 +425,9 @@ endif() if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU|Intel" AND NOT CMAKE_SYSTEM_NAME MATCHES "Haiku") if(MI_OPT_ARCH) - if(MI_ARCH STREQUAL "arm64") + if(APPLE AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES) + set(MI_OPT_ARCH_FLAGS "-Xarch_arm64" "-march=armv8.1-a") + elseif(MI_ARCH STREQUAL "arm64") set(MI_OPT_ARCH_FLAGS "-march=armv8.1-a") # fast atomics endif() endif() From 9053cf0cd25e7a59750eb974012c0f371ce3e312 Mon Sep 17 00:00:00 2001 From: Sergey Markelov Date: Fri, 7 Feb 2025 12:35:59 -0700 Subject: [PATCH 2/4] prim: fix dev3 UWP build (#1005) --- src/prim/windows/prim.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/prim/windows/prim.c b/src/prim/windows/prim.c index 0916a7ea..f91925fc 100644 --- a/src/prim/windows/prim.c +++ b/src/prim/windows/prim.c @@ -127,9 +127,11 @@ void _mi_prim_mem_init( mi_os_mem_config_t* config ) config->has_partial_free = false; config->has_virtual_reserve = true; // windows version - const DWORD win_version = GetVersion(); - win_major_version = (DWORD)(LOBYTE(LOWORD(win_version))); - win_minor_version = (DWORD)(HIBYTE(LOWORD(win_version))); + OSVERSIONINFOW version{sizeof(version)}; + if (GetVersionExW(&version)) { + win_major_version = version.dwMajorVersion; + win_minor_version = version.dwMinorVersion; + } // get the page size SYSTEM_INFO si; GetSystemInfo(&si); From 0e9159e0bf0943b4c11e3d0746d164033a42f3c8 Mon Sep 17 00:00:00 2001 From: Daan Date: Sat, 8 Feb 2025 12:06:39 -0800 Subject: [PATCH 3/4] add comment --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e30c40c8..530afcf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,7 +425,7 @@ endif() if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU|Intel" AND NOT CMAKE_SYSTEM_NAME MATCHES "Haiku") if(MI_OPT_ARCH) - if(APPLE AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES) + if(APPLE AND CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES) # to support multi-arch binaries (#999) set(MI_OPT_ARCH_FLAGS "-Xarch_arm64" "-march=armv8.1-a") elseif(MI_ARCH STREQUAL "arm64") set(MI_OPT_ARCH_FLAGS "-march=armv8.1-a") # fast atomics From 069279e3e7f6424eed1ea79f129ab26b22195b55 Mon Sep 17 00:00:00 2001 From: Daan Date: Sat, 8 Feb 2025 12:18:27 -0800 Subject: [PATCH 4/4] improve cmake for multi-arch binaries on apple --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 530afcf8..cd1582b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,10 +425,13 @@ endif() if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU|Intel" AND NOT CMAKE_SYSTEM_NAME MATCHES "Haiku") if(MI_OPT_ARCH) - if(APPLE AND CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES) # to support multi-arch binaries (#999) - set(MI_OPT_ARCH_FLAGS "-Xarch_arm64" "-march=armv8.1-a") + if(APPLE AND CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_OSX_ARCHITECTURES) # to support multi-arch binaries (#999) + set(MI_OPT_ARCH_FLAGS "") + if("arm64" IN_LIST CMAKE_OSX_ARCHITECTURES) + list(APPEND MI_OPT_ARCH_FLAGS "-Xarch_arm64;-march=armv8.1-a") + endif() elseif(MI_ARCH STREQUAL "arm64") - set(MI_OPT_ARCH_FLAGS "-march=armv8.1-a") # fast atomics + set(MI_OPT_ARCH_FLAGS "-march=armv8.1-a") # fast atomics endif() endif() endif()