Skip to content

Commit

Permalink
stand-alone support
Browse files Browse the repository at this point in the history
  • Loading branch information
baranaydogan committed Aug 19, 2022
1 parent 2128215 commit 291540c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 120 deletions.
74 changes: 23 additions & 51 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
# SET PATHS AND CONFIGURATION

# Path to the cmake executable
cmakeExe=cmake
cmakeExe=/home/baran/dev/cmake/bin/cmake

# Path to the compilers
c_compiler=gcc
cxx_compiler=g++
c_compiler=gcc-8
cxx_compiler=g++-8

# VTK cmake dir
VTK_DIR=/opt/VTK-9.1.0-static/lib/cmake/vtk-9.1
VTK_DIR=/opt/VTK/VTK-9.1.0-static/lib/cmake/vtk-9.1

# ACVD cmake dir
ACVD_DIR=/opt/ACVD-static/lib/cmake/ACVD
ACVD_DIR=/opt/ACVD/ACVD-static/lib/cmake/ACVD

# Path to Trekker (below is an example)
trekkerSrc=/home/baran/Work/code/trekker/src
trekkerLib=/home/baran/Work/code/trekker/build/Linux/install/lib
trekkerSrc=/home/baran/dev/trekker/src
trekkerLib=/home/baran/dev/trekker/build/Linux/install/lib

# Release or Debug
buildType=Release
Expand All @@ -31,53 +31,25 @@ rm -rf build
# Make a build directory
mkdir -p build

: '
-DEGL_LIBRARY=/usr/lib/libEGL_nvidia.so \
-DOPENGL_egl_LIBRARY=/usr/lib/libEGL_nvidia.so \
-DOPENGL_gles2_LIBRARY=/usr/lib/libGLESv2_nvidia.so \
-DOPENGL_gles3_LIBRARY=/usr/lib/libGLESv2_nvidia.so \
-DOPENGL_glx_LIBRARY=/usr/lib/libGLX_nvidia.so \
-Dharfbuzz_DIR=/opt/harfbuzz-5.1.0-static \
-DPNG_LIBRARY_RELEASE=/opt/libpng-1.6.37-static/lib/libpng16.a \
-DPNG_PNG_INCLUDE_DIR=/opt/libpng-1.6.37-static/include/ \
'

: '
-DQt6_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6 \
-DQt6Core_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6Core \
-DQt6Widgets_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6Widgets \
-DQt6Gui_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6Gui \
-DQt6BundledPcre2_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6BundledPcre2 \
-DQt6BundledLibpng_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6BundledLibpng \
-DQt6BundledHarfbuzz_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6BundledHarfbuzz \
-DQt6BundledFreetype_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6BundledFreetype \
-DQt6BundledLibjpeg_DIR=/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6BundledLibjpeg \
-DQT_FEATURE_shared=OFF \
-DQT_FEATURE_rpath=OFF \
-DQT_FEATURE_journald=OFF \
-DQT_FEATURE_intelcet=OFF \
-DQT_FEATURE_system_xcb_xinput=OFF \
'

# Build
cd build
${cmakeExe} \
-DQt6_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6 \
-DQt6Core_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6Core \
-DQt6CoreTools_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6CoreTools \
-DQt6DBus_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6DBus \
-DQt6DBusTools_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6DBusTools \
-DQt6Gui_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6Gui \
-DQt6GuiTools_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6GuiTools \
-DQt6OpenGL_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6OpenGL \
-DQt6OpenGLWidgets_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6OpenGLWidgets \
-DQt6Widgets_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6Widgets \
-DQt6WidgetsTools_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6WidgetsTools \
-DQt6BundledPcre2_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6BundledPcre2 \
-DQt6BundledLibpng_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6BundledLibpng \
-DQt6BundledHarfbuzz_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6BundledHarfbuzz \
-DQt6BundledFreetype_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6BundledFreetype \
-DQt6BundledLibjpeg_DIR=/opt/QT/QT6.3.0/lib/cmake/Qt6BundledLibjpeg \
-DQT_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6 \
-DQt6_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6 \
-DQt6Core_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6Core \
-DQt6CoreTools_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6CoreTools \
-DQt6DBus_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6DBus \
-DQt6DBusTools_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6DBusTools \
-DQt6Gui_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6Gui \
-DQt6GuiTools_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6GuiTools \
-DQt6OpenGL_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6OpenGL \
-DQt6OpenGLWidgets_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6OpenGLWidgets \
-DQt6Widgets_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6Widgets \
-DQt6WidgetsTools_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6WidgetsTools \
-DQt6BundledPcre2_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6BundledPcre2 \
-DQt6BundledLibpng_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6BundledLibpng \
-DQt6BundledHarfbuzz_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6BundledHarfbuzz \
-DQt6BundledFreetype_DIR=/opt/QT/QT-6.2.0-static/lib/cmake/Qt6BundledFreetype \
-DCMAKE_C_COMPILER=${c_compiler} \
-DCMAKE_CXX_COMPILER=${cxx_compiler} \
-DVTK_DIR=${VTK_DIR} \
Expand Down
76 changes: 7 additions & 69 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,10 @@ cmake_minimum_required(VERSION 3.20.0)

set (CMAKE_CXX_STANDARD 17)


set(VTK_DIR "/opt/VTK-9.1.0-static/lib/cmake/vtk-9.1")
set(ACVD_DIR "/opt/ACVD-static/lib/cmake/ACVD")

# set(TREKKER_SRC "/home/baran/Work/code/trekker/src")
# set(TREKKER_LIB "/home/baran/Work/code/trekker/build/Linux/install/lib")

# set(QT_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6")
# set(Qt6_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6")
# set(Qt6Core_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6Core")
# set(Qt6Widgets_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6Widgets")
# set(Qt6Gui_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6Gui")
# set(Qt6CoreTools_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6CoreTools")
# set(Qt6DBusTools_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6DBusTools")
# set(Qt6GuiTools_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6GuiTools")
# set(Qt6OpenGL_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6OpenGL")
# set(Qt6OpenGLWidgets_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6OpenGLWidgets")
# set(Qt6WidgetsTools_DIR "/opt/QT/6.3.0-minimal-static/lib/cmake/Qt6WidgetsTools")
# set(QT_QMAKE_EXECUTABLE "/opt/QT/6.3.0-minimal-static/bin/qmake")

# -DEGL_LIBRARY=/usr/lib/libEGL_nvidia.so \
# -DOPENGL_egl_LIBRARY=/usr/lib/libEGL_nvidia.so \
# -DOPENGL_gles2_LIBRARY=/usr/lib/libGLESv2_nvidia.so \
# -DOPENGL_gles3_LIBRARY=/usr/lib/libGLESv2_nvidia.so \
# -DOPENGL_glx_LIBRARY=/usr/lib/libGLX_nvidia.so \

# set(GLESv2_LIBRARY /usr/lib/libGLESv2_nvidia.so)
# set(EGL_LIBRARY /usr/lib/libEGL_nvidia.so)
# set(OPENGL_egl_LIBRARY /usr/lib/libEGL_nvidia.so)

set(HAVE_EGL True)

set(CMAKE_BUILD_TYPE "Release")

list(INSERT CMAKE_MODULE_PATH 0 "/usr/lib/cmake/OpenVDB")

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition")

# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++ -Wl,--whole-archive -lpthread -Wl,--no-whole-archive")

set(ZNZLIB_PATH ${TREKKER_SRC}/nifticlib-2.0.0/znzlib/)
include_directories( ${ZNZLIB_PATH} )

include_directories(${TREKKER_SRC})
link_directories(${TREKKER_LIB})

Expand All @@ -65,26 +26,12 @@ endif()
message (STATUS "VTK_VERSION: ${VTK_VERSION}")

if (${VTK_VERSION} LESS "9")
if (${VTK_VERSION} LESS "8")
if (${VTK_VERSION} LESS "7")
message (STATUS "VTK version is too old. This software requires VTK7 or newer")
return()
else()
SET(rttvis_gui_UI rttvis_gui_VTK7.ui)
add_definitions(-D HAVE_VTK7)
include(${VTK_USE_FILE})
message (STATUS "Compiling with QVTKWidget")
endif()
else()
SET(rttvis_gui_UI rttvis_gui_VTK8.ui)
add_definitions(-D HAVE_VTK8)
include(${VTK_USE_FILE})
message (STATUS "Compiling with QVTKOpenGLWidget")
endif()
message (STATUS "This software requires VTK9 or newer")
return()
else()
SET(rttvis_gui_UI rttvis_gui_VTK9.ui)
add_definitions(-D HAVE_VTK9)
message (STATUS "Compiling with QVTKOpenGLStereoWidget")
SET(rttvis_gui_UI rttvis_gui_VTK9.ui)
add_definitions(-D HAVE_VTK9)
message (STATUS "Compiling with QVTKOpenGLStereoWidget")
endif()


Expand Down Expand Up @@ -112,18 +59,10 @@ SET(rttvis_gui_MOC_HDRS rttvis_gui.h)
SET(about_UI gui_about.ui)

find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Gui Widgets)
# find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets OpenGL)

if (NOT Qt6_FOUND)
if (NOT Qt5_FOUND)
message("QT5 or QT6 not found")
return()
else()
message("QT5 found")
QT5_ADD_RESOURCES(rttvis_gui_SRCS resources.qrc)
QT5_WRAP_CPP(rttvis_gui_MOC_SRCS ${rttvis_gui_MOC_HDRS})
QT5_WRAP_UI(rttvis_gui_UI_HDRS about_UI_HDRS ${rttvis_gui_UI})
endif()
message("QT6 not found")
return()
else()
message("QT6 found")
QT6_ADD_RESOURCES(rttvis_gui_SRCS resources.qrc)
Expand All @@ -139,7 +78,6 @@ ADD_EXECUTABLE(rttvis

target_link_libraries(rttvis
Threads::Threads
z
${TREKKER_LIB}/libTrekker.a
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Expand Down

0 comments on commit 291540c

Please sign in to comment.