From 27e897a21a49b228840a12912bb99aa3f17975f3 Mon Sep 17 00:00:00 2001 From: Pariterre Date: Wed, 14 Aug 2024 09:31:36 -0400 Subject: [PATCH 1/5] Typo --- binding/matlab/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding/matlab/CMakeLists.txt b/binding/matlab/CMakeLists.txt index 707d8b1e..d151be04 100644 --- a/binding/matlab/CMakeLists.txt +++ b/binding/matlab/CMakeLists.txt @@ -66,7 +66,7 @@ foreach(SUFFIXES Read Write) PREFIX "" ) else() - message(FATAL_ERROR "Unknown architecture: ${CMAKE_SYSTEM_PROCESSOR}") + message(FATAL_ERROR "Unknown architecture: ${CMAKE_APPLE_SILICON_PROCESSOR}") endif () else() if (CMAKE_SIZEOF_VOID_P MATCHES "8") From 09fb952e45a4e9d6d7bb9dc3da4712132c4fbc03 Mon Sep 17 00:00:00 2001 From: Pariterre Date: Wed, 14 Aug 2024 10:35:31 -0400 Subject: [PATCH 2/5] to remove --- binding/matlab/CMakeLists.txt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/binding/matlab/CMakeLists.txt b/binding/matlab/CMakeLists.txt index d151be04..b543ce68 100644 --- a/binding/matlab/CMakeLists.txt +++ b/binding/matlab/CMakeLists.txt @@ -53,20 +53,32 @@ foreach(SUFFIXES Read Write) ) endif(CMAKE_CL_64) elseif(APPLE) - if (CMAKE_APPLE_SILICON_PROCESSOR STREQUAL "x86_64") + # Get the current architecture + message(STATUS "Architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") + if (NOT CMAKE_APPLE_SILICON_PROCESSOR) + execute_process( + COMMAND uname -m + OUTPUT_VARIABLE CMAKE_APPLE_SILICON_PROCESSOR + ) + message(STATUS "Ye") + endif() + message(STATUS "Architecture: ${CMAKE_APPLE_SILICON_PROCESSOR}") + + + if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") message(STATUS "Using MATLAB for MacOS Intel") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexmaci64" PREFIX "" ) - elseif(CMAKE_APPLE_SILICON_PROCESSOR STREQUAL "arm64") + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") message(STATUS "Using MATLAB for MacOS Arm") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexmaca64" PREFIX "" ) else() - message(FATAL_ERROR "Unknown architecture: ${CMAKE_APPLE_SILICON_PROCESSOR}") + message(FATAL_ERROR "Unknown architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") endif () else() if (CMAKE_SIZEOF_VOID_P MATCHES "8") From 02ef46ff8705c6332c92b75c2947dad6bfc80ac9 Mon Sep 17 00:00:00 2001 From: Pariterre Date: Wed, 14 Aug 2024 11:09:30 -0400 Subject: [PATCH 3/5] Fixed matlab github actions --- .github/workflows/publish_matlab_binaries.yml | 8 +++++-- .github/workflows/run_matlab_tests.yml | 10 ++++++--- binding/matlab/CMakeLists.txt | 21 +++++++------------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish_matlab_binaries.yml b/.github/workflows/publish_matlab_binaries.yml index b5da6f35..08d7e373 100644 --- a/.github/workflows/publish_matlab_binaries.yml +++ b/.github/workflows/publish_matlab_binaries.yml @@ -15,15 +15,19 @@ jobs: include: - os: ubuntu-latest label: linux-64 + architecture: x64 prefix: /usr/share/miniconda3/envs/ezc3d - os: macos-latest label: osx-arm64 + architecture: arm64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: macos-13 label: osx-intel + architecture: x86_64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: windows-latest label: win-64 + architecture: x64 prefix: C:\Miniconda3\envs\ezc3d name: ${{ matrix.label }} runs-on: ${{ matrix.os }} @@ -62,7 +66,7 @@ jobs: cache: true if: matrix.label != 'osx-arm64' - - name: Install MATLAB on MACOS-arm64 + - name: Install MATLAB on MACOS-Arm64 uses: matlab-actions/setup-matlab@v2 with: release: R2023a @@ -78,7 +82,7 @@ jobs: CONDA_ENV_PATH=$CONDA/envs/ezc3d mkdir -p $MAIN_FOLDER/$BUILD_FOLDER cd $MAIN_FOLDER/$BUILD_FOLDER - cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. + cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DCMAKE_APPLE_SILICON_PROCESSOR=${{ matrix.architecture }} -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. make install -j${{ steps.cpu-cores.outputs.count }} cd $MAIN_FOLDER if: matrix.label != 'win-64' diff --git a/.github/workflows/run_matlab_tests.yml b/.github/workflows/run_matlab_tests.yml index 36fb2ec6..aa3e62ac 100644 --- a/.github/workflows/run_matlab_tests.yml +++ b/.github/workflows/run_matlab_tests.yml @@ -13,15 +13,19 @@ jobs: include: - os: ubuntu-latest label: linux-64 + architecture: x64 prefix: /usr/share/miniconda3/envs/ezc3d - os: macos-latest label: osx-arm64 + architecture: arm64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: macos-13 label: osx-intel + architecture: x86_64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: windows-latest label: win-64 + architecture: x64 prefix: C:\Miniconda3\envs\ezc3d name: ${{ matrix.label }} runs-on: ${{ matrix.os }} @@ -60,7 +64,7 @@ jobs: cache: true if: matrix.label != 'osx-arm64' - - name: Install MATLAB on MACOS + - name: Install MATLAB on MACOS-Arm64 uses: matlab-actions/setup-matlab@v2 with: release: R2023a @@ -76,11 +80,11 @@ jobs: CONDA_ENV_PATH=$CONDA/envs/ezc3d mkdir -p $MAIN_FOLDER/$BUILD_FOLDER cd $MAIN_FOLDER/$BUILD_FOLDER - cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. + cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DCMAKE_APPLE_SILICON_PROCESSOR=${{ matrix.architecture }} -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. make install -j${{ steps.cpu-cores.outputs.count }} cd $MAIN_FOLDER if: matrix.label != 'win-64' - + - name: Build ezc3d on WINDOWS run: | MAIN_FOLDER=`pwd` diff --git a/binding/matlab/CMakeLists.txt b/binding/matlab/CMakeLists.txt index b543ce68..d1258761 100644 --- a/binding/matlab/CMakeLists.txt +++ b/binding/matlab/CMakeLists.txt @@ -54,31 +54,26 @@ foreach(SUFFIXES Read Write) endif(CMAKE_CL_64) elseif(APPLE) # Get the current architecture - message(STATUS "Architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") - if (NOT CMAKE_APPLE_SILICON_PROCESSOR) - execute_process( - COMMAND uname -m - OUTPUT_VARIABLE CMAKE_APPLE_SILICON_PROCESSOR - ) - message(STATUS "Ye") - endif() - message(STATUS "Architecture: ${CMAKE_APPLE_SILICON_PROCESSOR}") - + if (CMAKE_APPLE_SILICON_PROCESSOR) + set(OSX_ARCHITECTURE ${CMAKE_APPLE_SILICON_PROCESSOR} CACHE INTERNAL "The osx architecture" FORCE) + else(CMAKE_APPLE_SILICON_PROCESSOR) + set(OSX_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE INTERNAL "The osx architecture" FORCE) + endif(CMAKE_APPLE_SILICON_PROCESSOR) - if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") + if (OSX_ARCHITECTURE STREQUAL "x86_64") message(STATUS "Using MATLAB for MacOS Intel") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexmaci64" PREFIX "" ) - elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") + elseif(OSX_ARCHITECTURE STREQUAL "arm64") message(STATUS "Using MATLAB for MacOS Arm") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexmaca64" PREFIX "" ) else() - message(FATAL_ERROR "Unknown architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") + message(FATAL_ERROR "Unknown architecture: ${OSX_ARCHITECTURE}") endif () else() if (CMAKE_SIZEOF_VOID_P MATCHES "8") From cd8af9b82a5f8f7226bad55ae12b5f9a1116e9fe Mon Sep 17 00:00:00 2001 From: Pariterre Date: Wed, 14 Aug 2024 11:49:34 -0400 Subject: [PATCH 4/5] Removed all the shinanigans --- .github/workflows/publish_matlab_binaries.yml | 6 +----- .github/workflows/run_matlab_tests.yml | 6 +----- binding/matlab/CMakeLists.txt | 19 +++---------------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/.github/workflows/publish_matlab_binaries.yml b/.github/workflows/publish_matlab_binaries.yml index 08d7e373..7c469992 100644 --- a/.github/workflows/publish_matlab_binaries.yml +++ b/.github/workflows/publish_matlab_binaries.yml @@ -15,19 +15,15 @@ jobs: include: - os: ubuntu-latest label: linux-64 - architecture: x64 prefix: /usr/share/miniconda3/envs/ezc3d - os: macos-latest label: osx-arm64 - architecture: arm64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: macos-13 label: osx-intel - architecture: x86_64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: windows-latest label: win-64 - architecture: x64 prefix: C:\Miniconda3\envs\ezc3d name: ${{ matrix.label }} runs-on: ${{ matrix.os }} @@ -82,7 +78,7 @@ jobs: CONDA_ENV_PATH=$CONDA/envs/ezc3d mkdir -p $MAIN_FOLDER/$BUILD_FOLDER cd $MAIN_FOLDER/$BUILD_FOLDER - cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DCMAKE_APPLE_SILICON_PROCESSOR=${{ matrix.architecture }} -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. + cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. make install -j${{ steps.cpu-cores.outputs.count }} cd $MAIN_FOLDER if: matrix.label != 'win-64' diff --git a/.github/workflows/run_matlab_tests.yml b/.github/workflows/run_matlab_tests.yml index aa3e62ac..418d3673 100644 --- a/.github/workflows/run_matlab_tests.yml +++ b/.github/workflows/run_matlab_tests.yml @@ -13,19 +13,15 @@ jobs: include: - os: ubuntu-latest label: linux-64 - architecture: x64 prefix: /usr/share/miniconda3/envs/ezc3d - os: macos-latest label: osx-arm64 - architecture: arm64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: macos-13 label: osx-intel - architecture: x86_64 prefix: /Users/runner/miniconda3/envs/ezc3d - os: windows-latest label: win-64 - architecture: x64 prefix: C:\Miniconda3\envs\ezc3d name: ${{ matrix.label }} runs-on: ${{ matrix.os }} @@ -80,7 +76,7 @@ jobs: CONDA_ENV_PATH=$CONDA/envs/ezc3d mkdir -p $MAIN_FOLDER/$BUILD_FOLDER cd $MAIN_FOLDER/$BUILD_FOLDER - cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DCMAKE_APPLE_SILICON_PROCESSOR=${{ matrix.architecture }} -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. + cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_MATLAB=ON -DMatlab_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=OFF .. make install -j${{ steps.cpu-cores.outputs.count }} cd $MAIN_FOLDER if: matrix.label != 'win-64' diff --git a/binding/matlab/CMakeLists.txt b/binding/matlab/CMakeLists.txt index d1258761..328c9529 100644 --- a/binding/matlab/CMakeLists.txt +++ b/binding/matlab/CMakeLists.txt @@ -42,48 +42,35 @@ foreach(SUFFIXES Read Write) # Set the name of the library if(WIN32) if (CMAKE_CL_64) - message(STATUS "Using MATLAB for Windows 64-bits") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexw64" ) else(CMAKE_CL_64) - message(STATUS "Using MATLAB for Windows 32-bits") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexw32" ) endif(CMAKE_CL_64) elseif(APPLE) - # Get the current architecture - if (CMAKE_APPLE_SILICON_PROCESSOR) - set(OSX_ARCHITECTURE ${CMAKE_APPLE_SILICON_PROCESSOR} CACHE INTERNAL "The osx architecture" FORCE) - else(CMAKE_APPLE_SILICON_PROCESSOR) - set(OSX_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE INTERNAL "The osx architecture" FORCE) - endif(CMAKE_APPLE_SILICON_PROCESSOR) - - if (OSX_ARCHITECTURE STREQUAL "x86_64") - message(STATUS "Using MATLAB for MacOS Intel") + if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexmaci64" PREFIX "" ) - elseif(OSX_ARCHITECTURE STREQUAL "arm64") - message(STATUS "Using MATLAB for MacOS Arm") + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexmaca64" PREFIX "" ) else() - message(FATAL_ERROR "Unknown architecture: ${OSX_ARCHITECTURE}") + message(FATAL_ERROR "Unknown architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}") endif () else() if (CMAKE_SIZEOF_VOID_P MATCHES "8") - message(STATUS "Using MATLAB for Linux 64-bits") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexa64" PREFIX "" ) else(CMAKE_SIZEOF_VOID_P MATCHES "8") - message(STATUS "Using MATLAB for Linux 32-bits") set_target_properties(${PROJECT_NAME}_${SUFFIXES} PROPERTIES SUFFIX ".mexglx" PREFIX "" From ba8e91dbb093b849d06260a102c95134e9f7e3b2 Mon Sep 17 00:00:00 2001 From: Pariterre Date: Wed, 14 Aug 2024 12:09:52 -0400 Subject: [PATCH 5/5] Trying something for macos-arm64 --- .github/workflows/publish_matlab_binaries.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/publish_matlab_binaries.yml b/.github/workflows/publish_matlab_binaries.yml index 7c469992..f3068352 100644 --- a/.github/workflows/publish_matlab_binaries.yml +++ b/.github/workflows/publish_matlab_binaries.yml @@ -94,6 +94,13 @@ jobs: cd $MAIN_FOLDER if: matrix.label == 'win-64' + - name: Do some shinanigans on MACOS-ARM64 + run: | + # Since Github actions arm64 provides the wrong "uname -m", we change it by hand + cd $HOME/ezc3d_matlab + for old in *.mexmaci64; do mv $old `basename $old .mexmaci64`.mexmaca64; done + cd $MAIN_FOLDER + - name: Build MATLAB archives on UNIX run: | cp -r $HOME/ezc3d_matlab .