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 extension build on macOS by replacing real Virtual Reality module by a placeholder #93

Merged
merged 4 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ set(EXTENSION_DESCRIPTION "Allows user to interact with a Slicer scene using vir
set(EXTENSION_ICONURL "https://raw.githubusercontent.com/KitwareMedical/SlicerVirtualReality/master/SlicerVirtualReality.png")
set(EXTENSION_SCREENSHOTURLS "https://www.slicer.org/w/images/4/49/SlicerVirtualReality_Screenshot1.png https://www.slicer.org/w/images/0/04/SlicerVirtualReality_Screenshot2.png")
set(EXTENSION_DEPENDS "NA") # Specified as a space separated string, a list or 'NA' if any

#-----------------------------------------------------------------------------
if(APPLE)
# Virtual Reality is not supported on macOS, create an extension that contains a stub module
# that just displays the message that Virtual Reality is not supported. This avoids having
# a build error on the extension build dashboard.
find_package(Slicer REQUIRED)
include(${Slicer_USE_FILE})
add_subdirectory(VirtualRealityStub)
include(${Slicer_EXTENSION_GENERATE_CONFIG})
include(${Slicer_EXTENSION_CPACK})
return()
endif()
#-----------------------------------------------------------------------------

set(EXTENSION_BUILD_SUBDIRECTORY inner-build)

set(SUPERBUILD_TOPLEVEL_PROJECT inner)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ Usage

## Setup

Currently only Windows computers are supported, as until very recently there have been no virtual reality headsets officially supported on MacOS or Linux. If you already have virtual reality capable hardware, Steam
**Platform support:** Currently the extension only works on Windows computers. Linux support is experimental: [Steam VR has limited support on linux](https://github.com/ValveSoftware/SteamVR-for-Linux/blob/master/README.md) and the Slicer extension is built for Linux but not tested. The extension is not available on macOS, as currently there are no virtual reality headsets available for macOS. If you wish to use Virtual Reality extension on Linux or macOS and you have virtual reality capable hardware and Steam VR works well on your computer then add a comment in the issue tracker ([MacOS](https://github.com/KitwareMedical/SlicerVirtualReality/issues/3) / [Linux](https://github.com/KitwareMedical/SlicerVirtualReality/issues/57)).
lassoan marked this conversation as resolved.
Show resolved Hide resolved

works well on your computer, and you would like to use Slicer in virtual reality, too, then you add a comment in the issue tracker ([MacOS](https://github.com/KitwareMedical/SlicerVirtualReality/issues/3) / [Linux](https://github.com/KitwareMedical/SlicerVirtualReality/issues/57)).

If both integrated display card and high-performance GPU available in a system (typically this is the case on laptops with NVidia GPUs), then configure the graphics card application settings to use high-performance GPU for SlicerApp-real.exe (it is not necessary to use high-performance GPU for the launcher, Slicer.exe).
**Configuring graphics:** If both integrated display card and high-performance GPU available in a system (typically this is the case on laptops with NVidia GPUs), then configure the graphics card application settings to use high-performance GPU for `SlicerApp-real.exe` (it is not necessary to use high-performance GPU for the launcher, `Slicer.exe`).
lassoan marked this conversation as resolved.
Show resolved Hide resolved

<a name="setup-htc-vive" ></a>

Expand Down
18 changes: 18 additions & 0 deletions VirtualRealityStub/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#-----------------------------------------------------------------------------
set(MODULE_NAME VirtualRealityStub)

#-----------------------------------------------------------------------------
set(MODULE_PYTHON_SCRIPTS
${MODULE_NAME}.py
)

set(MODULE_PYTHON_RESOURCES
Resources/Icons/${MODULE_NAME}.png
)

#-----------------------------------------------------------------------------
slicerMacroBuildScriptedModule(
NAME ${MODULE_NAME}
SCRIPTS ${MODULE_PYTHON_SCRIPTS}
RESOURCES ${MODULE_PYTHON_RESOURCES}
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions VirtualRealityStub/VirtualRealityStub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import slicer
from slicer.ScriptedLoadableModule import *

#
# VirtualRealityStub
#

class VirtualRealityStub(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Virtual Reality"
self.parent.categories = ["Virtual Reality"]
self.parent.dependencies = []
self.parent.contributors = ["Andras Lasso (PerkLab)"]
self.parent.helpText = """
This is a placeholder module to tell the user that Virtual Reality extension is not available on the platform.
See more information in the <a href="https://github.com/KitwareMedical/SlicerVirtualReality">extensions documentation</a>.
lassoan marked this conversation as resolved.
Show resolved Hide resolved
"""
self.parent.acknowledgementText = ""

#
# VirtualRealityStubWidget
#

class VirtualRealityStubWidget(ScriptedLoadableModuleWidget):
def __init__(self, parent=None):
ScriptedLoadableModuleWidget.__init__(self, parent)

def setup(self):
ScriptedLoadableModuleWidget.setup(self)

def enter(self):
"""
Called each time the user opens this module.
"""
slicer.util.messageBox("Virtual Reality is not supported on this platform.<br>"
"See <a href='https://github.com/KitwareMedical/SlicerVirtualReality#setup'>Slicer Virtual Reality extension website</a> for details.")