diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 0a5212d..8e19452 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -21,11 +21,11 @@ jobs: - name: Build cryptopp run: | cd external-libs/cryptopp - CXXFLAGS="-DNDEBUG -g2 -O3 -fopenmp -lgomp" make -j$(nproc) dynamic cryptest.exe - CXXFLAGS="-DNDEBUG -g2 -O3 -fopenmp -lgomp" make -j$(nproc) libcryptopp.a libcryptopp.so cryptest.exe + CXXFLAGS="-DNDEBUG -g2 -O3 -fopenmp" make -j$(nproc) dynamic cryptest.exe + CXXFLAGS="-DNDEBUG -g2 -O3 -fopenmp" make -j$(nproc) libcryptopp.a libcryptopp.so cryptest.exe sudo make install PREFIX=/usr/local - - name: Qmake and make + - name: qmake and make run: | qmake CONFIG+=release make -j$(nproc) @@ -41,7 +41,9 @@ jobs: mkdir -p "TheoreticalDiary.AppDir/usr/share/metainfo/" cp "me.someretical.TheoreticalDiary.appdata.xml" "TheoreticalDiary.AppDir/usr/share/metainfo/" export VERSION="$(cat text/VERSION.txt)" - export OUTPUT="TheoreticalDiary-v${VERSION}-x86_64.AppImage" + export FIRST_NAME="TheoreticalDiary-v${VERSION}-x86_64" + export OUTPUT="${FIRST_NAME}.AppImage" + echo ::set-output name=first_name::${FIRST_NAME} echo ::set-output name=full_name::${OUTPUT} export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib sudo ldconfig /usr/local/lib @@ -50,5 +52,5 @@ jobs: - name: Upload to Github uses: actions/upload-artifact@v2 with: - name: ${{steps.build_appimage.outputs.full_name}} + name: ${{steps.build_appimage.outputs.first_name}} path: ${{steps.build_appimage.outputs.full_name}} diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml new file mode 100644 index 0000000..594a56a --- /dev/null +++ b/.github/workflows/osx.yml @@ -0,0 +1,51 @@ +on: [push, workflow_dispatch] + +env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + +jobs: + build: + name: Bundle build + runs-on: macos-10.15 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: Install Qt + uses: jurplel/install-qt-action@v2.6.2 + with: + host: mac + modules: 'qtcharts' + extra: --external 7z + + - name: Build cryptopp + run: | + brew install llvm libomp + cd external-libs/cryptopp + export CXXFLAGS="-DNDEBUG -g2 -O3 -fopenmp -L/usr/local/opt/llvm/lib -I/usr/local/opt/llvm/include" + export CC="/usr/local/opt/llvm/bin/clang" + export CXX="/usr/local/opt/llvm/bin/clang++" + make -j$(sysctl -n hw.logicalcpu) dynamic cryptest.exe + make -j$(sysctl -n hw.logicalcpu) libcryptopp.a libcryptopp.so cryptest.exe + sudo make install PREFIX=/usr/local + + - name: qmake and make + run: | + sudo xcode-select -s /Applications/Xcode_12.1.1.app/Contents/Developer + qmake QMAKE_CC="/usr/local/opt/llvm/bin/clang" QMAKE_CXX="/usr/local/opt/llvm/bin/clang++" CONFIG+=release QMAKE_LIBS+="-L/usr/local/opt/llvm/lib -L/usr/local/lib" INCLUDEPATH+="-I/usr/local/opt/llvm/include" + make -j$(sysctl -n hw.logicalcpu) + + - name: macdeployqt + id: macdeploy + run: | + export FIRST_NAME="TheoreticalDiary-v$(cat text/VERSION.txt)-x86_64" + echo ::set-output name=first_name::${FIRST_NAME} + macdeployqt TheoreticalDiary.app + + - name: Upload to Github + uses: actions/upload-artifact@v2 + with: + name: ${{steps.macdeploy.outputs.first_name}} + path: TheoreticalDiary.app diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 56750e4..897337b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -36,18 +36,17 @@ jobs: nmake nmake clean - - name: Link DLLs - id: link_dlls + - name: windeployqt + id: windeploy shell: cmd run: | windeployqt release\\theoreticaldiary.exe --compiler-runtime set /p VERSION=<"text/VERSION.txt" set FILE_NAME=TheoreticalDiary-v%VERSION%-x86_64 - rename "release\\theoreticaldiary.exe" "%FILE_NAME%.exe" echo ::set-output name=file_name::%FILE_NAME% - name: Upload to Github uses: actions/upload-artifact@v2 with: - name: ${{steps.link_dlls.outputs.file_name}} + name: ${{steps.windeploy.outputs.file_name}} path: release diff --git a/README.md b/README.md index 6dbe348..6a0570c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ A digital diary with Google Drive backups. This app is currently feature complet ### Windows -For Windows, the prebuilt binaries are available in `theoreticaldiary-x86_64` (check the result of the latest successful Github actions for [`windows.yml`](https://github.com/someretical/TheoreticalDiary/actions/workflows/windows.yml)). The only platform it is guaranteed to work on is Windows 10 x64. +Check the result of the latest successful Github actions for [`windows.yml`](https://github.com/someretical/TheoreticalDiary/actions/workflows/windows.yml). The only platform it is guaranteed to work on is Windows 10 x64. To fix scaling issues on Windows, follow these instructions: @@ -38,18 +38,11 @@ To fix scaling issues on Windows, follow these instructions: ### Linux -For Linux, the prebuilt app image is available in `theoreticaldiary-x86_64` (check the result of the latest successful Github actions for [`linux.yml`](https://github.com/someretical/TheoreticalDiary/actions/workflows/linux.yml)). Due to package version requirements, the app image will only work from Ubuntu 20.04 onwards. +Check the result of the latest successful Github actions for [`linux.yml`](https://github.com/someretical/TheoreticalDiary/actions/workflows/linux.yml). Due to package version requirements, the app image will only work from Ubuntu 20.04 onwards. ### MacOS -In theory it is possible to deploy to MacOS but I'm not bothered enough to figure out how to do so. Pull requsts are welcome on this matter. - +Check the result of the latest successful Github actions for [`osx.yml`](https://github.com/someretical/TheoreticalDiary/actions/workflows/osx.yml). It should work for version 10.15 and up. ## Building -### Windows - -My main development platform is not Windows so the best I can say is to take a look at [`windows.yml`](https://github.com/someretical/TheoreticalDiary/blob/master/.github/workflows/linux.yml) to see how to build it. - -### Linux - -Check out [`linux.yml`](https://github.com/someretical/TheoreticalDiary/blob/master/.github/workflows/linux.yml) for how to build your own app image. +Check the steps followed in all the workflow files. \ No newline at end of file diff --git a/images/readme/settings.png b/images/readme/settings.png index 65510bf..220f391 100644 Binary files a/images/readme/settings.png and b/images/readme/settings.png differ diff --git a/src/core/theoreticaldiary.cpp b/src/core/theoreticaldiary.cpp index 0043ff4..8c1eee7 100644 --- a/src/core/theoreticaldiary.cpp +++ b/src/core/theoreticaldiary.cpp @@ -60,7 +60,6 @@ TheoreticalDiary::TheoreticalDiary(int &argc, char *argv[]) : QApplication(argc, QFile file(":/VERSION.txt"); file.open(QIODevice::ReadOnly); setApplicationVersion(file.readAll()); - file.close(); setApplicationName("Theoretical Diary"); @@ -71,15 +70,15 @@ TheoreticalDiary::TheoreticalDiary(int &argc, char *argv[]) : QApplication(argc, setDesktopFileName("me.someretical.TheoreticalDiary.desktop"); setWindowIcon(QIcon(":/linux_icons/256x256/theoreticaldiary.png")); - gwrapper = new GoogleWrapper(this); - diary_holder = new DiaryHolder(); - encryptor = new Encryptor(); - internal_manager = new InternalManager(); - // Create app directory. QDir dir(internal_manager->data_location()); if (!dir.exists()) dir.mkpath("."); + + gwrapper = new GoogleWrapper(this); + diary_holder = new DiaryHolder(); + encryptor = new Encryptor(); + internal_manager = new InternalManager(); } TheoreticalDiary::~TheoreticalDiary() diff --git a/src/gui/diaryeditor.cpp b/src/gui/diaryeditor.cpp index ab14e9f..69c0e8b 100644 --- a/src/gui/diaryeditor.cpp +++ b/src/gui/diaryeditor.cpp @@ -145,7 +145,7 @@ void DiaryEditor::render_month(QDate const &date, std::optionalsecond; diff --git a/theoreticaldiary.pro b/theoreticaldiary.pro index 3737c28..2ce437e 100644 --- a/theoreticaldiary.pro +++ b/theoreticaldiary.pro @@ -6,6 +6,11 @@ INCLUDEPATH += external-libs/json/single_include/nlohmann \ unix:LIBS += \ -L/usr/lib/ -lcryptopp +macx:LIBS += \ + -L/usr/lib/ + +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15 + win32:LIBS += \ -l"external-libs/cryptopp/cryptlib" @@ -106,6 +111,3 @@ RESOURCES += \ images/images.qrc \ styles/styles.qrc \ text/text.qrc - -DISTFILES += \ - styles/global/standaloneoptions.qss