From 9a192b1a4c111efb04fa319de329556b33748633 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Mon, 18 Nov 2024 00:59:06 +0300 Subject: [PATCH 01/17] update distribution scripts, add codesigning --- macos/Info.plist | 338 ++++++++++++++++++++++++ macos/entitlements.plist | 9 + scripts/distribution_apple.sh | 40 --- scripts/distribution_apple_framework.sh | 137 ++++++++++ scripts/distribution_apple_pkg.sh | 86 ++++++ 5 files changed, 570 insertions(+), 40 deletions(-) create mode 100644 macos/Info.plist create mode 100644 macos/entitlements.plist delete mode 100755 scripts/distribution_apple.sh create mode 100755 scripts/distribution_apple_framework.sh create mode 100755 scripts/distribution_apple_pkg.sh diff --git a/macos/Info.plist b/macos/Info.plist new file mode 100644 index 000000000000..780b46b10178 --- /dev/null +++ b/macos/Info.plist @@ -0,0 +1,338 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + MeshLib + CFBundleGetInfoString + + CFBundleIconFile + + CFBundleIdentifier + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + + CFBundleName + MeshLib + CFBundlePackageType + APPL + CFBundleShortVersionString + + CFBundleSignature + ???? + CFBundleVersion + + CSResourcesFileMapped + + NSHumanReadableCopyright + + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + mru + + CFBundleTypeName + MeshLib Scene + LSHandlerRank + Owner + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + mrmesh + + CFBundleTypeName + MeshLib Mesh + LSHandlerRank + Owner + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + mrdistancemap + + CFBundleTypeName + MeshLib Distance Map + LSHandlerRank + Owner + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + mrlines + + CFBundleTypeName + MeshLib Lines + LSHandlerRank + Owner + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + mison + + CFBundleTypeName + MeshLib Object Notation + LSHandlerRank + Owner + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + stl + + CFBundleTypeName + STL File + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + ctm + + CFBundleTypeName + Compressed Triangle Mesh + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + ply + + CFBundleTypeName + Polygon File Format + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + obj + + CFBundleTypeName + OBJ Geometry Format + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + off + + CFBundleTypeName + Object File Format + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + dxf + + CFBundleTypeName + Drawing Interchange Format + CFBundleTypeRole + Viewer + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + 3mf + model + + CFBundleTypeName + 3D Manufacturing Format + CFBundleTypeRole + Viewer + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + step + stp + + CFBundleTypeName + STEP File + CFBundleTypeRole + Viewer + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + gltf + + CFBundleTypeName + glTF Scene + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + glb + + CFBundleTypeName + glTF Binary Scene + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + pts + + CFBundleTypeName + PTS File Format for 3D Points + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + asc + + CFBundleTypeName + ASC File Format for 3D Points + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + xyz + + CFBundleTypeName + XYZ File Format for 3D Points + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + xyzn + + CFBundleTypeName + XYZN File Format for 3D Points + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + e57 + + CFBundleTypeName + E57 File Format for 3D Points + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + las + laz + + CFBundleTypeName + LAS File Format for 3D Points + CFBundleTypeRole + Viewer + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + gcode + + CFBundleTypeName + G-code File + CFBundleTypeRole + Viewer + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + nc + + CFBundleTypeName + Numerical Control + CFBundleTypeRole + Viewer + CFBundleTypeIconFile + MeshLib.icns + + + CFBundleTypeExtensions + + vdb + + CFBundleTypeName + OpenVDB Voxels + CFBundleTypeRole + Editor + CFBundleTypeIconFile + MeshLib.icns + + + + \ No newline at end of file diff --git a/macos/entitlements.plist b/macos/entitlements.plist new file mode 100644 index 000000000000..b85d45e1e2a9 --- /dev/null +++ b/macos/entitlements.plist @@ -0,0 +1,9 @@ + + + + + + com.apple.security.cs.disable-library-validation + + + diff --git a/scripts/distribution_apple.sh b/scripts/distribution_apple.sh deleted file mode 100755 index 2c18ff328edf..000000000000 --- a/scripts/distribution_apple.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -if [ -d "./Library" ]; - then rm -rf "./Library"; -fi - -cd ./build/Release -cmake --install . --prefix=../.. -cd - -MR_VERSION=$(ls ./Library/Frameworks/MeshLib.framework/Versions/) -echo "version: ${MR_VERSION}" -MR_PREFIX="./Library/Frameworks/MeshLib.framework/Versions/${MR_VERSION}" -echo "prefix: ${MR_PREFIX}" - -cp -rL ./lib "${MR_PREFIX}/lib/" -cp -rL ./include "${MR_PREFIX}/include/" - -cp ./LICENSE ./macos/Resources -mkdir "${MR_PREFIX}"/requirements/ -cp ./requirements/macos.txt "${MR_PREFIX}"/requirements/ - -mkdir "${MR_PREFIX}"/share/ -cp -r "$(brew --prefix)"/share/glib-2.0 "${MR_PREFIX}"/share - -ln -s "/Library/Frameworks/MeshLib.framework/Versions/${MR_VERSION}" "./Library/Frameworks/MeshLib.framework/Versions/Current" -ln -s "/Library/Frameworks/MeshLib.framework/Resources" "./Library/Frameworks/MeshLib.framework/Versions/${MR_VERSION}/Resources" - -# be carefull with pkg names! The pkg can fail to build -pkgbuild \ - --root Library \ - --identifier com.MeshInspector.MeshLib \ - --install-location /Library \ - MeshLib.pkg - - -productbuild \ - --distribution ./macos/Distribution.xml \ - --package-path ./MeshLib.pkg \ - --resources ./macos/Resources \ - MeshLib_.pkg \ No newline at end of file diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh new file mode 100755 index 000000000000..2af3622d066b --- /dev/null +++ b/scripts/distribution_apple_framework.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +# exit if any command failed +set -eo pipefail + +create_framework_dir() { + if [ -d "./Library" ]; + then rm -rf "./Library"; + fi + + cmake --install ./build/Release --prefix "." + + MR_VERSION=$(ls ./Library/Frameworks/MeshLib.framework/Versions/) + MR_PREFIX="./Library/Frameworks/MeshLib.framework/Versions/${MR_VERSION}" + + echo "version: ${MR_VERSION}" + echo "prefix: ${MR_PREFIX}" + + mkdir -p "${MR_PREFIX}/libs/" + + cp -rL ./include "${MR_PREFIX}/include" + cp ./macos/Info.plist ./macos/Resources + cp ./LICENSE ./macos/Resources + + mkdir -p "${MR_PREFIX}"/requirements/ + cp ./requirements/macos.txt "${MR_PREFIX}"/requirements/ + cp ./requirements/distribution_python.txt "${MR_PREFIX}"/requirements/python.txt + + mkdir -p "${MR_PREFIX}"/share/ + cp -r "$(brew --prefix)"/share/glib-2.0 "${MR_PREFIX}"/share + + cd ./Library/Frameworks/MeshLib.framework/Versions/ + ln -s "${MR_VERSION}" ./Current + cd - +} + +embed_python() { + echo "Embedded python: processing requirements" + if [ -f "python.py" ]; + then rm "python.py"; + fi + + touch "python.py" + for PYTHON_LIB_NAME in $(cat "${MR_PREFIX}"/requirements/python.txt) + do + PYTHON_LIB_NAME=${PYTHON_LIB_NAME%%>*} + PYTHON_LIB_NAME=${PYTHON_LIB_NAME%%=*} + echo "$PYTHON_LIB_NAME" + echo "import $PYTHON_LIB_NAME" >> python.py + done + + python3.10 -m pip install --upgrade pip + python3.10 -m pip install virtualenv + python3.10 -m venv ./venv + source ./venv/bin/activate + python3.10 -m pip install pyinstaller + if [ -d "./dist" ]; + then rm -rf "./dist"; + fi + pyinstaller ./python.py --distpath ./dist + + echo "Embedded python: changing libMRPython.dylib embedded python path" + PYTHON_PATH=$(otool -L ./build/Release/bin/libMRPython.dylib | grep 'Python' | cut -d ' ' -f 1 | sed 's/[[:blank:]]//g') + NEW_PYTHON_PATH="@rpath/../python/_internal/Python.framework/Versions/3.10/Python" + echo "old: $PYTHON_PATH, new: $NEW_PYTHON_PATH" + install_name_tool -change "$PYTHON_PATH" "$NEW_PYTHON_PATH" ./build/Release/bin/libMRMesh.dylib + deactivate + echo "Done" +} + +pack_dylibs() { + echo "Fixing MeshLib executable @rpath" -x ${MR_PREFIX}/bin/meshconv + + bin_dir="${MR_PREFIX}/bin/" + lib_dir="${MR_PREFIX}/libs/" + dest_dir="${lib_dir}" + search_paths=("${dest_dir}" "./lib/" "./dist/python") + + for binary in "$bin_dir"*; do + if [[ -x "$binary" && -f "$binary" ]]; then + bundle_dylib "$binary" "$dest_dir" "${search_paths[@]}" + fi + done + + for lib in "$lib_dir"*; do + if [[ -x "$lib" && -f "$lib" ]]; then + bundle_dylib "$lib" "$dest_dir" "${search_paths[@]}" + fi + done + + for lib in "$lib_dir"/meshlib/*; do + if [[ -x "$lib" && -f "$lib" ]]; then + bundle_dylib "$lib" "$dest_dir" "${search_paths[@]}" + fi + done +} + +bundle_dylib() { + local fix_file="$1" + local dest_dir="$2" + shift 2 # Shift the first two arguments to capture the rest as search paths + local search_paths=("$@") # can be multiple + + if [[ -z "$fix_file" ]] || [[ -z "$dest_dir" ]]; then + echo "Error: fix_file and dest_dir are required for bundle_dylib." + return 1 + fi + if [[ -z "$dest_dir" ]]; then + echo "Error: dest_dir is required." + return 1 + fi + + local search_paths_args="" + for path in "${search_paths[@]}"; do + search_paths_args+=" --search-path $path" + done + + echo "Fixing MeshLib executable @rpath" + + dylibbundler \ + --bundle-deps \ + --create-dir \ + --overwrite-files \ + --fix-file "${fix_file}" \ + --dest-dir "${dest_dir}" \ + ${search_paths_args} \ + --install-path @executable_path/../libs +} + +echo "Installing required brew pkgs" +brew install dylibbundler + +create_framework_dir +embed_python +pack_dylibs + +echo "Framework creation: done" diff --git a/scripts/distribution_apple_pkg.sh b/scripts/distribution_apple_pkg.sh new file mode 100755 index 000000000000..39cb2cca5b72 --- /dev/null +++ b/scripts/distribution_apple_pkg.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +FRAMEWORK_PATH="./Library/Frameworks/MeshLib.framework/Versions/Current" +ENTITLEMENTS_PATH="./macos/entitlements.plist" + +DEVELOPER_ID_APPLICATION="Developer ID Application: ASGSoft LLC (465Q5Z6W45)" +DEVELOPER_ID_INSTALLER="Developer ID Installer: ASGSoft LLC (465Q5Z6W45)" + +SKIP_SIGN=false + +while [[ "$#" -gt 0 ]]; do + case $1 in + --skip-sign) SKIP_SIGN=true ;; + *) echo "Unknown parameter passed: $1"; exit 1 ;; + esac + shift +done + +sign_file() { + local file="$1" + echo "Code signing file: ${file}" + codesign --sign "${DEVELOPER_ID_APPLICATION}" --entitlements "${ENTITLEMENTS_PATH}" --verbose --timestamp --options=runtime --force "${file}" +} + +if [ "$SKIP_SIGN" = false ]; then + echo "Signing the main binaries MeshViewer and meshconv" + sign_file "${FRAMEWORK_PATH}/bin/MeshViewer" + sign_file "${FRAMEWORK_PATH}/bin/meshconv" + + echo "Verifying the signatures for MeshViewer and meshconv" + codesign --verify --verbose=2 "${FRAMEWORK_PATH}/MeshLib/MeshViewer" + codesign --verify --verbose=2 "${FRAMEWORK_PATH}/MeshLib/meshconv" + + echo "Signing additional libraries and components" + find "${FRAMEWORK_PATH}/libs" -type f \( -name "*.dylib" -o -name "*.so" -o -name "*.bundle" -o -name "*.plugin" \) | while read -r FILE; do + sign_file "${FILE}" + done + + echo "Signing the entire framework directory" + codesign --sign "${DEVELOPER_ID_APPLICATION}" --entitlements "${ENTITLEMENTS_PATH}" --verbose --deep "./MeshLib.framework" + + echo "Verifying code signature for the framework" + codesign --verify --deep --strict --verbose=2 "./MeshLib.framework" + + echo "Displaying code signing information for the framework" + codesign -dvv --verbose=4 "./MeshLib.framework" +else + echo "--skip-sign option detected, skipping the signing process." +fi + +echo "Building package from .framework" +if [ "$SKIP_SIGN" = false ]; then + pkgbuild \ + --root Library \ + --identifier com.MeshInspector.MeshLib \ + --sign "${DEVELOPER_ID_INSTALLER}" \ + --install-location /Library \ + MeshLib.pkg + + productbuild \ + --distribution ./macos/Distribution.xml \ + --package-path ./MeshLib.pkg \ + --resources ./macos/Resources \ + --sign "${DEVELOPER_ID_INSTALLER}" \ + MeshLib_signed.pkg +else + pkgbuild \ + --root Library \ + --identifier com.MeshInspector.MeshLib \ + --install-location /Library \ + MeshLib.pkg + + productbuild \ + --distribution ./macos/Distribution.xml \ + --package-path ./MeshLib.pkg \ + --resources ./macos/Resources \ + MeshLib_unsigned.pkg +fi + +echo "Verifying package signature" +if [ "$SKIP_SIGN" = false ]; then + mv MeshLib_signed.pkg meshlib.pkg +else + echo "Skipping signature verification because the package was not signed." + mv MeshLib_unsigned.pkg meshlib.pkg +fi From 964385717cf9ff5cb10cbd2946831a8436959d1a Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Mon, 18 Nov 2024 00:59:56 +0300 Subject: [PATCH 02/17] change cmake build options --- CMakeLists.txt | 6 ++++-- cmake/Modules/CompilerOptions.cmake | 4 ++++ source/MRIOExtras/CMakeLists.txt | 5 +++++ source/MRMesh/CMakeLists.txt | 2 +- source/MRPch/CMakeLists.txt | 2 +- source/meshconv/CMakeLists.txt | 9 ++++++++- thirdparty/CMakeLists.txt | 2 +- 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed1df8a744ad..3552345ab6e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ ENDIF() IF(APPLE) # need to hardcode some path to fix wheel (no option to pass path) # TODO: revise - set(CMAKE_INSTALL_RPATH "@loader_path;@loader_path/..;@loader_path/../lib;@loader_path/../lib/lib;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") + set(CMAKE_INSTALL_RPATH "@loader_path/../libs;@loader_path;@loader_path/..;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) IF(BUILD_TESTING) @@ -147,8 +147,10 @@ ELSE() # TODO: https://cmake.org/cmake/help/latest/prop_tgt/RESOURCE.html set(MR_ROOT "./Library/Frameworks/MeshLib.framework/Versions/${MESHLIB_VERSION}") set(MR_BIN_DIR "${MR_ROOT}/bin") + set(MR_INCLUDE_DIR "${MR_ROOT}") + set(MR_MAIN_LIB_DIR "${MR_ROOT}") set(MR_INCLUDE_DIR "${MR_ROOT}/include") - set(MR_MAIN_LIB_DIR "${MR_ROOT}/lib") + set(MR_MAIN_LIB_DIR "${MR_ROOT}/libs") set(MR_PY_LIB_DIR "${MR_MAIN_LIB_DIR}/meshlib") set(MR_RESOURCES_DIR "${MR_ROOT}/Resources") set(MR_FONTS_DIR "${MR_ROOT}/Resources/fonts") diff --git a/cmake/Modules/CompilerOptions.cmake b/cmake/Modules/CompilerOptions.cmake index 403d17c92558..80651dd2e9a9 100644 --- a/cmake/Modules/CompilerOptions.cmake +++ b/cmake/Modules/CompilerOptions.cmake @@ -95,3 +95,7 @@ IF(MR_EMSCRIPTEN) # FIXME: comment required add_compile_definitions(EIGEN_STACK_ALLOCATION_LIMIT=0) ENDIF() # MR_EMSCRIPTEN + +IF(APPLE) + set(MR_MIN_BOOST_VERSION "1.86.0") +ENDIF() \ No newline at end of file diff --git a/source/MRIOExtras/CMakeLists.txt b/source/MRIOExtras/CMakeLists.txt index e80f29aec384..0329eebbc9a9 100644 --- a/source/MRIOExtras/CMakeLists.txt +++ b/source/MRIOExtras/CMakeLists.txt @@ -159,6 +159,11 @@ install( RUNTIME DESTINATION "${MR_BIN_DIR}" ) +install( + FILES ${HEADERS} + DESTINATION "${MR_INCLUDE_DIR}/${PROJECT_NAME}" +) + install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake DESTINATION ${MR_CONFIG_DIR} diff --git a/source/MRMesh/CMakeLists.txt b/source/MRMesh/CMakeLists.txt index f9d0d4a144fb..b024d7812642 100644 --- a/source/MRMesh/CMakeLists.txt +++ b/source/MRMesh/CMakeLists.txt @@ -48,7 +48,7 @@ IF(DEFINED EIGEN3_FOUND) ENDIF() IF(NOT MR_EMSCRIPTEN) - find_package(Boost COMPONENTS REQUIRED) + find_package(Boost ${MR_MIN_BOOST_VERSION} COMPONENTS REQUIRED) find_package(TBB REQUIRED) pkg_check_modules(JSONCPP jsoncpp) include_directories(${JSONCPP_INCLUDE_DIRS}) diff --git a/source/MRPch/CMakeLists.txt b/source/MRPch/CMakeLists.txt index d0af5549160f..87c143341453 100644 --- a/source/MRPch/CMakeLists.txt +++ b/source/MRPch/CMakeLists.txt @@ -24,7 +24,7 @@ IF(MR_PCH) tbb ) ELSE() - find_package(Boost COMPONENTS REQUIRED) + find_package(Boost ${MR_MIN_BOOST_VERSION} COMPONENTS REQUIRED) find_package(TBB REQUIRED) pkg_check_modules(JSONCPP jsoncpp) include_directories(${JSONCPP_INCLUDE_DIRS}) diff --git a/source/meshconv/CMakeLists.txt b/source/meshconv/CMakeLists.txt index 70f691418c01..ee51fe1aa30e 100644 --- a/source/meshconv/CMakeLists.txt +++ b/source/meshconv/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) project(meshconv CXX) -find_package(Boost COMPONENTS program_options REQUIRED) +find_package(Boost ${MR_MIN_BOOST_VERSION} COMPONENTS program_options REQUIRED) IF(Boost_PROGRAM_OPTIONS_FOUND) link_libraries(${Boost_PROGRAM_OPTIONS_LIBRARY}) ENDIF() @@ -20,6 +20,13 @@ target_link_libraries(${PROJECT_NAME} PRIVATE tbb ) +IF(APPLE) + set(CMAKE_INSTALL_RPATH "@loader_path/../libs;@loader_path;@loader_path/..;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + set(CMAKE_MACOSX_RPATH TRUE) # Ensure RPATH is properly set for macOS +ENDIF() + + install(TARGETS ${PROJECT_NAME} DESTINATION "${MR_BIN_DIR}") IF(MR_PCH) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 8b2b1bf0b2c9..2e47f63878a8 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -72,7 +72,7 @@ ELSE() set(USE_EXPLICIT_INSTANTIATION OFF) # Ubuntu 20.04 compatibility - find_package(Boost REQUIRED) + find_package(Boost ${MR_MIN_BOOST_VERSION} REQUIRED) find_package(TBB REQUIRED) IF(Boost_VERSION VERSION_LESS 1.73 OR TBB_VERSION VERSION_LESS 2020.2) add_subdirectory(./openvdb/v9/openvdb) From 745bc87c6e7a9292b42588d26ac9394085c3b754 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Mon, 18 Nov 2024 01:00:19 +0300 Subject: [PATCH 03/17] build and test only macos pkg --- .github/workflows/build-test-distribute.yml | 23 ++++++++++------ .github/workflows/build-test-macos.yml | 30 ++++++++++++++------- .github/workflows/test-distribution.yml | 24 ++++++++++++----- 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-test-distribute.yml b/.github/workflows/build-test-distribute.yml index 3b559b30d112..b274d919c837 100644 --- a/.github/workflows/build-test-distribute.yml +++ b/.github/workflows/build-test-distribute.yml @@ -34,6 +34,7 @@ jobs: BUILD_MACHINE_TOKEN: ${{ secrets.BUILD_MACHINE_TOKEN }} windows-build-test: + if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-windows.yml with: @@ -43,6 +44,7 @@ jobs: secrets: inherit ubuntu-arm64-build-test: + if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-ubuntu-arm64.yml with: @@ -54,6 +56,7 @@ jobs: secrets: inherit ubuntu-x64-build-test: + if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-ubuntu-x64.yml with: @@ -65,6 +68,7 @@ jobs: secrets: inherit fedora-build-test: + if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-fedora.yml with: @@ -75,6 +79,7 @@ jobs: secrets: inherit emscripten-build-test: + if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-emscripten.yml with: @@ -91,7 +96,8 @@ jobs: secrets: inherit update-win-version: - if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} + if: ${{ false }} + # if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} needs: - windows-build-test - versioning-and-release-url @@ -161,7 +167,8 @@ jobs: retention-days: 1 create-nuget-package: - if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} + if: ${{ false }} + # if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} needs: - windows-build-test - versioning-and-release-url @@ -194,12 +201,12 @@ jobs: timeout-minutes: 10 runs-on: ubuntu-latest needs: - - update-win-version - - create-nuget-package - - ubuntu-x64-build-test - - ubuntu-arm64-build-test - - fedora-build-test - - emscripten-build-test + # - update-win-version + # - create-nuget-package + # - ubuntu-x64-build-test + # - ubuntu-arm64-build-test + # - fedora-build-test + # - emscripten-build-test - macos-build-test - versioning-and-release-url steps: diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index b09495b61378..db8682763c09 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -36,14 +36,17 @@ jobs: runner: macos-13 # github hosted config: Release brewpath: /usr/local + codesign-options: "--skip-sign" - os: github-arm runner: macos-latest # github hosted config: Debug brewpath: /opt/homebrew + codesign-options: "--skip-sign" - os: arm runner: macos-arm-build # self-hosted config: Release brewpath: /opt/homebrew + codesign-options: "" permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout @@ -91,7 +94,8 @@ jobs: MR_CMAKE_OPTIONS: -DMESHLIB_BUILD_MRMESH_PY_LEGACY=${{ fromJSON('["ON", "OFF"]')[inputs.mrbind] }} -DMR_CXX_STANDARD=23 - name: Generate and build MRBind bindings - if: ${{inputs.mrbind}} + if: ${{ false }} + # if: ${{inputs.mrbind}} env: PATH: ${{matrix.brewpath}}/opt/make/libexec/gnubin:${{matrix.brewpath}}/opt/grep/libexec/gnubin:${{env.PATH}} # Using 4 threads on github runners, because they have only 8G of RAM. @@ -105,7 +109,8 @@ jobs: ${{ fromJSON('["-j8", "-j4"]')[matrix.os == 'github-arm'] }} - name: Run Start-and-Exit Tests - if: ${{ matrix.os == 'arm' }} + if: ${{ false }} + # if: ${{ matrix.os == 'arm' }} run: MR_LOCAL_RESOURCES=1 ./build/${{ matrix.config }}/bin/MeshViewer -hidden -noEventLoop -unloadPluginsAtEnd - name: Unit Tests @@ -139,25 +144,32 @@ jobs: run: aws s3 sync ${{inputs.autotest_data_s3_url}} ./test_data --delete --no-sign-request --size-only - name: Python Regression Tests + if: ${{ false }} env: SMOKE: ${{ env.INTERNAL_BUILD == 'true' && inputs.full_config_build == false && matrix.config == 'Debug' }} BINDS_V: ${{ fromJSON('[2,3]')[inputs.mrbind || 0] }} - if: ${{ env.INTERNAL_BUILD == 'true' }} + # if: ${{ env.INTERNAL_BUILD == 'true' }} working-directory: ./build/${{ matrix.config }}/bin run: python3 ./../../../scripts/run_python_test_script.py -d '../test_regression' -s ${{env.SMOKE}} -bv ${{env.BINDS_V}} - name: Copy test artifacts to S3 - if: ${{ env.UPLOAD_TEST_ARTIFACTS == 'true' && env.INTERNAL_BUILD == 'true' && !cancelled() }} + if: ${{ false }} + # if: ${{ env.UPLOAD_TEST_ARTIFACTS == 'true' && env.INTERNAL_BUILD == 'true' && !cancelled() }} run: aws s3 cp ./pytest_temp 's3://test-artifacts-git/tests/${{github.run_id}}/macos/${{matrix.os}}' --recursive - - name: Create Pkg - if: ${{ inputs.UPLOAD_ARTIFACTS }} + - name: Create MeshLib.framework + if: ${{ inputs.UPLOAD_ARTIFACTS && env.INTERNAL_BUILD == 'true' && matrix.config == 'Release'}} + run: | + ./scripts/distribution_apple_framework.sh + + - name: Codesign framework + if: ${{ inputs.UPLOAD_ARTIFACTS && env.INTERNAL_BUILD == 'true' && matrix.config == 'Release'}} run: | - ./scripts/distribution_apple.sh - mv MeshLib_.pkg meshlib_${{matrix.os}}.pkg + ./scripts/distribution_apple_pkg.sh ${{matrix.codesign-options}} + mv meshlib.pkg meshlib_${{matrix.os}}.pkg - name: Upload Macos Distribution - if: ${{ inputs.UPLOAD_ARTIFACTS }} + if: ${{ inputs.UPLOAD_ARTIFACTS && env.INTERNAL_BUILD == 'true'}} uses: actions/upload-artifact@v4 with: name: Distributives_macos-${{matrix.os}} diff --git a/.github/workflows/test-distribution.yml b/.github/workflows/test-distribution.yml index 0d71147b1a89..d7b07c0cdd77 100644 --- a/.github/workflows/test-distribution.yml +++ b/.github/workflows/test-distribution.yml @@ -9,6 +9,7 @@ on: jobs: linux-test: + if: ${{ false }} timeout-minutes: 30 runs-on: ${{ matrix.runner }} container: @@ -132,6 +133,7 @@ jobs: - name: Ubuntu python test if: ${{ always() && matrix.os != 'fedora:39' }} env: + OLD_MESHLIB_BINDINGS: 1 PYTHONPATH: /usr/local/lib/MeshLib/ working-directory: test_python run: python3 -m pytest -s -v @@ -139,14 +141,24 @@ jobs: - name: Fedora python test if: ${{ always() && matrix.os == 'fedora:39' }} env: + OLD_MESHLIB_BINDINGS: 1 PYTHONPATH: /usr/local/lib64/MeshLib/ working-directory: test_python run: python3 -m pytest -s -v macos-test: - runs-on: macos-13 timeout-minutes: 30 + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + os: [ x64, arm] + include: + - os: x64 + runner: macos-13 # github hosted + - os: arm + runner: macos-latest # github hosted steps: - name: Checkout uses: actions/checkout@v4 @@ -157,17 +169,17 @@ jobs: uses: robinraju/release-downloader@v1.11 with: releaseId: ${{inputs.release_id}} - fileName: "*x64.pkg" + fileName: "*${{matrix.os}}.pkg" - name: Install Pkg run: | - sudo installer -pkg meshlib_*x64.pkg -target / + sudo installer -pkg meshlib_*${{matrix.os}}.pkg -target / xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt # [error] NSGL: Failed to find a suitable pixel format - #- name: Run MeshViewer - #if: always() - #run: /Library/Frameworks/MeshLib.framework/Versions/Current/bin/MeshViewer -tryHidden -noEventLoop -unloadPluginsAtEnd + - name: Run MeshViewer + if: always() + run: /Library/Frameworks/MeshLib.framework/Versions/Current/bin/MeshViewer -tryHidden -noEventLoop -unloadPluginsAtEnd - name: Show meshconv help if: always() From 90c98321a36c71efa3403f087a76e50ba2719352 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Mon, 18 Nov 2024 01:36:01 +0300 Subject: [PATCH 04/17] enable bindings --- .github/workflows/build-test-macos.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index db8682763c09..57f992017fa8 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -94,8 +94,7 @@ jobs: MR_CMAKE_OPTIONS: -DMESHLIB_BUILD_MRMESH_PY_LEGACY=${{ fromJSON('["ON", "OFF"]')[inputs.mrbind] }} -DMR_CXX_STANDARD=23 - name: Generate and build MRBind bindings - if: ${{ false }} - # if: ${{inputs.mrbind}} + if: ${{inputs.mrbind}} env: PATH: ${{matrix.brewpath}}/opt/make/libexec/gnubin:${{matrix.brewpath}}/opt/grep/libexec/gnubin:${{env.PATH}} # Using 4 threads on github runners, because they have only 8G of RAM. @@ -109,8 +108,7 @@ jobs: ${{ fromJSON('["-j8", "-j4"]')[matrix.os == 'github-arm'] }} - name: Run Start-and-Exit Tests - if: ${{ false }} - # if: ${{ matrix.os == 'arm' }} + if: ${{ matrix.os == 'arm' }} run: MR_LOCAL_RESOURCES=1 ./build/${{ matrix.config }}/bin/MeshViewer -hidden -noEventLoop -unloadPluginsAtEnd - name: Unit Tests From 623e366b3150847831dda3f0228dd39f97cb0a7a Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Mon, 18 Nov 2024 03:02:38 +0300 Subject: [PATCH 05/17] mv thirdparty libs and include --- CMakeLists.txt | 4 ++-- meshlib-config.cmake.in | 2 +- scripts/distribution_apple_framework.sh | 23 ++++++++++++++--------- source/meshconv/CMakeLists.txt | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3552345ab6e9..8412373f59d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ ENDIF() IF(APPLE) # need to hardcode some path to fix wheel (no option to pass path) # TODO: revise - set(CMAKE_INSTALL_RPATH "@loader_path/../libs;@loader_path;@loader_path/..;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") + set(CMAKE_INSTALL_RPATH "@loader_path/../lib;@loader_path;@loader_path/../lib/thirdparty_lib;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) IF(BUILD_TESTING) @@ -150,7 +150,7 @@ ELSE() set(MR_INCLUDE_DIR "${MR_ROOT}") set(MR_MAIN_LIB_DIR "${MR_ROOT}") set(MR_INCLUDE_DIR "${MR_ROOT}/include") - set(MR_MAIN_LIB_DIR "${MR_ROOT}/libs") + set(MR_MAIN_LIB_DIR "${MR_ROOT}/lib") set(MR_PY_LIB_DIR "${MR_MAIN_LIB_DIR}/meshlib") set(MR_RESOURCES_DIR "${MR_ROOT}/Resources") set(MR_FONTS_DIR "${MR_ROOT}/Resources/fonts") diff --git a/meshlib-config.cmake.in b/meshlib-config.cmake.in index c32ec97d15e9..ef81f3c8dff2 100644 --- a/meshlib-config.cmake.in +++ b/meshlib-config.cmake.in @@ -2,7 +2,7 @@ set(MESHLIB_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@") set(MESHLIB_THIRDPARTY_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@/include;@PACKAGE_MR_INCLUDE_DIR@/include/imgui") -set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@/lib") +set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@/thirdparty_lib") get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh index 2af3622d066b..b915de1ab1a1 100755 --- a/scripts/distribution_apple_framework.sh +++ b/scripts/distribution_apple_framework.sh @@ -18,7 +18,7 @@ create_framework_dir() { mkdir -p "${MR_PREFIX}/libs/" - cp -rL ./include "${MR_PREFIX}/include" + cp -rL ./include "${MR_PREFIX}/include/thirdparty_include" cp ./macos/Info.plist ./macos/Resources cp ./LICENSE ./macos/Resources @@ -72,25 +72,29 @@ pack_dylibs() { echo "Fixing MeshLib executable @rpath" -x ${MR_PREFIX}/bin/meshconv bin_dir="${MR_PREFIX}/bin/" - lib_dir="${MR_PREFIX}/libs/" - dest_dir="${lib_dir}" + lib_dir="${MR_PREFIX}/lib/" + thirdparty_lib_dir="${MR_PREFIX}/lib/thirdparty_lib" + dest_dir="${thirdparty_lib_dir}" + install_dir="lib/thirdparty_lib" search_paths=("${dest_dir}" "./lib/" "./dist/python") + mkdir -p $thirdparty_lib_dir + for binary in "$bin_dir"*; do if [[ -x "$binary" && -f "$binary" ]]; then - bundle_dylib "$binary" "$dest_dir" "${search_paths[@]}" + bundle_dylib "$binary" "$dest_dir" "$install_dir" "${search_paths[@]}" fi done for lib in "$lib_dir"*; do if [[ -x "$lib" && -f "$lib" ]]; then - bundle_dylib "$lib" "$dest_dir" "${search_paths[@]}" + bundle_dylib "$lib" "$dest_dir" "$install_dir" "${search_paths[@]}" fi done for lib in "$lib_dir"/meshlib/*; do if [[ -x "$lib" && -f "$lib" ]]; then - bundle_dylib "$lib" "$dest_dir" "${search_paths[@]}" + bundle_dylib "$lib" "$dest_dir" "$install_dir" "${search_paths[@]}" fi done } @@ -98,11 +102,12 @@ pack_dylibs() { bundle_dylib() { local fix_file="$1" local dest_dir="$2" + local install_dir="$3" shift 2 # Shift the first two arguments to capture the rest as search paths local search_paths=("$@") # can be multiple - if [[ -z "$fix_file" ]] || [[ -z "$dest_dir" ]]; then - echo "Error: fix_file and dest_dir are required for bundle_dylib." + if [[ -z "$fix_file" ]] || [[ -z "$dest_dir" ]] || [[ -z "$install_dir" ]]; then + echo "Error: fix_file, dest_dir and install_dir are required for bundle_dylib." return 1 fi if [[ -z "$dest_dir" ]]; then @@ -124,7 +129,7 @@ bundle_dylib() { --fix-file "${fix_file}" \ --dest-dir "${dest_dir}" \ ${search_paths_args} \ - --install-path @executable_path/../libs + --install-path @executable_path/../"${install_dir}" } echo "Installing required brew pkgs" diff --git a/source/meshconv/CMakeLists.txt b/source/meshconv/CMakeLists.txt index ee51fe1aa30e..ad9a5b5617d6 100644 --- a/source/meshconv/CMakeLists.txt +++ b/source/meshconv/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ) IF(APPLE) - set(CMAKE_INSTALL_RPATH "@loader_path/../libs;@loader_path;@loader_path/..;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") + set(CMAKE_INSTALL_RPATH "@loader_path/../lib;@loader_path;@loader_path/../lib/thirdparty_lib;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_MACOSX_RPATH TRUE) # Ensure RPATH is properly set for macOS ENDIF() From 0726e9e9332d1fd098270b003017f86727783d03 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Mon, 18 Nov 2024 20:11:12 +0300 Subject: [PATCH 06/17] update search paths of dylibbundler --- scripts/distribution_apple_framework.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh index b915de1ab1a1..f6c8aa22806b 100755 --- a/scripts/distribution_apple_framework.sh +++ b/scripts/distribution_apple_framework.sh @@ -76,7 +76,7 @@ pack_dylibs() { thirdparty_lib_dir="${MR_PREFIX}/lib/thirdparty_lib" dest_dir="${thirdparty_lib_dir}" install_dir="lib/thirdparty_lib" - search_paths=("${dest_dir}" "./lib/" "./dist/python") + search_paths=("${lib_dir}" "${dest_dir}" "./lib/" "./dist/python") mkdir -p $thirdparty_lib_dir From ca351aef2a668e3921c6c9acfa9fe48084288b2c Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Tue, 19 Nov 2024 01:19:33 +0300 Subject: [PATCH 07/17] store libs in one dir --- CMakeLists.txt | 2 +- meshlib-config.cmake.in | 2 +- scripts/distribution_apple_framework.sh | 7 ++----- source/meshconv/CMakeLists.txt | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8412373f59d9..573e947287e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ ENDIF() IF(APPLE) # need to hardcode some path to fix wheel (no option to pass path) # TODO: revise - set(CMAKE_INSTALL_RPATH "@loader_path/../lib;@loader_path;@loader_path/../lib/thirdparty_lib;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") + set(CMAKE_INSTALL_RPATH "@loader_path/../lib;@loader_path;@loader_path/..;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) IF(BUILD_TESTING) diff --git a/meshlib-config.cmake.in b/meshlib-config.cmake.in index ef81f3c8dff2..b3fedec4a186 100644 --- a/meshlib-config.cmake.in +++ b/meshlib-config.cmake.in @@ -2,7 +2,7 @@ set(MESHLIB_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@") set(MESHLIB_THIRDPARTY_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@/include;@PACKAGE_MR_INCLUDE_DIR@/include/imgui") -set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@/thirdparty_lib") +set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@") get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh index f6c8aa22806b..af9f2fdc68d9 100755 --- a/scripts/distribution_apple_framework.sh +++ b/scripts/distribution_apple_framework.sh @@ -73,13 +73,10 @@ pack_dylibs() { bin_dir="${MR_PREFIX}/bin/" lib_dir="${MR_PREFIX}/lib/" - thirdparty_lib_dir="${MR_PREFIX}/lib/thirdparty_lib" - dest_dir="${thirdparty_lib_dir}" - install_dir="lib/thirdparty_lib" + dest_dir="${lib_dir}" + install_dir="lib" search_paths=("${lib_dir}" "${dest_dir}" "./lib/" "./dist/python") - mkdir -p $thirdparty_lib_dir - for binary in "$bin_dir"*; do if [[ -x "$binary" && -f "$binary" ]]; then bundle_dylib "$binary" "$dest_dir" "$install_dir" "${search_paths[@]}" diff --git a/source/meshconv/CMakeLists.txt b/source/meshconv/CMakeLists.txt index ad9a5b5617d6..5bcfb6fc8480 100644 --- a/source/meshconv/CMakeLists.txt +++ b/source/meshconv/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ) IF(APPLE) - set(CMAKE_INSTALL_RPATH "@loader_path/../lib;@loader_path;@loader_path/../lib/thirdparty_lib;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") + set(CMAKE_INSTALL_RPATH "@loader_path/../lib;@loader_path;@loader_path/..;@loader_path/meshlib;${MESHLIB_THIRDPARTY_ROOT_DIR}/lib;${CMAKE_BINARY_DIR}/bin") set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_MACOSX_RPATH TRUE) # Ensure RPATH is properly set for macOS ENDIF() From b21dcd6f71af150da1fe1ae6d45f9c77837f7a92 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Tue, 19 Nov 2024 02:32:46 +0300 Subject: [PATCH 08/17] disable mrbind --- .github/workflows/build-test-distribute.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-distribute.yml b/.github/workflows/build-test-distribute.yml index b274d919c837..814e5b8c6294 100644 --- a/.github/workflows/build-test-distribute.yml +++ b/.github/workflows/build-test-distribute.yml @@ -92,7 +92,7 @@ jobs: with: app_version: ${{needs.versioning-and-release-url.outputs.app_version}} UPLOAD_ARTIFACTS: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} - mrbind: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} + mrbind: ${{ false }} # ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} secrets: inherit update-win-version: From 4cbeb8498c2dfdb256312fa05444d85112a07789 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Tue, 19 Nov 2024 20:12:41 +0300 Subject: [PATCH 09/17] another test --- meshlib-config.cmake.in | 2 +- scripts/distribution_apple_framework.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/meshlib-config.cmake.in b/meshlib-config.cmake.in index b3fedec4a186..c0bd4a267401 100644 --- a/meshlib-config.cmake.in +++ b/meshlib-config.cmake.in @@ -1,7 +1,7 @@ @PACKAGE_INIT@ set(MESHLIB_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@") -set(MESHLIB_THIRDPARTY_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@/include;@PACKAGE_MR_INCLUDE_DIR@/include/imgui") +set(MESHLIB_THIRDPARTY_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@/thirdparty_include;@PACKAGE_MR_INCLUDE_DIR@/thirdparty_include/imgui") set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@") get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh index af9f2fdc68d9..438c66b03859 100755 --- a/scripts/distribution_apple_framework.sh +++ b/scripts/distribution_apple_framework.sh @@ -26,8 +26,8 @@ create_framework_dir() { cp ./requirements/macos.txt "${MR_PREFIX}"/requirements/ cp ./requirements/distribution_python.txt "${MR_PREFIX}"/requirements/python.txt - mkdir -p "${MR_PREFIX}"/share/ - cp -r "$(brew --prefix)"/share/glib-2.0 "${MR_PREFIX}"/share + # mkdir -p "${MR_PREFIX}"/share/ + # cp -r "$(brew --prefix)"/share/glib-2.0 "${MR_PREFIX}"/share cd ./Library/Frameworks/MeshLib.framework/Versions/ ln -s "${MR_VERSION}" ./Current From 9102958257aaacbf165e8ebc244c86db0dc6be18 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Wed, 20 Nov 2024 00:03:26 +0300 Subject: [PATCH 10/17] use loader_path instead of executable_path --- scripts/distribution_apple_framework.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh index 438c66b03859..46fec2794dfc 100755 --- a/scripts/distribution_apple_framework.sh +++ b/scripts/distribution_apple_framework.sh @@ -126,7 +126,7 @@ bundle_dylib() { --fix-file "${fix_file}" \ --dest-dir "${dest_dir}" \ ${search_paths_args} \ - --install-path @executable_path/../"${install_dir}" + --install-path @loader_path/../"${install_dir}" } echo "Installing required brew pkgs" From 8c006ecd3a9deec57db6114d508bac5f6e34690f Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Wed, 20 Nov 2024 00:43:39 +0300 Subject: [PATCH 11/17] skip requirements installation --- .github/workflows/test-distribution.yml | 2 +- scripts/distribution_apple_framework.sh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-distribution.yml b/.github/workflows/test-distribution.yml index d7b07c0cdd77..70e85d291b07 100644 --- a/.github/workflows/test-distribution.yml +++ b/.github/workflows/test-distribution.yml @@ -174,7 +174,7 @@ jobs: - name: Install Pkg run: | sudo installer -pkg meshlib_*${{matrix.os}}.pkg -target / - xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt + # xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt # [error] NSGL: Failed to find a suitable pixel format - name: Run MeshViewer diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh index 46fec2794dfc..41737345b05c 100755 --- a/scripts/distribution_apple_framework.sh +++ b/scripts/distribution_apple_framework.sh @@ -16,8 +16,6 @@ create_framework_dir() { echo "version: ${MR_VERSION}" echo "prefix: ${MR_PREFIX}" - mkdir -p "${MR_PREFIX}/libs/" - cp -rL ./include "${MR_PREFIX}/include/thirdparty_include" cp ./macos/Info.plist ./macos/Resources cp ./LICENSE ./macos/Resources From 149e7a161cfb655fdef211683e496f912b5d7f38 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Wed, 20 Nov 2024 01:19:10 +0300 Subject: [PATCH 12/17] revert debug --- .github/workflows/build-test-distribute.yml | 25 ++++++++------------- .github/workflows/build-test-macos.yml | 6 ++--- .github/workflows/test-distribution.yml | 23 ++++++++++--------- 3 files changed, 23 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-test-distribute.yml b/.github/workflows/build-test-distribute.yml index 814e5b8c6294..3b559b30d112 100644 --- a/.github/workflows/build-test-distribute.yml +++ b/.github/workflows/build-test-distribute.yml @@ -34,7 +34,6 @@ jobs: BUILD_MACHINE_TOKEN: ${{ secrets.BUILD_MACHINE_TOKEN }} windows-build-test: - if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-windows.yml with: @@ -44,7 +43,6 @@ jobs: secrets: inherit ubuntu-arm64-build-test: - if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-ubuntu-arm64.yml with: @@ -56,7 +54,6 @@ jobs: secrets: inherit ubuntu-x64-build-test: - if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-ubuntu-x64.yml with: @@ -68,7 +65,6 @@ jobs: secrets: inherit fedora-build-test: - if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-fedora.yml with: @@ -79,7 +75,6 @@ jobs: secrets: inherit emscripten-build-test: - if: ${{ false }} needs: [ prepare-image, versioning-and-release-url ] uses: ./.github/workflows/build-test-emscripten.yml with: @@ -92,12 +87,11 @@ jobs: with: app_version: ${{needs.versioning-and-release-url.outputs.app_version}} UPLOAD_ARTIFACTS: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} - mrbind: ${{ false }} # ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} + mrbind: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} secrets: inherit update-win-version: - if: ${{ false }} - # if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} needs: - windows-build-test - versioning-and-release-url @@ -167,8 +161,7 @@ jobs: retention-days: 1 create-nuget-package: - if: ${{ false }} - # if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} needs: - windows-build-test - versioning-and-release-url @@ -201,12 +194,12 @@ jobs: timeout-minutes: 10 runs-on: ubuntu-latest needs: - # - update-win-version - # - create-nuget-package - # - ubuntu-x64-build-test - # - ubuntu-arm64-build-test - # - fedora-build-test - # - emscripten-build-test + - update-win-version + - create-nuget-package + - ubuntu-x64-build-test + - ubuntu-arm64-build-test + - fedora-build-test + - emscripten-build-test - macos-build-test - versioning-and-release-url steps: diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 57f992017fa8..395a16b8035a 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -142,17 +142,15 @@ jobs: run: aws s3 sync ${{inputs.autotest_data_s3_url}} ./test_data --delete --no-sign-request --size-only - name: Python Regression Tests - if: ${{ false }} env: SMOKE: ${{ env.INTERNAL_BUILD == 'true' && inputs.full_config_build == false && matrix.config == 'Debug' }} BINDS_V: ${{ fromJSON('[2,3]')[inputs.mrbind || 0] }} - # if: ${{ env.INTERNAL_BUILD == 'true' }} + if: ${{ env.INTERNAL_BUILD == 'true' }} working-directory: ./build/${{ matrix.config }}/bin run: python3 ./../../../scripts/run_python_test_script.py -d '../test_regression' -s ${{env.SMOKE}} -bv ${{env.BINDS_V}} - name: Copy test artifacts to S3 - if: ${{ false }} - # if: ${{ env.UPLOAD_TEST_ARTIFACTS == 'true' && env.INTERNAL_BUILD == 'true' && !cancelled() }} + if: ${{ env.UPLOAD_TEST_ARTIFACTS == 'true' && env.INTERNAL_BUILD == 'true' && !cancelled() }} run: aws s3 cp ./pytest_temp 's3://test-artifacts-git/tests/${{github.run_id}}/macos/${{matrix.os}}' --recursive - name: Create MeshLib.framework diff --git a/.github/workflows/test-distribution.yml b/.github/workflows/test-distribution.yml index 70e85d291b07..49df2c5bd51e 100644 --- a/.github/workflows/test-distribution.yml +++ b/.github/workflows/test-distribution.yml @@ -9,7 +9,6 @@ on: jobs: linux-test: - if: ${{ false }} timeout-minutes: 30 runs-on: ${{ matrix.runner }} container: @@ -133,7 +132,6 @@ jobs: - name: Ubuntu python test if: ${{ always() && matrix.os != 'fedora:39' }} env: - OLD_MESHLIB_BINDINGS: 1 PYTHONPATH: /usr/local/lib/MeshLib/ working-directory: test_python run: python3 -m pytest -s -v @@ -141,7 +139,6 @@ jobs: - name: Fedora python test if: ${{ always() && matrix.os == 'fedora:39' }} env: - OLD_MESHLIB_BINDINGS: 1 PYTHONPATH: /usr/local/lib64/MeshLib/ working-directory: test_python run: python3 -m pytest -s -v @@ -174,7 +171,7 @@ jobs: - name: Install Pkg run: | sudo installer -pkg meshlib_*${{matrix.os}}.pkg -target / - # xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt + xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt # [error] NSGL: Failed to find a suitable pixel format - name: Run MeshViewer @@ -185,6 +182,17 @@ jobs: if: always() run: /Library/Frameworks/MeshLib.framework/Versions/Current/bin/meshconv --help + - name: Build C examples + if: always() + working-directory: examples/c-examples + run: | + cmake -S . -B build -DCMAKE_C_COMPILER=/usr/bin/clang && \ + cmake --build build + + - name: Install MeshLib requirements + run: | + xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt + - name: Build C++ examples if: always() working-directory: examples/cpp-examples @@ -194,10 +202,3 @@ jobs: cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/clang++ && \ cmake --build . && \ ./MeshModification - - - name: Build C examples - if: always() - working-directory: examples/c-examples - run: | - cmake -S . -B build -DCMAKE_C_COMPILER=/usr/bin/clang && \ - cmake --build build From 79779ffd8a8bdc21d0515cde0866c41e60924f3e Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Wed, 20 Nov 2024 02:44:32 +0300 Subject: [PATCH 13/17] increase macos build timeout --- .github/workflows/build-test-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 395a16b8035a..11871b20d16e 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -20,7 +20,7 @@ on: jobs: macos-build-test: - timeout-minutes: 70 + timeout-minutes: 90 runs-on: ${{ matrix.runner }} strategy: fail-fast: false From 794aee1753c162afb844150b0c73b183f1c6045a Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Wed, 20 Nov 2024 20:14:09 +0300 Subject: [PATCH 14/17] minimize diff --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3940a19b95e5..68bcc5b69176 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,8 +153,6 @@ ELSE() # TODO: https://cmake.org/cmake/help/latest/prop_tgt/RESOURCE.html set(MR_ROOT "./Library/Frameworks/MeshLib.framework/Versions/${MESHLIB_VERSION}") set(MR_BIN_DIR "${MR_ROOT}/bin") - set(MR_INCLUDE_DIR "${MR_ROOT}") - set(MR_MAIN_LIB_DIR "${MR_ROOT}") set(MR_INCLUDE_DIR "${MR_ROOT}/include") set(MR_MAIN_LIB_DIR "${MR_ROOT}/lib") set(MR_PY_LIB_DIR "${MR_MAIN_LIB_DIR}/meshlib") From 996398201d6f8ab3b9f4569926267ead34005566 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Fri, 22 Nov 2024 22:00:02 +0300 Subject: [PATCH 15/17] fix distribution paths --- meshlib-config.cmake.in | 6 ++++-- scripts/distribution_apple_framework.sh | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/meshlib-config.cmake.in b/meshlib-config.cmake.in index 4665f6f29a9e..b245545dea74 100644 --- a/meshlib-config.cmake.in +++ b/meshlib-config.cmake.in @@ -1,8 +1,8 @@ @PACKAGE_INIT@ set(MESHLIB_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@") -set(MESHLIB_THIRDPARTY_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@/thirdparty_include;@PACKAGE_MR_INCLUDE_DIR@/thirdparty_include/imgui") -set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@") +set(MESHLIB_THIRDPARTY_INCLUDE_DIR "@PACKAGE_MR_INCLUDE_DIR@/include;@PACKAGE_MR_INCLUDE_DIR@/include/imgui") +set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@/lib") get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) @@ -35,5 +35,7 @@ if(MESHLIB_BUILD_EXTRA_IO_FORMATS) endif(MESHLIB_BUILD_EXTRA_IO_FORMATS) if(APPLE) + set(MESHLIB_THIRDPARTY_LIB_DIR "@PACKAGE_MR_MAIN_LIB_DIR@") + message("You can install required packages via brew: ' xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt '") endif(APPLE) diff --git a/scripts/distribution_apple_framework.sh b/scripts/distribution_apple_framework.sh index 41737345b05c..ba2bd77c853b 100755 --- a/scripts/distribution_apple_framework.sh +++ b/scripts/distribution_apple_framework.sh @@ -16,7 +16,7 @@ create_framework_dir() { echo "version: ${MR_VERSION}" echo "prefix: ${MR_PREFIX}" - cp -rL ./include "${MR_PREFIX}/include/thirdparty_include" + cp -rL ./include "${MR_PREFIX}/include/include" cp ./macos/Info.plist ./macos/Resources cp ./LICENSE ./macos/Resources From a5c673705b196eb455ea55937e06d63c183cef97 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Fri, 22 Nov 2024 23:36:09 +0300 Subject: [PATCH 16/17] skip brew install errors --- .github/workflows/test-distribution.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-distribution.yml b/.github/workflows/test-distribution.yml index 49df2c5bd51e..a463b0509f5d 100644 --- a/.github/workflows/test-distribution.yml +++ b/.github/workflows/test-distribution.yml @@ -191,7 +191,7 @@ jobs: - name: Install MeshLib requirements run: | - xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt + xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt || true - name: Build C++ examples if: always() From 540114b0bdd9ba8d0e8d008cb5d53c52106b9a30 Mon Sep 17 00:00:00 2001 From: Max Raiskii Date: Sat, 23 Nov 2024 00:55:04 +0300 Subject: [PATCH 17/17] skip brew install errors --- .github/workflows/test-distribution.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-distribution.yml b/.github/workflows/test-distribution.yml index a463b0509f5d..2135397e1eca 100644 --- a/.github/workflows/test-distribution.yml +++ b/.github/workflows/test-distribution.yml @@ -169,9 +169,7 @@ jobs: fileName: "*${{matrix.os}}.pkg" - name: Install Pkg - run: | - sudo installer -pkg meshlib_*${{matrix.os}}.pkg -target / - xargs brew install < /Library/Frameworks/MeshLib.framework/Versions/Current/requirements/macos.txt + run: sudo installer -pkg meshlib_*${{matrix.os}}.pkg -target / # [error] NSGL: Failed to find a suitable pixel format - name: Run MeshViewer