Compare commits
6 Commits
master
...
v4.2-branc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df401bc87e | ||
|
|
ec7bb26873 | ||
|
|
e10284d2cf | ||
|
|
fbb3d16f51 | ||
|
|
90224c273b | ||
|
|
a5c282f939 |
18
.DEREK.yml
@ -1,18 +0,0 @@
|
||||
maintainers:
|
||||
- dirkhh
|
||||
- neolit123
|
||||
- atdotde
|
||||
- torvalds
|
||||
- glance-
|
||||
- mturkia
|
||||
- janmulder
|
||||
- tcanabrava
|
||||
- bstoeger
|
||||
- sfuchs79
|
||||
- janiversen
|
||||
- jbygdell
|
||||
|
||||
features:
|
||||
- dco_check
|
||||
- comments
|
||||
- pr_description_required
|
||||
@ -1,23 +1,22 @@
|
||||
AccessModifierOffset: -8 # so public: and private: stays at the left site
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AccessModifierOffset: -8 # so public: and private: stays at the left site
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
BinPackParameters: true
|
||||
BreakBeforeBinaryOperators: false
|
||||
BreakBeforeBraces: Linux
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 0
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
ForEachMacros: [ 'for_each_dc', 'for_each_relevant_dc', 'for_each_dive', 'for_each_line' ]
|
||||
ColumnLimit: 0
|
||||
IndentFunctionDeclarationAfterType: false #personal taste, good for long methods
|
||||
IndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: All
|
||||
PointerBindsToType: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
# SpaceBeforeParens doesn't work --> SpaceBeforeParens: ControlStatements
|
||||
SpacesBeforeTrailingComments: 1
|
||||
# doesn't work --> SpaceBeforeParens: ControlStatements
|
||||
SpacesInParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
UseTab: Always
|
||||
PointerBindsToType: false
|
||||
# doesn't work, yet -> ForEachMacros: "Q_FOREACH"
|
||||
|
||||
6
.gitattributes
vendored
@ -1,8 +1,2 @@
|
||||
.gitignore export-ignore
|
||||
.gitattributes export-ignore
|
||||
Documentation/*.html.git text=auto
|
||||
theme/jqplot.canvasAxisTickRenderer.min.js binary
|
||||
theme/jqplot.highlighter.min.js binary
|
||||
theme/jquery.jqplot.min.js binary
|
||||
theme/jquery.min.js binary
|
||||
CHANGELOG.md -text merge=union
|
||||
|
||||
2
.github/FUNDING.yml
vendored
@ -1,2 +0,0 @@
|
||||
github: subsurface
|
||||
ko_fi: dirkhh
|
||||
39
.github/ISSUE_TEMPLATE.md
vendored
@ -1,39 +0,0 @@
|
||||
<!-- Lines like this one are comments and will not be shown in the final output. -->
|
||||
<!-- If you are a collaborator, please add labels and assign other collaborators for a review. -->
|
||||
|
||||
### Describe the issue:
|
||||
<!-- Replace [ ] with [x] to select options. -->
|
||||
- [ ] Bug
|
||||
- [ ] Change request
|
||||
- [ ] New feature request
|
||||
- [ ] Discussion request
|
||||
|
||||
### Issue long description:
|
||||
<!-- Describe the issue in detail. -->
|
||||
|
||||
### Operating system:
|
||||
<!-- What OS are you running, including OS version and the language that you are running in -->
|
||||
<!-- What device are you using? -->
|
||||
<!-- Only answer this question if you have tried: Does the same happen on another OS? -->
|
||||
|
||||
### Subsurface version:
|
||||
<!-- What version of Subsurface are you running? -->
|
||||
<!-- Does the same happen on another Subsurface version? -->
|
||||
<!-- Are you using official release, test build, or compiled yourself? -->
|
||||
<!-- Provide Git hash if your are building Subsurface yourself. -->
|
||||
|
||||
### Steps to reproduce:
|
||||
<!-- Provide reproduction steps separated with new lines - 1), 2), 3)... -->
|
||||
|
||||
### Current behavior:
|
||||
<!-- What is the current behavior? -->
|
||||
|
||||
### Expected behavior:
|
||||
<!-- What is the expected behavior? -->
|
||||
|
||||
### Additional information:
|
||||
<!-- If a simple dive log file can reproduce the issue, please attach that to the report. -->
|
||||
<!-- With dive computer download issues consider adding Subsurface log file and Subsurface dumpfile to the report. -->
|
||||
|
||||
### Mentions:
|
||||
<!-- Mention users that you want to review your issue with @<user-name>. Leave empty if not sure. -->
|
||||
39
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,39 +0,0 @@
|
||||
<!-- Lines like this one are comments and will not be shown in the final output. -->
|
||||
<!-- Make sure that you have read the "Contributing" section of the README and also the notes in CodingStyle. -->
|
||||
<!-- If you are a collaborator, please add labels and assign other collaborators for a review. -->
|
||||
|
||||
### Describe the pull request:
|
||||
<!-- Replace [ ] with [x] to select options. -->
|
||||
- [ ] Bug fix
|
||||
- [ ] Functional change
|
||||
- [ ] New feature
|
||||
- [ ] Code cleanup
|
||||
- [ ] Build system change
|
||||
- [ ] Documentation change
|
||||
- [ ] Language translation
|
||||
|
||||
### Pull request long description:
|
||||
<!-- Describe your pull request in detail. -->
|
||||
|
||||
### Changes made:
|
||||
<!-- Enumerate the changes with 1), 2), 3) etc. -->
|
||||
<!-- Ensure the test cases are updated if needed. -->
|
||||
|
||||
### Related issues:
|
||||
<!-- Reference issues with #<issue-num>. -->
|
||||
<!-- Write "Fixes #<issue-num" to notify Github that this PR fixes an issue. -->
|
||||
|
||||
### Additional information:
|
||||
<!-- Include sample dive log or other relevant information to allow testing the change where feasible. -->
|
||||
|
||||
### Release note:
|
||||
<!-- Describe if this change needs a release note present in CHANGELOG.md. -->
|
||||
<!-- Also, please make sure to add the release note on top of the file CHANGELOG.md. -->
|
||||
|
||||
### Documentation change:
|
||||
<!-- If this PR makes changes to user functionality, then the documentation has to be updated too. -->
|
||||
<!-- Please, briefly outline here what has changed in terms of the user experience (UX). -->
|
||||
<!-- If UX changes have been made, a maintainer should apply the 'needs-documentation-change' label. -->
|
||||
|
||||
### Mentions:
|
||||
<!-- Mention users that you want to review your pull request with @<user-name>. Leave empty if not sure. -->
|
||||
56
.github/actions/manage-version/action.yml
vendored
@ -1,56 +0,0 @@
|
||||
name: Manage the Subsurface CICD versioning
|
||||
|
||||
inputs:
|
||||
no-increment:
|
||||
description: 'Only get the current version, do not increment it even for push events (Caution: not actually a boolean)'
|
||||
default: false
|
||||
nightly-builds-secret:
|
||||
description: The secret to access the nightly builds repository
|
||||
default: ''
|
||||
|
||||
outputs:
|
||||
version:
|
||||
description: The long form version number
|
||||
value: ${{ steps.version_number.outputs.version }}
|
||||
buildnr:
|
||||
description: The build number
|
||||
value: ${{ steps.version_number.outputs.buildnr }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: atomically create or retrieve the build number and assemble release notes for a push (i.e. merging of a pull request)
|
||||
if: github.event_name == 'push' && inputs.no-increment == 'false'
|
||||
env:
|
||||
NIGHTLY_BUILDS_SECRET: ${{ inputs.nightly-builds-secret }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -z "$NIGHTLY_BUILDS_SECRET" ]; then
|
||||
echo "Need to supply the secret for the nightly-builds repository to increment the version number, aborting."
|
||||
exit 1
|
||||
fi
|
||||
scripts/get-atomic-buildnr.sh $GITHUB_SHA $NIGHTLY_BUILDS_SECRET "CICD-release"
|
||||
|
||||
- name: retrieve the current version number in all other cases
|
||||
if: github.event_name != 'push' || inputs.no-increment != 'false'
|
||||
env:
|
||||
PULL_REQUEST_BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "pull-request-$PULL_REQUEST_BRANCH" > latest-subsurface-buildnumber-extension
|
||||
|
||||
- name: store version number for the build
|
||||
id: version_number
|
||||
env:
|
||||
PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
# For a pull request we need the information from the pull request branch
|
||||
# and not from the merge branch on the pull request
|
||||
git checkout $PULL_REQUEST_HEAD_SHA
|
||||
version=$(scripts/get-version.sh)
|
||||
echo "version=$version" >> $GITHUB_OUTPUT
|
||||
buildnr=$(scripts/get-version.sh 1)
|
||||
echo "buildnr=$buildnr" >> $GITHUB_OUTPUT
|
||||
git checkout $GITHUB_SHA
|
||||
37
.github/workflows/android-dockerimage.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: Android Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- scripts/docker/android-build-container/**
|
||||
- .github/workflows/android-dockerimage.yml
|
||||
|
||||
jobs:
|
||||
android-build-container:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VERSION: ${{ '5.15.2' }} # the version numbers here is based on the Qt version, the third digit is the rev of the docker image
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build the name for the docker image
|
||||
id: build_name
|
||||
run: |
|
||||
v=$VERSION
|
||||
b=$GITHUB_REF # -BRANCH suffix, unless the branch is master
|
||||
b=${b/refs\/heads\//}
|
||||
b=${b,,} # the name needs to be all lower case
|
||||
if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi
|
||||
echo "NAME=$GITHUB_REPOSITORY_OWNER/android-build${b}:${v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and Publish Linux Docker image to Dockerhub
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: ${{ steps.build_name.outputs.NAME }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
dockerfile: 'Dockerfile'
|
||||
workdir: './scripts/docker/android-build-container/'
|
||||
91
.github/workflows/android.yml
vendored
@ -1,91 +0,0 @@
|
||||
name: Android
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
KEYSTORE_FILE: ${{ github.workspace }}/../subsurface.keystore
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker://subsurface/android-build:5.15.2
|
||||
|
||||
steps:
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: set up the keystore
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > $KEYSTORE_FILE
|
||||
|
||||
- name: run build
|
||||
id: build
|
||||
env:
|
||||
KEYSTORE_PASSWORD: pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||
KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
|
||||
BUILDNR: ${{ steps.version_number.outputs.buildnr }}
|
||||
run: |
|
||||
# this is rather awkward, but it allows us to use the preinstalled
|
||||
# Android and Qt versions with relative paths
|
||||
cd ..
|
||||
ln -s /android/5.15.* .
|
||||
ln -s /android/build-tools .
|
||||
ln -s /android/cmdline-tools .
|
||||
ln -s /android/ndk .
|
||||
ln -s /android/platform-tools .
|
||||
ln -s /android/platforms .
|
||||
ln -s /android/tools .
|
||||
git config --global user.email "ci@subsurface-divelog.org"
|
||||
git config --global user.name "Subsurface CI"
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
|
||||
# get the build number via curl so this works both for a pull request as well as a push
|
||||
export OUTPUT_DIR="$GITHUB_WORKSPACE"
|
||||
bash -x ./subsurface/packaging/android/qmake-build.sh -buildnr $BUILDNR
|
||||
|
||||
- name: delete the keystore
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
rm $KEYSTORE_FILE
|
||||
|
||||
- name: publish pull request artifacts
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Subsurface-Android-${{ steps.version_number.outputs.version }}
|
||||
path: Subsurface-mobile-*.apk
|
||||
|
||||
# only publish a 'release' on push events (those include merging a PR)
|
||||
- name: upload binaries
|
||||
if: github.event_name == 'push'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: ${{ github.repository_owner }}/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
Subsurface-mobile-${{ steps.version_number.outputs.version }}.apk
|
||||
24
.github/workflows/artifact-links.yml
vendored
@ -1,24 +0,0 @@
|
||||
name: Add artifact links to pull request
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Ubuntu 16.04 / Qt 5.15-- for AppImage", "Mac", "Windows", "Android", "iOS"]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
artifacts-url-comments:
|
||||
name: Add artifact links to PR and issues
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Add artifact links to PR and issues
|
||||
if: github.event.workflow_run.event == 'pull_request'
|
||||
uses: tonyhallett/artifacts-url-comments@v1.1.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
prefix: "**Artifacts:**"
|
||||
suffix: "_**WARNING:** Use at your own risk._"
|
||||
format: name
|
||||
addTo: pull
|
||||
errorNoArtifacts: false
|
||||
69
.github/workflows/codeql-analysis.yml
vendored
@ -1,69 +0,0 @@
|
||||
# Modified from the sample workflow suggested by GitHub/Semmle
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
# once this works, this should be
|
||||
# branches: [master]
|
||||
branches: [master, codeQL]
|
||||
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
|
||||
schedule:
|
||||
- cron: '0 2 * * 6'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Override automatic language detection by changing the below list
|
||||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
||||
language: ['c-cpp', 'javascript-typescript']
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: get container ready for build
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y -q \
|
||||
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
|
||||
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
|
||||
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
|
||||
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
|
||||
pkg-config qml-module-qtlocation qml-module-qtpositioning \
|
||||
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
|
||||
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
|
||||
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
|
||||
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd ..
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
|
||||
bash -e -x subsurface/scripts/build.sh -desktop -build-with-webkit
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
56
.github/workflows/coverity-scan.yml
vendored
@ -1,56 +0,0 @@
|
||||
name: Coverity Scan Linux Qt 5.9
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 18 * * *' # Daily at 18:00 UTC
|
||||
|
||||
jobs:
|
||||
CoverityScanBuildOnUbuntu:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:22.04
|
||||
|
||||
steps:
|
||||
- name: add build dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get dist-upgrade -y
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
|
||||
wget curl \
|
||||
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
|
||||
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
|
||||
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
|
||||
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
|
||||
pkg-config qml-module-qtlocation qml-module-qtpositioning \
|
||||
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
|
||||
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
|
||||
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
|
||||
qtquickcontrols2-5-dev libbluetooth-dev libmtp-dev
|
||||
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: configure environment
|
||||
run: |
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
|
||||
|
||||
- name: get the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
no-increment: true
|
||||
|
||||
- name: run coverity scan
|
||||
uses: vapier/coverity-scan-action@v1
|
||||
with:
|
||||
project: Subsurface-divelog/subsurface
|
||||
token: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||
email: glance@acc.umu.se
|
||||
command: subsurface/scripts/build.sh -desktop -build-with-webkit
|
||||
working-directory: ${{ github.workspace }}/..
|
||||
version: ${{ steps.version_number.outputs.version }}
|
||||
description: Automatic scan on github actions
|
||||
36
.github/workflows/documentation.yml
vendored
@ -1,36 +0,0 @@
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- Documentation
|
||||
- .github/workflows/documentation.yml
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- Documentation
|
||||
- .github/workflows/documentation.yml
|
||||
|
||||
jobs:
|
||||
documentation:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Install Packages
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install asciidoc docbook-xml w3m
|
||||
|
||||
- name: Checkout Sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Process the Documentation
|
||||
id: process_documentation
|
||||
working-directory: Documentation
|
||||
run: make
|
||||
59
.github/workflows/fedora-copr-build.yml
vendored
@ -1,59 +0,0 @@
|
||||
name: Fedora Copr Build
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
- current
|
||||
|
||||
jobs:
|
||||
setup-build:
|
||||
name: Submit build to Fedora COPR
|
||||
# this seems backwards, but we want to run under Fedora, but Github doesn' support that
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: fedora:latest
|
||||
|
||||
steps:
|
||||
- name: Setup build dependencies in the Fedora container
|
||||
run: |
|
||||
dnf -y install @development-tools @rpm-development-tools
|
||||
dnf -y install copr-cli make
|
||||
|
||||
- name: Check out sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: setup git
|
||||
run: |
|
||||
git config --global --add safe.directory /__w/subsurface/subsurface
|
||||
git config --global --add safe.directory /__w/subsurface/subsurface/libdivecomputer
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: Setup API token for copr-cli
|
||||
env:
|
||||
API_TOKEN: ${{ secrets.COPR_TOKEN }}
|
||||
API_LOGIN: ${{ secrets.COPR_LOGIN }}
|
||||
run: |
|
||||
mkdir -p "$HOME/.config"
|
||||
cp packaging/copr/config.copr "$HOME/.config/copr"
|
||||
sed -i "s/API_TOKEN/$API_TOKEN/;s/API_LOGIN/$API_LOGIN/" "$HOME/.config/copr"
|
||||
|
||||
- name: Checkout googlemaps
|
||||
run: |
|
||||
cd ..
|
||||
git clone https://github.com/subsurface/googlemaps
|
||||
|
||||
- name: run the copr build script
|
||||
run: |
|
||||
cd ..
|
||||
bash -x subsurface/packaging/copr/make-package.sh $GITHUB_REF_NAME
|
||||
|
||||
61
.github/workflows/ios.yml
vendored
@ -1,61 +0,0 @@
|
||||
name: iOS
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macOS-11
|
||||
steps:
|
||||
- name: switch to Xcode 11
|
||||
run: sudo xcode-select -s "/Applications/Xcode_11.7.app"
|
||||
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: setup Homebrew
|
||||
run: brew install autoconf automake libtool pkg-config
|
||||
|
||||
- name: checkout Qt resources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: subsurface/qt-ios
|
||||
ref: main
|
||||
path: qt-ios
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: build Subsurface-mobile for iOS
|
||||
env:
|
||||
VERSION: ${{ steps.version_number.outputs.version }}
|
||||
run: |
|
||||
cd ..
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
|
||||
export IOS_QT=$GITHUB_WORKSPACE/qt-ios
|
||||
echo "build for simulator"
|
||||
bash -x $GITHUB_WORKSPACE/packaging/ios/build.sh -simulator
|
||||
# We need this in order to be able to access the file and publish it
|
||||
mv build-Subsurface-mobile-Qt_5_14_1_for_iOS-Release/Release-iphonesimulator/Subsurface-mobile.app $GITHUB_WORKSPACE/Subsurface-mobile-$VERSION.app
|
||||
|
||||
- name: publish artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Subsurface-iOS-${{ steps.version_number.outputs.version }}
|
||||
path: Subsurface-mobile-*.app
|
||||
100
.github/workflows/linux-debian-generic.yml
vendored
@ -1,100 +0,0 @@
|
||||
name: Generic workflow for Debian and derivatives
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
container-image:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ inputs.container-image }}
|
||||
|
||||
steps:
|
||||
- name: get container ready for build
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "update distro and install dependencies"
|
||||
|
||||
apt-get update
|
||||
apt-get dist-upgrade -y
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
|
||||
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
|
||||
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
|
||||
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
|
||||
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
|
||||
pkg-config qml-module-qtlocation qml-module-qtpositioning \
|
||||
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
|
||||
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
|
||||
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
|
||||
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev \
|
||||
mdbtools-dev
|
||||
|
||||
git config --global user.email "ci@subsurface-divelog.org"
|
||||
git config --global user.name "Subsurface CI"
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
|
||||
# needs git from the previous step
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
no-increment: true
|
||||
|
||||
- name: build subsurface-mobile
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "building mobile"
|
||||
cd ..
|
||||
bash -e -x subsurface/scripts/build.sh -mobile
|
||||
|
||||
- name: test mobile build
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "running tests for mobile"
|
||||
|
||||
cd build-mobile/tests
|
||||
# xvfb-run --auto-servernum ./TestGitStorage -v2
|
||||
xvfb-run --auto-servernum make check
|
||||
|
||||
- name: build subsurface
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "building desktop"
|
||||
|
||||
# now build for the desktop version (including WebKit)
|
||||
cd ..
|
||||
bash -e -x subsurface/scripts/build.sh -desktop -build-with-webkit
|
||||
|
||||
- name: test desktop build
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "running tests for desktop"
|
||||
cd build/tests
|
||||
# xvfb-run --auto-servernum ./TestGitStorage -v2
|
||||
xvfb-run --auto-servernum make check
|
||||
|
||||
- name: build subsurface-downloader
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "building downloader"
|
||||
cd ..
|
||||
bash -e -x subsurface/scripts/build.sh -downloader
|
||||
|
||||
- name: build smtk2ssrf
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "building smtk2ssrf"
|
||||
|
||||
# build smtk2ssrf (needs the artefacts generated by the subsurface build
|
||||
cd ..
|
||||
bash -e -x subsurface/scripts/smtk2ssrf-build.sh -y
|
||||
19
.github/workflows/linux-debian-trixie-5.15.yml
vendored
@ -1,19 +0,0 @@
|
||||
name: Debian trixie / Qt 5.15--
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
do-build-test:
|
||||
uses: ./.github/workflows/linux-debian-generic.yml
|
||||
with:
|
||||
container-image: debian:trixie
|
||||
68
.github/workflows/linux-fedora-35-qt6.yml
vendored
@ -1,68 +0,0 @@
|
||||
name: Fedora 35 / Qt 6--
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: fedora:35
|
||||
|
||||
steps:
|
||||
- name: get container ready for build
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "update distro and install dependencies"
|
||||
|
||||
dnf update -y
|
||||
dnf install -y autoconf automake bluez-libs-devel cmake gcc-c++ git-core \
|
||||
libcurl-devel libsqlite3x-devel libssh2-devel libtool libudev-devel \
|
||||
libusbx-devel libxml2-devel libxslt-devel make \
|
||||
qt6-qtbase-devel qt6-qtconnectivity-devel qt6-qtdeclarative-devel \
|
||||
qt6-qtlocation-devel qt6-qtsvg-devel \
|
||||
qt6-qttools-devel redhat-rpm-config \
|
||||
libxkbcommon-devel qt6-qt5compat-devel \
|
||||
bluez-libs-devel libgit2-devel libzip-devel libmtp-devel \
|
||||
xorg-x11-server-Xvfb
|
||||
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
no-increment: true
|
||||
|
||||
- name: build Subsurface
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "building desktop"
|
||||
|
||||
# now build for the desktop version (without WebKit)
|
||||
cd ..
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
|
||||
git config --global --get-all safe.directory
|
||||
bash -e -x subsurface/scripts/build.sh -desktop -build-with-qt6
|
||||
|
||||
- name: test desktop build
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "running tests for desktop"
|
||||
cd build/tests
|
||||
xvfb-run --auto-servernum make check
|
||||
|
||||
80
.github/workflows/linux-snap.yml
vendored
@ -1,80 +0,0 @@
|
||||
name: Snap
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
Snap:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: store dummy version and build number for pull request
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
echo "100" > latest-subsurface-buildnumber
|
||||
echo "CICD-pull-request" > latest-subsurface-buildnumber-extension
|
||||
|
||||
- name: Set up LXD
|
||||
uses: canonical/setup-lxd@main
|
||||
|
||||
- name: Set up CCache
|
||||
id: setup-ccache
|
||||
run: |
|
||||
sudo apt-get install ccache
|
||||
mkdir -p ${HOME}/.ccache
|
||||
ccache --max-size=2G
|
||||
/snap/bin/lxc profile device add default ccache disk source=${HOME}/.ccache/ path=/root/.ccache
|
||||
|
||||
# Patch snapcraft.yaml to enable ccache
|
||||
patch -p1 < .github/workflows/scripts/linux-snap.patch
|
||||
|
||||
# Find common base between master and HEAD to use as cache key.
|
||||
git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin master
|
||||
echo "key=$( git merge-base origin/master $GITHUB_SHA )" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: CCache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
key: ccache-${{ runner.os }}-${{ steps.setup-ccache.outputs.key }}
|
||||
restore-keys: |
|
||||
ccache-${{ runner.os }}-
|
||||
path: ~/.ccache/**
|
||||
|
||||
- name: Build and verify the snap
|
||||
uses: canonical/actions/build-snap@release
|
||||
id: build-snap
|
||||
with:
|
||||
setup-lxd: false
|
||||
|
||||
- name: Clear CCache stats
|
||||
run: ccache --show-stats --zero-stats
|
||||
|
||||
- name: Upload the snap
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.build-snap.outputs.snap-name }}
|
||||
path: ${{ steps.build-snap.outputs.snap-path }}
|
||||
if-no-files-found: error
|
||||
@ -1,149 +0,0 @@
|
||||
name: Ubuntu 16.04 / Qt 5.15-- for AppImage
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:16.04
|
||||
|
||||
steps:
|
||||
- name: get container ready for build
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "update distro and install dependencies"
|
||||
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
|
||||
software-properties-common
|
||||
|
||||
add-apt-repository -y ppa:savoury1/qt-5-15
|
||||
add-apt-repository -y ppa:savoury1/kde-5-80
|
||||
add-apt-repository -y ppa:savoury1/gpg
|
||||
add-apt-repository -y ppa:savoury1/ffmpeg4
|
||||
add-apt-repository -y ppa:savoury1/vlc3
|
||||
add-apt-repository -y ppa:savoury1/gcc-9
|
||||
add-apt-repository -y ppa:savoury1/display
|
||||
add-apt-repository -y ppa:savoury1/apt-xenial
|
||||
add-apt-repository -y ppa:savoury1/gtk-xenial
|
||||
add-apt-repository -y ppa:savoury1/qt-xenial
|
||||
add-apt-repository -y ppa:savoury1/kde-xenial
|
||||
add-apt-repository -y ppa:savoury1/backports
|
||||
add-apt-repository -y ppa:savoury1/build-tools
|
||||
apt-get update
|
||||
apt-get dist-upgrade -y
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
|
||||
autoconf automake cmake g++ g++-9 git libcrypto++-dev libcurl4-gnutls-dev \
|
||||
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
|
||||
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
|
||||
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
|
||||
pkg-config qml-module-qtlocation qml-module-qtpositioning \
|
||||
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
|
||||
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
|
||||
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
|
||||
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev liblzma-dev \
|
||||
curl
|
||||
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-9
|
||||
|
||||
- name: checkout sources
|
||||
# We cannot update this as glibc on 16.04 is too old for node 20.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: build Subsurface
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "building desktop"
|
||||
|
||||
# now build the appimage
|
||||
cd ..
|
||||
bash -e -x subsurface/scripts/build.sh -desktop -create-appdir -build-with-webkit
|
||||
|
||||
- name: test desktop build
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "running tests for desktop"
|
||||
cd build/tests
|
||||
# xvfb-run --auto-servernum ./TestGitStorage -v2
|
||||
xvfb-run --auto-servernum make check
|
||||
|
||||
- name: build appimage
|
||||
env:
|
||||
VERSION: ${{ steps.version_number.outputs.version }}
|
||||
run: |
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "assembling AppImage"
|
||||
|
||||
export QT_PLUGIN_PATH=$QT_ROOT/plugins
|
||||
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
|
||||
export QT_DEBUG_PLUGINS=1
|
||||
|
||||
cd ..
|
||||
|
||||
# set up the appdir
|
||||
mkdir -p appdir/usr/plugins/
|
||||
|
||||
# mv googlemaps plugins into place
|
||||
mv appdir/usr/usr/lib/x86_64-linux-gnu/qt5/plugins/* appdir/usr/plugins # the usr/usr is not a typo, that's where it ends up
|
||||
rm -rf appdir/usr/home/ appdir/usr/include/ appdir/usr/share/man/ # No need to ship developer and man files as part of the AppImage
|
||||
rm -rf appdir/usr/usr appdir/usr/lib/x86_64-linux-gnu/cmake appdir/usr/lib/pkgconfig
|
||||
cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 appdir/usr/lib/
|
||||
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 appdir/usr/lib/
|
||||
|
||||
# get the linuxdeployqt tool and run it to collect the libraries
|
||||
curl -L -O "https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage"
|
||||
chmod a+x linuxdeployqt*.AppImage
|
||||
unset QTDIR
|
||||
unset QT_PLUGIN_PATH
|
||||
unset LD_LIBRARY_PATH
|
||||
./linuxdeployqt*.AppImage --appimage-extract-and-run ./appdir/usr/share/applications/*.desktop -exclude-libs=libdbus-1.so.3 -bundle-non-qt-libs -qmldir=./subsurface/stats -qmldir=./subsurface/map-widget/ -verbose=2
|
||||
|
||||
# create the AppImage
|
||||
./linuxdeployqt*.AppImage --appimage-extract-and-run ./appdir/usr/share/applications/*.desktop -exclude-libs=libdbus-1.so.3 -appimage -qmldir=./subsurface/stats -qmldir=./subsurface/map-widget/ -verbose=2
|
||||
|
||||
# copy AppImage to the calling VM
|
||||
# with GitHub Actions the $GITHUB_WORKSPACE directory is the current working directory at the start of a step
|
||||
cp Subsurface*.AppImage* $GITHUB_WORKSPACE/Subsurface-$VERSION.AppImage
|
||||
|
||||
- name: PR artifacts
|
||||
if: github.event_name == 'pull_request'
|
||||
# We cannot update this as glibc on 16.04 is too old for node 20.
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Subsurface-Linux-AppImage-${{ steps.version_number.outputs.version }}
|
||||
path: Subsurface-*.AppImage
|
||||
compression-level: 0
|
||||
|
||||
# only publish a 'release' on push events (those include merging a PR)
|
||||
- name: upload binaries
|
||||
if: github.event_name == 'push'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: ${{ github.repository_owner }}/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
./Subsurface-*.AppImage
|
||||
19
.github/workflows/linux-ubuntu-20.04-5.15.yml
vendored
@ -1,19 +0,0 @@
|
||||
name: Ubuntu 20.04 / Qt 5.12--
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
do-build-test:
|
||||
uses: ./.github/workflows/linux-debian-generic.yml
|
||||
with:
|
||||
container-image: ubuntu:20.04
|
||||
19
.github/workflows/linux-ubuntu-22.04-5.15.yml
vendored
@ -1,19 +0,0 @@
|
||||
name: Ubuntu 22.04 / Qt 5.15--
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
do-build-test:
|
||||
uses: ./.github/workflows/linux-debian-generic.yml
|
||||
with:
|
||||
container-image: ubuntu:22.04
|
||||
19
.github/workflows/linux-ubuntu-24.04-5.15.yml
vendored
@ -1,19 +0,0 @@
|
||||
name: Ubuntu 24.04 / Qt 5.15--
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
do-build-test:
|
||||
uses: ./.github/workflows/linux-debian-generic.yml
|
||||
with:
|
||||
container-image: ubuntu:24.04
|
||||
80
.github/workflows/mac.yml
vendored
@ -1,80 +0,0 @@
|
||||
name: Mac
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macOS-11
|
||||
steps:
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: setup Homebrew
|
||||
run: brew install hidapi libxslt libjpg libmtp create-dmg confuse
|
||||
|
||||
- name: checkout Qt resources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: subsurface/qt-mac
|
||||
ref: main
|
||||
path: qt-mac
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: build Subsurface
|
||||
id: build
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/..
|
||||
export QT_ROOT=${GITHUB_WORKSPACE}/qt-mac/Qt5.15.13
|
||||
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
|
||||
export PATH=$QT_ROOT/bin:$PATH
|
||||
export CMAKE_PREFIX_PATH=$QT_ROOT/lib/cmake
|
||||
|
||||
# now setup Subsurface with WebKit and build the dependencies, using the generic build script
|
||||
bash -e -x ./subsurface/scripts/build.sh -desktop -build-with-webkit -release -build-deps -ftdi -prep-only
|
||||
|
||||
echo "finished initial cmake setup of Subsurface - next build the package"
|
||||
cd subsurface/build
|
||||
echo "run the packaging script"
|
||||
bash -e -x ../packaging/macosx/make-package.sh | tee mp.log 2>&1
|
||||
IMG=$(grep ^created: mp.log | tail -1 | cut -b10-)
|
||||
echo "Created $IMG"
|
||||
echo "dmg=$IMG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: publish pull request artifacts
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Subsurface-MacOS-${{ steps.version_number.outputs.version }}
|
||||
path: ${{ steps.build.outputs.dmg }}
|
||||
compression-level: 0
|
||||
|
||||
# only publish a 'release' on push events (those include merging a PR)
|
||||
- name: upload binaries
|
||||
if: github.event_name == 'push'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: ${{ github.repository_owner }}/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
fail_on_unmatched_files: true
|
||||
files: ${{ steps.build.outputs.dmg }}
|
||||
45
.github/workflows/post-releasenotes.yml
vendored
@ -1,45 +0,0 @@
|
||||
name: Post Release Notes
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
postRelease:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
# since we are running this step on a pull request, we will skip build numbers in releases
|
||||
- name: assemble release notes
|
||||
env:
|
||||
EVENT_HEAD_COMMIT_ID: ${{ github.event.head_commit.id }}
|
||||
# Required because we are using the GitHub CLI in 'create-releasenotes.sh'
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
scripts/create-releasenotes.sh $EVENT_HEAD_COMMIT_ID
|
||||
|
||||
# add a file containing the release title so it can be picked up and listed on the release page on our web server
|
||||
- name: publish release
|
||||
if: github.event_name == 'push'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: ${{ github.repository_owner }}/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
files: release_content_title.txt
|
||||
body_path: gh_release_notes.md
|
||||
169
.github/workflows/scripts/check_usns.py
vendored
@ -1,169 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import logging
|
||||
import multiprocessing
|
||||
import os
|
||||
import pathlib
|
||||
import pprint
|
||||
import sys
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
from launchpadlib import errors as lp_errors # fades
|
||||
from launchpadlib.credentials import RequestTokenAuthorizationEngine, UnencryptedFileCredentialStore
|
||||
from launchpadlib.launchpad import Launchpad
|
||||
import requests # fades
|
||||
|
||||
|
||||
logger = logging.getLogger("subsurface.check_usns")
|
||||
logger.addHandler(logging.StreamHandler())
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
APPLICATION = "subsurface-ci"
|
||||
LAUNCHPAD = "production"
|
||||
TEAM = "subsurface"
|
||||
SOURCE_NAME = "subsurface"
|
||||
SNAPS = {
|
||||
"subsurface": {
|
||||
"stable": {"recipe": "subsurface-stable"},
|
||||
},
|
||||
}
|
||||
|
||||
STORE_URL = "https://api.snapcraft.io/api/v1/snaps" "/details/{snap}?channel={channel}"
|
||||
STORE_HEADERS = {"X-Ubuntu-Series": "16", "X-Ubuntu-Architecture": "{arch}"}
|
||||
|
||||
CHECK_NOTICES_PATH = "/snap/bin/review-tools.check-notices"
|
||||
CHECK_NOTICES_ARGS = ["--ignore-pockets", "esm-apps"]
|
||||
|
||||
|
||||
def get_store_snap(processor, snap, channel):
|
||||
logger.debug("Checking for snap %s on %s in channel %s", snap, processor, channel)
|
||||
data = {
|
||||
"snap": snap,
|
||||
"channel": channel,
|
||||
"arch": processor,
|
||||
}
|
||||
resp = requests.get(STORE_URL.format(**data), headers={k: v.format(**data) for k, v in STORE_HEADERS.items()})
|
||||
logger.debug("Got store response: %s", resp)
|
||||
|
||||
try:
|
||||
result = json.loads(resp.content)
|
||||
except json.JSONDecodeError:
|
||||
logger.error("Could not parse store response: %s", resp.content)
|
||||
else:
|
||||
return result
|
||||
|
||||
|
||||
def fetch_url(entry):
|
||||
dest, uri = entry
|
||||
r = requests.get(uri, stream=True)
|
||||
logger.debug("Downloading %s to %s…", uri, dest)
|
||||
if r.status_code == 200:
|
||||
with open(dest, "wb") as f:
|
||||
for chunk in r:
|
||||
f.write(chunk)
|
||||
return dest
|
||||
|
||||
|
||||
def check_snap_notices(store_snaps):
|
||||
with tempfile.TemporaryDirectory(dir=pathlib.Path.home()) as dir:
|
||||
snaps = multiprocessing.Pool(8).map(
|
||||
fetch_url,
|
||||
(
|
||||
(pathlib.Path(dir) / f"{snap['package_name']}_{snap['revision']}.snap", snap["download_url"])
|
||||
for snap in store_snaps
|
||||
),
|
||||
)
|
||||
|
||||
try:
|
||||
notices = subprocess.check_output([CHECK_NOTICES_PATH] + CHECK_NOTICES_ARGS + snaps, encoding="UTF-8")
|
||||
logger.debug("Got check_notices output:\n%s", notices)
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error("Failed to check notices:\n%s", e.output)
|
||||
sys.exit(2)
|
||||
else:
|
||||
notices = json.loads(notices)
|
||||
return notices
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_notices = os.path.isfile(CHECK_NOTICES_PATH) and os.access(CHECK_NOTICES_PATH, os.X_OK)
|
||||
|
||||
if not check_notices:
|
||||
raise RuntimeError("`review-tools` not found.")
|
||||
|
||||
try:
|
||||
lp = Launchpad.login_with(
|
||||
APPLICATION,
|
||||
LAUNCHPAD,
|
||||
version="devel",
|
||||
authorization_engine=RequestTokenAuthorizationEngine(LAUNCHPAD, APPLICATION),
|
||||
credential_store=UnencryptedFileCredentialStore(os.path.expanduser(sys.argv[1])),
|
||||
)
|
||||
except NotImplementedError:
|
||||
raise RuntimeError("Invalid credentials.")
|
||||
|
||||
ubuntu = lp.distributions["ubuntu"]
|
||||
logger.debug("Got ubuntu: %s", ubuntu)
|
||||
|
||||
team = lp.people[TEAM]
|
||||
logger.debug("Got team: %s", team)
|
||||
|
||||
errors = []
|
||||
|
||||
for snap, channels in SNAPS.items():
|
||||
for channel, snap_map in channels.items():
|
||||
logger.info("Processing channel %s for snap %s…", channel, snap)
|
||||
|
||||
try:
|
||||
snap_recipe = lp.snaps.getByName(owner=team, name=snap_map["recipe"])
|
||||
logger.debug("Got snap: %s", snap_recipe)
|
||||
except lp_errors.NotFound as ex:
|
||||
logger.error("Snap not found: %s", snap_map["recipe"])
|
||||
errors.append(ex)
|
||||
continue
|
||||
|
||||
if len(snap_recipe.pending_builds) > 0:
|
||||
logger.info("Skipping %s: snap builds pending…", snap_recipe.web_link)
|
||||
continue
|
||||
|
||||
store_snaps = tuple(
|
||||
filter(
|
||||
lambda snap: snap.get("result") != "error",
|
||||
(get_store_snap(processor.name, snap, channel) for processor in snap_recipe.processors),
|
||||
)
|
||||
)
|
||||
|
||||
logger.debug("Got store versions: %s", {snap["architecture"][0]: snap["version"] for snap in store_snaps})
|
||||
|
||||
snap_notices = check_snap_notices(store_snaps)[snap]
|
||||
|
||||
for store_snap in store_snaps:
|
||||
if str(store_snap["revision"]) not in snap_notices:
|
||||
logger.error(
|
||||
"Revision %s missing in result, see above for any review-tools errors.", store_snap["revision"]
|
||||
)
|
||||
errors.append(f"Revision {store_snap['revision']} missing in result:\n{store_snap}")
|
||||
|
||||
if any(snap_notices.values()):
|
||||
logger.info("Found USNs:\n%s", pprint.pformat(snap_notices))
|
||||
else:
|
||||
logger.info("Skipping %s: no USNs found", snap)
|
||||
continue
|
||||
|
||||
logger.info("Triggering %s…", snap_recipe.description or snap_recipe.name)
|
||||
|
||||
snap_recipe.requestBuilds(
|
||||
archive=snap_recipe.auto_build_archive,
|
||||
pocket=snap_recipe.auto_build_pocket,
|
||||
channels=snap_recipe.auto_build_channels,
|
||||
)
|
||||
logger.debug("Triggered builds: %s", snap_recipe.web_link)
|
||||
|
||||
for error in errors:
|
||||
logger.debug(error)
|
||||
|
||||
if errors:
|
||||
sys.exit(1)
|
||||
44
.github/workflows/scripts/linux-snap.patch
vendored
@ -1,44 +0,0 @@
|
||||
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
|
||||
index 9f34d0169..0d5a89fd9 100644
|
||||
--- a/snap/snapcraft.yaml
|
||||
+++ b/snap/snapcraft.yaml
|
||||
@@ -35,6 +35,7 @@ parts:
|
||||
source: https://github.com/Subsurface/googlemaps.git
|
||||
plugin: make
|
||||
build-packages:
|
||||
+ - ccache
|
||||
- qtbase5-dev
|
||||
- wget
|
||||
override-pull: |
|
||||
@@ -79,6 +80,7 @@ parts:
|
||||
override-build: |
|
||||
qmake \
|
||||
INCLUDEPATH+=${CRAFT_PART_SRC}/QtHeaders \
|
||||
+ CONFIG+=ccache \
|
||||
${CRAFT_PART_SRC}
|
||||
craftctl default
|
||||
|
||||
@@ -111,7 +113,11 @@ parts:
|
||||
source: .
|
||||
source-type: git
|
||||
source-subdir: libdivecomputer
|
||||
+ autotools-configure-parameters:
|
||||
+ - CC="ccache gcc"
|
||||
+ - CXX="ccache g++"
|
||||
build-packages:
|
||||
+ - ccache
|
||||
- libbluetooth-dev
|
||||
- libhidapi-dev
|
||||
- libusb-dev
|
||||
@@ -134,8 +140,11 @@ parts:
|
||||
- -DFTDISUPPORT=ON
|
||||
- -DLIBDIVECOMPUTER_LIBRARIES=../../../stage/usr/local/lib/libdivecomputer.so
|
||||
- -DLIBDIVECOMPUTER_INCLUDE_DIR=../../../stage/usr/local/include
|
||||
+ - -DCMAKE_C_COMPILER_LAUNCHER=ccache
|
||||
+ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
build-packages:
|
||||
- build-essential
|
||||
+ - ccache
|
||||
- libcurl4-gnutls-dev
|
||||
- libftdi1-dev
|
||||
- libgit2-dev
|
||||
2
.github/workflows/scripts/requirements.txt
vendored
@ -1,2 +0,0 @@
|
||||
launchpadlib
|
||||
requests
|
||||
37
.github/workflows/snap_usns.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: SnapUSNs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 5 * * *'
|
||||
|
||||
jobs:
|
||||
CheckUSNs:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install Python dependencies
|
||||
uses: insightsengineering/pip-action@v2.0.0
|
||||
with:
|
||||
requirements: .github/workflows/scripts/requirements.txt
|
||||
|
||||
- name: Install Snap dependencies
|
||||
run: |
|
||||
sudo snap install review-tools --edge
|
||||
|
||||
- name: Set up Launchpad credentials
|
||||
uses: DamianReeves/write-file-action@v1.2
|
||||
with:
|
||||
path: lp_credentials
|
||||
contents: ${{ secrets.LAUNCHPAD_CREDENTIALS }}
|
||||
|
||||
- name: Check for USNs
|
||||
run: .github/workflows/scripts/check_usns.py lp_credentials
|
||||
55
.github/workflows/ubuntu-launchpad-build.yml
vendored
@ -1,55 +0,0 @@
|
||||
name: Ubuntu Launchpad Build
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
- current
|
||||
|
||||
jobs:
|
||||
push-to-ppa:
|
||||
|
||||
name: Submit build to Ubuntu Launchpad
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: Setup build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y devscripts dput gpg debhelper qt5-qmake cmake
|
||||
|
||||
- name: Setup gpg key token for launchpad
|
||||
env:
|
||||
GPG_PRIVATE_KEY: ${{ secrets.PPA_SECRET_KEY }}
|
||||
run: |
|
||||
echo "$GPG_PRIVATE_KEY" > ~/.key
|
||||
gpg --import ~/.key
|
||||
|
||||
- name: setup git
|
||||
run: |
|
||||
git config --global --add safe.directory /__w/subsurface/subsurface
|
||||
git config --global --add safe.directory /__w/subsurface/subsurface/libdivecomputer
|
||||
|
||||
- name: Checkout googlemaps
|
||||
run: |
|
||||
cd ..
|
||||
git clone https://github.com/subsurface/googlemaps
|
||||
|
||||
- name: run the launchpad make-package script
|
||||
run: |
|
||||
cd ..
|
||||
bash -x subsurface/packaging/ubuntu/make-package.sh $GITHUB_REF_NAME
|
||||
|
||||
38
.github/workflows/windows-mxe-dockerimage.yml
vendored
@ -1,38 +0,0 @@
|
||||
name: Windows (MXE) Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- scripts/docker/mxe-build-container/**
|
||||
- .github/workflows/windows-mxe-dockerimage.yml
|
||||
|
||||
jobs:
|
||||
windows-mxe:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VERSION: ${{ '3.1.0' }} # 'official' images should have a dot-zero version
|
||||
mxe_sha: 'c0bfefc57a00fdf6cb5278263e21a478e47b0bf5'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build the name for the docker image
|
||||
id: build_name
|
||||
run: |
|
||||
v=$VERSION
|
||||
b=$GITHUB_REF # -BRANCH suffix, unless the branch is master
|
||||
b=${b/refs\/heads\//}
|
||||
b=${b,,} # the name needs to be all lower case
|
||||
if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi
|
||||
echo "NAME=$GITHUB_REPOSITORY_OWNER/mxe-build${b}:${v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and Publish Linux Docker image to Dockerhub
|
||||
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||
with:
|
||||
name: ${{ steps.build_name.outputs.NAME }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
workdir: './scripts/docker/mxe-build-container/'
|
||||
buildargs: mxe_sha
|
||||
73
.github/workflows/windows.yml
vendored
@ -1,73 +0,0 @@
|
||||
name: Windows
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- scripts/docker/**
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker://subsurface/mxe-build:3.1.0
|
||||
|
||||
steps:
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: set the version information
|
||||
id: version_number
|
||||
uses: ./.github/actions/manage-version
|
||||
with:
|
||||
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
|
||||
- name: get other dependencies
|
||||
env:
|
||||
SUBSURFACE_REPO_PATH: ${{ github.workspace }}
|
||||
run: |
|
||||
echo "Running script to install additional dependancies into container"
|
||||
git config --global --add safe.directory ${SUBSURFACE_REPO_PATH}
|
||||
git config --global --add safe.directory ${SUBSURFACE_REPO_PATH}/libdivecomputer
|
||||
cd /win
|
||||
ln -s /__w/subsurface/subsurface .
|
||||
bash -x subsurface/packaging/windows/container-prep.sh 2>&1 | tee pre-build.log
|
||||
|
||||
- name: run build
|
||||
run: |
|
||||
export OUTPUT_DIR="$GITHUB_WORKSPACE"
|
||||
cd /win
|
||||
bash -x subsurface/packaging/windows/in-container-build.sh 2>&1 | tee build.log
|
||||
grep "Built target installer" build.log
|
||||
|
||||
- name: publish pull request artifacts
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Subsurface-Windows-${{ steps.version_number.outputs.version }}
|
||||
path: |
|
||||
subsurface*.exe*
|
||||
smtk2ssrf*.exe
|
||||
|
||||
# only publish a 'release' on push events (those include merging a PR)
|
||||
- name: upload binaries
|
||||
if: github.event_name == 'push'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: ${{ github.repository_owner }}/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
./subsurface*.exe*
|
||||
./smtk2ssrf*.exe
|
||||
20
.gitignore
vendored
@ -17,36 +17,16 @@ Documentation/docbook-xsl.css
|
||||
Documentation/user-manual*.html
|
||||
Documentation/user-manual*.pdf
|
||||
Documentation/user-manual*.text
|
||||
Documentation/mobile-images/mobile-images
|
||||
packaging/windows/subsurface.nsi
|
||||
packaging/macos/Info.plist
|
||||
*.kdev4
|
||||
callgrind.out.*
|
||||
.gitignore
|
||||
build*/
|
||||
.rcc
|
||||
.moc
|
||||
.uic
|
||||
.obj
|
||||
Makefile
|
||||
subsurface.pro.user*
|
||||
Subsurface-mobile.pro.user*
|
||||
Subsurface.app
|
||||
.DS_Store
|
||||
!android/**/*.xml
|
||||
build*
|
||||
nightly-builds/
|
||||
mobile-widgets/qml/kirigami
|
||||
mobile-widgets/3rdparty/ECM/
|
||||
mobile-widgets/3rdparty/breeze-icons/
|
||||
mobile-widgets/3rdparty/extra-cmake-modules/
|
||||
mobile-widgets/3rdparty/kirigami/
|
||||
packaging/ios/install-root
|
||||
packaging/ios/Info.plist
|
||||
packaging/ios/Qt
|
||||
packaging/ios/asset_catalog_compiler.Info.plist
|
||||
appdata/subsurface.appdata.xml
|
||||
android-mobile/Roboto-Regular.ttf
|
||||
gh_release_notes.md
|
||||
release_content_title.txt
|
||||
/output/
|
||||
|
||||
4
.gitmodules
vendored
@ -1,4 +0,0 @@
|
||||
[submodule "libdivecomputer"]
|
||||
path = libdivecomputer
|
||||
url = https://github.com/Subsurface/libdc.git
|
||||
branch = Subsurface-NG
|
||||
17
.lgtm.yml
@ -1,17 +0,0 @@
|
||||
path_classifiers:
|
||||
test:
|
||||
- "tests/*"
|
||||
|
||||
extraction:
|
||||
cpp:
|
||||
configure:
|
||||
command:
|
||||
- export INSTALL_ROOT=/opt/out
|
||||
- export PKG_CONFIG_PATH=$INSTALL_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
- bash -x ./scripts/build-libdivecomputer.sh
|
||||
- mkdir _lgtm_build_dir
|
||||
- cd _lgtm_build_dir
|
||||
- cmake -DLIBGIT2_DYNAMIC=ON -DNO_DOCS=ON -DCMAKE_VERBOSE_MAKEFILE=ON ..
|
||||
|
||||
queries:
|
||||
- exclude: "cpp/short-global-name"
|
||||
47
.mailmap
@ -1,47 +0,0 @@
|
||||
<olteanu.claudiu@ymail.com> <olteanu.vasilica.claudiu@gmail.com>
|
||||
<danilo.eu@gmail.com> <danilo.cesar@collabora.co.uk>
|
||||
<dirk@hohndel.org> <dhohndel@dhohndel-mac02.jf.intel.com>
|
||||
<dirk@hohndel.org> <hohndel@mail.gr8dns.org>
|
||||
Dirk Hohndel <dirk@hohndel.org> Dirk Hohndel (Intel) <dhohndel@dhohndel-mac02.jf.intel.com>
|
||||
Dirk Hohndel <dirk@hohndel.org> Subsurface <dirk@subsurface-divelog.org>
|
||||
Dirk Hohndel <dirk@hohndel.org> Subsurface CI <dirk@hohndel.org>
|
||||
<guido.lerch@gmail.com> <glerch@Guidos-MacBook-Air.local>
|
||||
<jacco.van.koll@gmail.com> <jko@haringstad.com>
|
||||
<jlmulder@xs4all.nl> <jlmulder@planet.nl>
|
||||
<jef@libdivecomputer.org> <jefdriesen@telenet.be>
|
||||
<j.bygdell@gmail.com> <narogh@Qutie.local>
|
||||
<karent.bug@gmail.com> <k.arentowicz@gmail.com>
|
||||
<me@bearsh.org> <m.gysel@consonics.ch>
|
||||
<miika.turkia@gmail.com> <miika.turkia@nixu.fi>
|
||||
Robert C. Helling <helling@atdotde.de>
|
||||
Robert C. Helling <helling@atdotde.de> Robert.Helling <helling@atdotde.de>
|
||||
Robert C. Helling <helling@atdotde.de> Robert.Helling <Helling@th-nb-tmpmbp05.fritz.box>
|
||||
Robert C. Helling <helling@atdotde.de> Robert C. Helling <robert@thetheoreticaldiver.org>
|
||||
Robert C. Helling <helling@atdotde.de> Robert C. Helling <helling@lmu.de>
|
||||
Robert C. Helling <helling@atdotde.de> Robert Helling <helling@lmu.de>
|
||||
<sander@myowndomain.nl> <sander.kleywegt@netscout.com>
|
||||
<tim@tee-jay.demon.co.uk> <tim@tee-jay.org.uk>
|
||||
<tim@tee-jay.demon.co.uk> <timw00.tw@googlemail.com>
|
||||
<tomaz.canabrava@intel.com> <tcanabrava@kde.org>
|
||||
<tomaz.canabrava@intel.com> <tomaz.canabrava@gmail.com>
|
||||
<tomaz.canabrava@intel.com> <tomazcanabrava@Tomazs-MacBook-Pro.local>
|
||||
Willem Ferguson <willemferguson@zoology.up.ac.za>
|
||||
<willemferguson@zoology.up.ac.za> <fergusonwillem@gmail.com>
|
||||
<willemferguson@zoology.up.ac.za> <willem@localhost.localdomain>
|
||||
<willemferguson@zoology.up.ac.za> <willem@willem-Precision-M4700.(none)>
|
||||
<willemferguson@zoology.up.ac.za> <fergusonwillem@gmail.com>
|
||||
<jan@casacondor.com> <jani@libreoffice.org>
|
||||
<jan@casacondor.com> <jani@apache.org>
|
||||
<jan@casacondor.com> <jancasacondor@gmail.com>
|
||||
jan Iversen <jan@casacondor.com> jan iversen <jani@apache.org>
|
||||
Gehad Elrobey <gehadelrobey@gmail.com> <gehadelrobey@gmail.com>
|
||||
Joseph W. Joshua <joejoshw@gmail.com> <joejoshw@gmail.com>
|
||||
Joseph W. Joshua <joejoshw@gmail.com> <joshua@megvel.me.ke>
|
||||
Luisa Pires <luisapiresdesign@gmail.com> <luisapiresdesign@gmail.com>
|
||||
Pedro Neves <nevesdiver@gmail.com> <nevesdiver@gmail.com>
|
||||
Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it> <tiposchi@tiscali.it>
|
||||
Benjamin Fogel <nystire@gmail.com> <nystire@gmail.com>
|
||||
Guido Lerch <guido.lerch@gmail.com> <guido.lerch@gmail.com>
|
||||
Guido Lerch <guido.lerch@gmail.com> <glerch@Guidos-MacBook-Air.local>
|
||||
Joakim Bygdell <j.bygdell@gmail.com> <j.bygdell@gmail.com>
|
||||
|
||||
@ -11,4 +11,3 @@ type = TS
|
||||
source_file = terms
|
||||
source_lang = en
|
||||
type = txt
|
||||
|
||||
|
||||
48
CHANGELOG.md
@ -1,48 +0,0 @@
|
||||
statistics: show proper dates in January
|
||||
desktop: add country to the fields indexed for full text search
|
||||
import: update libdivecomputer version, add support for the Scubapro G3 / Luna and Shearwater Tern
|
||||
desktop: add a button linking to the 'Contribute' page
|
||||
mobile: fix configuration of decompression ceiling and gradient factors
|
||||
desktop: fix gas switches in UDDF exports
|
||||
core: allow of up to 6 O2 sensors (and corresponding voting logic)
|
||||
desktop: add divemode as a possible dive list column
|
||||
profile-widget: Now zomed in profiles can be panned with horizontal scroll.
|
||||
desktop: hide only events with the same severity when 'Hide similar events' is used
|
||||
equipment: mark gas mixes reported by the dive computer as 'inactive' as 'not used'
|
||||
equipment: include unused cylinders in merged dive if the preference is enabled
|
||||
equipment: fix bug showing the first diluent in the gas list as 'used' for CCR dives
|
||||
desktop: added button to hide the infobox in the dive profile
|
||||
desktop: use persisted device information for the dive computer configuration
|
||||
core: fix bug using salinity and pressure values in mbar <-> depth conversion
|
||||
export: fix bug resulting in invalid CSV for '""' in 'CSV summary dive details'
|
||||
desktop: add support for multiple tanks to the profile ruler
|
||||
export: change format produced by 'CSV summary dive details' from TSV (tab separated) to CSV
|
||||
desktop: add function to merge dive site into site selected in list
|
||||
import: add option to synchronise dive computer time when downloading dives
|
||||
desktop: fix salinity combo/icon when DC doesnt have salinity info
|
||||
core: fix bug when save sea water salinity given by DC
|
||||
desktop: add option to force firmware update on OSTC4
|
||||
desktop: add column for dive notes to the dive list table
|
||||
desktop: Add an option for printing in landscape mode
|
||||
desktop: fix bug when printing a dive plan with multiple segments
|
||||
desktop: fix remembering of bluetooth address for remembered dive computers (not MacOS)
|
||||
desktop: fix bug in bailout gas selection for CCR dives
|
||||
desktop: fix crash on cylinder update of multiple dives
|
||||
desktop: use dynamic tank use drop down in equipment tab and planner
|
||||
desktop: fix brightness configuration for OSTC4
|
||||
equipment: Use 'diluent' as default gas use type if the dive mode is 'CCR'
|
||||
htmlexport: fix search in HTML export
|
||||
htmlexport: fix diveguide display
|
||||
statistics: fix value axis for degenerate value ranges
|
||||
profile: Show correct gas density when in CCR mode
|
||||
statistics: show correct color of selected scatter items when switching to unbinned mode
|
||||
statistics: fix display of month number in continuous date axis
|
||||
statistics: fix range of continuous date axis
|
||||
desktop: fix dive time display in time shift dialog
|
||||
libdivecomputer: garmin: relax string parsing sanity checks
|
||||
libdivecomputer: add Cressi Donatello, Scubapro G2 TEK, Oceanic Geo Air, Scorpena Alpha
|
||||
|
||||
---
|
||||
* Always add new entries at the very top of this file above other existing entries and this note.
|
||||
* Use this layout for new entries: `[Area]: [Details about the change] [reference thread / issue]`
|
||||
# vim: textwidth=100
|
||||
903
CMakeLists.txt
@ -1,740 +1,209 @@
|
||||
# cmake based build of Subsurface
|
||||
|
||||
# Uncomment his to see all commands cmake actually executes
|
||||
# set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(Subsurface)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# don't process generated files - this is new in 3.10
|
||||
if (POLICY CMP0071)
|
||||
cmake_policy(SET CMP0071 OLD)
|
||||
#options
|
||||
SET(SUBSURFACE_QT_VERSION "4")
|
||||
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
SET(CMAKE_AUTOUIC ON)
|
||||
SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/marbledata)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
||||
endif()
|
||||
|
||||
# support Packagename_ROOT environment variable
|
||||
if (POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW) # CMake 3.12
|
||||
endif ()
|
||||
INCLUDE_DIRECTORIES( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
|
||||
# global settings
|
||||
MACRO(pkg_config_library LIBNAME pcfile)
|
||||
pkg_check_modules(${LIBNAME} ${pcfile})
|
||||
include_directories(${${LIBNAME}_INCLUDE_DIRS})
|
||||
link_directories(${${LIBNAME}_LIBRARY_DIRS})
|
||||
add_definitions(${${LIBNAME}_CFLAGS_OTHER})
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${${LIBNAME}_LIBRARIES})
|
||||
ENDMACRO()
|
||||
|
||||
set(CMAKE_MODULE_PATH
|
||||
${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules
|
||||
${${PROJECT_NAME}_SOURCE_DIR}/../install-root/lib/cmake
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
pkg_config_library(LIBXML libxml-2.0)
|
||||
pkg_config_library(LIBSQLITE3 sqlite3)
|
||||
pkg_config_library(LIBGIT2 libgit2)
|
||||
pkg_config_library(LIBXSLT libxslt)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
include(MacroOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
"We don't support building in source, please create a build folder elsewhere and remember to run git clean -xdf to remove temporary files created by CMake."
|
||||
)
|
||||
SET(LIBDCDEVEL "" CACHE STRING "libraries")
|
||||
IF(NOT (LIBDCDEVEL STREQUAL ""))
|
||||
cmake_policy(SET CMP0015 OLD)
|
||||
include_directories(${LIBDCDEVEL}/include )
|
||||
link_directories(${LIBDCDEVEL}/src/.libs)
|
||||
ENDIF()
|
||||
|
||||
#Option for memory debugging
|
||||
option(SUBSURFACE_ASAN_BUILD "enable memory debugging of Subsurface binary" OFF)
|
||||
STRING(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${${PROJECT_NAME}_BINARY_DIR}" insource)
|
||||
GET_FILENAME_COMPONENT(PARENTDIR ${${PROJECT_NAME}_SOURCE_DIR} PATH)
|
||||
STRING(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${PARENTDIR}" insourcesubdir)
|
||||
IF(NOT (insource OR insourcedir))
|
||||
add_custom_target(link_marble_data ALL COMMAND rm -f marbledata && ln -s ${${PROJECT_NAME}_SOURCE_DIR}/marbledata ${${PROJECT_NAME}_BINARY_DIR}/marbledata)
|
||||
ENDIF()
|
||||
|
||||
#Option for profiling
|
||||
option(SUBSURFACE_PROFILING_BUILD "enable profiling of Subsurface binary" OFF)
|
||||
#configure Qt version.
|
||||
IF(${SUBSURFACE_QT_VERSION} MATCHES "4")
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTXML TRUE)
|
||||
SET(QT_USE_QTSVG TRUE)
|
||||
SET(QT_USE_QTTEST TRUE)
|
||||
SET(QT_USE_QTWEBKIT TRUE)
|
||||
FIND_PACKAGE(Qt4 REQUIRED)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ADD_DEFINITIONS(${QT_DEFINITIONS})
|
||||
FIND_PACKAGE(Marble REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${MARBLE_INCLUDE_DIR})
|
||||
ELSEIF(${SUBSURFACE_QT_VERSION} MATCHES "5")
|
||||
ADD_DEFINITIONS(-DNO_MARBLE)
|
||||
ELSE()
|
||||
message( FATAL_ERROR "Qt version should be 4 or 5" )
|
||||
ENDIF()
|
||||
|
||||
#Options regarding usage of pkgconfig
|
||||
option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
|
||||
option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
|
||||
|
||||
#Library Handling
|
||||
option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
|
||||
option(LIBGIT2_DYNAMIC "search for libgit2.so before libgit2.a" OFF)
|
||||
|
||||
#Options regarding disabling parts of subsurface.
|
||||
option(NO_DOCS "disable the docs" OFF)
|
||||
option(NO_PRINTING "disable the printing support" OFF)
|
||||
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
|
||||
|
||||
#Options regarding enabling parts of subsurface
|
||||
option(BTSUPPORT "enable support for QtBluetooth" ON)
|
||||
option(FTDISUPPORT "enable support for libftdi based serial" OFF)
|
||||
|
||||
# Options regarding What should we build on subsurface
|
||||
option(MAKE_TESTS "Make the tests" ON)
|
||||
|
||||
# Option whether we should try to build against Qt6, if it is available
|
||||
option(BUILD_WITH_QT6 "try to build against Qt6 (incomplete)" OFF)
|
||||
|
||||
SET(SUBSURFACE_TARGET_EXECUTABLE "DesktopExecutable" CACHE STRING "The type of application, DesktopExecutable, MobileExecutable, or DownloaderExecutable")
|
||||
LIST(APPEND SUBSURFACE_ACCEPTED_EXECUTABLES "DesktopExecutable" "MobileExecutable" "DownloaderExecutable")
|
||||
SET_PROPERTY(CACHE SUBSURFACE_TARGET_EXECUTABLE PROPERTY STRINGS ${SUBSURFACE_ACCEPTED_EXECUTABLES})
|
||||
|
||||
#verify if Platform is correct and warn on wxit with example.
|
||||
list (FIND SUBSURFACE_ACCEPTED_EXECUTABLES ${SUBSURFACE_TARGET_EXECUTABLE} _index)
|
||||
if (_index EQUAL -1)
|
||||
message(FATAL_ERROR "Requested platform not supported, please use one of the following:
|
||||
${SUBSURFACE_ACCEPTED_EXECUTABLES}
|
||||
|
||||
inputted value was: ${SUBSURFACE_TARGET_EXECUTABLE}
|
||||
|
||||
Example: -DSUBSURFACE_TARGET_EXECUTABLE=DesktopExecutable")
|
||||
endif()
|
||||
|
||||
# SUBSURFACE_SOURCE may be used in subdirectories (tests)
|
||||
set(SUBSURFACE_SOURCE ${CMAKE_SOURCE_DIR})
|
||||
add_definitions(-DSUBSURFACE_SOURCE="${SUBSURFACE_SOURCE}")
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
||||
#
|
||||
# TODO: This Compilation part should go on the Target specific CMake.
|
||||
#
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
|
||||
if ((CMAKE_SYSTEM_NAME MATCHES "Darwin") AND
|
||||
((CMAKE_SYSTEM_VERSION MATCHES "11.4.") OR
|
||||
(CMAKE_OSX_DEPLOYMENT_TARGET MATCHES "10.7") OR
|
||||
(CMAKE_OSX_DEPLOYMENT_TARGET MATCHES "10.8")))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Warn about possible float conversion errors
|
||||
# Use NOT VERSION_LESS since VERSION_GREATER_EQUAL is not available
|
||||
# in currently used cmake version.
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfloat-conversion")
|
||||
endif()
|
||||
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
# using Intel C++
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# using Visual Studio C++
|
||||
endif()
|
||||
|
||||
# set up profiling
|
||||
if (SUBSURFACE_PROFILING_BUILD)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
|
||||
endif()
|
||||
# set up ASan
|
||||
if (SUBSURFACE_ASAN_BUILD)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# every compiler understands -Wall
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=format")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=format")
|
||||
|
||||
# by detault optimize with -O2 even for debug builds
|
||||
set (GCC_OPTIMIZATION_FLAGS "-O2" CACHE STRING "GCC optimization flags")
|
||||
message (STATUS "GCC optimization flags: " ${GCC_OPTIMIZATION_FLAGS})
|
||||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${GCC_OPTIMIZATION_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${GCC_OPTIMIZATION_FLAGS}")
|
||||
|
||||
# pkgconfig for required libraries
|
||||
find_package(PkgConfig)
|
||||
include(pkgconfig_helper)
|
||||
|
||||
# The 'HandleFindXXX' are special libraries that subsurface needs
|
||||
# to find and configure in a few different ways because of a few
|
||||
# developers that prefer pkg-config over CMake, so we try to make
|
||||
# everyone happy. It also sets some variables for each library, so
|
||||
# if you think a module miss anything, take a look on the specific
|
||||
# module file.
|
||||
include(HandleFindGit2)
|
||||
include(HandleFindLibDiveComputer)
|
||||
include(HandleFtdiSupport)
|
||||
include(HandleVersionGeneration)
|
||||
include(RunOnBuildDir)
|
||||
include(cmake_variables_helper)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
include_directories(${CMAKE_OSX_SYSROOT}/usr/include/libxml2)
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lxml2 -lxslt -lsqlite3)
|
||||
else()
|
||||
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
|
||||
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
|
||||
pkg_config_library(LIBXSLT libxslt REQUIRED)
|
||||
endif()
|
||||
pkg_config_library(LIBZIP libzip REQUIRED)
|
||||
|
||||
if(NOT ANDROID)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
pkg_config_library(BLUEZ bluez REQUIRED)
|
||||
endif()
|
||||
pkg_config_library(LIBUSB libusb-1.0 QUIET)
|
||||
pkg_config_library(LIBMTP libmtp QUIET)
|
||||
endif()
|
||||
|
||||
include_directories(.
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}/desktop-widgets
|
||||
)
|
||||
|
||||
# decide what to do about Qt
|
||||
# this is messy because we want to support older Qt5 versions, newer Qt5 versions,
|
||||
# and Qt6 when enabled / available.
|
||||
if(BUILD_WITH_QT6)
|
||||
set(CHECK_QT6 "Qt6")
|
||||
endif()
|
||||
|
||||
# figure out which version of Qt we are building against
|
||||
# in theory this should get us all the variables set up correctly, but that
|
||||
# ended up failing in subtle ways to do what was advertized; in the Qt5 case
|
||||
# some of the variables didn't get set up, so we'll immediately call it again
|
||||
# for Qt5
|
||||
find_package(QT NAMES ${CHECK_QT6} Qt5 REQUIRED COMPONENTS Core Widgets)
|
||||
|
||||
# right now there are a few things that don't work with Qt6
|
||||
# let's disable them right here and remember our Qt version
|
||||
if(QT_VERSION_MAJOR STREQUAL "6")
|
||||
set(USINGQT6 ON)
|
||||
set(QT5OR6 "")
|
||||
# for Qt6 we want the Qt5 compatibility package
|
||||
LIST(APPEND QT_EXTRA_COMPONENTS Core5Compat)
|
||||
LIST(APPEND QT_TEST_LIBRARIES Qt::Core5Compat)
|
||||
|
||||
# QtWebKit doesn't work with Qt6, so no printing, no manual
|
||||
set(NO_PRINTING ON)
|
||||
set(NO_USERMANUAL ON)
|
||||
|
||||
# as of Qt 6.3 by default QtLocation isn't included, but one can
|
||||
# build the module from source; so let's look if the user has installed
|
||||
# it (or if a newer version is out that includes it, anyway)
|
||||
find_package(Qt6 COMPONENTS Location)
|
||||
if(Qt6Location_FOUND)
|
||||
message(STATUS "Found Qt6Location")
|
||||
LIST(APPEND QT_EXTRA_COMPONENTS Location)
|
||||
add_definitions(-DMAP_SUPPORT)
|
||||
set(MAPSUPPORT ON)
|
||||
|
||||
# at least on macOS something goes sideways and we fail to load the
|
||||
# QML files with a weird error about Qml.WorkerScript missing
|
||||
# linking Subsurface against that component appears enough to hack
|
||||
# around that, but that feels... wrong
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
find_package(Qt6 COMPONENTS QmlWorkerScript)
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt6::QmlWorkerScript)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# as mentioned above, since some variables appear to fail to populate
|
||||
# on some platforms, simply run this again the 'old' way
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
|
||||
set(USINGQT6 OFF)
|
||||
set(QT5OR6 "5")
|
||||
set(QT_VERSION ${Qt5_VERSION})
|
||||
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
|
||||
# for Qt5 we want the Location component (which is missing so far in Qt6)
|
||||
LIST(APPEND QT_EXTRA_COMPONENTS Location)
|
||||
add_definitions(-DMAP_SUPPORT)
|
||||
set(MAPSUPPORT ON)
|
||||
endif()
|
||||
message(STATUS "building with Qt ${QT_VERSION}")
|
||||
|
||||
# Project Target specific configuration should go here,
|
||||
# if the configuration is too big or would disrupt the normal code flux,
|
||||
# move it somewhere else (another file) and include it.
|
||||
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(SUBSURFACE_TARGET Subsurface)
|
||||
else()
|
||||
set(SUBSURFACE_TARGET subsurface)
|
||||
endif()
|
||||
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
|
||||
remove_definitions(-DSUBSURFACE_MOBILE)
|
||||
if(NO_USERMANUAL)
|
||||
message(STATUS "building without built-in user manual support")
|
||||
add_definitions(-DNO_USERMANUAL)
|
||||
else()
|
||||
set(REQUEST_WEBKIT ON)
|
||||
endif()
|
||||
if(NO_PRINTING)
|
||||
message(STATUS "building without printing support")
|
||||
add_definitions(-DNO_PRINTING)
|
||||
else()
|
||||
set(REQUEST_WEBKIT ON)
|
||||
endif()
|
||||
if(REQUEST_WEBKIT)
|
||||
# Because Qt5WebKitWidgets isn't a part of the "regular" Qt5, we can't get it the normal way
|
||||
find_package(Qt5WebKitWidgets QUIET)
|
||||
if(Qt5WebKitWidgets_FOUND STREQUAL "1")
|
||||
LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport WebKitWidgets)
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt5::WebKitWidgets)
|
||||
message(STATUS "building with QtWebKit")
|
||||
else()
|
||||
message(STATUS "didn't find QtWebKit, building without user manual and printing support")
|
||||
add_definitions(-DNO_PRINTING)
|
||||
add_definitions(-DNO_USERMANUAL)
|
||||
set(NO_PRINTING ON)
|
||||
set(NO_USERMANUAL ON)
|
||||
endif()
|
||||
endif()
|
||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(SUBSURFACE_TARGET Subsurface-mobile)
|
||||
else()
|
||||
set(SUBSURFACE_TARGET subsurface-mobile)
|
||||
endif()
|
||||
list(APPEND QT_EXTRA_COMPONENTS QuickControls2)
|
||||
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
|
||||
add_definitions(-DSUBSURFACE_MOBILE)
|
||||
|
||||
# add definition to seperate mobile for devices and for desktop
|
||||
add_definitions(-DSUBSURFACE_MOBILE_DESKTOP)
|
||||
|
||||
message(STATUS "Building Subsurface-mobile requires BT support")
|
||||
set(BTSUPPORT ON)
|
||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(SUBSURFACE_TARGET Subsurface-downloader)
|
||||
else()
|
||||
set(SUBSURFACE_TARGET subsurface-downloader)
|
||||
endif()
|
||||
set(BTSUPPORT ON)
|
||||
add_definitions(-DSUBSURFACE_DOWNLOADER)
|
||||
message(STATUS "building the embedded Subsurface-downloader app")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(NO_PRINTING ON)
|
||||
set(NO_USERMANUAL ON)
|
||||
set(MAKE_TESTS OFF)
|
||||
list(APPEND QT_EXTRA_COMPONENTS AndroidExtras)
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -llog)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# add pthread to the end of the library list on Linux
|
||||
# this is only needed on Ubuntu
|
||||
# but shouldn't hurt on other Linux versions
|
||||
# in some builds we appear to be missing libz for some strange reason...
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lz -lpthread)
|
||||
|
||||
# Test for ARM processor (Raspberry Pi) and add libGLESv2 if found
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6l")
|
||||
message (STATUS "Found ARM processor. Adding libGLESv2")
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lGLESv2)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
execute_process(
|
||||
COMMAND bash scripts/get-version.sh
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE SSRF_VERSION_STRING
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
find_library(APP_SERVICES_LIBRARY ApplicationServices)
|
||||
find_library(HID_LIB HidApi)
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES ${HID_LIB})
|
||||
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
|
||||
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
|
||||
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||
set(MACOSX_BUNDLE_INFO_STRING "Subsurface-mobile")
|
||||
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface-mobile")
|
||||
else()
|
||||
set(MACOSX_BUNDLE_INFO_STRING "Subsurface")
|
||||
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface")
|
||||
endif()
|
||||
set(MACOSX_BUNDLE_ICON_FILE Subsurface.icns)
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.subsurface-divelog")
|
||||
set(MACOSX_BUNDLE_BUNDLE_VERSION "${SSRF_VERSION_STRING}")
|
||||
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${SSRF_VERSION_STRING}")
|
||||
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${SSRF_VERSION_STRING}")
|
||||
set(MACOSX_BUNDLE_COPYRIGHT "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, Berthold Stoeger and others")
|
||||
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lwsock32 -lws2_32)
|
||||
remove_definitions(-DUNICODE)
|
||||
add_definitions(-mwindows -D_WIN32)
|
||||
endif()
|
||||
|
||||
if(BTSUPPORT)
|
||||
set(BLESUPPORT ON)
|
||||
list(APPEND QT_EXTRA_COMPONENTS Bluetooth)
|
||||
add_definitions(-DBT_SUPPORT)
|
||||
add_definitions(-DBLE_SUPPORT)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
# when building for Android, the toolchain file requires all cmake modules
|
||||
# to be inside the CMAKE_FIND_ROOT_PATH - which prevents cmake from finding
|
||||
# our Qt installation. This is ugly, but it works.
|
||||
set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}")
|
||||
endif()
|
||||
set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick ${QT_EXTRA_COMPONENTS})
|
||||
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
|
||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||
# Kirigami 5.62 and newer require at least Qt 5.12
|
||||
if(ANDROID)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools)
|
||||
else()
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
|
||||
endif()
|
||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
# let's pick a version that's not ancient
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.11 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS})
|
||||
set(MAKE_TESTS OFF)
|
||||
endif()
|
||||
|
||||
foreach(_QT_COMPONENT ${QT_FIND_COMPONENTS})
|
||||
list(APPEND QT_LIBRARIES Qt${QT5OR6}::${_QT_COMPONENT})
|
||||
endforeach()
|
||||
if(NOT ANDROID)
|
||||
LIST(APPEND QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt${QT5OR6}::Test Qt${QT5OR6}::QuickTest)
|
||||
endif()
|
||||
|
||||
#set up the subsurface_link_libraries variable
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
|
||||
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
if(USINGQT6)
|
||||
if(MAPSUPPORT)
|
||||
qt_add_resources(SUBSURFACE_RESOURCES map-widget/qml/map-widget.qrc)
|
||||
set(SUBSURFACE_MAPWIDGET subsurface_mapwidget)
|
||||
endif()
|
||||
qt_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc desktop-widgets/qml/statsview2.qrc)
|
||||
else()
|
||||
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc)
|
||||
set(SUBSURFACE_MAPWIDGET subsurface_mapwidget)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# hack to build successfully on LGTM
|
||||
if(DEFINED ENV{LGTM_SRC})
|
||||
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lgssapi_krb5 -lhttp_parser)
|
||||
endif()
|
||||
|
||||
# include translations
|
||||
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
add_subdirectory(translations)
|
||||
endif()
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(qt-models)
|
||||
add_subdirectory(commands)
|
||||
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
add_subdirectory(profile-widget)
|
||||
if(MAPSUPPORT)
|
||||
add_subdirectory(map-widget)
|
||||
endif()
|
||||
add_subdirectory(mobile-widgets)
|
||||
add_subdirectory(stats)
|
||||
endif()
|
||||
add_subdirectory(backend-shared)
|
||||
|
||||
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||
add_subdirectory(desktop-widgets)
|
||||
endif()
|
||||
|
||||
# create the executables
|
||||
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||
# set up Kirigami using KDE ECM
|
||||
# that's available as kde-extra-cmake-modules on Homebrew, on all Linux flavors
|
||||
# Android and iOS are built via qmake, Windows build of Subsurface-mobile isn't supported
|
||||
find_package(ECM REQUIRED CONFIG PATHS ${CMAKE_CURRENT_SOURCE_DIR}/mobile-widgets/3rdparty/ECM)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
|
||||
set(BREEZEICONS_DIR mobile-widgets/3rdparty/breeze-icons/)
|
||||
|
||||
SET(QML_IMPORT_PATH ${QML_IMPORT_PATH} ${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/src ${CMAKE_SOURCE_DIR}/mobile-widgets/qml)
|
||||
add_subdirectory(mobile-widgets/3rdparty)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/src)
|
||||
include(${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/KF5Kirigami2Macros.cmake)
|
||||
|
||||
set(MOBILE_SRC
|
||||
subsurface-mobile-main.cpp
|
||||
subsurface-helper.cpp
|
||||
)
|
||||
if(USINGQT6)
|
||||
qt_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
|
||||
qt_add_resources(MOBILE_RESOURCES profile.qrc)
|
||||
qt_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
|
||||
qt_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
|
||||
else()
|
||||
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
|
||||
qt5_add_resources(MOBILE_RESOURCES profile.qrc)
|
||||
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
|
||||
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
|
||||
endif()
|
||||
|
||||
# the following is split across two commands since in cmake 3.12 this would result
|
||||
# in a non-sensical "no sources given to target" error if done all as one set of
|
||||
# arguments to the add_executable() call
|
||||
add_executable(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_RESOURCES})
|
||||
target_sources(${SUBSURFACE_TARGET} PUBLIC ${MOBILE_SRC} ${MOBILE_RESOURCES})
|
||||
target_link_libraries(
|
||||
${SUBSURFACE_TARGET}
|
||||
subsurface_mobile
|
||||
subsurface_profile
|
||||
${SUBSURFACE_MAPWIDGET}
|
||||
subsurface_backend_shared
|
||||
subsurface_models_mobile
|
||||
subsurface_commands
|
||||
subsurface_corelib
|
||||
subsurface_stats
|
||||
kirigamiplugin
|
||||
${SUBSURFACE_LINK_LIBRARIES}
|
||||
)
|
||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||
set(SUBSURFACE_APP
|
||||
subsurface-desktop-main.cpp
|
||||
subsurface-helper.cpp
|
||||
)
|
||||
source_group("Subsurface App" FILES ${SUBSURFACE_APP})
|
||||
if(ANDROID)
|
||||
add_library(${SUBSURFACE_TARGET} SHARED ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
||||
else()
|
||||
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
${SUBSURFACE_TARGET}
|
||||
subsurface_generated_ui
|
||||
subsurface_interface
|
||||
subsurface_profile
|
||||
${SUBSURFACE_MAPWIDGET}
|
||||
subsurface_backend_shared
|
||||
subsurface_models_desktop
|
||||
subsurface_commands
|
||||
subsurface_corelib
|
||||
subsurface_stats
|
||||
${SUBSURFACE_LINK_LIBRARIES}
|
||||
)
|
||||
add_dependencies(subsurface_desktop_preferences subsurface_generated_ui)
|
||||
add_dependencies(subsurface_interface subsurface_generated_ui)
|
||||
add_dependencies(subsurface_profile subsurface_generated_ui)
|
||||
add_dependencies(subsurface_models_desktop subsurface_generated_ui)
|
||||
add_dependencies(subsurface_generated_ui version)
|
||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
set(DOWNLOADER_APP
|
||||
subsurface-downloader-main.cpp
|
||||
cli-downloader.cpp
|
||||
)
|
||||
source_group("Downloader App" FILES ${DOWNLOADER_APP})
|
||||
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${DOWNLOADER_APP} ${SUBSURFACE_RESOURCES})
|
||||
target_link_libraries(
|
||||
${SUBSURFACE_TARGET}
|
||||
subsurface_backend_shared
|
||||
subsurface_models_downloader
|
||||
subsurface_commands
|
||||
subsurface_corelib
|
||||
${SUBSURFACE_LINK_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_dependencies(subsurface_corelib version)
|
||||
|
||||
# add platform specific actions
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "[Paths]
|
||||
Prefix=.
|
||||
# Generate the ssrf-config.h every 'make'
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/version.h.in "\#define VERSION_STRING \"4.1.\"@VERSION@\n")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/version.cmake "EXECUTE_PROCESS(
|
||||
COMMAND date +\"%s\"
|
||||
OUTPUT_VARIABLE VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
|
||||
")
|
||||
endif()
|
||||
|
||||
# build an automated html exporter
|
||||
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp ${SUBSURFACE_RESOURCES})
|
||||
target_link_libraries(export-html subsurface_corelib ${SUBSURFACE_LINK_LIBRARIES})
|
||||
|
||||
# install Subsurface
|
||||
# first some variables with files that need installing
|
||||
set(DOCFILES
|
||||
README.md
|
||||
ReleaseNotes/ReleaseNotes.txt
|
||||
SupportedDivecomputers.txt
|
||||
${CMAKE_BINARY_DIR}/Documentation/user-manual.html
|
||||
${CMAKE_BINARY_DIR}/Documentation/user-manual_es.html
|
||||
${CMAKE_BINARY_DIR}/Documentation/user-manual_fr.html
|
||||
ADD_CUSTOM_TARGET(version ALL COMMAND
|
||||
${CMAKE_COMMAND} -D SRC=${CMAKE_BINARY_DIR}/version.h.in
|
||||
-D DST=${CMAKE_BINARY_DIR}/ssrf-version.h
|
||||
-P ${CMAKE_BINARY_DIR}/version.cmake
|
||||
)
|
||||
|
||||
# add all the translations that we may need
|
||||
FILE(STRINGS "subsurface_enabled_translations" QTTRANSLATIONS_BASE)
|
||||
# compile the core library, in C.
|
||||
SET(SUBSURFACE_CORE_LIB_SRCS
|
||||
deco.c
|
||||
device.c
|
||||
dive.c
|
||||
divelist.c
|
||||
equipment.c
|
||||
file.c
|
||||
libdivecomputer.c
|
||||
load-git.c
|
||||
membuffer.c
|
||||
parse-xml.c
|
||||
planner.c
|
||||
profile.c
|
||||
worldmap-save.c
|
||||
save-git.c
|
||||
save-xml.c
|
||||
save-html.c
|
||||
sha1.c
|
||||
statistics.c
|
||||
strtod.c
|
||||
subsurfacestartup.c
|
||||
time.c
|
||||
uemis.c
|
||||
uemis-downloader.c
|
||||
linux.c
|
||||
#gettextfrommoc should be added because we are using it on the c-code.
|
||||
gettextfromc.cpp
|
||||
#dirk ported some core functionality to c++.
|
||||
qthelper.cpp
|
||||
divecomputer.cpp
|
||||
exif.cpp
|
||||
subsurfacesysinfo.cpp
|
||||
)
|
||||
|
||||
if(NOT DEFINED QT_TRANSLATION_DIR OR QT_TRANSLATION_DIR STREQUAL "")
|
||||
if(USINGQT6)
|
||||
set(QT_TRANSLATION_DIR ${QtCore_DIR}/../../../translations)
|
||||
else()
|
||||
set(QT_TRANSLATION_DIR ${Qt5Core_DIR}/../../../translations)
|
||||
endif()
|
||||
endif()
|
||||
set(QTTRANSLATIONS "")
|
||||
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
|
||||
if (QTTRANSLATION AND EXISTS ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
||||
set(QTTRANSLATIONS ${QTTRANSLATIONS} ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
||||
endif()
|
||||
endforeach()
|
||||
#the interface, in C++
|
||||
SET(SUBSURFACE_INTERFACE
|
||||
qt-ui/updatemanager.cpp
|
||||
qt-ui/about.cpp
|
||||
qt-ui/completionmodels.cpp
|
||||
qt-ui/divecomputermanagementdialog.cpp
|
||||
qt-ui/divelistview.cpp
|
||||
qt-ui/diveplanner.cpp
|
||||
qt-ui/downloadfromdivecomputer.cpp
|
||||
qt-ui/globe.cpp
|
||||
qt-ui/graphicsview-common.cpp
|
||||
qt-ui/kmessagewidget.cpp
|
||||
qt-ui/maintab.cpp
|
||||
qt-ui/mainwindow.cpp
|
||||
qt-ui/modeldelegates.cpp
|
||||
qt-ui/models.cpp
|
||||
qt-ui/preferences.cpp
|
||||
qt-ui/printdialog.cpp
|
||||
qt-ui/printlayout.cpp
|
||||
qt-ui/printoptions.cpp
|
||||
qt-ui/simplewidgets.cpp
|
||||
qt-ui/starwidget.cpp
|
||||
qt-ui/subsurfacewebservices.cpp
|
||||
qt-ui/tableview.cpp
|
||||
qt-ui/divelogimportdialog.cpp
|
||||
qt-ui/tagwidget.cpp
|
||||
qt-ui/groupedlineedit.cpp
|
||||
qt-ui/usermanual.cpp
|
||||
qt-ui/divelogexportdialog.cpp
|
||||
qt-ui/divepicturewidget.cpp
|
||||
qt-ui/usersurvey.cpp
|
||||
|
||||
# now for each platform the install instructions
|
||||
if(ANDROID)
|
||||
# Android template directory
|
||||
include(${QT_ANDROID_CMAKE})
|
||||
if((DEFINED ENV{KEYSTORE}) AND (DEFINED ENV{KEYSTORE_PASSWORD}))
|
||||
add_qt_android_apk(${SUBSURFACE_TARGET}.apk ${SUBSURFACE_TARGET}
|
||||
PACKAGE_SOURCES ${CMAKE_BINARY_DIR}/android-mobile DEPENDS ${ANDROID_NATIVE_LIBSSL} ${ANDROID_NATIVE_LIBCRYPT}
|
||||
KEYSTORE $ENV{KEYSTORE} Subsurface-mobile KEYSTORE_PASSWORD $ENV{KEYSTORE_PASSWORD}
|
||||
)
|
||||
message(STATUS "KEYSTORE=$ENV{KEYSTORE} KEYSTORE_PASSWORD=$ENV{KEYSTORE_PASSWORD}")
|
||||
else()
|
||||
add_qt_android_apk(${SUBSURFACE_TARGET}.apk ${SUBSURFACE_TARGET}
|
||||
PACKAGE_SOURCES ${CMAKE_BINARY_DIR}/android-mobile DEPENDS ${ANDROID_NATIVE_LIBSSL} ${ANDROID_NATIVE_LIBCRYPT}
|
||||
)
|
||||
message(STATUS "no KEYSTORE")
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(APP_BUNDLE_DIR "${SUBSURFACE_TARGET}.app")
|
||||
# macdeployqt simplifies a lot of this process, but still doesn't get everything right
|
||||
# - it misses a couple of resources and frameworks
|
||||
# - it seems to always deploy the SQL plugins (even though they aren't needed)
|
||||
set(MACDEPLOY_ARGS "-qmldir=${APP_BUNDLE_DIR}/Contents/Resources/qml -appstore-compliant -verbose=0 -executable=${APP_BUNDLE_DIR}/Contents/MacOS/${SUBSURFACE_TARGET} -always-overwrite -libpath=${CMAKE_SOURCE_DIR}/../install-root/lib")
|
||||
set(RESOURCEDIR ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources)
|
||||
set(PLUGINDIR ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns)
|
||||
install(DIRECTORY Documentation/images DESTINATION ${RESOURCEDIR}/share/Documentation)
|
||||
install(FILES ${DOCFILES} DESTINATION ${RESOURCEDIR}/share/Documentation)
|
||||
install(DIRECTORY theme DESTINATION ${RESOURCEDIR})
|
||||
install(DIRECTORY printing_templates DESTINATION ${RESOURCEDIR})
|
||||
install(FILES ${TRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
|
||||
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
|
||||
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
|
||||
if(USINGQT6)
|
||||
set(QT_INSTALL_PREFIX ${QT6_INSTALL_PREFIX})
|
||||
else()
|
||||
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
|
||||
endif()
|
||||
if(MAPSUPPORT)
|
||||
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
|
||||
# this is really weird. We first try a plugin that ended up in the Qt install prefix
|
||||
# then we try one that's in that odd broken install location that the qmake file results in (that includes the QT_INSTALL_PREFIX after our INSTALL_ROOT
|
||||
# and finally, for fat binaries, we copy the one that's in the 'logical' spot under the INSTALL_ROOT
|
||||
# this should cover all cases and always get us the correct library
|
||||
install(CODE "execute_process(COMMAND cp ${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||
endif()
|
||||
# this will fail is macdeployqt isn't in the PATH - that seemed to happen in the past, but not recently
|
||||
# also, on M1 macOS systems macdeployqt throws a ton of (apparently harmless) errors. Warn the unsuspecting developer
|
||||
install(CODE "execute_process(COMMAND macdeployqt ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})")
|
||||
# the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed
|
||||
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)")
|
||||
# and another hack to get the QML Components in the right place
|
||||
if(MAPSUPPORT)
|
||||
if (USINGQT6)
|
||||
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick,QtLocation,QtPositioning})")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
else()
|
||||
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
endif()
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
endif()
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
if(NOT QT_VERSION VERSION_LESS 5.11.0)
|
||||
# and with Qt 5.11 we need another library that isn't copied by macdeployqt
|
||||
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtPositioningQuick.framework)")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
|
||||
endif()
|
||||
if(NOT QT_VERSION VERSION_LESS 5.14.0)
|
||||
# and with Qt 5.14 we need another library that isn't always copied by macdeployqt
|
||||
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtQmlWorkerScript.framework)")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/lib/QtQmlWorkerScript.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
|
||||
endif()
|
||||
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
if(NOT DEFINED OBJCOPY)
|
||||
set(OBJCOPY x86_64-w64-mingw32.shared-objcopy)
|
||||
endif()
|
||||
find_program(OBJCOPY_FOUND ${OBJCOPY})
|
||||
if (OBJCOPY_FOUND)
|
||||
message(STATUS "Build type is 'RelWithDebInfo'. Creating debug symbols in a separate file.")
|
||||
add_custom_command(TARGET ${SUBSURFACE_TARGET} POST_BUILD
|
||||
COMMAND ${OBJCOPY} --only-keep-debug ${SUBSURFACE_TARGET}.exe ${SUBSURFACE_TARGET}.exe.debug
|
||||
COMMAND ${OBJCOPY} --strip-debug --strip-unneeded ${SUBSURFACE_TARGET}.exe
|
||||
COMMAND ${OBJCOPY} --add-gnu-debuglink=${SUBSURFACE_TARGET}.exe.debug ${SUBSURFACE_TARGET}.exe
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
)
|
||||
|
||||
# Windows bundling rules
|
||||
# We don't have a helpful tool like macdeployqt for Windows, so we hardcode
|
||||
# which libs we need.
|
||||
# "make install", copies everything into a staging area
|
||||
# "make installer", uses makensis to create an installer executable
|
||||
set(WINDOWSSTAGING ${CMAKE_BINARY_DIR}/staging)
|
||||
install(DIRECTORY Documentation/images DESTINATION ${WINDOWSSTAGING}/Documentation)
|
||||
install(FILES ${DOCFILES} DESTINATION ${WINDOWSSTAGING}/Documentation)
|
||||
install(DIRECTORY theme DESTINATION ${WINDOWSSTAGING})
|
||||
install(DIRECTORY printing_templates DESTINATION ${WINDOWSSTAGING})
|
||||
install(FILES ${TRANSLATIONS} DESTINATION ${WINDOWSSTAGING}/translations)
|
||||
install(FILES ${QTTRANSLATIONS} DESTINATION ${WINDOWSSTAGING}/translations)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt ${CMAKE_SOURCE_DIR}/packaging/windows/subsurface.ico DESTINATION ${WINDOWSSTAGING})
|
||||
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION ${WINDOWSSTAGING})
|
||||
install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${WINDOWSSTAGING})
|
||||
#the profile widget
|
||||
SET(SUBSURFACE_PROFILE_LIB_SRCS
|
||||
qt-ui/profile/profilewidget2.cpp
|
||||
qt-ui/profile/diverectitem.cpp
|
||||
qt-ui/profile/divepixmapitem.cpp
|
||||
qt-ui/profile/divelineitem.cpp
|
||||
qt-ui/profile/divetextitem.cpp
|
||||
qt-ui/profile/animationfunctions.cpp
|
||||
qt-ui/profile/divecartesianaxis.cpp
|
||||
qt-ui/profile/diveplotdatamodel.cpp
|
||||
qt-ui/profile/diveprofileitem.cpp
|
||||
qt-ui/profile/diveeventitem.cpp
|
||||
qt-ui/profile/divetooltipitem.cpp
|
||||
qt-ui/profile/ruleritem.cpp
|
||||
)
|
||||
|
||||
if(NOT QT_VERSION VERSION_LESS 5.11.0)
|
||||
# hack to work around the fact that we don't process the dependencies of plugins
|
||||
# as of Qt 5.11 this additional DLL is needed and it's only referenced in the qml DLLs
|
||||
install(FILES ${QT_INSTALL_PREFIX}/bin/Qt5PositioningQuick.dll DESTINATION ${WINDOWSSTAGING})
|
||||
endif()
|
||||
#the main app.
|
||||
SET(SUBSURFACE_APP
|
||||
main.cpp
|
||||
qt-gui.cpp
|
||||
qthelper.cpp
|
||||
)
|
||||
|
||||
if(NOT DEFINED MAKENSIS)
|
||||
set(MAKENSIS makensis)
|
||||
endif()
|
||||
FILE(GLOB SUBSURFACE_UI qt-ui/*.ui)
|
||||
# to be replaced by QT_WRAP_UI on CMake 3.
|
||||
IF(${SUBSURFACE_QT_VERSION} MATCHES "4")
|
||||
QT4_WRAP_UI( SUBSURFACE_UI_HDRS ${SUBSURFACE_UI} )
|
||||
QT4_ADD_RESOURCES( SUBSURFACE_QRC_HRDS subsurface.qrc )
|
||||
ELSEIF(${SUBSURFACE_QT_VERSION} MATCHES "5")
|
||||
QT5_WRAP_UI( SUBSURFACE_UI_HDRS ${SUBSURFACE_UI} )
|
||||
ENDIF()
|
||||
|
||||
# the script we created above is now added as a command to run at
|
||||
# install time - so this ensures that subsurface.exe has been
|
||||
# built before this is run
|
||||
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DSUBSURFACE_TARGET=${SUBSURFACE_TARGET} -DSUBSURFACE_SOURCE=${SUBSURFACE_SOURCE} -DSTAGING=${WINDOWSSTAGING} -P ${CMAKE_SOURCE_DIR}/cmake/Modules/dlllist.cmake)")
|
||||
ADD_LIBRARY(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} )
|
||||
ADD_LIBRARY(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS})
|
||||
ADD_LIBRARY(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS})
|
||||
ADD_LIBRARY(subsurface_interface STATIC ${SUBSURFACE_INTERFACE})
|
||||
ADD_EXECUTABLE(subsurface ${SUBSURFACE_APP} ${SUBSURFACE_QRC_HRDS} )
|
||||
|
||||
# create the subsurface-x.y.z.exe installer - this needs to depend
|
||||
# on the install target but cmake doesn't allow that, so we depend
|
||||
# on the fake target instead
|
||||
add_custom_target(
|
||||
fake_install
|
||||
COMMAND "${CMAKE_COMMAND}" --build . --target install
|
||||
DEPENDS ${SUBSURFACE_TARGET}
|
||||
)
|
||||
target_link_libraries( subsurface
|
||||
subsurface_generated_ui
|
||||
subsurface_interface
|
||||
subsurface_profile
|
||||
subsurface_corelib
|
||||
${QT_LIBRARIES}
|
||||
${MARBLE_LIBRARIES}
|
||||
${SUBSURFACE_LINK_LIBRARIES}
|
||||
-ldivecomputer
|
||||
-lzip
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
installer
|
||||
COMMAND ${MAKENSIS} ${WINDOWSSTAGING}/subsurface.nsi
|
||||
DEPENDS fake_install
|
||||
)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# the syntax is odd, but this searches for libqtgeoservices_googlemaps.so
|
||||
# in the filesystem below our install-root
|
||||
# different Linux flavors put the plugin in different directories
|
||||
file(GLOB_RECURSE GOOGLEMAPS ${CMAKE_SOURCE_DIR}/../install-root/libqtgeoservices_googlemaps.so)
|
||||
if (NOT GOOGLEMAPS)
|
||||
message(STATUS "Cannot find libqtgeoservices_googlemaps.so")
|
||||
else()
|
||||
add_custom_target(link_googlemaps_plugin ALL COMMAND
|
||||
rm -rf ${CMAKE_BINARY_DIR}/geoservices &&
|
||||
mkdir -p ${CMAKE_BINARY_DIR}/geoservices &&
|
||||
ln -sf ${GOOGLEMAPS} ${CMAKE_BINARY_DIR}/geoservices)
|
||||
endif()
|
||||
install(FILES subsurface.debug DESTINATION bin)
|
||||
install(FILES subsurface.desktop DESTINATION share/applications)
|
||||
install(CODE "execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/scripts/add-version-to-metainfo.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})")
|
||||
install(FILES metainfo/subsurface.metainfo.xml DESTINATION share/metainfo)
|
||||
install(FILES icons/subsurface-icon.svg DESTINATION share/icons/hicolor/scalable/apps)
|
||||
install(DIRECTORY Documentation/images DESTINATION share/subsurface/Documentation)
|
||||
install(FILES ${DOCFILES} DESTINATION share/subsurface/Documentation)
|
||||
install(DIRECTORY theme DESTINATION share/subsurface)
|
||||
install(DIRECTORY printing_templates DESTINATION share/subsurface)
|
||||
install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
|
||||
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
|
||||
endif()
|
||||
ADD_DEPENDENCIES(subsurface_profile subsurface_generated_ui)
|
||||
ADD_DEPENDENCIES(subsurface_interface subsurface_generated_ui)
|
||||
ADD_DEPENDENCIES(subsurface_generated_ui version)
|
||||
ADD_DEPENDENCIES(subsurface_corelib version)
|
||||
|
||||
if (MAKE_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
ENABLE_TESTING()
|
||||
ADD_EXECUTABLE( TestUnitConversion tests/testunitconversion.cpp )
|
||||
TARGET_LINK_LIBRARIES( TestUnitConversion ${QT_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -lzip -ldivecomputer subsurface_corelib)
|
||||
ADD_TEST( NAME TestUnitConversion COMMAND TestUnitConversion)
|
||||
|
||||
# useful for debugging CMake issues
|
||||
# print_all_variables()
|
||||
ADD_EXECUTABLE( TestProfile tests/testprofile.cpp )
|
||||
TARGET_LINK_LIBRARIES( TestProfile ${QT_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -lzip -ldivecomputer subsurface_corelib)
|
||||
ADD_TEST( NAME TestProfile COMMAND TestProfile)
|
||||
424
CODINGSTYLE.md
@ -1,424 +0,0 @@
|
||||
# Coding Style
|
||||
|
||||
Here are some of the basics that we are trying to enforce for our coding style
|
||||
and conventions. The existing code (as of the commit that adds these lines) is
|
||||
not yet fully consistent to these rules, but following these rules will make
|
||||
sure that no one yells at you about your patches.
|
||||
|
||||
We have a script that can be used to reformat code to be reasonably close
|
||||
to these rules; it's in `scripts/whitespace.pl` – this script requires
|
||||
clang-format to be installed (which sadly isn't installed by default on
|
||||
any of our platforms; even on Mac where clang is the default compiler).
|
||||
|
||||
At the end of this file are some ideas for your `.emacs` file (if that's
|
||||
your editor of choice) as well as for QtCreator. If you have settings for
|
||||
other editors that implement this coding style, please add them here.
|
||||
|
||||
## Basic rules
|
||||
|
||||
* all indentation is tabs (set to 8 char) with the exception of
|
||||
continuation lines that are aligned with tabs and then spaces
|
||||
|
||||
* all keywords followed by a '(' have a space in between
|
||||
```
|
||||
if (condition)
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
```
|
||||
|
||||
* function calls do NOT have a space between their name and argument
|
||||
```
|
||||
i = some_function(argument);
|
||||
```
|
||||
|
||||
* usually there is no space on the inside of parenthesis (see examples
|
||||
above)
|
||||
|
||||
* function / method implementations have their opening curly braces in
|
||||
column 1
|
||||
|
||||
* all other opening curly braces follow at the end of the line, with a
|
||||
space separating them:
|
||||
```
|
||||
if (condition) {
|
||||
dosomething();
|
||||
dosomethingelse();
|
||||
}
|
||||
```
|
||||
|
||||
* both sides of an `if` / `else` clause either use or do not use curly braces:
|
||||
```
|
||||
if (condition)
|
||||
i = 4;
|
||||
else
|
||||
j = 6;
|
||||
|
||||
if (condition) {
|
||||
i = 6;
|
||||
} else {
|
||||
i = 4;
|
||||
j = 6;
|
||||
}
|
||||
```
|
||||
|
||||
* use space to make visual separation easier
|
||||
```
|
||||
a = b + 3 + e / 4;
|
||||
```
|
||||
|
||||
* continuation lines have the operator / comma at the end
|
||||
```
|
||||
if (very_long_condition_1 ||
|
||||
condition_2)
|
||||
|
||||
b = a + (c + d +
|
||||
f + z);
|
||||
```
|
||||
|
||||
* in a C++ constructor initialization list, the colon is on the same line and
|
||||
continuation lines are aligned as the rule above:
|
||||
```
|
||||
ClassName::ClassName() : x(1),
|
||||
y(2),
|
||||
z(3)
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
* unfortunate inconsistency
|
||||
|
||||
- C code usually uses underscores to structure names
|
||||
```
|
||||
variable_in_C
|
||||
```
|
||||
- In contrast, C++ code usually uses camelCase
|
||||
```
|
||||
variableInCPlusPlus
|
||||
```
|
||||
for variable names and PascalCase
|
||||
```
|
||||
ClassInCPlusPlus
|
||||
```
|
||||
for names of classes and other types
|
||||
|
||||
where the two meet, use your best judgment and go for best consistency
|
||||
(i.e., where does the name "originate")
|
||||
|
||||
* macro names should be capitalized; e.g., prefer
|
||||
```
|
||||
#define FROB 17
|
||||
#define FROBULATE(x) (x)+FROB
|
||||
```
|
||||
to
|
||||
```
|
||||
#define frob 17
|
||||
#define frobulate(x) (x)+frob
|
||||
```
|
||||
|
||||
* there is a strong preference for lower case file names; sometimes conventions
|
||||
or outside requirements make camelCase filenames the better (or only) choice,
|
||||
but absent such an outside reason all file names should be lower case
|
||||
This rule applies to new file names, existing file names should not be
|
||||
changed without a reason.
|
||||
|
||||
* cpp/h file names should usually be identical to the class name but in lower
|
||||
case. Where it seems appropriate, multiple, closely related classes can be
|
||||
in a single file with a more generic name.
|
||||
|
||||
* `switch` statements with blocks are a little bit special (to avoid indenting
|
||||
too far)
|
||||
```
|
||||
switch (foo) {
|
||||
case FIRST:
|
||||
whatever();
|
||||
break;
|
||||
case SECOND: {
|
||||
int i;
|
||||
for (i = 0; i < 5; i++)
|
||||
do_something(i);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Coding conventions
|
||||
|
||||
* variable declarations
|
||||
|
||||
In C code we really like them to be at the beginning of a code block,
|
||||
not interspersed in the middle.
|
||||
in C++ we are a bit less strict about this – but still, try not to go
|
||||
crazy. Notably, in C++ the lifetime of a variable often coincides with the
|
||||
lifetime of a resource (e.g. file) and therefore the variable is defined
|
||||
at the place where the resource is needed.
|
||||
|
||||
* The `*`, `&` and `&&` declarators are grouped with the name, not the type
|
||||
(classical C-style) as in `char *string` instead of `char* string`. This
|
||||
reflects the precedence rules of the language: `int &i` means that the name
|
||||
`i` stands for a reference [to an object with type `int`], not that
|
||||
`i` stands for an object of the type [reference to `int`].
|
||||
Although this may seem like hairsplitting (both interpretations
|
||||
have the same effect) it is crucial in the
|
||||
definition of multiple variables, such
|
||||
as
|
||||
```
|
||||
struct dive *next, **pprev;
|
||||
```
|
||||
|
||||
* In C++ code, we generally use explicit types in variable declarations for clarity.
|
||||
Use `auto` sparingly and only in cases where code readability improves.
|
||||
Two classical examples are:
|
||||
- Iterators, whose type names often are verbose:
|
||||
```
|
||||
auto it = m_trackers.find(when);
|
||||
```
|
||||
is not only distinctly shorter than
|
||||
```
|
||||
QMap<qint64, gpsTracker>::iterator it = m_trackers.find(when);
|
||||
```
|
||||
it will also continue working if a different data structure is chosen.
|
||||
- If the type is given in the same line anyway. Thus,
|
||||
```
|
||||
auto service = qobject_cast<QLowEnergyService*>(sender());
|
||||
```
|
||||
is easier to read than and conveys the same information as
|
||||
```
|
||||
QLowEnergyService *service = qobject_cast<QLowEnergyService*>(sender());
|
||||
```
|
||||
- If the variable is a container that is only assigned to a local variable to
|
||||
be able to use it in a range-based `for` loop
|
||||
```
|
||||
const auto serviceUuids = device.serviceUuids();
|
||||
for (QBluetoothUuid id: serviceUuids) {
|
||||
```
|
||||
The variable has also to be const to avoid that Qt containers will do a
|
||||
deep copy when the range bases `for` loop will call the `begin()` method
|
||||
internally.
|
||||
|
||||
* text strings
|
||||
|
||||
The default language of subsurface is US English so please use US English
|
||||
spelling and terminology.
|
||||
User-visible strings should be passed to the `tr()` function to enable
|
||||
translation into other languages.
|
||||
- like this
|
||||
```
|
||||
QString msgTitle = tr("Check for updates.");
|
||||
```
|
||||
- rather than
|
||||
```
|
||||
QString msgTitle = "Check for updates.";
|
||||
```
|
||||
|
||||
This works by default in classes (indirectly) derived from `QObject`. Each
|
||||
string to be translated is associated with a context, which corresponds
|
||||
to the class name. Classes that are not derived from `QObject` can generate
|
||||
the `tr()` functions by using the `Q_DECLARE_TR_FUNCTIONS` macro:
|
||||
```
|
||||
#include <QCoreApplication>
|
||||
|
||||
class myClass {
|
||||
Q_DECLARE_TR_FUNCTIONS(gettextfromC)
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
As an alternative, which also works outside of class context, the `tr()`
|
||||
function of a different class can be called. This avoids creating multiple
|
||||
translations for the same string:
|
||||
```
|
||||
gettextFromC::tr("%1km")
|
||||
```
|
||||
|
||||
The `gettextFromC` class in the above example was created as a catch-all
|
||||
context for translations accessed in C code. But it can also be used
|
||||
from C++ helper functions. To use it from C, include the `"core/gettext.h"`
|
||||
header and invoke the `translate()` macro:
|
||||
```
|
||||
#include "core/gettext.h"
|
||||
|
||||
report_error(translate("gettextFromC", "Remote storage and local data diverged"));
|
||||
```
|
||||
It is crucial to pass `"gettextFromC"` as a first macro argument so that Qt
|
||||
is able to associate the string with the correct context.
|
||||
The translate macro returns a cached C-style string, which is generated at runtime
|
||||
when the particular translation string is encountered for the first time.
|
||||
It remains valid during the whole application's life time.
|
||||
|
||||
Outside of function context, the `QT_TRANSLATE_NOOP` macro can be used as in
|
||||
```
|
||||
struct ws_info_t ws_info[100] = {
|
||||
{ QT_TRANSLATE_NOOP("gettextFromC", "integrated"), 0 },
|
||||
{ QT_TRANSLATE_NOOP("gettextFromC", "belt"), 0 },
|
||||
{ QT_TRANSLATE_NOOP("gettextFromC", "ankle"), 0 },
|
||||
{ QT_TRANSLATE_NOOP("gettextFromC", "backplate"), 0 },
|
||||
{ QT_TRANSLATE_NOOP("gettextFromC", "clip-on"), 0 },
|
||||
};
|
||||
```
|
||||
Note that here, the texts will be scheduled for translation with the `"gettextFromC"`
|
||||
context, but the array is only initialized with the original text. The actual
|
||||
translation has to be performed later in code. For C-code, the `QT_TRANSLATE_NOOP`
|
||||
macro is defined in the `"core/gettext.h"` header.
|
||||
|
||||
* UI text style
|
||||
|
||||
These guidelines are designed to ensure consistency in presentation within
|
||||
Subsurface.
|
||||
Only the first word of multi-word text strings should be capitalized unless
|
||||
a word would normally be capitalized mid-sentence, like Africa. This applies
|
||||
to all UI text including menus, menu items, tool-tips, button text and label
|
||||
text etc. e.g. "Check for updates" rather than "Check for Updates".
|
||||
We also capitalize Subsurface (NOTE: not SubSurface) when referring to the
|
||||
application itself.
|
||||
Abbreviations should end with a period, e.g. "temp." not "temp" for
|
||||
temperature
|
||||
Numerals in chemical formulae should use subscript characters e.g. O₂ not O2
|
||||
Partial pressures in Subsurface are, by convention, abbreviated with a single
|
||||
"p" rather than 2, as in pO₂ not ppO₂
|
||||
Where more than one term exists for something, please choose the one already
|
||||
in use within Subsurface e.g. Cylinder vs. Tank.
|
||||
|
||||
|
||||
* string manipulation
|
||||
|
||||
* user interface
|
||||
|
||||
In UI part of the code use of `QString` methods is preferred, see this pretty
|
||||
good guide in [`QString` documentation][1]
|
||||
|
||||
* core components
|
||||
|
||||
In the core part of the code, C-string should be used.
|
||||
C-string manipulation is not always straightforward specifically when
|
||||
it comes to memory allocation, a set of helper functions has been developed
|
||||
to help with this. Documentation and usage examples can be found in
|
||||
[core/membuffer.h][2]
|
||||
|
||||
## Sample Settings
|
||||
|
||||
### Emacs
|
||||
|
||||
These lines in your `.emacs` file should get you fairly close when it comes
|
||||
to indentation – many of the other rules you have to follow manually
|
||||
|
||||
```
|
||||
;; indentation
|
||||
(defun c-lineup-arglist-tabs-only (ignored)
|
||||
"Line up argument lists by tabs, not spaces"
|
||||
(let* ((anchor (c-langelem-pos c-syntactic-element))
|
||||
(column (c-langelem-2nd-pos c-syntactic-element))
|
||||
(offset (- (1+ column) anchor))
|
||||
(steps (floor offset c-basic-offset)))
|
||||
(* (max steps 1)
|
||||
c-basic-offset)))
|
||||
|
||||
(add-hook 'c-mode-common-hook
|
||||
(lambda ()
|
||||
;; Add kernel style
|
||||
(c-add-style
|
||||
"linux-tabs-only"
|
||||
'("linux" (c-offsets-alist
|
||||
(arglist-cont-nonempty
|
||||
c-lineup-gcc-asm-reg
|
||||
c-lineup-arglist-tabs-only))))))
|
||||
|
||||
(add-hook 'c-mode-hook
|
||||
(lambda ()
|
||||
(let ((filename (buffer-file-name)))
|
||||
;; Enable kernel mode for the appropriate files
|
||||
(setq indent-tabs-mode t)
|
||||
(c-set-style "linux-tabs-only"))))
|
||||
|
||||
(add-hook 'c++-mode-hook
|
||||
(lambda ()
|
||||
(let ((filename (buffer-file-name)))
|
||||
;; Enable kernel mode for the appropriate files
|
||||
(setq indent-tabs-mode t)
|
||||
(c-set-style "linux-tabs-only"))))
|
||||
```
|
||||
|
||||
### QtCreator
|
||||
|
||||
These settings seem to get indentation right in QtCreator. Making TAB
|
||||
always adjust indent makes it hard to add hard tabs before '\' when
|
||||
creating continuing lines. Copying a tab with your mouse / ctrl-C and
|
||||
inserting it with ctrl-V seems to work around that problem (use Command
|
||||
instead of ctrl on your Mac)
|
||||
Save this XML code below to a file, open Preferences (or Tools->Options)
|
||||
in QtCreator, pick C++ in the left column and then click on Import...
|
||||
to open the file you just created. Now you should have a "Subsurface"
|
||||
style that you can select which should work well for our coding style.
|
||||
|
||||
```
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorCodeStyle>
|
||||
<!-- Written by QtCreator 3.0.0, 2014-02-27T07:52:57. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>CodeStyleData</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="AlignAssignments">false</value>
|
||||
<value type="bool" key="AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="BindStarToIdentifier">true</value>
|
||||
<value type="bool" key="BindStarToLeftSpecifier">false</value>
|
||||
<value type="bool" key="BindStarToRightSpecifier">false</value>
|
||||
<value type="bool" key="BindStarToTypeName">false</value>
|
||||
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">false</value>
|
||||
<value type="bool" key="IndentAccessSpecifiers">false</value>
|
||||
<value type="bool" key="IndentBlockBody">true</value>
|
||||
<value type="bool" key="IndentBlockBraces">false</value>
|
||||
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
|
||||
<value type="bool" key="IndentClassBraces">false</value>
|
||||
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
|
||||
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
|
||||
<value type="bool" key="IndentEnumBraces">false</value>
|
||||
<value type="bool" key="IndentFunctionBody">true</value>
|
||||
<value type="bool" key="IndentFunctionBraces">false</value>
|
||||
<value type="bool" key="IndentNamespaceBody">false</value>
|
||||
<value type="bool" key="IndentNamespaceBraces">false</value>
|
||||
<value type="int" key="IndentSize">8</value>
|
||||
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
|
||||
<value type="bool" key="IndentSwitchLabels">false</value>
|
||||
<value type="int" key="PaddingMode">2</value>
|
||||
<value type="bool" key="SpacesForTabs">false</value>
|
||||
<value type="int" key="TabSize">8</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>DisplayName</variable>
|
||||
<value type="QString">Subsurface</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
```
|
||||
|
||||
### Vim
|
||||
|
||||
As everybody knows vim is a way better editor than emacs and thus needs to be
|
||||
in this file too. Put this into your `.vimrc` and this should produce something
|
||||
close to our coding standards.
|
||||
|
||||
```
|
||||
" Subsurface coding style
|
||||
filetype plugin indent on
|
||||
filetype detect
|
||||
set cindent tabstop=8 shiftwidth=8 cinoptions=l1,:0,(0,g0
|
||||
" TODO: extern "C" gets indented
|
||||
|
||||
" And some sane defaults, optional, but quite nice
|
||||
set nocompatible
|
||||
syntax on
|
||||
colorscheme default
|
||||
set hls
|
||||
set is
|
||||
|
||||
" The default blue is just impossible to see on a black terminal
|
||||
highlight Comment ctermfg=Brown
|
||||
|
||||
" clearly point out when someone have trailing spaces
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
|
||||
" Show trailing whitespace and spaces before a tab:
|
||||
match ExtraWhitespace /\s\+$\| \+\ze\t/
|
||||
```
|
||||
|
||||
[1]: http://doc.qt.io/qt-5/qstring.html#manipulating-string-data
|
||||
[2]: https://github.com/Subsurface/subsurface/blob/master/core/membuffer.h
|
||||
122
CONTRIBUTING.md
@ -1,122 +0,0 @@
|
||||
# Contributing to Subsurface
|
||||
|
||||
## Ways to Contribute
|
||||
|
||||
There are many ways in which you can contribute. We are always looking for testers who are willing to test the code while it is being developed. We especially need people running Windows and Mac (as the majority of the active developers are Linux people). We are also always looking for volunteers who help reviewing and improving the documentation. And very importantly we are looking for translators willing to translate the software into different languages. Our translations are centrally handled at [Transifex][4] – please sign up for an account there and then request to join the [Subsurface Team][5].
|
||||
|
||||
If you would like to contribute financially to help us cover the cost of running a free cloud synchronisation service for dive logs, you can do so by sponsoring this project.
|
||||
|
||||
|
||||
## Joining the Subsurface Contributors' Community
|
||||
|
||||
To get 'into the loop' for what is going on in Subsurface you should join our [mailing list][1], and start watching the [subsurface/subsurface repository on GitHub][2]. Conversation in the mailing list is in English – even though Subsurface itself and the website and documentation are available in many languages, the shared language the contributors communicate in is English. Actually "Broken English" is just fine… :-)
|
||||
|
||||
Of course it is also a good idea to join our [User Forum][3], to be able to see feedback and bug reports from our users.
|
||||
|
||||
|
||||
## Tips for Code Contributions
|
||||
|
||||
### Code Change Submissions
|
||||
|
||||
If you would like to contribute patches that fix bugs or add new features, that is of course especially welcome. If you are looking for places to start, look at the open bugs in our [bug tracker][6].
|
||||
|
||||
Here is a very brief introduction on creating commits that you can either send as [pull requests][7] on our main GitHub repository or send as emails to the mailing list. Much more details on how to use Git can be found at the [Git user manual][8].
|
||||
|
||||
Start with getting the latest source.
|
||||
|
||||
cd subsurface
|
||||
git checkout master
|
||||
git pull
|
||||
|
||||
ok, now we know you're on the latest version. Create a working branch to keep your development in:
|
||||
|
||||
git checkout -b devel
|
||||
|
||||
Edit the code (or documentation), compile, test… then create a commit:
|
||||
|
||||
git commit -s -a
|
||||
|
||||
Depending on your OS this will open a default editor – usually you can define which by setting the environment variable `GIT_EDITOR`. Here you enter your commit message. The first line is the title of your commit. Keep it brief and to the point. Then a longer explanation (more on this and the fact that we insist on all contributions containing a Signed-off-by: line below).
|
||||
|
||||
If you want to change the commit message, `git commit --amend` is the way to go. Feel free to break your changes into multiple smaller commits. Then, when you are done there are two directions to go, which one you find easier depends a bit on how familiar you are with GitHub. You can either push your branch to GitHub and create a [pull requests on GitHub][7], or you run:
|
||||
|
||||
git format-patch master..devel
|
||||
|
||||
Which creates a number of files that have names like `0001-Commit-title.patch`, which you can then send to our developer mailing list.
|
||||
|
||||
|
||||
### Developer Certificate of Origin (DCO)
|
||||
|
||||
When sending code, please either send signed-off patches or a pull request with signed-off commits. If you don't sign off on them, we will not accept them. This means adding a line that says "Signed-off-by: Name \<Email\>" at the end of each commit, indicating that you wrote the code and have the right to pass it on as an open source patch.
|
||||
|
||||
See: [Signed-off-by Lines][9]
|
||||
|
||||
|
||||
### Commit Messages
|
||||
|
||||
Also, please write good Git commit messages. A good commit message looks like this:
|
||||
|
||||
Header line: explaining the commit in one line
|
||||
|
||||
Body of commit message is a few lines of text, explaining things
|
||||
in more detail, possibly giving some background about the issue
|
||||
being fixed, etc etc.
|
||||
|
||||
The body of the commit message can be several paragraphs, and
|
||||
please do proper word-wrap and keep columns shorter than about
|
||||
74 characters or so. That way "git log" will show things
|
||||
nicely even when it's indented.
|
||||
|
||||
Reported-by: whoever-reported-it
|
||||
Signed-off-by: Your Name <you@example.com>
|
||||
|
||||
That header line really should be meaningful, and really should be just one line. The header line is what is shown by tools like gitk and shortlog, and should summarize the change in one readable line of text, independently of the longer explanation.
|
||||
|
||||
The preferred way to write a commit message is using [imperative mood][12], e.g. "Make foo do xyz" instead of "This patch makes foo do xyz" or "I made foo do xyz", as if you are giving commands or requests to the code base.
|
||||
|
||||
![gitk sample][10]
|
||||
|
||||
_Example with gitk_
|
||||
|
||||
|
||||
### Changelog
|
||||
|
||||
Additionally when important changes to behaviors, fixes or new feature are introduced an entry must be added to `CHANGELOG.md` file. Always add new entries at the very top of the file above other existing entries. Use this layout for new entries:
|
||||
|
||||
Area: Details about the change [reference thread / issue]
|
||||
|
||||
When multiple areas are affected list the areas separated with a /:
|
||||
|
||||
Area1/Area2: Detail about the change [reference thread / issue]
|
||||
|
||||
Here is a (non exhaustive) list of Areas that can be used:
|
||||
|
||||
* Bluetooth
|
||||
* Cloud-storage
|
||||
* Desktop
|
||||
* Dive pictures
|
||||
* Import
|
||||
* Libdivecomputer
|
||||
* Map-widget
|
||||
* Mobile
|
||||
* Planner
|
||||
* Printing
|
||||
* Profile
|
||||
|
||||
|
||||
### Coding Style
|
||||
|
||||
In order to make reviews simpler and have contributions merged faster in the code base, please follow Subsurface project's coding style and coding conventions described in the [CodingStyle][11] file.
|
||||
|
||||
[1]: http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
|
||||
[2]: https://github.com/subsurface/subsurface
|
||||
[3]: https://groups.google.com/g/subsurface-divelog
|
||||
[4]: https://www.transifex.com/
|
||||
[5]: https://explore.transifex.com/subsurface/subsurface/
|
||||
[6]: https://github.com/Subsurface/subsurface/issues
|
||||
[7]: https://github.com/Subsurface/subsurface/pulls
|
||||
[8]: https://www.kernel.org/pub/software/scm/git/docs/user-manual.html
|
||||
[9]: https://gerrit-review.googlesource.com/Documentation/user-signedoffby.html
|
||||
[10]: https://github.com/subsurface/subsurface/Documentation/images/Screenshot-gitk-subsurface-1.png "Example with gitk"
|
||||
[11]: https://github.com/Subsurface/subsurface/blob/master/CODINGSTYLE.md
|
||||
[12]: https://en.wikipedia.org/wiki/Imperative_mood
|
||||
235
CodingStyle
Normal file
@ -0,0 +1,235 @@
|
||||
Coding Style
|
||||
============
|
||||
|
||||
Here are some of the basics that we are trying to enforce for our coding
|
||||
style. The existing code (as of the commit that adds these lines) is not
|
||||
yet fully consistent to these rules, but following these rules will make
|
||||
sure that no one yells at you about your patches.
|
||||
|
||||
We have a script that can be used to reformat code to be reasonably close
|
||||
to these rules; it's in scripts/whitespace.pl - this script requires
|
||||
clang-format to be installed (which sadly isn't installed by default on
|
||||
any of our platforms; even on Mac where clang is the default compiler).
|
||||
|
||||
At the end of this file are some ideas for your .emacs file (if that's
|
||||
your editor of choice) as well as for QtCreator. If you have settings for
|
||||
other editors that implement this coding style, please add them here.
|
||||
|
||||
Basic rules
|
||||
===========
|
||||
|
||||
- all indentation is tabs (set to 8 char) with the exception of
|
||||
continuation lines that are alligned with tabs and then spaces
|
||||
|
||||
- all keywords followed by a '(' have a space in between
|
||||
|
||||
if (condition)
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
|
||||
- function calls do NOT have a space between their name and argument
|
||||
|
||||
i = some_function(argument);
|
||||
|
||||
- usually there is no space on the inside of parenthesis (see examples
|
||||
above)
|
||||
|
||||
- function / method implementations have their opening curly braces in
|
||||
column 1
|
||||
|
||||
- all other opening curly braces follow at the end of the line, with a
|
||||
space separating them:
|
||||
|
||||
if (condition) {
|
||||
dosomething();
|
||||
}
|
||||
|
||||
- both sides of an if / else clause either use or do not use curly braces:
|
||||
|
||||
if (condition)
|
||||
i = 4;
|
||||
else
|
||||
j = 6;
|
||||
|
||||
if (condition) {
|
||||
i = 6;
|
||||
} else {
|
||||
i = 4;
|
||||
j = 6;
|
||||
}
|
||||
|
||||
- use space to make visual separation easier
|
||||
|
||||
a = b + 3 + e / 4;
|
||||
|
||||
- continuation lines have the operator / comma at the end
|
||||
|
||||
if (very_long_conditiont_1 ||
|
||||
condition_2)
|
||||
|
||||
b = a + (c + d +
|
||||
f + z);
|
||||
|
||||
- in a C++ constructor initialization list, the colon is on the same line and
|
||||
continuation lines are aligned as the rule above:
|
||||
|
||||
ClassName::ClassName() : x(1), y(2),
|
||||
z(3)
|
||||
{
|
||||
}
|
||||
|
||||
- unfortunate inconsistency:
|
||||
-- C code usually uses underscores to structure names
|
||||
|
||||
variable_in_C
|
||||
|
||||
-- C++ code usually uses camelCase
|
||||
|
||||
variableInCPlusPlus
|
||||
|
||||
where the two meet, use your best judgment and go for best consistency
|
||||
(i.e., where does the variable "originate")
|
||||
|
||||
- switch statements with blocks are a little bit special (to avoid indenting
|
||||
too far)
|
||||
|
||||
switch (foo) {
|
||||
case FIRST:
|
||||
whatever();
|
||||
break;
|
||||
case SECOND: {
|
||||
int i;
|
||||
for (i = 0; i < 5; i++)
|
||||
do_something(i);
|
||||
}
|
||||
}
|
||||
|
||||
- variable declarations
|
||||
in C code we really like them to be at the beginning of a code block,
|
||||
not interspersed in the middle.
|
||||
in C++ we are a bit less strict about this - but still, try not to go
|
||||
crazy.
|
||||
|
||||
Sample Settings
|
||||
===============
|
||||
|
||||
Emacs
|
||||
-----
|
||||
|
||||
These lines in your .emacs file should get you fairly close when it comes
|
||||
to indentation - many of the other rules you have to follow manually
|
||||
|
||||
;; indentation
|
||||
(defun c-lineup-arglist-tabs-only (ignored)
|
||||
"Line up argument lists by tabs, not spaces"
|
||||
(let* ((anchor (c-langelem-pos c-syntactic-element))
|
||||
(column (c-langelem-2nd-pos c-syntactic-element))
|
||||
(offset (- (1+ column) anchor))
|
||||
(steps (floor offset c-basic-offset)))
|
||||
(* (max steps 1)
|
||||
c-basic-offset)))
|
||||
|
||||
(add-hook 'c-mode-common-hook
|
||||
(lambda ()
|
||||
;; Add kernel style
|
||||
(c-add-style
|
||||
"linux-tabs-only"
|
||||
'("linux" (c-offsets-alist
|
||||
(arglist-cont-nonempty
|
||||
c-lineup-gcc-asm-reg
|
||||
c-lineup-arglist-tabs-only))))))
|
||||
|
||||
(add-hook 'c-mode-hook
|
||||
(lambda ()
|
||||
(let ((filename (buffer-file-name)))
|
||||
;; Enable kernel mode for the appropriate files
|
||||
(setq indent-tabs-mode t)
|
||||
(c-set-style "linux-tabs-only"))))
|
||||
|
||||
(add-hook 'c++-mode-hook
|
||||
(lambda ()
|
||||
(let ((filename (buffer-file-name)))
|
||||
;; Enable kernel mode for the appropriate files
|
||||
(setq indent-tabs-mode t)
|
||||
(c-set-style "linux-tabs-only"))))
|
||||
|
||||
|
||||
QtCreator
|
||||
---------
|
||||
|
||||
These settings seem to get indentation right in QtCreator. Making TAB
|
||||
always adjust indent makes it hard to add hard tabs before '\' when
|
||||
creating continuing lines. Copying a tab with your mouse / ctrl-C and
|
||||
inserting it with ctrl-V seems to work around that problem (use Command
|
||||
instead of ctrl on your Mac)
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorCodeStyle>
|
||||
<!-- Written by QtCreator 3.0.0, 2014-02-27T07:52:57. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>CodeStyleData</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="AlignAssignments">false</value>
|
||||
<value type="bool" key="AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="BindStarToIdentifier">true</value>
|
||||
<value type="bool" key="BindStarToLeftSpecifier">false</value>
|
||||
<value type="bool" key="BindStarToRightSpecifier">false</value>
|
||||
<value type="bool" key="BindStarToTypeName">false</value>
|
||||
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">false</value>
|
||||
<value type="bool" key="IndentAccessSpecifiers">false</value>
|
||||
<value type="bool" key="IndentBlockBody">true</value>
|
||||
<value type="bool" key="IndentBlockBraces">false</value>
|
||||
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
|
||||
<value type="bool" key="IndentClassBraces">false</value>
|
||||
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
|
||||
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
|
||||
<value type="bool" key="IndentEnumBraces">false</value>
|
||||
<value type="bool" key="IndentFunctionBody">true</value>
|
||||
<value type="bool" key="IndentFunctionBraces">false</value>
|
||||
<value type="bool" key="IndentNamespaceBody">false</value>
|
||||
<value type="bool" key="IndentNamespaceBraces">false</value>
|
||||
<value type="int" key="IndentSize">8</value>
|
||||
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
|
||||
<value type="bool" key="IndentSwitchLabels">false</value>
|
||||
<value type="int" key="PaddingMode">2</value>
|
||||
<value type="bool" key="SpacesForTabs">false</value>
|
||||
<value type="int" key="TabSize">8</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>DisplayName</variable>
|
||||
<value type="QString">Subsurface</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
|
||||
|
||||
Vim
|
||||
---------
|
||||
|
||||
As everybody knows vim is a way better editor than emacs and thus needs to be
|
||||
in this file too. Put this into your .vimrc and this should produce something
|
||||
close to our coding standards.
|
||||
|
||||
" Subsurface coding style
|
||||
filetype plugin indent on
|
||||
filetype detect
|
||||
set cindent tabstop=8 shiftwidth=8 cinoptions=l1,:0,(0,g0
|
||||
" TODO: extern "C" gets indented
|
||||
|
||||
" And some sane defaults, optional, but quite nice
|
||||
set nocompatible
|
||||
syntax on
|
||||
colorscheme default
|
||||
set hls
|
||||
set is
|
||||
|
||||
" The default blue is just impossible to see on a black terminal
|
||||
highlight Comment ctermfg=Brown
|
||||
|
||||
" clearly point out when someone have trailing spaces
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
|
||||
" Show trailing whitespace and spaces before a tab:
|
||||
match ExtraWhitespace /\s\+$\| \+\ze\t/
|
||||
@ -7,7 +7,7 @@
|
||||
# submitting patches to the user manual, only submit the changes to the .txt
|
||||
# file - the maintainer will recreate the .html.git file
|
||||
|
||||
DOCNAMES = user-manual user-manual_es user-manual_fr user-manual_nl mobile-manual-v3
|
||||
DOCNAMES = user-manual user-manual_es user-manual_ru
|
||||
|
||||
HTMLDOCS = $(patsubst %,$(OUT)%.html,$(DOCNAMES))
|
||||
TEXTDOCS = $(patsubst %,$(OUT)%.text,$(DOCNAMES))
|
||||
@ -19,7 +19,7 @@ BROWSER = firefox
|
||||
THEME = compact_subsurface
|
||||
PWD = $(realpath .)
|
||||
|
||||
all: $(HTMLDOCS) $(TEXTDOCS) $(PDFDOCS)
|
||||
all: $(HTMLEDOCS) $(TEXTDOCS) $(PDFDOCS)
|
||||
|
||||
doc: $(HTMLDOCS)
|
||||
|
||||
@ -30,20 +30,9 @@ $(OUT)%.pdf: %.txt
|
||||
-$(A2X) --dblatex-opts "-P latex.output.revhistory=0" -f pdf $<
|
||||
|
||||
$(OUT)%.html: %.txt
|
||||
$(ASCIIDOC) --version > /dev/null 2>&1 || echo "if asciidoc isn't found the html file included in the sources is copied"
|
||||
$(ASCIIDOC) -a toc -a toclevels=3 -a themedir=$(PWD) -a theme=$(THEME) -o $@ $< || \
|
||||
cp $(<:%.txt=%.html.git) $@
|
||||
|
||||
# for the web facing version of the desktop manual, just use the post-processing script
|
||||
user-manual.html.wp: user-manual.html
|
||||
bash ../scripts/prep-manual.sh $<
|
||||
|
||||
# for the web facing version of the mobile manual, re-create the HTML with only one level in
|
||||
# the table of context and then post process
|
||||
mobile-manual-v3.html.wp: mobile-manual-v3.txt
|
||||
$(ASCIIDOC) -a toc -a toclevels=1 -a themedir=$(PWD) -a theme=$(THEME) -o $(<:%.txt=%.html.tmp) $< && \
|
||||
bash ../scripts/prep-manual.sh $(<:%.txt=%.html.tmp) && \
|
||||
mv $(<:%.txt=%.html.tmp.wp) $@
|
||||
@echo "if asciidoc isn't found the html file included in the sources is copied"
|
||||
$(ASCIIDOC) -a toc -a toclevels=3 -a themedir=$(PWD) -a theme=$(THEME) -a stylesdir=$(PWD) \
|
||||
-o $@ $< || cp $(<:%.txt=%.html.git) $@
|
||||
|
||||
# Alternatively::
|
||||
$(OUT)$(DOCNAME).xhtml: $(DOCSOURCE)
|
||||
@ -53,4 +42,4 @@ show: $(HTMLDOC)
|
||||
$(BROWSER) $<
|
||||
|
||||
clean:
|
||||
rm -f *~ *.xml docbook-xsl.css $(HTMLDOCS) $(TEXTDOCS) $(PDFDOCS)
|
||||
rm -f *~ docbook-xsl.css $(HTMLDOCS) $(TEXTDOCS) $(PDFDOCS)
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
* { padding: 0; margin: 0; }
|
||||
img { border: 0; margin: 15px; max-width:90% }
|
||||
img { border: 0; }
|
||||
|
||||
/*** Layout ***/
|
||||
|
||||
@ -69,12 +69,12 @@ body { font-family: Verdana, sans-serif; }
|
||||
#footer { font-size: 0.8em; }
|
||||
|
||||
h2, h3, h4, h5, .title { font-family: Arial, sans-serif; }
|
||||
h2 { font-size: 160%; }
|
||||
h2 { font-size: 1.5em; }
|
||||
.sectionbody { font-size: 0.85em; }
|
||||
.sectionbody .sectionbody { font-size: inherit; }
|
||||
h3 { font-size: 150%; } /* 1.35em */
|
||||
h4 { font-size: 140%; } /* 1.2em */
|
||||
h5 { font-size: 130%; } /* 1em */
|
||||
h3 { font-size: 159%; } /* 1.35em */
|
||||
h4 { font-size: 141%; } /* 1.2em */
|
||||
h5 { font-size: 118%; } /* 1em */
|
||||
.title { font-size: 106%; /* 0.9em */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 56 KiB |
BIN
Documentation/images/AddDive2.jpg
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 18 KiB |
BIN
Documentation/images/BlueEditBar.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 12 KiB |
BIN
Documentation/images/CSVDownload.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
Documentation/images/Ceilings.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
Documentation/images/CompletedDiveInfo.jpg
Normal file
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 36 KiB |
BIN
Documentation/images/CylinderDataEntry3.jpg
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB |
BIN
Documentation/images/DC_gas_dialogue1.jpg
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
Documentation/images/DC_gas_dialogue2.jpg
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 10 KiB |
BIN
Documentation/images/DivePlanner2.jpg
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
Documentation/images/DiveProfile1.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 30 KiB |
BIN
Documentation/images/DiveProfile2.jpg
Normal file
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 19 KiB |
BIN
Documentation/images/DiveProfile3.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
BIN
Documentation/images/DiveProfile4.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 33 KiB |
BIN
Documentation/images/Export.jpg
Normal file
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 65 KiB |