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

Only initialize the CLI for headless mode and add Dockerfile #2438

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.github
scripts
.clang-format
.git
.gitattributes
.gitignore
.travis.yml
build.sh
compile_commands.json
34 changes: 9 additions & 25 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,19 @@ jobs:
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
version: 5.15.2
target: desktop
host: mac
setup-python: 'false'
setup-python: 'true'
install-deps: true

- name: Print out Qt directory
run: echo $Qt5_DIR; echo $Qt5_Dir

- name: Prepare
run: |
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/ /usr/local/include/X11

- name: make
run: ./build.sh -DQt_PATH="${Qt5_Dir}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Progress! Now the configure is failing, this should be changed to ${Qt_dir} or path or whichever it is now...


Expand All @@ -47,7 +43,7 @@ jobs:
./repair_package.sh

- name: Upload installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SCIRunMacInstaller
path: bin/SCIRun/SCIRun-5.0.beta.*-Darwin.pkg
Expand Down Expand Up @@ -75,20 +71,16 @@ jobs:
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
version: 5.15.2
target: desktop
host: mac
setup-python: 'false'
setup-python: 'true'
install-deps: true

- name: Prepare
run: |
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/ /usr/local/include/X11

- name: make
run: ./build.sh -DBUILD_WITH_PYTHON=OFF -DQt_PATH="${Qt5_Dir}"

Expand All @@ -102,7 +94,7 @@ jobs:
./repair_package.sh

- name: Upload installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SCIRunMacNPInstaller
path: bin/SCIRun/SCIRun-5.0.beta.*-Darwin.pkg
Expand All @@ -118,23 +110,19 @@ jobs:
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
version: 5.15.2
target: desktop
host: mac
setup-python: 'false'
setup-python: 'true'
install-deps: true

- name: Print out Qt directory
run: echo $Qt5_DIR; echo $Qt5_Dir

- name: Prepare
run: |
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/ /usr/local/include/X11

- name: make
run: ./build.sh -DWITH_OSPRAY:BOOL=ON -DQt_PATH="${Qt5_Dir}"

Expand All @@ -148,7 +136,7 @@ jobs:
./repair_package.sh

- name: Upload installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SCIRunMacOsprayInstaller
path: bin/SCIRun/SCIRun-5.0.beta.*-Darwin.pkg
Expand All @@ -173,10 +161,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare
run: |
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/ /usr/local/include/X11

- name: Compile
run: ./build.sh -DBUILD_HEADLESS:BOOL=ON -DBUILD_TESTING:BOOL=ON

Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ jobs:
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
version: 5.15.2
target: desktop
host: windows
arch: win64_msvc2019_64
setup-python: 'false'
setup-python: 'true'
install-deps: true

- name: Print out Qt directory
Expand All @@ -76,7 +76,7 @@ jobs:
run: cmake --build . --config Release --target package

- name: Upload installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: SCIRunWindowsInstaller_qt5
Expand All @@ -93,15 +93,15 @@ jobs:
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
version: 6.3.*
target: desktop
host: windows
arch: win64_msvc2019_64
setup-python: 'false'
setup-python: 'true'
install-deps: true

- name: Print out Qt directory
Expand All @@ -110,7 +110,7 @@ jobs:
- name: Configure
working-directory: bin
run: |
cmake ..\Superbuild -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" -Ax64 -DSCIRUN_QT_MIN_VERSION:STRING="6.3.1" -DQt_PATH:PATH="$env:Qt6_Dir" -DBUILD_WITH_PYTHON:BOOL=OFF
cmake ..\Superbuild -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" -Ax64 -DSCIRUN_QT_MIN_VERSION:STRING="6.3.1" -DQt_PATH:PATH="$env:QT_ROOT_DIR" -DBUILD_WITH_PYTHON:BOOL=OFF

- name: Compile
working-directory: bin
Expand All @@ -124,7 +124,7 @@ jobs:
run: cmake --build . --config Release --target package

- name: Upload installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: SCIRunWindowsInstaller_qt6
Expand All @@ -141,15 +141,15 @@ jobs:
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
version: 5.15.2
target: desktop
host: windows
arch: win64_msvc2019_64
setup-python: 'false'
setup-python: 'true'
install-deps: true

- name: Configure
Expand All @@ -169,7 +169,7 @@ jobs:
run: cmake --build . --config Release --target package

- name: Upload installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: SCIRunWindowsPythonInstaller
Expand Down Expand Up @@ -197,15 +197,15 @@ jobs:
fetch-depth: 0

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
version: 5.15.2
target: desktop
host: windows
arch: win64_msvc2019_64
setup-python: 'false'
setup-python: 'true'
install-deps: true

- name: Configure
Expand All @@ -225,7 +225,7 @@ jobs:
run: cmake --build . --config Release --target package

- name: Upload installer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: SCIRunWindowsOsprayInstaller
Expand Down
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#syntax=docker/dockerfile:1-labs
FROM ubuntu:24.04

ARG SCIRUN_VERSION="v5.0-beta.2023"

RUN apt-get -y update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install qtbase5-dev libqt5svg5-dev \
cmake git openssl tzdata build-essential g++ zlib1g-dev libssl-dev libncurses-dev libsqlite3-dev \
libreadline-dev libtk-img-dev libgdm-dev libdb-dev libpcap-dev \
&& rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

WORKDIR /scirun-src
COPY . /scirun-src/

WORKDIR /opt/scirun
# TODO: Separate external building from SCIRun
RUN cmake -DQt_PATH=/usr/lib/x86_64-linux-gnu/cmake \
-DCMAKE_BUILD_TYPE=Release /scirun-src/Superbuild && make

# Make the internal python usable externally
ENV LD_LIBRARY_PATH=/opt/scirun/Externals/Install/Python_external/lib:$LD_LIBRARY_PATH
ENV PATH=/opt/scirun/SCIRun:/opt/scirun/Externals/Install/Python_external/bin:$PATH
RUN python3 -m ensurepip && python3 -m pip install --no-cache-dir --upgrade pip && python3 -m venv /opt/venv

WORKDIR /opt/scripts
COPY <<EOF /opt/scripts/entrypoint.sh
set -e
. /opt/venv/bin/activate
exec "\$@"
EOF

RUN chmod a+x /opt/scripts/entrypoint.sh

WORKDIR /data
ENTRYPOINT [ "/opt/scripts/entrypoint.sh" ]
CMD ["/opt/scirun/SCIRun/SCIRun"]
18 changes: 11 additions & 7 deletions docs/start/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,25 @@


#### Linux
- Tested on Ubuntu 16.04 LTS, 18.04 LTS, 22.04 LTS, OpenSUSE Leap 42.1, Arch Linux
- Tested on Ubuntu 16.04 LTS, 18.04 LTS, 22.04 LTS, 24.04 LTS, OpenSUSE Leap 42.1, Arch Linux
- gcc 7+
- Qt 5.15 or later
+ [Download](https://download.qt.io/archive/qt/) and run the desired Qt 5.x or 6.x installer. Make sure to turn off other versions and system configurations to save space and build time.
Optionally, install Qt through your distro's package manager instead(apt on Ubuntu/Debian, pacman on Arch).

To install Qt 5, the command on Ubuntu/Debian is:
To install Qt 5, the command on Ubuntu (20.04 LTS or earlier) or Debian is:
```
sudo apt-get install qt5-default
```
or, on Ubuntu 22.04 LTS and later
```
sudo apt-get install qtbase5-dev libqt5svg5-dev
```
To install Qt 6, the command on Ubuntu/Debian is:
```
sudo apt-get install qt6-base-dev libqt6svg6-dev
```
The installation directory for the CMake variable `Qt5_DIR`(for Qt5) or `Qt_PATH`(for Qt6) will then be `/usr/lib/x86_64-linux-gnu/cmake/`.
The installation directory for the CMake variable `Qt_PATH` will then be `/usr/lib/x86_64-linux-gnu/cmake/`.

To install Qt 5, the command on Arch is:
```
Expand All @@ -56,7 +60,7 @@
```
sudo pacman -S qt6-base
```
The installation directory for the CMake variable `Qt5_DIR`(for Qt5) or `Qt_PATH`(for Qt6) will then be `/usr/lib/cmake/`.
The installation directory for the CMake variable `Qt_PATH` will then be `/usr/lib/cmake/`.

#### All Platforms
- [CMake](https://cmake.org/) (platform independent configuring system that is used for generating Makefiles, Visual Studio project files, or Xcode project files)
Expand Down Expand Up @@ -97,15 +101,15 @@ If you installed Qt in the default location, it should find Qt automatically.

### Configuring SCIRun with Qt 5

Building SCIRun with Qt 5 requires additional input. Use the `Qt5_PATH` CMake variable to point to the Qt 5 build location. Look at the Qt install steps above for information about the directory. This can be done through the command line with a command similar to:
Building SCIRun with Qt 5 requires additional input. Use the `Qt_PATH` CMake variable to point to the Qt 5 build location. Look at the Qt install steps above for information about the directory. This can be done through the command line with a command similar to:
```
cmake -DQt5_PATH=path_to_Qt5_build/ ../Superbuild/
cmake -DQt_PATH=path_to_Qt5_build/ ../Superbuild/
```
Or they can be set in the CMake GUI or with the `ccmake` function.

The command will be similar to the following:
```
cmake -DQt5_PATH=path_to_Qt5/5.15.1/clang_64/ ../Superbuild/
cmake -DQt_PATH=path_to_Qt5/5.15.1/clang_64/ ../Superbuild/
```

### Configuring SCIRun with Qt 6
Expand Down
6 changes: 6 additions & 0 deletions src/Main/scirunMain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ int mainImpl(int argc, const char* argv[], char **environment)
//TODO: must read --headless flag here, or try pushing command queue building all the way up here
//TODO: https://doc.qt.io/qt-5/qapplication.html#details
#ifndef BUILD_HEADLESS
if (Application::Instance().parameters()->disableGui() || Application::Instance().parameters()->help())
{
return ConsoleApplication::run(argc, argv);
}

return GuiApplication::run(argc, argv);

#else
return ConsoleApplication::run(argc, argv);
#endif
Expand Down
Loading