From bdb53aad46da782931e57efc8b6f3c59361dca5b Mon Sep 17 00:00:00 2001 From: "Dongwon, Kim" <68371880+comwitch@users.noreply.github.com> Date: Wed, 18 Mar 2026 16:39:04 +0900 Subject: [PATCH 1/4] macos_build --- MotionCorrection/CMakeLists.txt | 8 ++++++++ MotionCorrection/src/cpp/Compiler.h | 2 +- MotionCorrection/src/cpp/Math/SIMD.h | 13 ++++++++++++- NEWREADME.md | 13 +++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 NEWREADME.md diff --git a/MotionCorrection/CMakeLists.txt b/MotionCorrection/CMakeLists.txt index 0770898..c997d50 100644 --- a/MotionCorrection/CMakeLists.txt +++ b/MotionCorrection/CMakeLists.txt @@ -7,6 +7,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # Find Python find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +if(APPLE) + include_directories(/opt/homebrew/include/) +endif() + + # Find or fetch pybind11 find_package(pybind11 CONFIG QUIET) if(NOT pybind11_FOUND) @@ -73,6 +78,9 @@ target_compile_definitions(motion_correction_cpp_base PUBLIC EIGEN_MPL2_ONLY) if(MSVC) # MSVC-specific flags target_compile_options(motion_correction_cpp_base PRIVATE /W4 /arch:AVX) +elseif(APPLE) + target_compile_options(motion_correction_cpp_base PRIVATE -Wall -Wextra -O3) + else() # GCC/Clang flags (also applies to MinGW on Windows) # Enable SSE4.1 and AVX instructions for SIMD operations diff --git a/MotionCorrection/src/cpp/Compiler.h b/MotionCorrection/src/cpp/Compiler.h index 851f934..1e86f49 100644 --- a/MotionCorrection/src/cpp/Compiler.h +++ b/MotionCorrection/src/cpp/Compiler.h @@ -20,6 +20,6 @@ #if defined(COMPILER_MSVC) #define FORCE_INLINE __forceinline -#elif defined(COMPILER_GNUC) +#elif defined(COMPILER_GNUC) || defined(__clang__) #define FORCE_INLINE inline __attribute__((always_inline)) #endif diff --git a/MotionCorrection/src/cpp/Math/SIMD.h b/MotionCorrection/src/cpp/Math/SIMD.h index dfc1ced..981e5bf 100644 --- a/MotionCorrection/src/cpp/Math/SIMD.h +++ b/MotionCorrection/src/cpp/Math/SIMD.h @@ -6,7 +6,18 @@ #pragma once #include -#include +#ifdef __APPLE__ + #define SIMDE_ENABLE_NATIVE_ALIASES + #include + #include + #include + #include + #include + #include + #include +#else + #include +#endif namespace SIMD { diff --git a/NEWREADME.md b/NEWREADME.md new file mode 100644 index 0000000..d29242c --- /dev/null +++ b/NEWREADME.md @@ -0,0 +1,13 @@ +아아 안녕하세요 김동원입니다. + +이거 리눅스관련 코드는 맥으로 바꿨고요, + + +brew install simde + +하고 상위폴더에서 + +pip install -e [.all] + +이렇게 설치하면됩니다. (python=3.10테스트) + From 4d2620d7820d7bde90c4ec0e67c9f7bbd23dffd2 Mon Sep 17 00:00:00 2001 From: "Dongwon, Kim" <68371880+comwitch@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:17:18 +0900 Subject: [PATCH 2/4] delete newreadme --- NEWREADME.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 NEWREADME.md diff --git a/NEWREADME.md b/NEWREADME.md deleted file mode 100644 index d29242c..0000000 --- a/NEWREADME.md +++ /dev/null @@ -1,13 +0,0 @@ -아아 안녕하세요 김동원입니다. - -이거 리눅스관련 코드는 맥으로 바꿨고요, - - -brew install simde - -하고 상위폴더에서 - -pip install -e [.all] - -이렇게 설치하면됩니다. (python=3.10테스트) - From 00291106752af0a75841f3b9b6110957832daadd Mon Sep 17 00:00:00 2001 From: "Dongwon, Kim" <68371880+comwitch@users.noreply.github.com> Date: Thu, 19 Mar 2026 16:23:21 +0900 Subject: [PATCH 3/4] fix to aarch64 --- MotionCorrection/CMakeLists.txt | 19 +++++++++++++++---- MotionCorrection/src/cpp/Math/SIMD.h | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/MotionCorrection/CMakeLists.txt b/MotionCorrection/CMakeLists.txt index c997d50..87a259c 100644 --- a/MotionCorrection/CMakeLists.txt +++ b/MotionCorrection/CMakeLists.txt @@ -7,10 +7,16 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # Find Python find_package(Python3 COMPONENTS Interpreter Development REQUIRED) -if(APPLE) - include_directories(/opt/homebrew/include/) -endif() +# Find brew package +find_path(SIMDE_INCLUDE_DIR + NAMES simde/x86/sse.h +) +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64|ARM64)") + if(NOT SIMDE_INCLUDE_DIR) + message(FATAL_ERROR "SIMDe headers not found. Please install simde or set CMAKE_PREFIX_PATH.") + endif() +endif() # Find or fetch pybind11 find_package(pybind11 CONFIG QUIET) @@ -66,6 +72,10 @@ target_include_directories(motion_correction_cpp_base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/cpp ) +if(SIMDE_INCLUDE_DIR) + target_include_directories(motion_correction_cpp_base PUBLIC ${SIMDE_INCLUDE_DIR}) +endif() + if(TARGET Eigen3::Eigen) target_link_libraries(motion_correction_cpp_base PUBLIC Eigen3::Eigen) else() @@ -78,7 +88,8 @@ target_compile_definitions(motion_correction_cpp_base PUBLIC EIGEN_MPL2_ONLY) if(MSVC) # MSVC-specific flags target_compile_options(motion_correction_cpp_base PRIVATE /W4 /arch:AVX) -elseif(APPLE) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64|i[3-6]86)$") + # ARM64/NEON flags target_compile_options(motion_correction_cpp_base PRIVATE -Wall -Wextra -O3) else() diff --git a/MotionCorrection/src/cpp/Math/SIMD.h b/MotionCorrection/src/cpp/Math/SIMD.h index 981e5bf..f78b742 100644 --- a/MotionCorrection/src/cpp/Math/SIMD.h +++ b/MotionCorrection/src/cpp/Math/SIMD.h @@ -6,7 +6,7 @@ #pragma once #include -#ifdef __APPLE__ +#if defined(__aarch64__) || defined(__ARM_NEON) #define SIMDE_ENABLE_NATIVE_ALIASES #include #include From 1e95ba5567d5b163e73eab9442c84ff6b6783382 Mon Sep 17 00:00:00 2001 From: "Dongwon, Kim" <68371880+comwitch@users.noreply.github.com> Date: Thu, 19 Mar 2026 16:30:06 +0900 Subject: [PATCH 4/4] fix to aarch64 --- MotionCorrection/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MotionCorrection/CMakeLists.txt b/MotionCorrection/CMakeLists.txt index 87a259c..763bece 100644 --- a/MotionCorrection/CMakeLists.txt +++ b/MotionCorrection/CMakeLists.txt @@ -88,7 +88,7 @@ target_compile_definitions(motion_correction_cpp_base PUBLIC EIGEN_MPL2_ONLY) if(MSVC) # MSVC-specific flags target_compile_options(motion_correction_cpp_base PRIVATE /W4 /arch:AVX) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64|i[3-6]86)$") +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64|ARM64)") # ARM64/NEON flags target_compile_options(motion_correction_cpp_base PRIVATE -Wall -Wextra -O3)