Skip to content

Commit

Permalink
added osx build
Browse files Browse the repository at this point in the history
- updated readme
  • Loading branch information
someretical committed Jan 10, 2022
1 parent 45a3a72 commit dfd4a3e
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 30 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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}}
51 changes: 51 additions & 0 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.
Binary file modified images/readme/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions src/core/theoreticaldiary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/diaryeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void DiaryEditor::render_month(QDate const &date, std::optional<td::YearMap::ite
for (int i = current_month_offset; i < 7; ++i, ++days_added) {
// Render the day if it has a corresponding entry.
// There are 2 entirely separate flows here simply because there are 2 checks required to see if the entry is
// present. I could use goto but hat's kind of messy and harder to keep track of compared to plain old copy
// present. I could use goto but that's kind of messy and harder to keep track of compared to plain old copy
// pasting.
if (opt) {
auto const &monthmap = (*opt)->second;
Expand Down
8 changes: 5 additions & 3 deletions theoreticaldiary.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -106,6 +111,3 @@ RESOURCES += \
images/images.qrc \
styles/styles.qrc \
text/text.qrc

DISTFILES += \
styles/global/standaloneoptions.qss

0 comments on commit dfd4a3e

Please sign in to comment.