Skip to content

Commit

Permalink
refs #12066 - added CMake option BUILD_ONLINE_HELP to conditionally…
Browse files Browse the repository at this point in the history
… add `online-help.qhc` target to CMake
  • Loading branch information
firewave committed Sep 23, 2024
1 parent 6e53331 commit 277cc87
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ jobs:
if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On'
run: |
sudo apt-get update
sudo apt-get install libxml2-utils libtinyxml2-dev
# qt6-tools-dev-tools for lprodump
# qt6-l10n-tools for lupdate
sudo apt-get install libxml2-utils libtinyxml2-dev qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev
sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev
# coreutils contains "nproc"
- name: Install missing software on macos
Expand Down Expand Up @@ -127,9 +128,10 @@ jobs:
if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On'
run: |
sudo apt-get update
sudo apt-get install libxml2-utils
# qt6-tools-dev-tools for lprodump
# qt6-l10n-tools for lupdate
sudo apt-get install libxml2-utils qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev
sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev
# coreutils contains "nproc"
- name: Install missing software on macos
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Build GUI release (CMake)
if: startsWith(matrix.qt_ver, '6')
run: |
cmake -S . -B build -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On || exit /b !errorlevel!
cmake -S . -B build -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake --build build --target cppcheck-gui || exit /b !errorlevel!
# TODO: deploy with CMake/Qt6
Expand Down
13 changes: 13 additions & 0 deletions cmake/findDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ if(BUILD_GUI)
find_package(Qt5 COMPONENTS ${qt_components} REQUIRED)
set(QT_VERSION "${Qt5Core_VERSION_STRING}")
endif()

if(BUILD_ONLINE_HELP)
find_program(QHELPGENERATOR qhelpgenerator)
if(NOT QHELPGENERATOR)
# TODO: how to properly get the Qt binary folder?
# piggy-back off Qt::qmake for now as it should be in the same folder as the binary we are looking for
get_target_property(_qmake_executable Qt::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir ${_qmake_executable} DIRECTORY)
message(STATUS "qhelpgenerator not found in PATH - trying ${_qt_bin_dir}")
# cannot be mandatory since qhelpgenerator is missing from the official qttools Linux package - https://bugreports.qt.io/browse/QTBUG-116168
find_program(QHELPGENERATOR qhelpgenerator HINTS ${_qt_bin_dir} REQUIRED)
endif()
endif()
endif()

if(HAVE_RULES)
Expand Down
1 change: 1 addition & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ option(BUILD_GUI "Build the qt application"
option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF)
option(USE_QT6 "Prefer Qt6 when available" OFF)
option(REGISTER_GUI_TESTS "Register GUI tests in CTest" ON)
option(BUILD_ONLINE_HELP "Build online help" OFF)

option(HAVE_RULES "Usage of rules (needs PCRE library and headers)" OFF)
option(USE_BUNDLED_TINYXML2 "Usage of bundled tinyxml2 library" ON)
Expand Down
1 change: 1 addition & 0 deletions cmake/printInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ if(BUILD_GUI)
message(STATUS "Qt5Core_LIBRARIES = ${Qt5Core_LIBRARIES}")
message(STATUS "Qt5Core_INCLUDE_DIRS = ${Qt5Core_INCLUDE_DIRS}")
endif()
message(STATUS "QHELPGENERATOR = ${QHELPGENERATOR}")
endif()
message(STATUS)
message(STATUS "HAVE_RULES = ${HAVE_RULES}")
Expand Down
6 changes: 6 additions & 0 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ CheckOptions:
target_compile_options_safe(cppcheck-gui -Wno-redundant-parens)
endif()

if (QHELPGENERATOR)
# TODO: generate in CMAKE_BINARY_DIR folder
add_custom_target(online-help.qhc ${QHELPGENERATOR} ${CMAKE_CURRENT_SOURCE_DIR}/help/online-help.qhcp -o ${CMAKE_CURRENT_SOURCE_DIR}/help/online-help.qhc)
add_dependencies(cppcheck-gui online-help.qhc)
endif()

install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)

Expand Down

0 comments on commit 277cc87

Please sign in to comment.