Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MACOS release executable #79

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
57 changes: 57 additions & 0 deletions .github/workflows/test-macos-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: test-macos-release

on: pull_request

env:
BUILD_TYPE: Release
jobs:

build_mac:

runs-on: macos-12
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.20.3'

- name: Clean superbuild folder
run: python3 superbuild/clean/clean.py

- name: Open superbuild folder
run: cd superbuild

- name: Configure CMake
run: |
cd superbuild
cmake -S . -B . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: |
cd superbuild
make
- name: Set path to dynamic libs
run: |
cd superbuild/install_Darwin/bin
install_name_tool -change @rpath/libGLEW.2.2.dylib @executable_path/libGLEW.2.2.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_highgui.405.dylib @executable_path/libopencv_highgui.405.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_ml.405.dylib @executable_path/libopencv_ml.405.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_photo.405.dylib @executable_path/libopencv_photo.405.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_video.405.dylib @executable_path/libopencv_video.405.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_videoio.405.dylib @executable_path/libopencv_videoio.405.dylib VR-Volumeviewer
install_name_tool -change libz.1.dylib @executable_path/libz.1.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_imgcodecs.405.dylib @executable_path/libopencv_imgcodecs.405.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_imgproc.405.dylib @executable_path/libopencv_imgproc.405.dylib VR-Volumeviewer
install_name_tool -change @rpath/libopencv_core.405.dylib @executable_path/libopencv_core.405.dylib VR-Volumeviewer

- name: Zip bin folder
run: |
cd superbuild/install_Darwin
mv bin vr-volumeviewer
tar -a -c -f vr-volumeviewer-macos.zip ./vr-volumeviewer
- name: Upload app to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/superbuild/install_Darwin/vr-volumeviewer-macos.zip
tag: ${{ github.ref }}
34 changes: 30 additions & 4 deletions superbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,43 @@ set_target_properties(${OpenCV_LIBS} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBIN
if(OpenCV_FOUND)
message(STATUS "OpenCV found ${_OpenCV_LIB_PATH}")
message(STATUS "OpenCV found ${OpenCV_INSTALL_PATH}")
set(DEBUG_SUFFIX ${CMAKE_DEBUG_SUFFIX})
if(MSVC)
message(STATUS "OpenCV for Windows Visual studio")
set(OPENCV_PATH ${_OpenCV_LIB_PATH} )
set(OPENCV_SUFIX "455" )
set(DEBUG_SUFFIX ${CMAKE_DEBUG_SUFFIX})
set(OPENCV_PATH ${_OpenCV_LIB_PATH} )
file(COPY "${OPENCV_PATH}/${OPENCV_PREFIX}opencv_videoio${OPENCV_SUFIX}${DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_DIR_ABSOLUTE}/bin" )
file(COPY "${OPENCV_PATH}/${OPENCV_PREFIX}opencv_imgcodecs${OPENCV_SUFIX}${DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_DIR_ABSOLUTE}/bin" )
file(COPY "${OPENCV_PATH}/${OPENCV_PREFIX}opencv_imgproc${OPENCV_SUFIX}${DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_DIR_ABSOLUTE}/bin" )
file(COPY "${OPENCV_PATH}/${OPENCV_PREFIX}opencv_core${OPENCV_SUFIX}${DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_DIR_ABSOLUTE}/bin" )
endif()
file(COPY "${OPENCV_PATH}/${OPENCV_PREFIX}opencv_photo${OPENCV_SUFIX}${DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_DIR_ABSOLUTE}/bin" )
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS "OpenCV for MacOS Clang++")
set(OPENCV_PATH ${OpenCV_INSTALL_PATH}/lib)
message(STATUS "OPENCV_PATH ${OPENCV_PATH}")
file(GLOB OPENCV_CORE_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_core*.dylib")
file(GLOB OPENCV_HIGHGUI_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_highgui*.dylib")
file(GLOB OPENCV_IMGCODECS_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_imgcodecs*.dylib")
file(GLOB OPENCV_IMGPROC_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_imgproc*.dylib")
file(GLOB OPENCV_ML_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_ml*.dylib")
file(GLOB OPENCV_VIDEOIO_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_videoio*.dylib")
file(GLOB OPENCV_VIDEO_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_video*.dylib")
file(GLOB OPENCV_PHOTO_DYNAMIC_LIBS "${OPENCV_PATH}/libopencv_photo*.dylib")
file(GLOB LIBZ_DYNAMIC_LIBS "${OPENCV_PATH}/libz*")
file(GLOB GLEW_DYNAMIC_LIBS "${OPENCV_PATH}/libGLEW*.dylib")
message(STATUS "OPENCV_DYNAMIC_LIBS ${OPENCV_DYNAMIC_LIBS}")
file(COPY ${OPENCV_CORE_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${OPENCV_HIGHGUI_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${OPENCV_IMGCODECS_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${OPENCV_IMGPROC_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${OPENCV_ML_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${OPENCV_VIDEOIO_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${OPENCV_VIDEO_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${OPENCV_PHOTO_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${LIBZ_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY ${GLEW_DYNAMIC_LIBS} DESTINATION ${INSTALL_DIR_ABSOLUTE}/bin )
file(COPY "${OPENCV_PATH}/MinVR-2.0" DESTINATION "${INSTALL_DIR_ABSOLUTE}/bin")
endif()
else()
message(FATAL_ERROR "OpenCV NOT found ${_OpenCV_LIB_PATH}")
endif()
Expand Down Expand Up @@ -548,7 +575,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/install_${CMAKE_SYSTEM_NA
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/install_${CMAKE_SYSTEM_NAME}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/install_${CMAKE_SYSTEM_NAME}/bin)


add_executable(${PROJECT_NAME} ${source_files} ${header_files})

message(STATUS "CMAKE_DL_LIBS ${CMAKE_DL_LIBS}")
Expand Down