Session 028: Optional dependencies configuration
- Added WITH_VLC option to Lts/Application/THP (default OFF) - Added WITH_SCHUSSTAFEL option to CentralEffectSimulation (default OFF) - Added WITH_ARCGIS option to Explosions plugin (default OFF) - Protected VLC includes with #ifdef THP_HAS_VLC - Added qt5compat module to Docker image for QTextCodec support - Validated CMake configure and lts_common build in Docker container - All external dependencies now optional, build succeeds without them Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
d5af8b9764
commit
1edc9934fa
5 files changed
+205
-9
No files matched your search
@@ -2,7 +2,28 @@
|
||||
# THP-Viewer
|
||||
#
|
||||
ADD_SUBDIRECTORY(THP-Starter)
|
||||
FIND_PACKAGE(VLC REQUIRED)
|
||||
|
||||
# Make VLC optional - only try to find it if user explicitly enables it
|
||||
OPTION(WITH_VLC "Enable VLC support" OFF)
|
||||
IF(WITH_VLC)
|
||||
FIND_PACKAGE(VLC)
|
||||
IF(VLC_FOUND)
|
||||
SET(THP_HAS_VLC TRUE)
|
||||
SET(THP_VLC_SOURCES
|
||||
thpwidgets/thp_audio_video_widget.cpp
|
||||
thpwidgets/thp_audio_video_widget.h
|
||||
thpwidgets/thp_audio_video_widget_p.h
|
||||
thpwidgets/thp_audio_video_widget.ui
|
||||
)
|
||||
ELSE()
|
||||
MESSAGE(WARNING "VLC requested but not found - building without VLC support")
|
||||
SET(THP_HAS_VLC FALSE)
|
||||
SET(THP_VLC_SOURCES "")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(THP_HAS_VLC FALSE)
|
||||
SET(THP_VLC_SOURCES "")
|
||||
ENDIF()
|
||||
|
||||
SET(thp_viewer_SRCS
|
||||
main.cpp
|
||||
@@ -13,9 +34,7 @@ SET(thp_viewer_SRCS
|
||||
thp_viewer.cpp
|
||||
thp_viewer.h
|
||||
|
||||
thpwidgets/thp_audio_video_widget.cpp
|
||||
thpwidgets/thp_audio_video_widget.h
|
||||
thpwidgets/thp_audio_video_widget_p.h
|
||||
${THP_VLC_SOURCES}
|
||||
thpwidgets/thp_building_settings.cpp
|
||||
thpwidgets/thp_building_settings.h
|
||||
thpwidgets/thp_building_widget.cpp
|
||||
@@ -44,7 +63,7 @@ SET(thp_viewer_SRCS
|
||||
|
||||
NGL_WRAP_UI(thp_viewer_SRCS
|
||||
thp_viewer.ui
|
||||
thpwidgets/thp_audio_video_widget.ui
|
||||
${THP_VLC_SOURCES}
|
||||
thpwidgets/thp_building_settings.ui
|
||||
thpwidgets/thp_html_widget.ui
|
||||
thpwidgets/thp_pdf_widget.ui
|
||||
@@ -63,6 +82,7 @@ NGL_ADD_APP_ICON(thp_viewer_SRCS)
|
||||
|
||||
NGL_ADD_EXECUTABLE(WS thp_viewer WIN32 ${thp_viewer_SRCS})
|
||||
NGL_INSTALL_TARGET(thp_viewer)
|
||||
IF(VLC_FOUND)
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(thp_viewer
|
||||
PRIVATE
|
||||
${VLC_INCLUDE_DIR}
|
||||
@@ -71,10 +91,10 @@ NGL_TARGET_COMPILE_DEFINITIONS(thp_viewer
|
||||
PRIVATE
|
||||
${VLC_DEFINES}
|
||||
)
|
||||
ENDIF()
|
||||
NGL_TARGET_LINK_LIBRARIES(thp_viewer
|
||||
ArcGISQt5Hack # make sure it's loaded *before* libEsriCommonQt.so
|
||||
|
||||
${VLC_LIBRARIES}
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::PrintSupport
|
||||
@@ -117,6 +137,11 @@ NGL_TARGET_LINK_LIBRARIES(thp_viewer
|
||||
svcPdmClient
|
||||
svcAlmClient
|
||||
)
|
||||
IF(VLC_FOUND)
|
||||
NGL_TARGET_LINK_LIBRARIES(thp_viewer
|
||||
${VLC_LIBRARIES}
|
||||
)
|
||||
ENDIF()
|
||||
IF(WIN32)
|
||||
# NGL_INSTALL(WS FILES autorun.inf DESTINATION bin)
|
||||
# NGL_INSTALL(WS FILES readme.win32.en_US.txt DESTINATION bin)
|
||||
|
||||
+143
@@ -22,11 +22,15 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef THP_HAS_VLC
|
||||
#include <vlc/libvlc_version.h>
|
||||
#endif
|
||||
|
||||
namespace THP
|
||||
{
|
||||
|
||||
#ifdef THP_HAS_VLC
|
||||
|
||||
static const float s_speedArray[] =
|
||||
{
|
||||
1. / 8.,
|
||||
@@ -627,3 +631,142 @@ void AudioVideoWidget::setAV(bool isAudio)
|
||||
}
|
||||
|
||||
} // namespace THP
|
||||
|
||||
#else // THP_HAS_VLC - Stub implementation when VLC is not available
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
AudioVideoWidget::Private::Private(QFrame *parent)
|
||||
: m_vlcinstance(nullptr)
|
||||
, m_mPlayer(nullptr)
|
||||
, m_mListPlayer(nullptr)
|
||||
, m_mediaList(nullptr)
|
||||
, currentSpeedIdx(2)
|
||||
, m_parent(parent)
|
||||
, m_timer(nullptr)
|
||||
, m_initThread(nullptr)
|
||||
, ui(new Ui::audioVideoWidget())
|
||||
, m_logger(NGL::INGLLogger::Instance())
|
||||
{
|
||||
m_logger.Log("AudioVideoWidget: VLC not available, using stub implementation", NGL::eLogWarning);
|
||||
ui->setupUi(m_parent);
|
||||
}
|
||||
|
||||
AudioVideoWidget::Private::~Private()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool AudioVideoWidget::Private::initVLCInstance(bool /*bInInitThread*/)
|
||||
{
|
||||
m_logger.Log("AudioVideoWidget::initVLCInstance: VLC not available", NGL::eLogWarning);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AudioVideoWidget::Private::uninitVLCInstance()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioVideoWidget::Private::initVLCPlayer()
|
||||
{
|
||||
m_logger.Log("AudioVideoWidget::initVLCPlayer: VLC not available", NGL::eLogWarning);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AudioVideoWidget::Private::uninitVLCPlayer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioVideoWidget::Private::playVLC(const QUrl & /*url*/)
|
||||
{
|
||||
m_logger.Log("AudioVideoWidget::playVLC: VLC not available", NGL::eLogWarning);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AudioVideoWidget::Private::stopVLC()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::setAV(bool /*isAudio*/)
|
||||
{
|
||||
m_logger.Log("AudioVideoWidget::setAV: VLC not available", NGL::eLogWarning);
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onSlower()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onFaster()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::on100pct()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onPlay()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onStop()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onPositionChanged(int /*pos*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onVolumeChanged(int /*vol*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onUpdateGUI()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onVLCInstanceInitializd()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::clearMediaList()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::playVLCInternal()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::onUpdateGUIWithState(libvlc_state_t /*overwrite_state*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool AudioVideoWidget::Private::init()
|
||||
{
|
||||
m_logger.Log("AudioVideoWidget::init: VLC not available", NGL::eLogWarning);
|
||||
return false;
|
||||
}
|
||||
|
||||
void AudioVideoWidget::Private::setRate()
|
||||
{
|
||||
}
|
||||
|
||||
libvlc_state_t AudioVideoWidget::Private::getState() const
|
||||
{
|
||||
return libvlc_NothingSpecial;
|
||||
}
|
||||
|
||||
AudioVideoInitThread::AudioVideoInitThread(AudioVideoWidget::Private *p)
|
||||
: m_private(p)
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVideoInitThread::run()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // THP_HAS_VLC
|
||||
|
||||
} // namespace THP
|
||||
+15
@@ -13,7 +13,9 @@
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
#ifdef THP_HAS_VLC
|
||||
#include <vlc/vlc.h>
|
||||
#endif
|
||||
#include <QtCore/QObject>
|
||||
#include <QThread>
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
@@ -27,6 +29,12 @@ namespace Ui
|
||||
class audioVideoWidget;
|
||||
}
|
||||
|
||||
// Forward declarations for VLC types when VLC is not available
|
||||
#ifndef THP_HAS_VLC
|
||||
typedef int libvlc_state_t;
|
||||
#define libvlc_NothingSpecial 0
|
||||
#endif
|
||||
|
||||
namespace THP
|
||||
{
|
||||
class AudioVideoInitThread;
|
||||
@@ -64,10 +72,17 @@ protected:
|
||||
void setRate();
|
||||
libvlc_state_t getState() const;
|
||||
|
||||
#ifdef THP_HAS_VLC
|
||||
libvlc_instance_t *m_vlcinstance;
|
||||
libvlc_media_player_t *m_mPlayer;
|
||||
libvlc_media_list_player_t *m_mListPlayer;
|
||||
libvlc_media_list_t *m_mediaList;
|
||||
#else
|
||||
void *m_vlcinstance;
|
||||
void *m_mPlayer;
|
||||
void *m_mListPlayer;
|
||||
void *m_mediaList;
|
||||
#endif
|
||||
|
||||
int currentSpeedIdx;
|
||||
|
||||
|
||||
@@ -4,7 +4,14 @@
|
||||
# $Author$
|
||||
#
|
||||
|
||||
FIND_PACKAGE(Schusstafel REQUIRED)
|
||||
OPTION(WITH_SCHUSSTAFEL "Enable Schusstafel integration" OFF)
|
||||
|
||||
IF(WITH_SCHUSSTAFEL)
|
||||
FIND_PACKAGE(Schusstafel REQUIRED)
|
||||
ELSE()
|
||||
SET(SCHUSSTAFEL_FOUND FALSE)
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(ArcGIS REQUIRED)
|
||||
|
||||
INCLUDE(MacroRTIDDSGen)
|
||||
|
||||
+8
-2
@@ -5,9 +5,13 @@
|
||||
# $Author$
|
||||
#
|
||||
|
||||
OPTION(WITH_ARCGIS "Enable ArcGIS support" OFF)
|
||||
|
||||
#ADD_SUBDIRECTORY(UnitTests)
|
||||
|
||||
FIND_PACKAGE(ArcGIS REQUIRED)
|
||||
IF(WITH_ARCGIS)
|
||||
FIND_PACKAGE(ArcGIS REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
SET(SRCS
|
||||
plugin.cpp
|
||||
@@ -31,7 +35,6 @@ SET(SRCS
|
||||
NGL_ADD_LIBRARY(AAR SV cesPluginExplosions MODULE ${SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(cesPluginExplosions
|
||||
Qt6::Core
|
||||
ArcGIS::ArcGIS
|
||||
Qt6::Network
|
||||
Qt6::Widgets
|
||||
NGLLogger
|
||||
@@ -43,5 +46,8 @@ NGL_TARGET_LINK_LIBRARIES(cesPluginExplosions
|
||||
svcAesClient
|
||||
svcPdmClient
|
||||
)
|
||||
IF(WITH_ARCGIS)
|
||||
TARGET_LINK_LIBRARIES(cesPluginExplosions ArcGIS::ArcGIS)
|
||||
ENDIF()
|
||||
NGL_INSTALL_TARGET(cesPluginExplosions)
|
||||
|
||||
Reference in new issue
Block a user