pax_global_header 0000666 0000000 0000000 00000000064 15163172372 0014521 g ustar 00root root 0000000 0000000 52 comment=251ac788374985188f97c771c7f79882a24c32ad
OpenChemistry-avogadroapp-3ced952/ 0000775 0000000 0000000 00000000000 15163172372 0017233 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/.clang-format 0000664 0000000 0000000 00000000402 15163172372 0021602 0 ustar 00root root 0000000 0000000 ---
# This configuration requires clang-format 3.8 or higher.
BasedOnStyle: Mozilla
AlwaysBreakAfterReturnType: None
AlwaysBreakAfterDefinitionReturnType: None
BinPackArguments: true
BinPackParameters: true
BreakConstructorInitializersBeforeComma: false
...
OpenChemistry-avogadroapp-3ced952/.clang-tidy 0000664 0000000 0000000 00000001625 15163172372 0021273 0 ustar 00root root 0000000 0000000 Checks: 'clang-analyzer*,modernize-avoid-bind,modernize-concat-nested-namespaces,
modernize-loop-convert,modernize-macro-to-enum,modernize-use-bool-literals,
modernize-use-auto,modernize-use-nullptr,modernize-use-override,
modernize-raw-string-literal,modernize-use-emplace,modernize-pass-by-value
misc-unused-using-decls,
misc-unused-alias-decls,
misc-redundant-expression,
performance-for-range-copy,
performance-inefficient*,performance-type-promotion*,
performance-unnecessary-copy-initialization,
performance-move-const-arg,
readability-const-return-type,
readability-delete-null-pointer,
readability-redundant-string-cstr,
readability-simplify*
-readability-else-after-return,
-portability-restrict-system-includes,
-modernize-use-trailing-return-type'
FormatStyle: file
OpenChemistry-avogadroapp-3ced952/.codacy.yaml 0000664 0000000 0000000 00000000116 15163172372 0021435 0 ustar 00root root 0000000 0000000 ---
engines:
cppcheck:
language: c++
exclude_paths:
- "thirdparty/**"
OpenChemistry-avogadroapp-3ced952/.github/ 0000775 0000000 0000000 00000000000 15163172372 0020573 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/.github/FUNDING.yml 0000664 0000000 0000000 00000000172 15163172372 0022410 0 ustar 00root root 0000000 0000000 # These are supported funding model platforms
open_collective: avogadro # Replace with a single Open Collective username
OpenChemistry-avogadroapp-3ced952/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 15163172372 0022756 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001531 15163172372 0025450 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
---
**Avogadro version: (please complete the following information from the About box):**
- Avogadrolibs: (e.g. 1.90.0-316-g6d14770)
- Qt: (e.g., 5.9.5)
**Desktop version: (please complete the following information):**
- OS: [e.g. MacOS]
- Version [e.g. 10.12.4]
- Compiler (if you built from source)
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here. **Please consider uploading or linking test files.**
OpenChemistry-avogadroapp-3ced952/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000001425 15163172372 0026505 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I wish Avogadro calculated XYQ moments to render with ..
**Describe the solution you'd like**
A clear and concise description of what you want to happen. Please be detailed. How might this feature work (e.g., first a window would open and you'd click to …)
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
Please consider opening a topic on https://discuss.avogadro.cc/ to allow further public discussion
OpenChemistry-avogadroapp-3ced952/.github/PULL_REQUEST_TEMPLATE 0000664 0000000 0000000 00000002615 15163172372 0024001 0 ustar 00root root 0000000 0000000 Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
OpenChemistry-avogadroapp-3ced952/.github/actions/ 0000775 0000000 0000000 00000000000 15163172372 0022233 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/.github/actions/checkout-repositories/ 0000775 0000000 0000000 00000000000 15163172372 0026565 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/.github/actions/checkout-repositories/action.yml 0000664 0000000 0000000 00000003734 15163172372 0030574 0 ustar 00root root 0000000 0000000 name: 'Checkout Avogadro Repositories'
description: 'Checks out all required Avogadro repositories'
inputs:
checkout-submodules:
description: 'Whether to checkout submodules for openchemistry'
required: false
default: 'recursive'
checkout-avogadroapp-path:
description: 'Path for avogadroapp checkout'
required: false
default: 'openchemistry/avogadroapp'
runs:
using: "composite"
steps:
- name: Checkout openchemistry
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/openchemistry
submodules: ${{ inputs.checkout-submodules }}
path: openchemistry
- name: Checkout avogadroapp
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: openchemistry/avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/avogadrolibs
path: openchemistry/avogadrolibs
- name: Checkout i18n
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/avogadro-i18n
path: openchemistry/avogadro-i18n
- name: Checkout avogenerators
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/avogenerators
path: openchemistry/avogenerators
- name: Checkout crystals
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/crystals
path: openchemistry/crystals
- name: Checkout fragments
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/fragments
path: openchemistry/fragments
- name: Checkout molecules
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/molecules
path: openchemistry/molecules
OpenChemistry-avogadroapp-3ced952/.github/config.yml 0000664 0000000 0000000 00000001770 15163172372 0022570 0 ustar 00root root 0000000 0000000 # Configuration for welcome - https://github.com/behaviorbot/welcome
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
Thanks for opening your first issue here! Please try to include example files and screenshots if possible.
If you're looking for support, please post on our forum: https://discuss.avogadro.cc/
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
Thanks for opening this pull request! Please check out our contributing guidelines and check for the automated tests.
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
Congrats on merging your first pull request! 🎉 Thanks for making Avogadro better for everyone!
OpenChemistry-avogadroapp-3ced952/.github/dependabot.yml 0000664 0000000 0000000 00000000360 15163172372 0023422 0 ustar 00root root 0000000 0000000 # Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directories:
- "/.github/**/*"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
OpenChemistry-avogadroapp-3ced952/.github/move.yml 0000664 0000000 0000000 00000001032 15163172372 0022260 0 ustar 00root root 0000000 0000000 # Configuration for move-issues - https://github.com/dessant/move-issues
# Delete the command comment when it contains no other content
deleteCommand: true
# Close the source issue after moving
closeSourceIssue: true
# Lock the source issue after moving
lockSourceIssue: false
# Mention issue and comment authors
mentionAuthors: true
# Preserve mentions in the issue content
keepContentMentions: false
# Set custom aliases for targets
# aliases:
# r: repo
# or: owner/repo
# Repository to extend settings from
# _extends: repo
OpenChemistry-avogadroapp-3ced952/.github/release-drafter.yml 0000664 0000000 0000000 00000001335 15163172372 0024365 0 ustar 00root root 0000000 0000000 name-template: 'Avogadro $RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
categories:
- title: 'Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'build'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: minor
template: |
## Changes
$CHANGES
## Credits
Thanks to many contributors, including: $CONTRIBUTORS
OpenChemistry-avogadroapp-3ced952/.github/workflows/ 0000775 0000000 0000000 00000000000 15163172372 0022630 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/.github/workflows/add_artifact_urls.yml 0000664 0000000 0000000 00000001234 15163172372 0027025 0 ustar 00root root 0000000 0000000 name: add artifact links to pull request
on:
workflow_run:
workflows: ['Qt5 Build Matrix']
types: [completed]
jobs:
artifacts-url-comments:
name: add artifact links to pull request job
runs-on: windows-latest
steps:
- name: add artifact links to pull request step
uses: tonyhallett/artifacts-url-comments@0965ff1a7ae03c5c1644d3c30f956effea4e05ef # v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prefix: Here are the build results
suffix: Artifacts will only be retained for 90 days.
format: name
addTo: pull
continue-on-error: true
OpenChemistry-avogadroapp-3ced952/.github/workflows/build_flatpak.yml 0000664 0000000 0000000 00000007032 15163172372 0026156 0 ustar 00root root 0000000 0000000 name: Build Flatpak
on: [push, pull_request, workflow_dispatch]
jobs:
flatpak:
name: "Flatpak"
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt update -qq && sudo apt install -y -qq flatpak
- name: Configure flatpak
run: flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
- name: Install flatpak-builder
run: flatpak --user install --or-update --noninteractive flathub org.flatpak.Builder
- name: Configure git
run: git config --global protocol.file.allow always
# Have to do this because for a while git's handling of submodules was broken
# See https://github.com/flatpak/flatpak-builder/issues/495
- name: Checkout openchemistry
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/openchemistry
submodules: false
path: openchemistry
- name: Checkout avogadroapp
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: openchemistry/avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/avogadrolibs
path: openchemistry/avogadrolibs
- name: Checkout i18n
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/avogadro-i18n
path: openchemistry/avogadro-i18n
- name: Checkout avogenerators
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/avogenerators
path: openchemistry/avogenerators
- name: Checkout crystals
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/crystals
path: openchemistry/crystals
- name: Checkout fragments
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/fragments
path: openchemistry/fragments
- name: Checkout molecules
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: openchemistry/molecules
path: openchemistry/molecules
- name: Checkout Flathub shared-modules
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: flathub/shared-modules
path: shared-modules
- name: Set up tmate session
if: failure()
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
timeout-minutes: 60
- name: Move manifest
run: mv openchemistry/avogadroapp/flatpak/org.openchemistry.Avogadro2.yaml ./
- name: Build with flatpak-builder
run: dbus-run-session flatpak run org.flatpak.Builder --force-clean --user --install-deps-from=flathub --arch=x86_64 --default-branch=test --repo=repo builddir org.openchemistry.Avogadro2.yaml
- name: Create bundle
run: flatpak build-bundle repo Avogadro2.flatpak org.openchemistry.Avogadro2 test
- name: Upload bundle
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: Avogadro2.flatpak
- name: Cleanup
if: ${{ always() }} # To ensure this step runs even when earlier steps fail
shell: bash
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
OpenChemistry-avogadroapp-3ced952/.github/workflows/build_linux.yml 0000664 0000000 0000000 00000014007 15163172372 0025673 0 ustar 00root root 0000000 0000000 name: Linux Build Matrix
# Many thanks to Cristian Adam for examples
# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/
on: [push, pull_request, workflow_dispatch]
env:
QT_VERSION: 6.8.3
FEATURES: -DBUILD_GPL_PLUGINS=ON -DBUILD_MOLEQUEUE=OFF -DWITH_COORDGEN=OFF -DQT_VERSION=6
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu x86", artifact: "",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
build_type: "Release",
cmake_flags: "-G Ninja -DUSE_SYSTEM_EIGEN=TRUE",
}
- {
name: "AppImage x86", artifact: "Avogadro2-x86_64.AppImage",
os: ubuntu-22.04,
cc: "gcc", cxx: "g++",
build_type: "Release",
cmake_flags: "-G Ninja -DUSE_SYSTEM_EIGEN=TRUE -DINSTALL_BUNDLE_FILES=ON -DUSE_YAEHMOP=ON",
}
- {
name: "Ubuntu Address Sanitizer", artifact: "",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
build_type: "asan",
cmake_flags: "-G Ninja -DUSE_SYSTEM_EIGEN=TRUE -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
}
- {
name: "Ubuntu Undefined Behavior Sanitizer", artifact: "",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
build_type: "ubsan",
cmake_flags: "-G Ninja -DUSE_SYSTEM_EIGEN=TRUE -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
}
- {
name: "Ubuntu Leak Sanitizer", artifact: "",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
build_type: "lsan",
cmake_flags: "-G Ninja -DUSE_SYSTEM_EIGEN=TRUE -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
}
- {
name: "Ubuntu Thread Sanitizer", artifact: "",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
build_type: "tsan",
cmake_flags: "-G Ninja -DUSE_SYSTEM_EIGEN=TRUE -DENABLE_TESTING=ON -DTEST_QTGL=OFF -USE_SYSTEM_ZLIB=ON",
}
steps:
- name: Checkout workflow repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout Repositories
uses: ./.github/actions/checkout-repositories
- name: Install Dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq install ninja-build libeigen3-dev libboost-all-dev libglew-dev libxml2-dev
sudo apt-get -qq install libfuse2
- name: Install Qt
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005 # v4.3.0
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE/openchemistry ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Run tests
if: (matrix.config.build_type != 'Release')
shell: cmake -P {0}
run: |
include(ProcessorCount)
ProcessorCount(N)
set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
set(ENV{ASAN_OPTIONS} "new_delete_type_mismatch=0")
execute_process(
COMMAND ctest -j ${N}
WORKING_DIRECTORY ${{ runner.workspace }}/build/avogadrolibs
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Running tests failed!")
endif()
- name: Package AppImage
if: matrix.config.name == 'AppImage x86'
shell: bash
run: |
mkdir appdir
mv prefix appdir/usr
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:appdir/usr/lib
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
wget -c -nv "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod a+x *.AppImage
# get pixi
# wget -c -nv "https://github.com/prefix-dev/pixi/releases/latest/download/pixi-x86_64-unknown-linux-musl"
# mv pixi-x86_64-unknown-linux-musl appdir/usr/bin/pixi
# Though it is not great security practice, bundle libssl and libcrypto
./linuxdeploy-x86_64.AppImage -d appdir/usr/share/applications/*.desktop --plugin qt --library /lib/x86_64-linux-gnu/libssl.so.3 --library /lib/x86_64-linux-gnu/libcrypto.so.3 --appdir appdir
# add the custom AppRun
rm appdir/AppRun
cp ../${{ github.event.repository.name }}/openchemistry/avogadrolibs/scripts/AppImage.sh appdir/AppRun
chmod a+x appdir/AppRun
./appimagetool-x86_64.AppImage appdir
mv Avogadro*.AppImage avogadroapp/Avogadro2-x86_64.AppImage # for upload
working-directory: ${{ runner.workspace }}/build
- name: Upload
if: matrix.config.artifact != 0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/build/avogadroapp/Avogadro2*.*
name: ${{ matrix.config.artifact }}
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
timeout-minutes: 60
OpenChemistry-avogadroapp-3ced952/.github/workflows/build_linux_arm64.yml 0000664 0000000 0000000 00000011366 15163172372 0026711 0 ustar 00root root 0000000 0000000 name: Linux ARM64 Build Matrix
# Many thanks to Cristian Adam for examples
# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/
on: [push, pull_request, workflow_dispatch]
env:
QT_VERSION: 6.8.3
FEATURES: -DBUILD_GPL_PLUGINS=ON -DBUILD_MOLEQUEUE=OFF -DWITH_COORDGEN=OFF -DQT_VERSION=6
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu ARM", artifact: "",
os: ubuntu-24.04-arm,
cc: "gcc", cxx: "g++",
build_type: "Debug",
cmake_flags: "-G Ninja -DUSE_SYSTEM_EIGEN=TRUE",
}
- {
name: "AppImage ARM", artifact: "Avogadro2-arm64.AppImage",
os: ubuntu-24.04-arm,
cc: "gcc", cxx: "g++",
build_type: "Release",
cmake_flags: "-G Ninja -DINSTALL_BUNDLE_FILES=ON",
}
steps:
- name: Checkout workflow repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout Repositories
uses: ./.github/actions/checkout-repositories
- name: Install Dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq install ninja-build libeigen3-dev libboost-all-dev libglew-dev libxml2-dev
sudo apt-get -qq install libfuse2
- name: Install Qt
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005 # v4.3.0
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE/openchemistry ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Run tests
if: (matrix.config.build_type != 'Release')
shell: cmake -P {0}
run: |
include(ProcessorCount)
ProcessorCount(N)
set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
set(ENV{ASAN_OPTIONS} "new_delete_type_mismatch=0")
execute_process(
COMMAND ctest -j ${N}
WORKING_DIRECTORY ${{ runner.workspace }}/build/avogadrolibs
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Running tests failed!")
endif()
- name: Package AppImage
if: matrix.config.name == 'AppImage ARM'
shell: bash
run: |
mkdir appdir
mv prefix appdir/usr
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:appdir/usr/lib
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-aarch64.AppImage"
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-aarch64.AppImage"
wget -c -nv "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage"
chmod a+x *.AppImage
# get pixi
# wget -c -nv "https://github.com/prefix-dev/pixi/releases/latest/download/pixi-aarch64-unknown-linux-musl"
# mv pixi-aarch64-unknown-linux-musl appdir/usr/bin/pixi
./linuxdeploy-aarch64.AppImage -d appdir/usr/share/applications/*.desktop --plugin qt --library /usr/lib/aarch64-linux-gnu/libssl.so.3 --library /usr/lib/aarch64-linux-gnu/libcrypto.so.3 --appdir appdir
# add the custom AppRun
rm appdir/AppRun
cp ../${{ github.event.repository.name }}/openchemistry/avogadrolibs/scripts/AppImage.sh appdir/AppRun
chmod a+x appdir/AppRun
./appimagetool-aarch64.AppImage appdir
mv Avogadro*.AppImage avogadroapp/Avogadro2-aarch64.AppImage # for upload
working-directory: ${{ runner.workspace }}/build
- name: Upload
if: matrix.config.artifact != 0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/build/avogadroapp/Avogadro2*.*
name: ${{ matrix.config.artifact }}
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
timeout-minutes: 60
OpenChemistry-avogadroapp-3ced952/.github/workflows/build_mac.yml 0000664 0000000 0000000 00000022634 15163172372 0025301 0 ustar 00root root 0000000 0000000 name: Mac Build Matrix
# Many thanks to Cristian Adam for examples
# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/
on: [push, pull_request, workflow_dispatch]
env:
QT_VERSION: 6.10.0
# this is different from MACOSX_DEPLOYMENT_TARGET to prevent build problems
# we set MACOSX_DEPLOYMENT_TARGET later
MACOS_TARGET: 13
FEATURES: -DBUILD_GPL_PLUGINS=ON -DBUILD_MOLEQUEUE=OFF -DWITH_COORDGEN=OFF -DQT_VERSION=6 -DUSE_YAEHMOP=ON
CACHE: -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
SCCACHE_GHA_ENABLED: "true"
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "macOS Qt6 ARM", artifact: "macOS-arm64",
os: macos-15,
cc: "clang", cxx: "clang++",
build_type: "Release",
cmake_flags: "-G Ninja -DCMAKE_OSX_ARCHITECTURES=arm64",
}
- {
name: "macOS Qt6 Intel", artifact: "macOS-intel",
os: macos-15-intel,
cc: "clang", cxx: "clang++",
build_type: "Release",
cmake_flags: "-G Ninja -DCMAKE_OSX_ARCHITECTURES=x86_64",
}
steps:
- name: Checkout workflow repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout Repositories
uses: ./.github/actions/checkout-repositories
- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install eigen glew pixi create-dmg
- name: Install Qt
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005 # v4.3.0
with:
version: ${{ env.QT_VERSION }}
- name: Grab cache files
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
${{ runner.workspace }}/build/Downloads
key: ${{ matrix.config.name }}-downloads
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
# won't have any effect except on Mac
echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE/openchemistry ${{env.FEATURES}} ${{env.CACHE}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} CMAKE_C_COMPILER_LAUNCHER=sccache CMAKE_CXX_COMPILER_LAUNCHER=sccache cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Fix Mac plugins
if: runner.os == 'macOS'
working-directory: ${{ runner.workspace }}/build/prefix/lib/openbabel
run: |
for plugin in *.so; do
for libpath in `otool -L ${plugin} | grep '/Users/runner/work' | awk '{print $1}'`; do
export lib=`echo $libpath | cut -d '/' -f 9`;
echo "Fixing $plugin $lib $libpath"
install_name_tool -change $libpath @executable_path/../Frameworks/$lib $plugin
done
done
cd .. # build/prefix/lib
for plugin in libinchi.?.?.?.dylib libopenbabel.?.?.?.dylib; do
for libpath in `otool -L ${plugin} | grep '/Users/runner/work' | awk '{print $1}'`; do
export lib=`echo $libpath | cut -d '/' -f 9`;
echo "Fixing $plugin $lib $libpath"
install_name_tool -change $libpath @executable_path/../Frameworks/$lib $plugin
done
done
otool -L libinchi.?.?.?.dylib
otool -L libopenbabel.?.?.?.dylib
# cp -p libinchi* ../Avogadro2.app/Contents/Frameworks/
# cp -p libopenbabel* ../Avogadro2.app/Contents/Frameworks/
# finally, fixup the binaries
cd ../bin
for exe in obabel obmm eht_bind genXrdPattern; do
for libpath in `otool -L ${exe} | grep '/Users/runner/work' | awk '{print $1}'`; do
export lib=`echo $libpath | cut -d '/' -f 9`;
echo "Fixing $exe $lib $libpath"
install_name_tool -change $libpath @executable_path/../Frameworks/$lib $exe
done
done
ls .. # build/prefix
- name: Install the Apple certificate
# From GitHub docs: https://docs.github.com/en/actions/guides/installing-an-apple-certificate-on-macos-runners-for-xcode-development
if: runner.os == 'macOS'
working-directory: ${{ runner.workspace }}/build
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
NOTARIZE_USERNAME: ${{ secrets.AC_USERNAME }}
NOTARIZE_PASSWORD: ${{ secrets.AC_PASSWORD }}
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_ID }}
PRODUCT_BUNDLE_IDENTIFIER: cc.avogadro
run: |
# create variables
if [ -n "${P12_PASSWORD}" ]; then
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 -d -o $CERTIFICATE_PATH
# create temporary keychain if the cert is non-zero
if [ -s $CERTIFICATE_PATH ]; then
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# signing occurs via avogadroapp cpack instructions
fi # certificate exists
fi # password exists
- name: Create Mac Packages
if: runner.os == 'macOS'
shell: bash
run: |
exe_path=prefix/Avogadro2.app/Contents/MacOS/
cp -p `which pixi` ${exe_path}
for exe in ${exe_path}*; do
args="${args} -executable=${exe}"
done;
macdeployqt prefix/Avogadro2.app ${args} -libpath=prefix/lib -always-overwrite
if [ -n "${P12_PASSWORD}" ]; then
# codesign the Open Babel modules, then the app
/usr/bin/codesign -s "${CODESIGN_IDENTITY}" -f --timestamp --deep --options runtime --entitlements ../avogadrolibs/avogadroapp/cmake/Entitlements.plist prefix/Avogadro2.app/Contents/lib/openbabel/*.so
/usr/bin/codesign -s "${CODESIGN_IDENTITY}" -f --timestamp --deep --options runtime --entitlements ../avogadrolibs/avogadroapp/cmake/Entitlements.plist prefix/Avogadro2.app
fi
# create the DMG
cd prefix
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# This is a tag - extract version
VERSION="${GITHUB_REF#refs/tags/}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
IS_RELEASE=true
else
# This is a nightly build - use current date
VERSION=$(date +%Y-%m-%d)
IS_RELEASE=false
fi
VOLNAME="Avogadro2 ${VERSION}"
# Determine architecture
ARCH=$(uname -m)
# Build DMG filename
if [[ "$IS_RELEASE" == true ]]; then
if [[ "$ARCH" == "arm64" ]]; then
DMG_NAME="Avogadro2-${VERSION}-Darwin-arm64.dmg"
else
DMG_NAME="Avogadro2-${VERSION}-Darwin.dmg"
fi
else
if [[ "$ARCH" == "arm64" ]]; then
DMG_NAME="Avogadro2-${VERSION}-arm64.dmg"
else
DMG_NAME="Avogadro2-${VERSION}.dmg"
fi
fi
echo "Building DMG: ${DMG_NAME}"
create-dmg --volname "${VOLNAME}" --icon-size 64 --filesystem "APFS" --format "ULMO" --no-internet-enable --icon "Avogadro2.app" 20 64 --app-drop-link 200 64 ${DMG_NAME} Avogadro2.app
mv ${DMG_NAME} ../${DMG_NAME}
cd ..
echo "Submitting DMG: ${DMG_NAME}"
xcrun notarytool submit ${DMG_NAME} --apple-id "$NOTARIZE_USERNAME" --team-id "$NOTARIZE_TEAM" --password "$NOTARIZE_PASSWORD" --verbose --wait
echo "Stapling notarized DMG: ${DMG_NAME}"
xcrun stapler staple -v ${DMG_NAME}
working-directory: ${{ runner.workspace }}/build/
continue-on-error: true
env:
NOTARIZE_TEAM: ${{ secrets.AC_TEAM }}
NOTARIZE_USERNAME: ${{ secrets.AC_USERNAME }}
NOTARIZE_PASSWORD: ${{ secrets.AC_PASSWORD }}
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_ID }}
PRODUCT_BUNDLE_IDENTIFIER: cc.avogadro
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
- name: Upload
if: matrix.config.artifact != 0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/build/Avogadro2*.*
name: ${{ matrix.config.artifact }}
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
timeout-minutes: 60
OpenChemistry-avogadroapp-3ced952/.github/workflows/build_win_arm.yml 0000664 0000000 0000000 00000012742 15163172372 0026174 0 ustar 00root root 0000000 0000000 name: Windows ARM Build
# Many thanks to Cristian Adam for examples
# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/
# This workflow will build and (optionally) sign releases for Windows
# .. since SignPath requires only a Windows build in the action
# .. to successfully sign
on: [push, pull_request, workflow_dispatch]
env:
QT_VERSION: 6.10.0
# this is different from MACOSX_DEPLOYMENT_TARGET to prevent build problems
# we set MACOSX_DEPLOYMENT_TARGET later
FEATURES: -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF -DQT_VERSION=6 -DUSE_3DCONNEXION=OFF -DBUILD_MOLEQUEUE=OFF
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Qt6 ARM", artifact: "Win-ARM.exe",
os: windows-11-arm,
cc: "cl", cxx: "cl",
build_type: "Release",
cmake_flags: "-DCMAKE_TOOLCHAIN_FILE=/c/vcpkg/scripts/buildsystems/vcpkg.cmake -DUSE_SYSTEM_EIGEN=ON -DUSE_SYSTEM_LIBARCHIVE=ON -DUSE_SYSTEM_LIBXML2=ON -DUSE_SYSTEM_ZLIB=ON",
build_flags: "-j 2",
}
steps:
- name: Checkout workflow repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout Repositories
uses: ./.github/actions/checkout-repositories
- name: Install Qt
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005 # v4.3.0
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Configure MSVC Command Prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: arm64
- name: Install Dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install nsis
cd /c/vcpkg
git pull origin master
vcpkg install libarchive eigen3 libxml2 zlib
shell: bash
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE/openchemistry ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Create Windows Packages
if: runner.os == 'Windows'
shell: bash
run: |
gh release download -R prefix-dev/pixi -p "pixi-aarch64-pc-windows-msvc.exe"
# wget https://github.com/prefix-dev/pixi/releases/latest/download/pixi-aarch64-pc-windows-msvc.exe
# move pixi to prefix/bin
mv pixi-aarch64-pc-windows-msvc.exe prefix/bin/pixi.exe
# run windeployqt
windeployqt --release prefix/bin/avogadro2.exe
mv prefix avogadro2
# 7z a Avogadro2-windows.zip avogadro2
cd avogadro2
# create NSIS
/c/Program\ Files\ \(x86\)/NSIS/bin/makensis avogadro2.nsi
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# This is a tag - extract version
VERSION="${GITHUB_REF#refs/tags/}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
else
# This is a nightly build - use current date
VERSION=$(date +%Y-%m-%d)
fi
mv Avogadro2-Setup.exe ../Avogadro2-${VERSION}.exe
working-directory: ${{ runner.workspace }}/build/
env:
GH_TOKEN: ${{ github.token }}
- name: Upload
if: matrix.config.artifact != 0
id: upload-artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/build/Avogadro2*.*
name: ${{ matrix.config.artifact }}
- name: Sign Windows release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
uses: signpath/github-action-submit-signing-request@3f9250c56651ff692d6729a2fbb0603a42d7d322 # v2.0
continue-on-error: true
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '${{ secrets.SIGNPATH_ORG_ID }}'
project-slug: 'avogadrolibs'
signing-policy-slug: 'release-signing'
github-artifact-id: '${{ steps.upload-artifact.outputs.artifact-id }}'
wait-for-completion: false
output-artifact-directory: '../build/'
- name: Create MSIX
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
shell: powershell
run:
# create MSIX
makeappx pack /v /d . /p ../Avogadro2.msix
working-directory: ${{ runner.workspace }}/build/avogadro2
env:
GH_TOKEN: ${{ github.token }}
- name: Upload MSIX
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/build/Avogadro2.msix
name: Avogadro2.msix
- name: Setup tmate session
if: failure()
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
timeout-minutes: 60
OpenChemistry-avogadroapp-3ced952/.github/workflows/build_windows.yml 0000664 0000000 0000000 00000012723 15163172372 0026231 0 ustar 00root root 0000000 0000000 name: Windows Build
# Many thanks to Cristian Adam for examples
# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/
# This workflow will build and (optionally) sign releases for Windows
# .. since SignPath requires only a Windows build in the action
# .. to successfully sign
on: [push, pull_request, workflow_dispatch]
env:
QT_VERSION: 6.10.0
# this is different from MACOSX_DEPLOYMENT_TARGET to prevent build problems
# we set MACOSX_DEPLOYMENT_TARGET later
FEATURES: -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF -DQT_VERSION=6 -DUSE_3DCONNEXION=OFF -DBUILD_MOLEQUEUE=OFF
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Qt6", artifact: "Win64.exe",
os: windows-latest,
cc: "cl", cxx: "cl",
build_type: "Release",
cmake_flags: "-DCMAKE_TOOLCHAIN_FILE=/c/vcpkg/scripts/buildsystems/vcpkg.cmake -DUSE_SYSTEM_EIGEN=ON -DUSE_SYSTEM_LIBARCHIVE=ON -DUSE_SYSTEM_LIBXML2=ON -DUSE_SYSTEM_ZLIB=ON",
build_flags: "-j 2",
}
steps:
- name: Checkout workflow repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout Repositories
uses: ./.github/actions/checkout-repositories
- name: Install Qt
uses: jurplel/install-qt-action@d325aaf2a8baeeda41ad0b5d39f84a6af9bcf005 # v4.3.0
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Configure MSVC Command Prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: x64
- name: Install Dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install nsis
cd /c/vcpkg
git pull origin master
vcpkg install libarchive eigen3 libxml2 zlib
shell: bash
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE/openchemistry ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Create Windows Packages
if: runner.os == 'Windows'
shell: bash
run: |
gh release download -R prefix-dev/pixi -p "pixi-x86_64-pc-windows-msvc.exe"
# wget https://github.com/prefix-dev/pixi/releases/latest/download/pixi-x86_64-pc-windows-msvc.exe
# move pixi to prefix/bin
mv pixi-x86_64-pc-windows-msvc.exe prefix/bin/pixi.exe
# run windeployqt
windeployqt --release prefix/bin/avogadro2.exe
mv prefix avogadro2
# 7z a Avogadro2-windows.zip avogadro2
cd avogadro2
# create NSIS
/c/Program\ Files\ \(x86\)/NSIS/bin/makensis avogadro2.nsi
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# This is a tag - extract version
VERSION="${GITHUB_REF#refs/tags/}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
else
# This is a nightly build - use current date
VERSION=$(date +%Y-%m-%d)
fi
mv Avogadro2-Setup.exe ../Avogadro2-${VERSION}.exe
working-directory: ${{ runner.workspace }}/build/
env:
GH_TOKEN: ${{ github.token }}
- name: Upload
if: matrix.config.artifact != 0
id: upload-artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/build/Avogadro2*.*
name: ${{ matrix.config.artifact }}
- name: Sign Windows release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
uses: signpath/github-action-submit-signing-request@3f9250c56651ff692d6729a2fbb0603a42d7d322 # v2.0
continue-on-error: true
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '${{ secrets.SIGNPATH_ORG_ID }}'
project-slug: 'avogadrolibs'
signing-policy-slug: 'release-signing'
github-artifact-id: '${{ steps.upload-artifact.outputs.artifact-id }}'
wait-for-completion: false
output-artifact-directory: '../build/'
- name: Create MSIX
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
shell: powershell
run:
# create MSIX
makeappx pack /v /d . /p ../Avogadro2.msix
working-directory: ${{ runner.workspace }}/build/avogadro2
env:
GH_TOKEN: ${{ github.token }}
- name: Upload MSIX
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/build/Avogadro2.msix
name: Avogadro2.msix
- name: Setup tmate session
if: failure()
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
timeout-minutes: 60
OpenChemistry-avogadroapp-3ced952/.github/workflows/clang-format-check.yml 0000664 0000000 0000000 00000004603 15163172372 0027003 0 ustar 00root root 0000000 0000000 name: clang-format Check
on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
if: ${{ github.ref != 'refs/heads/master' }}
steps:
- name: 'Install clang-format'
run: sudo apt-get -qq install clang-format
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 'Run clang-format-diff'
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/openchemistry/avogadrolibs
git fetch origin master:master
echo `which clang-format-diff`
export MASTER_SHA=`cat .git/refs/heads/master`
echo MASTER_SHA=${MASTER_SHA}
git diff `cat .git/refs/heads/master` --name-only
DIFF=`git diff -U0 ${MASTER_SHA} -- '*.h' '*.cpp' | clang-format-diff -p1`
if [ -z "$DIFF" ]; then
printf "clang-format-diff reports no problems"
exit 0
else
git diff -U0 ${MASTER_SHA} -- '*.h' '*.cpp' | clang-format-diff -p1 >${{ runner.workspace }}/clang-format.diff
exit 1
fi
- name: Upload patch
if: failure()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: ${{ runner.workspace }}/clang-format.diff
name: clang-format.diff
- name: Comment on diff
if: failure()
run: |
export NAME=`curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" | jq '.artifacts[].name'`
export DL=`curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" | jq '.artifacts[].archive_download_url'`
export URL="https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts"
echo URL=${URL}
echo NAME=${NAME}
echo DL=${DL}
curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts"
jq -nc "{\"body\": \"ERROR: clang-format-diff detected formatting issues. See the artifact for a patch or run clang-format on your branch.\"}" | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments"
OpenChemistry-avogadroapp-3ced952/.github/workflows/clang-tidy.yml 0000664 0000000 0000000 00000006310 15163172372 0025406 0 ustar 00root root 0000000 0000000 name: Clang-Tidy Static Analysis
on:
workflow_dispatch:
env:
FEATURES: -DUSE_VTK=ON -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF -DUSE_YAEHMOP=ON
BUILD_TYPE: RelWithDebInfo
QT_VERSION: 6.8.3
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Analysis",
os: ubuntu-latest,
cc: "clang", cxx: "clang++",
cmake_flags: "-G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DUSE_SYSTEM_LIBXML2=ON -USE_SYSTEM_ZLIB=ON",
cpack: "",
}
steps:
- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get -qq update
sudo apt-get -qq install ninja-build bear libeigen3-dev libboost-all-dev libglew-dev libxml2-dev
sudo apt-get -qq install clang-tidy
- name: Install Qt
uses: jurplel/install-qt-action@b7840a6733f49e2a39c4355260d2375063d39b61 # v3
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Checkout Repositories
uses: ./.github/actions/checkout-repositories
- name: Grab cache files
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
if: runner.os != 'Windows'
with:
path: |
${{ runner.workspace }}/build/thirdparty
${{ runner.workspace }}/build/Downloads
key: ${{ matrix.config.name }}-thirdparty
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} ninja
# only re-compile avogadrolibs
(cd avogadrolibs; ninja clean)
bear -- ninja
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Create results directory
run: |
mkdir ${{ runner.workspace }}/clang-tidy-result
- name: Analyze
run: |
# generate the fixes and we'll make a diff
run-clang-tidy -p ../build -fix
cd avogadrolibs
pwd
echo "Generating diff"
git diff >${{ runner.workspace }}/clang-tidy-result/tidy.patch
working-directory: ${{ runner.workspace }}/avogadrolibs
- name: Save PR metadata
run: |
echo ${{ github.event.number }} > ${{ runner.workspace }}/clang-tidy-result/pr-id.txt
echo ${{ github.event.pull_request.head.repo.full_name }} > ${{ runner.workspace }}/clang-tidy-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.ref }} > ${{ runner.workspace }}/clang-tidy-result/pr-head-ref.txt
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: clang-tidy-result
path: ${{ runner.workspace }}/clang-tidy-result/
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
OpenChemistry-avogadroapp-3ced952/.github/workflows/codacy.yml 0000664 0000000 0000000 00000005347 15163172372 0024626 0 ustar 00root root 0000000 0000000 # This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.
name: Codacy Security Scan
on:
workflow_dispatch:
# push:
# branches: [ master ]
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [ master ]
# schedule:
# - cron: '28 10 * * 6'
permissions:
contents: read
jobs:
codacy-security-scan:
name: Codacy Security Scan
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@562ee3e92b8e92df8b67e0a5ff8aa8e261919c08 # v4.4.7
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
- name: Filter out MISRA
run: |
pip install globber
python3 scripts/github-actions/filter_sarif.py --input results.sarif --output filtered.sarif --split-lines -- "-**/*.*:cppcheck_misra*"
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
sarif_file: filtered.sarif
OpenChemistry-avogadroapp-3ced952/.github/workflows/release-drafter.yml 0000664 0000000 0000000 00000001574 15163172372 0026427 0 ustar 00root root 0000000 0000000 name: Release Drafter
# https://github.com/release-drafter/release-drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@139054aeaa9adc52ab36ddf67437541f039b88e2 # v7.1.1
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OpenChemistry-avogadroapp-3ced952/.github/workflows/update-i18n-templates.yml 0000664 0000000 0000000 00000001650 15163172372 0027410 0 ustar 00root root 0000000 0000000 name: update-i18n-templates
on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
# run weekly, every Sunday at 01:23
- cron: '23 1 * * 0'
jobs:
update-i18n:
name: Update translation templates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install packages
run: |
sudo apt-get -qq update
sudo apt-get -qq install gettext
- name: Run extract-messages
run: |
sh scripts/extract-messages.sh
- name: Create pull request
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
commit-message: "Automated translation updates"
signoff: true
title: "Automated translation updates"
branch: update-i18n-templates
delete-branch: true
labels: i18n
OpenChemistry-avogadroapp-3ced952/.gitignore 0000664 0000000 0000000 00000000026 15163172372 0021221 0 ustar 00root root 0000000 0000000 .idea/
cmake-build-*/
OpenChemistry-avogadroapp-3ced952/.gitmodules 0000664 0000000 0000000 00000000171 15163172372 0021407 0 ustar 00root root 0000000 0000000 [submodule "flatpak/shared-modules"]
path = flatpak/shared-modules
url = https://github.com/flathub/shared-modules.git
OpenChemistry-avogadroapp-3ced952/CMakeLists.txt 0000664 0000000 0000000 00000005000 15163172372 0021766 0 ustar 00root root 0000000 0000000 cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
# Use the new policy for linking to qtmain
if(POLICY CMP0020)
# cmake_policy(SET CMP0020 NEW)
endif()
# Set CMP0080 to OLD for now for BundleUtilities, this needs porting to NEW.
if(POLICY CMP0080)
cmake_policy(SET CMP0080 OLD)
endif()
project(AvogadroApp)
set(CMAKE_MODULE_PATH ${AvogadroApp_SOURCE_DIR}/cmake)
# Request C++17 standard, using new CMake variables.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS False)
# Set symbol visibility defaults for all targets.
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN True)
include(BuildType)
include(BuildLocation)
include(CompilerFlags)
include(InstallLocation)
include(DetermineVersion)
# Set up our version.
set(AvogadroApp_VERSION_MAJOR "2")
set(AvogadroApp_VERSION_MINOR "0")
set(AvogadroApp_VERSION_PATCH "0")
set(AvogadroApp_VERSION
"${AvogadroApp_VERSION_MAJOR}.${AvogadroApp_VERSION_MINOR}.${AvogadroApp_VERSION_PATCH}")
find_package(Git)
determine_version(${AvogadroApp_SOURCE_DIR} ${GIT_EXECUTABLE} "AvogadroApp")
if(APPLE)
set(MACOSX_BUNDLE_NAME "Avogadro2")
set(prefix "${MACOSX_BUNDLE_NAME}.app/Contents")
set(INSTALL_INCLUDE_DIR "${prefix}/${INSTALL_INCLUDE_DIR}")
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")
set(INSTALL_LIBRARY_DIR "${prefix}/${INSTALL_LIBRARY_DIR}")
set(INSTALL_ARCHIVE_DIR "${prefix}/${INSTALL_ARCHIVE_DIR}")
set(INSTALL_DATA_DIR "${prefix}/${INSTALL_DATA_DIR}")
set(INSTALL_DOC_DIR "${prefix}/${INSTALL_DOC_DIR}")
set(INSTALL_CMAKE_DIR "${prefix}/Resources")
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(QT_VERSION "6" CACHE STRING "What major version of Qt")
set(QT_VERSIONS_SUPPORTED 6)
set_property(CACHE QT_VERSION PROPERTY STRINGS 6)
if(NOT QT_VERSION IN_LIST QT_VERSIONS_SUPPORTED)
message(FATAL_ERROR "Qt version must be one of ${QT_VERSIONS_SUPPORTED}")
endif()
option(ENABLE_TESTING "Enable testing and building the tests." OFF)
if(ENABLE_TESTING)
include(CTest)
enable_testing()
endif()
option(Avogadro_ENABLE_RPC "Enable RPC server" ON)
add_subdirectory(avogadro)
option(BUILD_DOCUMENTATION "Build project documentation" OFF)
if(BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()
install(
FILES
README.md
CONTRIBUTING.md
LICENSE
DESTINATION "${INSTALL_DOC_DIR}/avogadro2")
include(AvogadroCPack)
if(ENABLE_TESTING)
include(BuildPackageTest)
BuildPackageTest_Add("AvogadroApp" "${CMAKE_CURRENT_BINARY_DIR}")
add_subdirectory(tests)
endif()
OpenChemistry-avogadroapp-3ced952/CONTRIBUTING.md 0000664 0000000 0000000 00000001563 15163172372 0021471 0 ustar 00root root 0000000 0000000 Contributing
------------
Our project uses the standard GitHub pull request process for code review
and integration. Please check our [development][Development] guide for more
details on developing and contributing to the project. The GitHub issue
tracker can be used to report bugs, make feature requests, etc.
Our [wiki][Wiki] is used to document features, flesh out designs and host other
documentation. Our API is documented using Doxygen with updated
documentation generated nightly. We have several [mailing lists][MailingLists]
to coordinate development and to provide support.
[Development]: http://wiki.openchemistry.org/Development "Development guide"
[Wiki]: http://wiki.openchemistry.org/ "Open Chemistry wiki"
[Doxygen]: http://doc.openchemistry.org/avogadrolibs/api/ "API documentation"
[MailingLists]: http://openchemistry.org/mailing-lists "Mailing Lists"
OpenChemistry-avogadroapp-3ced952/CTestConfig.cmake 0000664 0000000 0000000 00000000374 15163172372 0022411 0 ustar 00root root 0000000 0000000 set(CTEST_PROJECT_NAME "AvogadroApp")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "cdash.openchemistry.org")
set(CTEST_DROP_LOCATION "/submit.php?project=AvogadroApp")
set(CTEST_DROP_SITE_CDASH TRUE)
OpenChemistry-avogadroapp-3ced952/LICENSE 0000664 0000000 0000000 00000002745 15163172372 0020250 0 ustar 00root root 0000000 0000000 Copyright (c) 2011-2020, Kitware, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OpenChemistry-avogadroapp-3ced952/README.md 0000664 0000000 0000000 00000013270 15163172372 0020515 0 ustar 00root root 0000000 0000000 # ![Avogadro 2][Avogadro2Logo] Avogadro 2
[](https://github.com/OpenChemistry/avogadrolibs/releases) [](https://github.com/OpenChemistry/avogadrolibs/blob/master/LICENSE) [](https://github.com/OpenChemistry/avogadrolibs/actions) [](https://app.codacy.com/gh/OpenChemistry/avogadrolibs/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[](https://github.com/OpenChemistry/avogadrolibs/releases) [](http://doi.org/10.1186/1758-2946-4-17)
[](http://makeapullrequest.com) [](https://github.com/OpenChemistry/avogadrolibs/graphs/contributors) [](https://opencollective.com/open-chemistry)
## Introduction
Avogadro is an advanced molecular editor designed for cross-platform use in
computational chemistry, molecular modeling, education, bioinformatics,
materials science, and related areas.
It offers flexible rendering and a powerful plugin architecture.
Core features and goals of the Avogadro project include:
* Open-source, distributed under the liberal 3-clause BSD license
* Cross-platform, with builds on Linux, Mac OS X and Windows
* An intuitive interface designed to be useful to the whole community
* Fast and efficient, embracing the latest technologies
* Extensible, making extensive use of a plugin architecture
* Flexible, supporting a range of chemical data formats and packages
Avogadro 2 began as a rewrite of the original [Avogadro 1.x][Avogadro1], which
is now unsupported.
The successor is faster, better, much more stable, and [more feature-rich]
(https://two.avogadro.cc/docs/whats-new-in-avogadro-2/).
Avogadro's codebase is split across a
[libraries repository](https://github.com/openchemistry/avogadrolibs)
and an [application repository](https://github.com/openchemistry/avogadroapp).
The new code architecture provides a high-performance rendering engine, modern
code development, and significantly improved speed and stability.
Avogadro is being developed as part of the [Open Chemistry][OpenChemistry]
project by an open community, which was started at [Kitware][Kitware] as
an open-source community project.
## Installing
For the most up-to-date experience use the nightly builds prepared by GitHub
actions for:
* [Linux (AppImage)](https://nightly.link/OpenChemistry/avogadrolibs/workflows/build_linux/master/Avogadro2-x86_64.AppImage.zip)
* [macOS (Apple Silicon)](https://nightly.link/OpenChemistry/avogadrolibs/workflows/build_mac/master/macOS-arm64.zip)
* [macOS (Intel)](https://nightly.link/OpenChemistry/avogadrolibs/workflows/build_mac/master/macOS-intel.zip)
* [Windows](https://nightly.link/OpenChemistry/avogadrolibs/workflows/build_windows/master/Win64.exe.zip)
We also maintain a
[`beta` Flatpak](https://two.avogadro.cc/install/flatpak.html#install-flatpak-beta)
for Linux that is updated with the lastest changes every week or two.
For full releases and an overview of all available ways to obtain Avogadro see
the [overview](Install) on the Avogadro website.
Binaries and the source code for each release can be found on the
[GitHub releases page](https://github.com/OpenChemistry/avogadrolibs/releases).
If you would like to build from source we recommend that you follow our
[build guide][Build].
## User guide
Our [user documentation](https://two.avogadro.cc/docs/) can be found on the
Avogadro website, as well as a brief guide to
[getting started](https://two.avogadro.cc/docs/getting-started/).
## Contributing
We welcome *all* kinds of contributions as a community project, from bug
reports, feature suggestions, language translations, Python plugins,
and C++ code development.
Our project uses the standard GitHub pull request process for code review
and integration. Please check our [contribution][Contribution] guide for more
details on developing and contributing to the project. The [GitHub issue
tracker](https://github.com/openchemistry/avogadrolibs/issues/)
can be used to report bugs, make feature requests, etc. Our API is
[documented online][API] with updated documentation generated nightly.
To introduce yourself, ask for help, or general discussion, we welcome everyone
to our [forum](https://discuss.avogadro.cc/)
Contributors Hall of Fame:
[Avogadro2Logo]: https://raw.githubusercontent.com/OpenChemistry/avogadrolibs/master/docs/avogadro2_64.png "Avogadro2"
[OpenChemistry]: https://openchemistry.org/ "Open Chemistry Project"
[OpenChemistryLogo]: https://raw.githubusercontent.com/OpenChemistry/avogadrolibs/master/docs/OpenChemistry128.png "Open Chemistry"
[Kitware]: https://kitware.com/ "Kitware, Inc."
[Avogadro1]: https://avogadro.cc/ "Avogadro 1"
[Build]: https://two.avogadro.cc/develop/build/ "Building Avogadro"
[Install]: https://two.avogadro.cc/install/ "Installing Avogadro"
[Contribution]: https://two.avogadro.cc/contrib/ "Contribution guide"
[API]: https://two.avogadro.cc/develop/classlist/ "API documentation"
OpenChemistry-avogadroapp-3ced952/SECURITY.md 0000664 0000000 0000000 00000001652 15163172372 0021030 0 ustar 00root root 0000000 0000000 # Security Policy
## Supported Versions
We support security updates on the most recent release and current nightly snapshots.
We will work with distributions (e.g., Ubuntu, FreeBSD, etc.) to provide security patches for widely used long-term-support OS.
Going forward, we will indicate particular releases for long-term-support, although we intend to keep to a frequent release schedule.
| Version | Supported |
| ------- | ------------------ |
| 2.0.x | :white_check_mark: |
| 1.103.x | :white_check_mark: |
| < 1.103 | :x: |
## Reporting a Vulnerability
We currently support private security vulnerability reporting through our
[GitHub](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)
pages. We will work to verify the security vulnerability within 14 days
and a patch or new release within 30 days of reporting.
OpenChemistry-avogadroapp-3ced952/avogadro/ 0000775 0000000 0000000 00000000000 15163172372 0021035 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/avogadro/CMakeLists.txt 0000664 0000000 0000000 00000022756 15163172372 0023611 0 ustar 00root root 0000000 0000000 include(ExternalProject)
find_package(AvogadroLibs REQUIRED NO_MODULE)
include_directories(${AvogadroLibs_INCLUDE_DIRS})
list(APPEND CMAKE_MODULE_PATH ${AvogadroLibs_CMAKE_DIR})
find_package(Eigen3 REQUIRED)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
option(USE_PLOTTER "Enable JKQTPlotter for charts and spectra" ON)
if(USE_PLOTTER)
# should be passed along by avogadrolibs as well
find_package(JKQTPlotter${QT_VERSION} REQUIRED)
endif()
if(MSVC)
add_definitions("-D_CRT_SECURE_NO_WARNINGS")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
# Find the Qt components we need.
if(QT_VERSION EQUAL 6)
find_package(Qt6
COMPONENTS
Concurrent
Widgets
Network
OpenGL
OpenGLWidgets
REQUIRED)
endif()
configure_file(avogadroappconfig.h.in avogadroappconfig.h)
set(avogadro_srcs
aboutdialog.cpp
application.cpp
avogadro.cpp
backgroundfileformat.cpp
mainwindow.cpp
menubuilder.cpp
renderingdialog.cpp
tooltipfilter.cpp
viewfactory.cpp
)
qt_wrap_ui(ui_srcs
aboutdialog.ui
mainwindow.ui
renderingdialog.ui
)
qt_add_resources(rcc_srcs avogadro.qrc)
# download and install QM translation files
# Look in parallel directory for the i18n repository
set(_i18n "${AvogadroApp_SOURCE_DIR}/../avogadro-i18n")
if(NOT EXISTS "${_i18n}")
# download molecules...
ExternalProject_Add(i18n
GIT_REPOSITORY https://github.com/openchemistry/avogadro-i18n
SOURCE_DIR "${AvogadroApp_SOURCE_DIR}/../avogadro-i18n"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()
install(DIRECTORY "${AvogadroApp_SOURCE_DIR}/../avogadro-i18n/avogadroapp/"
"${AvogadroApp_SOURCE_DIR}/../avogadro-i18n/avogadrolibs/"
DESTINATION "${INSTALL_DATA_DIR}/avogadro2/i18n"
FILES_MATCHING PATTERN "*.qm"
)
if(APPLE OR WIN32 OR INSTALL_BUNDLE_FILES)
# copy the qt translation files
get_filename_component(_qttranslationdir "${Qt${QT_VERSION}_DIR}/../../../translations" ABSOLUTE)
message(STATUS "Install Qt translations ${_qttranslationdir}")
install(DIRECTORY "${_qttranslationdir}/"
DESTINATION "${INSTALL_DATA_DIR}/avogadro2/i18n"
FILES_MATCHING PATTERN "qt_*.qm" PATTERN "qtbase*.qm"
# technically, this also copies qt_help.* but that's not a big deal
)
endif()
if(Avogadro_ENABLE_RPC)
add_subdirectory(rpc)
list(APPEND avogadro_srcs rpclistener.cpp rpclistener.h)
add_definitions("-DAvogadro_ENABLE_RPC")
endif()
if(ENABLE_TESTING)
if(QT_VERSION EQUAL 6)
find_package(Qt6 COMPONENTS Test REQUIRED)
endif()
find_package(QtTesting REQUIRED NO_MODULE)
include_directories(${QtTesting_INCLUDE_DIRS})
link_directories(${QtTesting_LIBRARY_DIR})
add_definitions(-DQTTESTING)
endif()
# Need to add current binary dir to include path for UI file headers
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# if we are building statically then we need HDF5 targets
if(NOT BUILD_SHARED_LIBS)
find_package(HDF5 REQUIRED COMPONENTS C)
endif()
# Handle Mac OS X specific icons etc.
if(APPLE)
# add some Objective-C++ code
# list(APPEND avogadro_srcs mac.mm)
# for all the translations, create a .lproj directory
# Migrated from Avo 1.x - contributed by Geoff Hutchison
# We're assuming that there will never be an libavogadro translation
# without a corresponding avogadro one.
# (Fairly safe assumption)
# This regex gives us translations with just two characters
# (e.g., avogadro_fr.ts)
FILE(GLOB avogadro_QM "${INSTALL_DATA_DIR}/avogadro2/i18n/*.qm")
string(REGEX MATCHALL "-[a-z]+\\.qm" langresult "${avogadro_QM}")
string(REGEX REPLACE "-([^.]+)\\.qm" "\\1" languages "${langresult}")
# This one gives us languages for country codes (e.g., avogadro_zh_CN.ts)
string(REGEX MATCHALL "-[a-z]+_[A-Z]+\\.qm" langresult "${avogadro_QM}")
string(REGEX REPLACE "-([^_]+_[^.]+)\\.qm" "\\1" fulllangs "${langresult}")
set (LANGUAGES "${languages};${fulllangs};en;en_US")
foreach(lang ${LANGUAGES})
set( MAC_LANG_DIR "${CMAKE_INSTALL_PREFIX}/Resources/${lang}.lproj" )
install(CODE "EXECUTE_PROCESS(COMMAND
mkdir ${MAC_LANG_DIR}
ERROR_QUIET)")
endforeach()
list(APPEND avogadro_srcs icons/Assets.car)
list(APPEND avogadro_srcs icons/AppIcon.icns)
list(APPEND avogadro_srcs icons/doc.icns)
list(APPEND avogadro_srcs icons/cml.icns)
list(APPEND avogadro_srcs icons/cjson.icns)
set(MACOSX_BUNDLE_ICON_FILE AppIcon)
set(MACOSX_BUNDLE_BUNDLE_VERSION "${AvogadroApp_VERSION}")
set(MACOSX_BUNDLE_INFO_STRING "Avogadro - version ${AvogadroApp_VERSION}")
# Change following line to point to actual icns file in bundle.
set(MACOSX_BUNDLE_GUI_IDENTIFIER "cc.avogadro")
set(MACOSX_BUNDLE_BUNDLE_NAME "Avogadro")
set_source_files_properties(icons/Assets.car PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(icons/AppIcon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(icons/doc.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(icons/cjson.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(icons/cml.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
elseif(UNIX)
install(FILES "metainfo/org.openchemistry.Avogadro2.desktop" DESTINATION "${INSTALL_XDG_APPS_DIR}")
install(FILES "metainfo/org.openchemistry.Avogadro2.metainfo.xml" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/metainfo")
install(FILES "icons/avogadro.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/32x32/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/16x16@2/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_64.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/64x64/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_64.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/32x32@2/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_128.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/128x128/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_256.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/256x256/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2.svg" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/scalable/apps"
RENAME "org.openchemistry.Avogadro2.svg")
elseif(WIN32)
list(APPEND avogadro_srcs icons/avogadro.rc)
# copy icons
install(FILES "icons/avogadro.png" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/avogadro.ico" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/doc.ico" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/cml.ico" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/cjson.ico" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
# for the MSIX installer
install(FILES "icons/Avogadro2-310x150.png" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/Avogadro2_44.png" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/Avogadro2_71.png" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/Avogadro2_150.png" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
install(FILES "icons/Avogadro2_310.png" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons")
# configure the NSI and MSIX installer scripts
configure_file("${AvogadroApp_SOURCE_DIR}/cmake/avogadro2.nsi.in" "${CMAKE_INSTALL_PREFIX}/avogadro2.nsi" @ONLY)
configure_file("${AvogadroApp_SOURCE_DIR}/cmake/AppxManifest.xml.in" "${CMAKE_INSTALL_PREFIX}/AppxManifest.xml" @ONLY)
endif()
if(USE_3DCONNEXION AND (WIN32 OR APPLE))
list(APPEND avogadro_srcs icons/3dx_pivot.png)
list(APPEND avogadro_srcs tdxcontroller.cpp)
list(APPEND avogadro_srcs "${AvogadroApp_SOURCE_DIR}/thirdparty/3DConnexion/src/navlib_load.cpp")
list(APPEND avogadro_srcs "${AvogadroApp_SOURCE_DIR}/thirdparty/3DConnexion/src/navlib_stub.c")
set_source_files_properties(icons/3dx_pivot.png PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
endif()
add_executable(avogadro WIN32 MACOSX_BUNDLE
${avogadro_srcs} ${ui_srcs} ${rcc_srcs})
target_link_libraries(avogadro Qt::Widgets Qt::Network Qt::Concurrent)
if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRTD")
endif()
set_target_properties(avogadro PROPERTIES AUTOMOC TRUE)
target_link_libraries(avogadro Avogadro::QtOpenGL Avogadro::QtGui Avogadro::QtPlugins)
if(Avogadro_ENABLE_RPC)
target_link_libraries(avogadro AvogadroRPC)
endif()
if(APPLE)
set_target_properties(avogadro PROPERTIES OUTPUT_NAME ${MACOSX_BUNDLE_NAME})
else()
set_target_properties(avogadro PROPERTIES OUTPUT_NAME "avogadro2")
endif()
if(ENABLE_TESTING)
target_link_libraries(avogadro qttesting)
endif()
if(QT_VERSION EQUAL 6)
target_link_libraries(avogadro Qt6::OpenGL Qt6::OpenGLWidgets)
endif()
if(USE_3DCONNEXION AND (WIN32 OR APPLE))
target_compile_definitions(avogadro PUBLIC _3DCONNEXION)
target_include_directories(avogadro PUBLIC "${AvogadroApp_SOURCE_DIR}/thirdparty/3DConnexion/inc")
if(APPLE)
target_compile_definitions(avogadro PUBLIC __APPLE__)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdeclspec")
elseif(WIN32)
install(FILES "icons/3dx_pivot.png" DESTINATION "${CMAKE_INSTALL_BINDIR}/img")
endif()
endif()
install(TARGETS avogadro
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
BUNDLE DESTINATION .
)
# Keep "add_subdirectory(lastinstall)" last: fixup_bundle needs to be
# *after* all other install(TARGETS and install(FILES calls
add_subdirectory(lastinstall)
OpenChemistry-avogadroapp-3ced952/avogadro/aboutdialog.cpp 0000664 0000000 0000000 00000005534 15163172372 0024042 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include "aboutdialog.h"
#include "avogadroappconfig.h"
#include "ui_aboutdialog.h"
#include
#include
namespace Avogadro {
AboutDialog::AboutDialog(QWidget* parent_)
: QDialog(parent_)
, m_ui(new Ui::AboutDialog)
{
m_ui->setupUi(this);
// description text
// mostly to get picked up for the installer
// and Linux .desktop file
QString description(tr("Molecular editor and visualizer"));
QString html(""
"%2"
"
");
// Add the labels
m_ui->versionLabel->setText(html.arg("20").arg(tr("Version:")));
m_ui->libsLabel->setText(html.arg("10").arg(tr("Avogadro Library Version:")));
m_ui->qtVersionLabel->setText(html.arg("10").arg(tr("Qt Version:")));
m_ui->sslVersionLabel->setText(html.arg("10").arg(tr("SSL Version:")));
// Add the version numbers
m_ui->version->setText(html.arg("20").arg(AvogadroApp_VERSION));
m_ui->libsVersion->setText(html.arg("10").arg(version()));
m_ui->qtVersion->setText(html.arg("10").arg(qVersion()));
m_ui->sslVersion->setText(
html.arg("10").arg(QSslSocket::sslLibraryVersionString()));
// check for light or dark mode
const QPalette defaultPalette;
// is the text lighter than the window color?
bool darkMode = (defaultPalette.color(QPalette::WindowText).lightness() >
defaultPalette.color(QPalette::Window).lightness());
QString theme = darkMode ? "dark" : "light";
loadImage(theme);
}
void AboutDialog::loadImage(const QString& theme)
{
QString pixels = window()->devicePixelRatio() == 2 ? "@2x" : "";
QString path(":/icons/Avogadro2-about-" + theme + pixels + ".png");
QPixmap pix(path);
if (window()->devicePixelRatio() == 2)
pix.setDevicePixelRatio(2);
m_ui->Image->setPixmap(QPixmap(path));
}
void AboutDialog::changeEvent(QEvent* e)
{
// it's supposed to be through a theme change
// but on macOS, it seems to be triggered
// by a palette change, so we handle both
if (e->type() == QEvent::ApplicationPaletteChange ||
e->type() == QEvent::PaletteChange || e->type() == QEvent::ThemeChange) {
e->accept();
const QPalette defaultPalette;
// is the text lighter than the window color?
bool darkMode = (defaultPalette.color(QPalette::WindowText).lightness() >
defaultPalette.color(QPalette::Window).lightness());
QString theme = darkMode ? "dark" : "light";
loadImage(theme);
}
}
AboutDialog::~AboutDialog()
{
delete m_ui;
}
} /* namespace Avogadro */
OpenChemistry-avogadroapp-3ced952/avogadro/aboutdialog.h 0000664 0000000 0000000 00000001405 15163172372 0023500 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#ifndef AVOGADRO_ABOUTDIALOG_H
#define AVOGADRO_ABOUTDIALOG_H
#include
namespace Ui {
class AboutDialog;
}
namespace Avogadro {
class AboutDialog : public QDialog
{
Q_OBJECT
public:
AboutDialog(QWidget* Parent);
~AboutDialog() override;
void loadImage(const QString& theme);
// handle theme changes
void changeEvent(QEvent* event) override;
private:
Ui::AboutDialog* m_ui;
};
} // End Avogadro namespace
#endif // AVOGADRO_ABOUTDIALOG_H
OpenChemistry-avogadroapp-3ced952/avogadro/aboutdialog.ui 0000664 0000000 0000000 00000023741 15163172372 0023675 0 ustar 00root root 0000000 0000000
AboutDialog
0
0
522
525
0
0
true
-
0
0
:/icons/Avogadro2-about-light.png
-
-
-
Qt::Orientation::Horizontal
40
20
-
Version:
Qt::TextFormat::AutoText
Qt::AlignmentFlag::AlignCenter
-
0.1
Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse
-
Qt::Orientation::Horizontal
40
20
-
-
Qt::Orientation::Horizontal
40
20
-
Avogadro Library Version:
-
0.1
Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse
-
Qt::Orientation::Horizontal
40
20
-
-
Qt::Orientation::Horizontal
40
20
-
Qt Version:
-
0.1
Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse
-
SSL Version:
-
0.1
-
Qt::Orientation::Horizontal
40
20
-
Qt::Orientation::Vertical
20
5
-
-
Qt::Orientation::Horizontal
40
20
-
<html><head/><body><p><span style=" font-size:10pt; font-weight:600;">License: </span><a href="https://opensource.org/licenses/BSD-3-Clause"><span style=" font-size:10pt; text-decoration: underline; color:#0096ff;">BSD 3-Clause</span></a></p></body></html>
true
-
Qt::Orientation::Horizontal
40
20
-
Qt::Orientation::Vertical
20
5
-
-
Qt::Orientation::Horizontal
40
20
-
<html><head/><body><p><a href="https://avogadro.cc"><span style=" text-decoration: underline; color:#0096ff;">avogadro.cc</span></a></p></body></html>
Qt::TextFormat::RichText
Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
true
-
Qt::Orientation::Horizontal
40
20
-
-
Qt::Orientation::Horizontal
0
20
-
OK
OK
clicked()
AboutDialog
accept()
278
253
96
254
OpenChemistry-avogadroapp-3ced952/avogadro/application.cpp 0000664 0000000 0000000 00000003467 15163172372 0024056 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include "application.h"
#include "mainwindow.h"
#include
#include
#include
#include
#include
#include
namespace Avogadro {
Application::Application(int& argc, char** argv)
: QApplication(argc, argv)
{
}
// Handle open events (e.g., Mac OS X open files)
bool Application::event(QEvent* event)
{
switch (event->type()) {
case QEvent::FileOpen:
return loadFile(static_cast(event)->file());
default:
return QGuiApplication::event(event);
}
}
bool Application::loadFile(const QString& fileName)
{
if (fileName.isEmpty()) {
return false;
}
// check to see if we already have an open window
// (we'll let MainWindow handle the real work)
const MainWindow* window = nullptr;
foreach (const QWidget* item, topLevelWidgets()) {
window = qobject_cast(item);
if (window)
break;
}
// if not, need to make this spawn a new instance
if (!window) {
qDebug() << " don't have a window! ";
return false;
}
// Set the default directory for file dialogs based on the opened file
// This respects the current working directory when launching from CLI
const_cast(window)->setDefaultFileDialogPath(fileName);
if (!const_cast(window)->openFile(fileName)) {
qDebug() << " failed to open through MainWindow";
return false;
}
return true;
}
} // end namespace Avogadro
OpenChemistry-avogadroapp-3ced952/avogadro/application.h 0000664 0000000 0000000 00000001217 15163172372 0023512 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#ifndef AVOGADRO_APPLICATION_H
#define AVOGADRO_APPLICATION_H
#include
namespace Avogadro {
class Application : public QApplication
{
Q_OBJECT
public:
Application(int& argc, char** argv);
bool loadFile(const QString& fileName);
protected:
bool event(QEvent* event) override;
private:
};
} // end namespace Avogadro
#endif
OpenChemistry-avogadroapp-3ced952/avogadro/avogadro.cpp 0000664 0000000 0000000 00000031454 15163172372 0023352 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// install a message handler (for Windows)
#include
#include
#include
#include
#include "application.h"
#include "avogadroappconfig.h"
#include "mainwindow.h"
#ifdef Q_OS_MAC
// void removeMacSpecificMenuItems();
#endif
#ifdef Avogadro_ENABLE_RPC
#include "rpclistener.h"
#endif
#define DEBUG false
// Based on https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler
void myMessageOutput(QtMsgType type, const QMessageLogContext& context,
const QString& msg)
{
QByteArray localMsg = msg.toLocal8Bit();
QString file = context.file;
QString function = context.function;
// get current date and time
QDateTime dateTime = QDateTime::currentDateTime();
QString dateTimeString = dateTime.toString("yyyy-MM-dd hh:mm:ss");
QString message;
switch (type) {
case QtInfoMsg:
message = QString("Info: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtWarningMsg:
message = QString("Warning: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtCriticalMsg:
message = QString("Critical: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtFatalMsg:
message = QString("Fatal: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtDebugMsg:
default:
message = QString("Debug: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
}
QString writableDocs =
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
QFile outFile(writableDocs + "/avogadro2.log");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << message << Qt::endl;
}
// Fixes issues with Nvidia drivers giving a GLES-style context instead of
// a Desktop context.
// Taken from https://github.com/openscad/openscad/pull/6711
void configureOpenGLContext()
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (qEnvironmentVariableIsEmpty("QT_OPENGL")) {
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
}
auto format = QSurfaceFormat::defaultFormat();
format.setRenderableType(QSurfaceFormat::OpenGL);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
if (format.depthBufferSize() < 24)
format.setDepthBufferSize(24);
if (format.stencilBufferSize() < 8)
format.setStencilBufferSize(8);
QSurfaceFormat::setDefaultFormat(format);
#endif
}
int main(int argc, char* argv[])
{
#ifdef Q_OS_MAC
// call some Objective-C++
// removeMacSpecificMenuItems();
// Native Mac applications do not have icons in the menus
// until Tahoe (macOS 26)
// (and only do this with Qt 6.7 or later)
bool oldQtVersion = true;
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
oldQtVersion = false;
#endif
auto currentOS = QOperatingSystemVersion::current();
if (oldQtVersion || currentOS.majorVersion() < 26) {
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
// Use Qt-managed popup windows for combo boxes and context menus.
// Native macOS popups can fail to appear in windows with QOpenGLWidget.
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuWindows);
#endif
#endif
QCoreApplication::setOrganizationName("OpenChemistry");
QCoreApplication::setOrganizationDomain("openchemistry.org");
QCoreApplication::setApplicationName("Avogadro");
QGuiApplication::setDesktopFileName("org.openchemistry.Avogadro2");
configureOpenGLContext();
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#ifdef Q_OS_WIN
// We need to ensure desktop OpenGL is loaded for our rendering.
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
// remove the previous log file
QString writableDocs =
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
QFile outFile(writableDocs + "/avogadro2.log");
outFile.remove(); // we don't care if this fails
// install the message handler (goes to Documents / avogadro2.log)
qInstallMessageHandler(myMessageOutput);
#endif
// output the version information
qDebug() << "Avogadroapp version: " << AvogadroApp_VERSION;
qDebug() << "Avogadrolibs version: " << Avogadro::version();
qDebug() << "Qt version: " << qVersion();
qDebug() << "SSL version: " << QSslSocket::sslLibraryVersionString();
Avogadro::Application app(argc, argv);
QSettings settings;
QString language = settings.value("locale", "System").toString();
// Before we do much else, load translations
// This ensures help messages and debugging info can be translated
QLocale currentLocale;
if (language != "System") {
currentLocale = QLocale(language);
}
#ifdef Q_OS_MAC
else {
// On macOS, we can get the system language from the AppleLanguages
// setting, which is a list of preferred languages.
// https://www.qtcentre.org/threads/57433-SOLVED-Get-system-language-on-Mac-OS-X
QVariant osxLanguageSettings = settings.value("AppleLanguages");
QStringList displayLanguages = osxLanguageSettings.toStringList();
QString preferredLanguage = displayLanguages.first();
qDebug() << "preferred language is:" << preferredLanguage;
if (!preferredLanguage.isEmpty()) {
currentLocale = QLocale(preferredLanguage);
}
}
#endif
qDebug() << "Using locale: " << currentLocale.name();
QStringList translationPaths;
// check environment variable and local paths
foreach (const QString& variable, QProcess::systemEnvironment()) {
QStringList split1 = variable.split('=');
if (split1[0] == "AVOGADRO_TRANSLATIONS") {
foreach (const QString& path, split1[1].split(':'))
translationPaths << path;
}
}
translationPaths << QLibraryInfo::location(QLibraryInfo::TranslationsPath);
translationPaths << QCoreApplication::applicationDirPath() +
"/../share/avogadro2/i18n/";
// add the possible plugin download paths
QStringList stdPaths =
QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation);
foreach (const QString& dirStr, stdPaths) {
QString path = dirStr + "/i18n/avogadro-i18n/avogadroapp";
translationPaths << path; // we'll check if these exist below
path = dirStr + "/i18n/avogadro-i18n/avogadrolibs";
translationPaths << path;
}
// Make sure to use pointers:
//
auto* qtTranslator = new QTranslator;
auto* qtBaseTranslator = new QTranslator;
auto* avoTranslator = new QTranslator;
auto* avoLibsTranslator = new QTranslator;
bool qtLoaded = false;
bool avoLoaded = false;
bool libsLoaded = false;
QString successfulPath;
foreach (const QString& translationPath, translationPaths) {
if (!qtLoaded &&
qtTranslator->load(currentLocale, "qt", "_", translationPath)) {
if (app.installTranslator(qtTranslator)) {
qDebug() << "qt Translation successfully loaded.";
qtLoaded = true;
}
}
if (!qtLoaded &&
qtBaseTranslator->load(currentLocale, "qtbase", "_", translationPath)) {
if (app.installTranslator(qtBaseTranslator)) {
qDebug() << "qtbase Translation successfully loaded.";
qtLoaded = true;
}
}
if (!avoLoaded && avoTranslator->load(currentLocale, "avogadroapp", "-",
translationPath)) {
if (app.installTranslator(avoTranslator)) {
qDebug() << "AvogadroApp Translation " << currentLocale.name()
<< " loaded " << translationPath;
avoLoaded = true;
successfulPath = translationPath;
}
}
if (!libsLoaded && avoLibsTranslator->load(currentLocale, "avogadrolibs",
"-", translationPath)) {
if (app.installTranslator(avoLibsTranslator)) {
qDebug() << "AvogadroLibs Translation " << currentLocale.name()
<< " loaded " << translationPath;
libsLoaded = true;
}
}
} // done looking for translations
// Go through the possible translations / locale codes
// to get the localized names for the language dialog
if (successfulPath.isEmpty()) {
// the default for most systems
// (e.g., /usr/bin/avogadro2 -> /usr/share/avogadro2/i18n/)
// or /Applications/Avogadro2.app/Contents/share/avogadro2/i18n/
// .. etc.
successfulPath =
QCoreApplication::applicationDirPath() + "/../share/avogadro2/i18n/";
}
QDir dir(successfulPath);
QStringList files =
dir.entryList(QStringList() << "avogadroapp*.qm", QDir::Files);
QStringList languages, codes;
languages << "System"; // we handle this in the dialog
codes << ""; // default is the system language
bool addedUS = false;
// check what files exist
foreach (const QString& file, files) {
// remove "avogadroapp-" and the ".qm"
QString localeCode = file.left(file.indexOf('.')).remove("avogadroapp-");
if (localeCode.startsWith("en") && !addedUS) {
// add US English (default)
addedUS = true;
QLocale us("en_US");
languages << us.nativeLanguageName();
codes << "en_US";
}
QLocale locale(localeCode);
QString languageName = locale.nativeLanguageName();
if (languageName.isEmpty() && localeCode == "oc")
languageName = "Occitan";
// potentially other exceptions here
// cases like Brazilian Portuguese show up as duplicates
if (languages.contains(languageName)) {
languageName += " (" + locale.nativeCountryName() + ")";
}
languages << languageName;
codes << localeCode;
}
// Check for valid OpenGL support.
auto offscreen = new QOffscreenSurface;
offscreen->create();
auto context = new QOpenGLContext;
context->create();
context->makeCurrent(offscreen);
bool contextIsValid = context->isValid();
delete context;
delete offscreen;
if (!contextIsValid) {
QMessageBox::information(
nullptr, QCoreApplication::translate("main.cpp", "Avogadro"),
QCoreApplication::translate("main.cpp",
"This system does not support OpenGL."));
return 1;
}
// Set up the default format for our GL contexts.
QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat();
#if defined(Q_OS_MAC)
defaultFormat.setAlphaBufferSize(8);
#endif
defaultFormat.setVersion(4, 0);
defaultFormat.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(defaultFormat);
QStringList fileNames;
bool disableSettings = false;
#ifdef QTTESTING
QString testFile;
bool testExit = true;
#endif
QStringList args = QCoreApplication::arguments();
for (QStringList::const_iterator it = args.constBegin() + 1;
it != args.constEnd(); ++it) {
if (*it == "--test-file" && it + 1 != args.constEnd()) {
#ifdef QTTESTING
testFile = *(++it);
#else
qWarning("Avogadro called with --test-file but testing is disabled.");
return EXIT_FAILURE;
#endif
} else if (*it == "--test-no-exit") {
#ifdef QTTESTING
testExit = false;
#else
qWarning("Avogadro called with --test-no-exit but testing is disabled.");
return EXIT_FAILURE;
#endif
} else if (*it == "--disable-settings") {
disableSettings = true;
} else if (it->startsWith("-")) {
qWarning("Unknown command line option '%s'", qPrintable(*it));
return EXIT_FAILURE;
} else { // Assume it is a file name.
fileNames << *it;
}
}
Avogadro::MainWindow window(fileNames, disableSettings);
window.setTranslationList(languages, codes);
#ifdef QTTESTING
window.playTest(testFile, testExit);
#endif
window.show();
#ifdef Avogadro_ENABLE_RPC
// create rpc listener
Avogadro::RpcListener listener;
listener.start();
#endif
return app.exec();
}
OpenChemistry-avogadroapp-3ced952/avogadro/avogadro.qrc 0000664 0000000 0000000 00000000544 15163172372 0023351 0 ustar 00root root 0000000 0000000
icons/avogadro.png
icons/avogadro@2x.png
icons/Avogadro2-about-dark.png
icons/Avogadro2-about-dark@2x.png
icons/Avogadro2-about-light.png
icons/Avogadro2-about-light@2x.png
OpenChemistry-avogadroapp-3ced952/avogadro/avogadroappconfig.h.in 0000664 0000000 0000000 00000000071 15163172372 0025302 0 ustar 00root root 0000000 0000000 #cmakedefine AvogadroApp_VERSION "@AvogadroApp_VERSION@"
OpenChemistry-avogadroapp-3ced952/avogadro/backgroundfileformat.cpp 0000664 0000000 0000000 00000007230 15163172372 0025733 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include "backgroundfileformat.h"
#include
#include
#include
#include
namespace Avogadro {
BackgroundFileFormat::BackgroundFileFormat(Io::FileFormat* format,
QObject* aparent)
: QObject(aparent)
, m_format(format)
, m_molecule(nullptr)
, m_success(false)
{
}
BackgroundFileFormat::~BackgroundFileFormat()
{
delete m_format;
}
void BackgroundFileFormat::read()
{
m_success = false;
m_error.clear();
if (!m_molecule)
m_error = tr("No molecule set in BackgroundFileFormat!");
if (!m_format)
m_error = tr("No file format set in BackgroundFileFormat!");
if (m_fileName.isEmpty())
m_error = tr("No file name set in BackgroundFileFormat!");
if (m_error.isEmpty()) {
// sometimes we hit UTF-16 files, so we need to convert them to UTF-8
// first check whether the file is UTF-16
QFile file(m_fileName);
QTextStream in(&file);
QString text;
bool isUTF16 = false;
if (file.open(QIODevice::ReadOnly)) {
QByteArray data = file.read(2);
// look for a byte-order mark
if ((data.size() == 2 && data[0] == '\xff' && data[1] == '\xfe') ||
(data.size() == 2 && data[0] == '\xfe' && data[1] == '\xff')) {
// UTF-16, read the file and let QString handle decoding
isUTF16 = true;
file.close();
file.open(QIODevice::ReadOnly | QIODevice::Text);
#if QT_VERSION < 0x060000
in.setCodec("UTF-16");
#endif
text = in.readAll();
file.close();
}
}
if (!isUTF16)
m_success =
m_format->readFile(m_fileName.toLocal8Bit().data(), *m_molecule);
else {
// write it to a temporary file and we'll read it back in
// some formats (like the generic output) need a file
// not just a string buffer
// first, we need the *name* of the file, not the full path
// because we're going to save a copy in a temp directory
QTemporaryDir tempDir;
QString tempFileName = tempDir.filePath(QFileInfo(m_fileName).fileName());
QFile tempFile(tempFileName);
if (tempFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&tempFile);
// set it to UTF-8
#if QT_VERSION > 0x060000
out.setEncoding(QStringConverter::Utf8);
#else
out.setCodec("UTF-8");
#endif
out << text;
out.flush();
tempFile.close();
m_success =
m_format->readFile(tempFileName.toLocal8Bit().data(), *m_molecule);
tempFile.remove();
} else // try just reading the string
m_success =
m_format->readString(text.toLocal8Bit().data(), *m_molecule);
}
if (!m_success)
m_error = QString::fromStdString(m_format->error());
}
emit finished();
}
void BackgroundFileFormat::write()
{
m_success = false;
m_error.clear();
if (!m_molecule)
m_error = tr("No molecule set in BackgroundFileFormat!");
if (!m_format)
m_error = tr("No file format set in BackgroundFileFormat!");
if (m_fileName.isEmpty())
m_error = tr("No file name set in BackgroundFileFormat!");
if (m_error.isEmpty()) {
m_success =
m_format->writeFile(m_fileName.toLocal8Bit().data(), *m_molecule);
if (!m_success)
m_error = QString::fromStdString(m_format->error());
}
emit finished();
}
} // namespace Avogadro
OpenChemistry-avogadroapp-3ced952/avogadro/backgroundfileformat.h 0000664 0000000 0000000 00000004106 15163172372 0025377 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#ifndef AVOGADRO_BACKGROUNDFILEFORMAT_H
#define AVOGADRO_BACKGROUNDFILEFORMAT_H
#include
#include
namespace Avogadro {
namespace Core {
class Molecule;
}
namespace Io {
class FileFormat;
}
/**
* @brief The BackgroundFileFormat class provides a thin QObject wrapper around
* an instance of Io::FileFormat.
*/
class BackgroundFileFormat : public QObject
{
Q_OBJECT
public:
/**
* This class takes ownership of @a format and will delete it when destructed.
*/
explicit BackgroundFileFormat(Io::FileFormat* format, QObject* aparent = 0);
~BackgroundFileFormat() override;
/**
* The molecule instance to read/write.
* @{
*/
void setMolecule(Core::Molecule* mol) { m_molecule = mol; }
Core::Molecule* molecule() const { return m_molecule; }
/**@}*/
/**
* The name of the file to read/write.
* @{
*/
void setFileName(const QString& filename) { m_fileName = filename; }
QString fileName() const { return m_fileName; }
/**@}*/
/**
* The Io::FileFormat to use.
*/
Io::FileFormat* fileFormat() const { return m_format; }
/**
* @return True if the operation was successful.
*/
bool success() const { return m_success; }
/**
* @return An error string, set if success() is false.
*/
QString error() const { return m_error; }
signals:
/**
* Emitted when a call to read or write is called.
*/
void finished();
public slots:
/**
* Use the fileFormat() to read fileName() into molecule().
*/
void read();
/**
* Use the fileFormat() to write fileName() from molecule().
*/
void write();
private:
Io::FileFormat* m_format;
Core::Molecule* m_molecule;
QString m_fileName;
QString m_error;
bool m_success;
};
} // namespace Avogadro
#endif // AVOGADRO_BACKGROUNDFILEFORMAT_H
OpenChemistry-avogadroapp-3ced952/avogadro/icons/ 0000775 0000000 0000000 00000000000 15163172372 0022150 5 ustar 00root root 0000000 0000000 OpenChemistry-avogadroapp-3ced952/avogadro/icons/3dx_pivot.png 0000664 0000000 0000000 00000000626 15163172372 0024601 0 ustar 00root root 0000000 0000000 PNG
IHDR
)B ]IDATxڍGa?_4uEuHJuI-TRZ6;\MZx&.s1cf7o1vQ&w.)
,X8K$Y4q+LKK(%PD\%&\Ng x?ORBrvر TV,{IwZW&h^B7WVWZ4ēgbyE8d-̍fN`̯'ϰ3h^Gi6 k"#Qo!Oy@ۢEf