Skip to content

Commit

Permalink
Merge pull request #1 from berkowski/dev/qt6
Browse files Browse the repository at this point in the history
Update TowCam GUI build infrastructure
  • Loading branch information
berkowski authored Aug 5, 2024
2 parents a48c5d6 + d6868e9 commit 4abc9b6
Show file tree
Hide file tree
Showing 13 changed files with 35,814 additions and 19,404 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
# name: CMake on multiple platforms

on: push

jobs:
build:
permissions:
contents: write
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: true

matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
build_type: [Release]
include:
- os: windows-latest
cpack_generator: ZIP
binary_package: "*windows*zip"
- os: ubuntu-latest
cpack_generator: TGZ
binary_package: "*linux*tar.gz"
- os: macos-latest
cpack_generator: DragNDrop
binary_package: "*darwin*dmg"
- os: macos-13
cpack_generator: DragNDrop
binary_package: "*darwin*dmg"

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.7.1'
install-deps: 'true'
modules: 'qtserialport'
set-env: 'true'
aqtversion: '==3.1.*'
cache: 'true'

- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

# - name: Package Source
# if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v') }}
# run: |
# cd ${{ steps.strings.outputs.build-output-dir }}
# cpack -G "TGZ;ZIP" --config CPackSourceConfig.cmake

# - name: Upload Source Archives
# if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v') }}
# uses: ncipollo/release-action@v1
# with:
# artifacts: "${{ steps.strings.outputs.build-output-dir }}/*Source.*"

- name: Package Binary
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
cd ${{ steps.strings.outputs.build-output-dir }}
cpack -G "${{ matrix.cpack_generator }}" --config CPackConfig.cmake
- name: Upload Binary Archives
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ncipollo/release-action@v1
with:
artifacts: "${{ steps.strings.outputs.build-output-dir }}/${{ matrix.binary_package }}"
allowUpdates: 'true'
175 changes: 175 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# Created by https://www.toptal.com/developers/gitignore/api/qt,c++,emacs,vim
# Edit at https://www.toptal.com/developers/gitignore?templates=qt,c++,emacs,vim

### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

### CMake Patch ###
# External projects
*-prefix/

### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# Org-mode
.org-id-locations
*_archive

# flymake-mode
*_flymake.*

# eshell files
/eshell/history
/eshell/lastdir

# elpa packages
/elpa/

# reftex files
*.rel

# AUCTeX auto folder
/auto/

# cask packages
.cask/
dist/

# Flycheck
flycheck_*.el

# server auth directory
/server/

# projectiles files
.projectile

# directory configuration
.dir-locals.el

# network security
/network-security.data


### Qt ###
# C++ objects and libs
*.so.*

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*

# QtCreator 4.8< compilation database
compile_commands.json

# QtCreator local machine specific files for imported projects
*creator.user*

*_qmlcache.qrc

### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

# End of https://www.toptal.com/developers/gitignore/api/qt,c++,emacs,vim

build/
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# TowCam GUI Changelog

## [1.2 (2024-08-05)]

### Changed
- Use CMake for building
- Remove calls to QDateTime::toTime (method deprecated in Qt5, removed in Qt6)
- Update QCustomPlot to version 2
- Increase font size to 12pt
- Add ability to hide (unused) switch widgets in GUI (they still exist, but are set invisible)

### Added
- This CHANGELOG.md
- github workflow to build on linux (ubuntu), windows, and osx and upload artifacts for tags starting with 'v' as releases

## [1.1]
Previous versioned release - predates this changelog

75 changes: 75 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
cmake_minimum_required(VERSION 3.25)

project(towcam
VERSION 1.2
LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

find_package(Qt6 REQUIRED COMPONENTS Widgets Gui Network Core PrintSupport)
qt_standard_project_setup()

qt_add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME}
PRIVATE
main.cpp
ini_file.h
ini_file.cpp
qcustomplot.h
qcustomplot.cpp
TowCam.h
TowCam.cpp
TowcamSocketThread.h
TowcamSocketThread.cpp
compilation.h
HCLog.h
HCLog.cpp
)

target_compile_definitions(${PROJECT_NAME}
PRIVATE TOWCAM_VERSION_MAJOR="${PROJECT_VERSION_MAJOR}"
TOWCAM_VERSION_MINOR="${PROJECT_VERSION_MINOR}")

target_link_libraries(${PROJECT_NAME} PRIVATE Qt::Widgets Qt::Gui Qt::Network Qt::PrintSupport)

if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE)
endif()

if(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
endif()

install(TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
TARGET ${PROJECT_NAME}
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
NO_TRANSLATIONS
DEPLOY_TOOL_OPTIONS ${DEPLOY_TOOL_OPTIONS}
# Fedora installs Qt libraries into /lib64, which is excluded due to QT_DEPLOY_IGNORED_LIB_DIRS
# POST_INCLUDE_REGEXES here will make sure at at least the Qt libraries are grabbed.
POST_INCLUDE_REGEXES "libQt6.*"
)


install(SCRIPT ${deploy_script})

set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
string(TOLOWER "${CPACK_PACKAGE_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
set(CPACK_VERBATIM_VARIABLES ON)
if(NOT APPLE)
set(CPACK_PACKAGING_INSTALL_PREFIX "/${PROJECT_NAME}")
endif()
cmake_path(RELATIVE_PATH CMAKE_BINARY_DIR BASE_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE RELATIVE_BINARY_DIR)
set(CPACK_SOURCE_IGNORE_FILES /${RELATIVE_BINARY_DIR}/;/\\.cache/;/\\.git/)
include(CPack)
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# WHOI TowCam Data Logging GUI
A simple logging GUI for MISO TowCam: https://www2.whoi.edu/site/miso/miso-instrumentation/towcam/
The GUI displays live feeds of TowCam altimeter, depth, and forward-looking altimeter (if installed)
for use during operations.

- Source repository: https://github.com/WHOIGit/TowCam/

# Building

The TowCam GUI requires Qt6 (https://www.qt.io/download-open-source) and CMake (https://cmake.org/).
Obtaining Qt and CMake varies by OS. Additionally, for XCode (https://developer.apple.com/xcode/)
is required for building TowCam for Apple OSX.

To build TowCam:

```
git clone https://github.com/WHOIGit/TowCam # Clone this git repository
cd towcam
mkdir build && cd build # Make a build directory
cmake .. && cmake --build . # Configure and build the 'towcam' application.
cpack -G $GEN # Package the application. Typical values of $GEN would be:
# Windows: ZIP (ZIP archive w/ Qt libraries)
# Linux: TGZ (gzipped tar archive (.tar.gz) w/ Qt libraries)
# OSX: DragNDrop (Disk image (.dmg) with shortcut to Applications for install)
```

# Configuration
The GUI looks for a file named `towcam.ini` in the `Desktop` folder. An example configuration file
is provided in this repository.

# Logging
Data is logged to a folder named `towcamData` that will be created in the `Desktop` folder.
Loading

0 comments on commit 4abc9b6

Please sign in to comment.