diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index b09495b61378..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 @@ -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 @@ -150,14 +153,19 @@ jobs: 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.sh - mv MeshLib_.pkg meshlib_${{matrix.os}}.pkg + ./scripts/distribution_apple_framework.sh + + - name: Codesign framework + if: ${{ inputs.UPLOAD_ARTIFACTS && env.INTERNAL_BUILD == 'true' && matrix.config == 'Release'}} + run: | + ./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..2135397e1eca 100644 --- a/.github/workflows/test-distribution.yml +++ b/.github/workflows/test-distribution.yml @@ -145,8 +145,17 @@ jobs: 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,22 +166,31 @@ 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 / - 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 - #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() 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 || true + - name: Build C++ examples if: always() working-directory: examples/cpp-examples @@ -182,10 +200,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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 27d2320f19ef..68bcc5b69176 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,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/../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/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/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/meshlib-config.cmake.in b/meshlib-config.cmake.in index c785267157d9..b245545dea74 100644 --- a/meshlib-config.cmake.in +++ b/meshlib-config.cmake.in @@ -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.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..ba2bd77c853b --- /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}" + + cp -rL ./include "${MR_PREFIX}/include/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}/lib/" + dest_dir="${lib_dir}" + install_dir="lib" + search_paths=("${lib_dir}" "${dest_dir}" "./lib/" "./dist/python") + + for binary in "$bin_dir"*; do + if [[ -x "$binary" && -f "$binary" ]]; then + 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" "$install_dir" "${search_paths[@]}" + fi + done + + for lib in "$lib_dir"/meshlib/*; do + if [[ -x "$lib" && -f "$lib" ]]; then + bundle_dylib "$lib" "$dest_dir" "$install_dir" "${search_paths[@]}" + fi + done +} + +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" ]] || [[ -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 + 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 @loader_path/../"${install_dir}" +} + +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 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..5bcfb6fc8480 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/../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() + + 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)