Skip to content

Commit

Permalink
adding static libs
Browse files Browse the repository at this point in the history
  • Loading branch information
baranaydogan committed Aug 19, 2022
1 parent 390efd0 commit 2128215
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PROJECT(RealTimeTractogramVisualizer)
cmake_minimum_required(VERSION 3.15.0)
cmake_minimum_required(VERSION 3.20.0)
ADD_SUBDIRECTORY(src)
57 changes: 52 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash



# SET PATHS AND CONFIGURATION

# Path to the cmake executable
Expand All @@ -11,6 +9,12 @@ cmakeExe=cmake
c_compiler=gcc
cxx_compiler=g++

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

# ACVD cmake dir
ACVD_DIR=/opt/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
Expand All @@ -19,9 +23,6 @@ trekkerLib=/home/baran/Work/code/trekker/build/Linux/install/lib
buildType=Release





# MAKE A CLEAN INSTALL

# Delete the existing build directory
Expand All @@ -30,11 +31,57 @@ 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 \
-DCMAKE_C_COMPILER=${c_compiler} \
-DCMAKE_CXX_COMPILER=${cxx_compiler} \
-DVTK_DIR=${VTK_DIR} \
-DACVD_DIR=${ACVD_DIR} \
-DTREKKER_SRC=${trekkerSrc} \
-DTREKKER_LIB=${trekkerLib} \
-DCMAKE_BUILD_TYPE=${buildType} ..
Expand Down
53 changes: 46 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
PROJECT(RealTimeTractogramVisualizer)

cmake_minimum_required(VERSION 3.15.0)
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} )

Expand All @@ -21,6 +59,7 @@ add_definitions(-D ENABLE_MULTITHREADING)
FIND_PACKAGE(VTK REQUIRED)
if (NOT VTK_FOUND)
message("${VTK_NOT_FOUND_MESSAGE}")
message (STATUS "VTK not found")
return ()
endif()
message (STATUS "VTK_VERSION: ${VTK_VERSION}")
Expand Down Expand Up @@ -51,12 +90,13 @@ endif()

FIND_PACKAGE(ACVD REQUIRED)
if (ACVD_FOUND)
message("ACVD found")
message(STATUS "ACVD found")
else ()
message("ACVD not found")
message(STATUS "ACVD not found")
return ()
endif()


# Add Tread
find_package (Threads)

Expand All @@ -71,8 +111,8 @@ SET(rttvis_gui_SRCS
SET(rttvis_gui_MOC_HDRS rttvis_gui.h)
SET(about_UI gui_about.ui)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
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)
Expand Down Expand Up @@ -100,13 +140,12 @@ ADD_EXECUTABLE(rttvis
target_link_libraries(rttvis
Threads::Threads
z
Trekker
${TREKKER_LIB}/libTrekker.a
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
${VTK_LIBRARIES}
${ACVD_LIBRARIES}

)

INSTALL(TARGETS rttvis DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../bin)
Expand Down
Binary file added src/DejaVuSans.ttf
Binary file not shown.
13 changes: 13 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
#include "aux.h"
#include <QFontDatabase>

int main(int argc, char *argv[]) {

QApplication app(argc, argv);

// Load the embedded font.
QString fontPath = ":/DejaVuSans.ttf";
QFontDatabase::addApplicationFont(fontPath);
QFont font("DejaVuSans");
if (font.pointSize() != -1)
font.setPointSize(font.pointSize()*0.8);
else
font.setPixelSize(font.pixelSize()*0.8);
app.setFont(font);


auto renderer = vtkSmartPointer<vtkRenderer>::New();
RTTVIS* dialog = startRenderer(renderer);
app.exec();
Expand Down
1 change: 1 addition & 0 deletions src/resources.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<RCC version="1.0">
<qresource prefix="/">
<file alias="anim.gif">anim.gif</file>
<file alias="DejaVuSans.ttf">DejaVuSans.ttf</file>
</qresource>
</RCC>

0 comments on commit 2128215

Please sign in to comment.