Unverified Commit 71514b36 authored by Wieland Morgenstern's avatar Wieland Morgenstern Committed by GitHub

Merge pull request #69 from stitchEm/w-m/mac-package

Fixes for Mac Package
parents 4fee6ee7 54a2359a
...@@ -34,6 +34,17 @@ option(GPU_BACKEND_OPENCL "Build with OpenCL backend" OFF) ...@@ -34,6 +34,17 @@ option(GPU_BACKEND_OPENCL "Build with OpenCL backend" OFF)
message(STATUS "GPU_BACKEND_CUDA='${GPU_BACKEND_CUDA}'") message(STATUS "GPU_BACKEND_CUDA='${GPU_BACKEND_CUDA}'")
message(STATUS "GPU_BACKEND_OPENCL='${GPU_BACKEND_OPENCL}'") message(STATUS "GPU_BACKEND_OPENCL='${GPU_BACKEND_OPENCL}'")
# Windows: actually delays loading to runtime
# Mac: create symlink to either libvideostitch_cuda/libvideostitch_opencl,
# change symlink at runtime and restart if necessary
# Linux: not implemented
option(USE_DELAY_LOAD "Delay loading of GPU backend to runtime" OFF)
if(${GPU_BACKEND_CUDA} AND ${GPU_BACKEND_OPENCL})
set(USE_DELAY_LOAD "ON" CACHE BOOL "Defaulting to USE_DELAY_LOAD=ON as both GPU backends are built" FORCE)
endif()
message(STATUS "USE_DELAY_LOAD=${USE_DELAY_LOAD}")
set(GPU_BACKEND_DEFAULT "CUDA" CACHE STRING "Default GPU backend") set(GPU_BACKEND_DEFAULT "CUDA" CACHE STRING "Default GPU backend")
set_property(CACHE GPU_BACKEND_DEFAULT PROPERTY STRINGS OPENCL CUDA) set_property(CACHE GPU_BACKEND_DEFAULT PROPERTY STRINGS OPENCL CUDA)
...@@ -397,13 +408,7 @@ endif(GPU_BACKEND_CUDA) ...@@ -397,13 +408,7 @@ endif(GPU_BACKEND_CUDA)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Delay load on Windows # Delay load on Windows
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
set(USE_DELAY_LOAD "OFF") if(USE_DELAY_LOAD AND MSVC)
if(GPU_BACKEND_CUDA AND GPU_BACKEND_OPENCL AND MSVC)
set(USE_DELAY_LOAD "ON")
endif()
message(STATUS "USE_DELAY_LOAD = ${USE_DELAY_LOAD}")
if(USE_DELAY_LOAD)
find_library(DELAY_LOAD_LIB NAMES "DelayImp.lib") find_library(DELAY_LOAD_LIB NAMES "DelayImp.lib")
endif() endif()
...@@ -419,7 +424,7 @@ if(CMAKE_BUILD_TYPE) ...@@ -419,7 +424,7 @@ if(CMAKE_BUILD_TYPE)
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-P ${CMAKE_SOURCE_DIR}/lib/generateFakeLibvideostitch.cmake -P ${CMAKE_SOURCE_DIR}/lib/generateFakeLibvideostitch.cmake
DEPENDS ${VS_LIB_DEFAULT}) DEPENDS ${VS_LIB_DEFAULT})
if(USE_DELAY_LOAD) if(USE_DELAY_LOAD AND MSVC)
add_dependencies(generateFakeLibvideostitch ${VS_LIB_FAKE}) add_dependencies(generateFakeLibvideostitch ${VS_LIB_FAKE})
endif() endif()
else() else()
...@@ -431,7 +436,7 @@ else() ...@@ -431,7 +436,7 @@ else()
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UP}} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UP}}
-P ${CMAKE_SOURCE_DIR}/lib/generateFakeLibvideostitch.cmake -P ${CMAKE_SOURCE_DIR}/lib/generateFakeLibvideostitch.cmake
DEPENDS ${VS_LIB_DEFAULT}) DEPENDS ${VS_LIB_DEFAULT})
if(USE_DELAY_LOAD) if(USE_DELAY_LOAD AND MSVC)
add_dependencies(generateFakeLibvideostitch_${OUTPUTCONFIG_UP} ${VS_LIB_FAKE}) add_dependencies(generateFakeLibvideostitch_${OUTPUTCONFIG_UP} ${VS_LIB_FAKE})
endif() endif()
endforeach() endforeach()
...@@ -439,6 +444,7 @@ endif() ...@@ -439,6 +444,7 @@ endif()
# This function should be use by every dll/exe that links on libvideostitch # This function should be use by every dll/exe that links on libvideostitch
function(link_target_to_libvideostitch TARGET_NAME) function(link_target_to_libvideostitch TARGET_NAME)
if(WINDOWS) if(WINDOWS)
if(CMAKE_BUILD_TYPE) if(CMAKE_BUILD_TYPE)
add_dependencies(${TARGET_NAME} generateFakeLibvideostitch) add_dependencies(${TARGET_NAME} generateFakeLibvideostitch)
...@@ -448,7 +454,7 @@ function(link_target_to_libvideostitch TARGET_NAME) ...@@ -448,7 +454,7 @@ function(link_target_to_libvideostitch TARGET_NAME)
add_dependencies(${TARGET_NAME} generateFakeLibvideostitch_${OUTPUTCONFIG_UP}) add_dependencies(${TARGET_NAME} generateFakeLibvideostitch_${OUTPUTCONFIG_UP})
endforeach() endforeach()
endif(CMAKE_BUILD_TYPE) endif(CMAKE_BUILD_TYPE)
endif(WINDOWS)
if(USE_DELAY_LOAD) if(USE_DELAY_LOAD)
target_link_libraries(${TARGET_NAME} PRIVATE ${DELAY_LOAD_LIB}) target_link_libraries(${TARGET_NAME} PRIVATE ${DELAY_LOAD_LIB})
target_link_libraries(${TARGET_NAME} PRIVATE ${VS_LIB_FAKE}) target_link_libraries(${TARGET_NAME} PRIVATE ${VS_LIB_FAKE})
...@@ -459,8 +465,15 @@ function(link_target_to_libvideostitch TARGET_NAME) ...@@ -459,8 +465,15 @@ function(link_target_to_libvideostitch TARGET_NAME)
set(new_link_flags "${existing_link_flags} ${new_link_flags}") set(new_link_flags "${existing_link_flags} ${new_link_flags}")
endif() endif()
set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS ${new_link_flags}) set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS ${new_link_flags})
endif()
elseif(APPLE) elseif(APPLE)
if (USE_DELAY_LOAD)
target_link_libraries(${TARGET_NAME} PRIVATE ${VS_LIB_FAKE}) target_link_libraries(${TARGET_NAME} PRIVATE ${VS_LIB_FAKE})
else()
target_link_libraries(${TARGET_NAME} PRIVATE ${VS_LIB_DEFAULT})
endif()
# ensure the non-fake backend libs are built # ensure the non-fake backend libs are built
if(GPU_BACKEND_CUDA) if(GPU_BACKEND_CUDA)
add_dependencies(${TARGET_NAME} ${VS_LIB_CUDA}) add_dependencies(${TARGET_NAME} ${VS_LIB_CUDA})
...@@ -470,10 +483,9 @@ function(link_target_to_libvideostitch TARGET_NAME) ...@@ -470,10 +483,9 @@ function(link_target_to_libvideostitch TARGET_NAME)
endif() endif()
else() else()
target_link_libraries(${TARGET_NAME} PUBLIC ${VS_LIB_DEFAULT}) target_link_libraries(${TARGET_NAME} PUBLIC ${VS_LIB_DEFAULT})
endif(USE_DELAY_LOAD) endif()
endfunction() endfunction()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Android specific after android.toolchain.cmake # Android specific after android.toolchain.cmake
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
...@@ -77,10 +77,14 @@ function(setup_av_plugin PLUGIN_NAME BACKEND_NAME USE_CUDA) ...@@ -77,10 +77,14 @@ function(setup_av_plugin PLUGIN_NAME BACKEND_NAME USE_CUDA)
target_link_libraries(${PLUGIN_NAME} PRIVATE ${libmfxhw64} ${DirectX_LIB}) target_link_libraries(${PLUGIN_NAME} PRIVATE ${libmfxhw64} ${DirectX_LIB})
set_property(TARGET ${PLUGIN_NAME} APPEND_STRING PROPERTY LINK_FLAGS "/NODEFAULTLIB:libcmt /NODEFAULTLIB:libcmtd") set_property(TARGET ${PLUGIN_NAME} APPEND_STRING PROPERTY LINK_FLAGS "/NODEFAULTLIB:libcmt /NODEFAULTLIB:libcmtd")
elseif(APPLE) elseif(APPLE)
if (USE_DELAY_LOAD)
target_link_libraries(${PLUGIN_NAME} PRIVATE ${VS_LIB_FAKE}) target_link_libraries(${PLUGIN_NAME} PRIVATE ${VS_LIB_FAKE})
else() else()
target_link_libraries(${PLUGIN_NAME} PRIVATE ${VS_LIB_DEFAULT}) target_link_libraries(${PLUGIN_NAME} PRIVATE ${VS_LIB_DEFAULT})
endif() endif()
else()
target_link_libraries(${PLUGIN_NAME} PRIVATE ${VS_LIB_DEFAULT})
endif()
# Unit tests # Unit tests
if(NOT WINDOWS) if(NOT WINDOWS)
......
...@@ -207,8 +207,8 @@ function make_dmg { ...@@ -207,8 +207,8 @@ function make_dmg {
# give all users read and execute access to the .app, recursively # give all users read and execute access to the .app, recursively
chmod -R og+rx "${PACKAGE}" chmod -R og+rx "${PACKAGE}"
codesign --deep --force --verify --verbose=4 --sign "VIDEOSTITCH" "${PACKAGE}" # codesign --deep --force --verify --verbose=4 --sign "VIDEOSTITCH" "${PACKAGE}"
codesign --deep --verify --verbose=4 "${PACKAGE}" # codesign --deep --verify --verbose=4 "${PACKAGE}"
TMP="dmg/videostitch_tmp.dmg" TMP="dmg/videostitch_tmp.dmg"
hdiutil create "${TMP}" -volname "${TARGET}" -srcfolder "${PACKAGE}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -ov hdiutil create "${TMP}" -volname "${TARGET}" -srcfolder "${PACKAGE}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -ov
...@@ -232,9 +232,6 @@ function make_dmg { ...@@ -232,9 +232,6 @@ function make_dmg {
mkdir "${DMG_MOUNT}/.background" mkdir "${DMG_MOUNT}/.background"
cp "dmg/logo_background.png" "${DMG_MOUNT}/.background/" cp "dmg/logo_background.png" "${DMG_MOUNT}/.background/"
#copy the link to the nVidia website
cp "dmg/List of supported graphics cards.webloc" "${DMG_MOUNT}/List of supported graphics cards.webloc"
#create an alias to Applications #create an alias to Applications
ln -sf /Applications "${DMG_MOUNT}/Applications" ln -sf /Applications "${DMG_MOUNT}/Applications"
...@@ -265,7 +262,6 @@ function make_dmg { ...@@ -265,7 +262,6 @@ function make_dmg {
set background picture of theViewOptions to file ".background:'logo_background.png'" set background picture of theViewOptions to file ".background:'logo_background.png'"
set position of item "'${APPLICATION_BUNDLE}.app'" of container window to {120, 125} set position of item "'${APPLICATION_BUNDLE}.app'" of container window to {120, 125}
set position of item "'Applications'" of container window to {385, 125} set position of item "'Applications'" of container window to {385, 125}
set position of item "'List of supported graphics cards.webloc'" of container window to {260, 300}
close close
open open
update without registering applications update without registering applications
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<key>CFBundleName</key> <key>CFBundleName</key>
<string>VideoStitch Studio</string> <string>VideoStitch Studio</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>videostitch-studio.icns</string> <string>videostitch.icns</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
...@@ -94,6 +94,6 @@ ...@@ -94,6 +94,6 @@
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.video-stitch.Studio</string> <string>com.video-stitch.Studio</string>
<key>NOTE</key> <key>NOTE</key>
<string>https://github.com/stitchEm</string> <string>https://github.com/stitchEm/stitchEm</string>
</dict> </dict>
</plist> </plist>
...@@ -172,9 +172,9 @@ bool getAppsInfoComponents(const QString& infoString, QString& appName, AppsVers ...@@ -172,9 +172,9 @@ bool getAppsInfoComponents(const QString& infoString, QString& appName, AppsVers
// Release versions won't have commits count and commit hash // Release versions won't have commits count and commit hash
QRegularExpression versionInfoExpression( QRegularExpression versionInfoExpression(
"(VahanaVR|Studio)-[0-9.a-zA-Z]+-?\\d*-[a-zA-Z0-9]*-[a-zA-Z0-9-]+\\.\\d{4}-\\d{2}-\\d{2}"); R"((VahanaVR|Studio)-[0-9.a-zA-Z]+-?\d*-[a-zA-Z0-9]*-[a-zA-Z0-9-\/]+\.\d{4}-\d{2}-\d{2})");
if (!versionInfoExpression.match(infoString).hasMatch()) { if (!versionInfoExpression.match(infoString).hasMatch()) {
LogManager::getInstance()->writeToLogFile("Error: the current version doesn't respect the version template"); LogManager::getInstance()->writeToLogFile("Error: the current version doesn't respect the version template (regex)");
return false; return false;
} }
...@@ -198,7 +198,7 @@ bool getAppsInfoComponents(const QString& infoString, QString& appName, AppsVers ...@@ -198,7 +198,7 @@ bool getAppsInfoComponents(const QString& infoString, QString& appName, AppsVers
if (isDevVersion) { if (isDevVersion) {
components = branchName.split("-"); components = branchName.split("-");
if (components.size() < 3) { if (components.size() < 3) {
LogManager::getInstance()->writeToLogFile("Error: the current version doesn't respect the version template"); LogManager::getInstance()->writeToLogFile("Error: the current version doesn't respect the version template (dev version branch name)");
return false; return false;
} }
commitCount = components.takeFirst().toInt(); commitCount = components.takeFirst().toInt();
......
...@@ -171,7 +171,7 @@ if(BUILD_MACOSX_BUNDLE AND APPLE) ...@@ -171,7 +171,7 @@ if(BUILD_MACOSX_BUNDLE AND APPLE)
set(VS_STUDIO_BUNDLE "VideoStitch-Studio") set(VS_STUDIO_BUNDLE "VideoStitch-Studio")
set(BIN_NAME "${VS_STUDIO_BUNDLE}") set(BIN_NAME "${VS_STUDIO_BUNDLE}")
add_executable(${VS_STUDIO_BUNDLE} MACOSX_BUNDLE ${STUDIO_SOURCES} ${STUDIO_HEADERS} ${UI_GENERATED_HEADERS} ${RESOURCES}) add_executable(${VS_STUDIO_BUNDLE} MACOSX_BUNDLE ${STUDIO_SOURCES} ${STUDIO_HEADERS} ${UI_GENERATED_HEADERS} ${RESOURCES} ${Studio_ICON})
set_target_properties(${VS_STUDIO_BUNDLE} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/dmg/videostitch-studio.plist ) set_target_properties(${VS_STUDIO_BUNDLE} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/dmg/videostitch-studio.plist )
add_dependencies(${VS_STUDIO_BUNDLE} batchstitcher) add_dependencies(${VS_STUDIO_BUNDLE} batchstitcher)
......
...@@ -106,9 +106,16 @@ set (DISCOVERY_SRC_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/src/include) ...@@ -106,9 +106,16 @@ set (DISCOVERY_SRC_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/src/include)
include_discovery_vs_headers(${VS_DISCOVERY}) include_discovery_vs_headers(${VS_DISCOVERY})
if(USE_DELAY_LOAD) if(USE_DELAY_LOAD)
if(MSVC)
target_compile_definitions(${VS_DISCOVERY} PRIVATE DELAY_LOAD_ENABLED=1) target_compile_definitions(${VS_DISCOVERY} PRIVATE DELAY_LOAD_ENABLED=1)
elseif(APPLE)
target_compile_definitions(${VS_DISCOVERY} PRIVATE SYMLINK_UPDATE_ENABLED=1)
endif()
endif() endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Unit tests # Unit tests
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
...@@ -95,7 +95,7 @@ bool readVsSymLink(std::string& targetLib) { ...@@ -95,7 +95,7 @@ bool readVsSymLink(std::string& targetLib) {
} }
bool BackendLibLoader::updateVsSymlink() { bool BackendLibLoader::updateVsSymlink() {
#ifdef DELAY_LOAD_ENABLED #ifdef SYMLINK_UPDATE_ENABLED
std::string pathToLibs; std::string pathToLibs;
if (!getPathToLibs(pathToLibs)) { if (!getPathToLibs(pathToLibs)) {
return false; return false;
...@@ -119,7 +119,7 @@ bool BackendLibLoader::updateVsSymlink() { ...@@ -119,7 +119,7 @@ bool BackendLibLoader::updateVsSymlink() {
std::cerr << "Error creating symlink to " << pathToSymlink << std::endl; std::cerr << "Error creating symlink to " << pathToSymlink << std::endl;
return false; return false;
} }
#endif // DELAY_LOAD_ENABLED #endif // SYMLINK_UPDATE_ENABLED
return true; return true;
} }
#endif // __APPLE__ #endif // __APPLE__
...@@ -182,10 +182,8 @@ bool BackendLibLoader::selectBackend(const Discovery::Framework& framework, bool ...@@ -182,10 +182,8 @@ bool BackendLibLoader::selectBackend(const Discovery::Framework& framework, bool
if (needToRestart) { if (needToRestart) {
*needToRestart = false; *needToRestart = false;
} }
#ifndef DELAY_LOAD_ENABLED
(void)framework; #if defined(SYMLINK_UPDATE_ENABLED) || defined(DELAY_LOAD_ENABLED)
return true;
#else
if (framework == Discovery::Framework::Unknown) { if (framework == Discovery::Framework::Unknown) {
return false; return false;
} }
...@@ -193,6 +191,7 @@ bool BackendLibLoader::selectBackend(const Discovery::Framework& framework, bool ...@@ -193,6 +191,7 @@ bool BackendLibLoader::selectBackend(const Discovery::Framework& framework, bool
return true; return true;
} }
currentVsFramework = framework; currentVsFramework = framework;
#if _MSC_VER #if _MSC_VER
if (getBackendHandler() != NULL) { if (getBackendHandler() != NULL) {
if (needToRestart) { if (needToRestart) {
...@@ -210,7 +209,10 @@ bool BackendLibLoader::selectBackend(const Discovery::Framework& framework, bool ...@@ -210,7 +209,10 @@ bool BackendLibLoader::selectBackend(const Discovery::Framework& framework, bool
#else #else
return true; return true;
#endif // _MSC_VER #endif // _MSC_VER
#endif // DELAY_LOAD_ENABLED #else
(void)framework;
return true;
#endif // defined(SYMLINK_UPDATE_ENABLED) || defined(DELAY_LOAD_ENABLED)
} }
#ifdef __APPLE__ #ifdef __APPLE__
......
...@@ -815,12 +815,11 @@ endif() ...@@ -815,12 +815,11 @@ endif()
# To be sure, the generated dll on Windows will be replaced by an empty one in generateFakeLibvideostitch, # To be sure, the generated dll on Windows will be replaced by an empty one in generateFakeLibvideostitch,
# while VS_LIB will be loaded using the delay load function # while VS_LIB will be loaded using the delay load function
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(USE_DELAY_LOAD OR APPLE) if(USE_DELAY_LOAD)
# Use any backend, we don't care, we just want the .lib with the common exported symbols # Use any backend, we don't care, we just want the .lib with the common exported symbols
configure_lib_main_target(${VS_LIB_FAKE} ${GPU_BACKEND_DEFAULT} "SHARED") configure_lib_main_target(${VS_LIB_FAKE} ${GPU_BACKEND_DEFAULT} "SHARED")
endif(USE_DELAY_LOAD OR APPLE)
if(USE_DELAY_LOAD) if(MSVC)
function(generate_lib_symbols BACKEND_NAME LIB_DIR) function(generate_lib_symbols BACKEND_NAME LIB_DIR)
add_custom_command(TARGET ${VS_LIB_${BACKEND_NAME}} add_custom_command(TARGET ${VS_LIB_${BACKEND_NAME}}
POST_BUILD POST_BUILD
...@@ -839,7 +838,8 @@ if(USE_DELAY_LOAD) ...@@ -839,7 +838,8 @@ if(USE_DELAY_LOAD)
add_custom_target(compareLibsSymbols ALL add_custom_target(compareLibsSymbols ALL
COMMAND ${CMAKE_COMMAND} -E compare_files lib_symbols_only_CUDA.txt lib_symbols_only_OPENCL.txt COMMAND ${CMAKE_COMMAND} -E compare_files lib_symbols_only_CUDA.txt lib_symbols_only_OPENCL.txt
DEPENDS ${VS_LIB_CUDA} ${VS_LIB_OPENCL}) DEPENDS ${VS_LIB_CUDA} ${VS_LIB_OPENCL})
endif(USE_DELAY_LOAD) endif()
endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# static lib # static lib
......
...@@ -122,9 +122,8 @@ bool loadGPUBackend(const int deviceId, int& returnCode) { ...@@ -122,9 +122,8 @@ bool loadGPUBackend(const int deviceId, int& returnCode) {
PfnDliHook oldFailureHook = __pfnDliFailureHook2; PfnDliHook oldFailureHook = __pfnDliFailureHook2;
__pfnDliFailureHook2 = &delayFailureHook; __pfnDliFailureHook2 = &delayFailureHook;
try { try {
#endif // call any lib function
Status::OK(); Status::OK();
#ifdef DELAY_LOAD_ENABLED
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << "Error using backend library: " << e.what() << std::endl; std::cerr << "Error using backend library: " << e.what() << std::endl;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment