Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qmake to cmake migration #421

Merged
merged 1 commit into from
Dec 30, 2022
Merged

Qmake to cmake migration #421

merged 1 commit into from
Dec 30, 2022

Conversation

zjeffer
Copy link
Collaborator

@zjeffer zjeffer commented Oct 30, 2022

Fixes actions/runner-images#408.

TODO:

  • Migrate from qmake to cmake
  • Successful build and run
  • Fix Github Action workflows
    • Linux
    • Windows
    • macOS

@zjeffer zjeffer force-pushed the qmake-to-cmake branch 2 times, most recently from 90f52c2 to 2d1b5cc Compare November 6, 2022 14:36
@zjeffer zjeffer self-assigned this Nov 6, 2022
@zjeffer zjeffer requested a review from guihkx December 24, 2022 12:26
@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 24, 2022

Hi @guihkx, you seem to be familiar with macOS building, do you have time to fix the macOS builds? I already fixed the Windows and Linux builds, but I don't have a mac so that makes it very hard to debug.

And don't mind the above commits, it took me a while to fix them lol

@guihkx
Copy link
Collaborator

guihkx commented Dec 24, 2022

It looks like it's failing because the macOS image provided by GitHub Actions comes with Python installed by default now? Nevertheless, if I read correctly, I think we can prevent homebrew from updating the dependencies by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1.

And don't mind the above commits, it took me a while to fix them lol

No worries, lol. Just squash them afterward.

@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 24, 2022

@guihkx Thanks. There's also a problem with the non-homebrew builds. Something about lambdas not supporting auto, maybe an old/wrong compiler version?

@guihkx
Copy link
Collaborator

guihkx commented Dec 24, 2022

Upstream bug: actions/setup-python#577

People have provided some workarounds there. You might wanna try some of them in case HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 doesn't work.

If you do add a workaround though, please also add a TODO comment pointing to the issue, so we can later remove the workaround once it's fixed by GitHub.

@guihkx
Copy link
Collaborator

guihkx commented Dec 24, 2022

@guihkx Thanks. There's also a problem with the non-homebrew builds. Something about lambdas not supporting auto, maybe an old/wrong compiler version?

I'll take a look at that.

@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 24, 2022

Ok, thanks for your help!

.github/workflows/macos.yml Outdated Show resolved Hide resolved
.github/workflows/macos.yml Outdated Show resolved Hide resolved
.github/workflows/macos.yml Outdated Show resolved Hide resolved
@guihkx
Copy link
Collaborator

guihkx commented Dec 24, 2022

Regarding the compilation errors, I believe we must require a compiler that supports at least the C++14 standard.

Add this to CMakeLists.txt:

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Though I'd wait for other people to confirm this later, it's not exactly my area of expertise.

@guihkx
Copy link
Collaborator

guihkx commented Dec 25, 2022

Heads up: You may want to sync your branch with dev to avoid merge conflicts.

I have some questions/suggestions about the changes I see in the Linux workflow, but I'll wait until you're happy with your changes and the PR is unmarked as draft.

@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 25, 2022

Still failing on the brew update/upgrade, while this shouldn't be an issue anymore: actions/runner-images#2322 ?

@guihkx
Copy link
Collaborator

guihkx commented Dec 25, 2022

Still failing on the brew update/upgrade, while this shouldn't be an issue anymore: actions/runner-images#2322 ?

That's from 2020, though... Check the new bug report I linked a few posts ago.

HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 should work around it.

@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 25, 2022

That's from 2020, though... Check the new bug report I linked a few posts ago.

Oops, I completely forgot about that post, sorry. I just tested positive for Covid, I'll blame it on that :)

@zjeffer zjeffer marked this pull request as ready for review December 25, 2022 21:52
@zjeffer zjeffer requested a review from guihkx December 26, 2022 09:14
guihkx
guihkx previously requested changes Dec 26, 2022
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/macos.yml Outdated Show resolved Hide resolved
.github/workflows/macos.yml Outdated Show resolved Hide resolved
.github/workflows/macos.yml Show resolved Hide resolved
.github/workflows/windows.yml Outdated Show resolved Hide resolved
.github/workflows/windows.yml Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
.github/workflows/macos.yml Outdated Show resolved Hide resolved
@guihkx
Copy link
Collaborator

guihkx commented Dec 30, 2022

From the Qt 6 docs:

For a consistent developer experience on all platforms, use the Ninja or Ninja Multi-Config generator.

You can select the CMake generator either by setting the CMAKE_GENERATOR environment variable or using the -G argument:

cmake -G Ninja ...

Didn't know that, but if the docs recommend then we should probably do it. Hopefully it just works for Qt 5 builds too...

.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
@guihkx
Copy link
Collaborator

guihkx commented Dec 30, 2022

On Ubuntu the package is actually called ninja-build... 😅

Quite odd that it doesn't come pre-installed on Linux, but it does on Windows...

Anyway, you'll have to install ninja on macOS too... For the build-homebrew job on macOS, you can try adding ninja to the homebrew list of packages, on the Install Qt ${{ matrix.qt-version-major }} (homebrew) step.

Now, for the dmg-aqtinstall job, you'll have to create a new step either before or after Install Qt ${{ matrix.qt-version }} (aqtinstall) and install ninja with homebrew too...

Copy link
Collaborator

@guihkx guihkx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry in advance about my silly nitpicks about sorting things alphabetically... 😅

.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/linux.yml Outdated Show resolved Hide resolved
.github/workflows/macos.yml Outdated Show resolved Hide resolved
.github/workflows/macos.yml Outdated Show resolved Hide resolved
.github/workflows/windows.yml Outdated Show resolved Hide resolved
@zjeffer zjeffer force-pushed the qmake-to-cmake branch 2 times, most recently from 7c49258 to d759ca1 Compare December 30, 2022 14:34
@guihkx
Copy link
Collaborator

guihkx commented Dec 30, 2022

Awesome! Thanks a lot for the fixes! 🏆

LGTM CI-wise, although I haven't actually tested any of the artifacts generated by it (just yet).

Anyway, I noticed that we had a couple of Linux-specific subcommands in src/Notes.pro, like make deb and make appimage.

I personally never used them, but I wonder if it's easy enough to re-add them here? 🤔

@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 30, 2022

Awesome! Thanks a lot for the fixes!

Thank you very much for your help!

Anyway, I noticed that we had a couple of Linux-specific subcommands in src/Notes.pro, like make deb and make appimage.

I saw we already have make_deb.sh and make_snap.sh scripts in packaging, maybe we can just add a make_appimage.sh script as well, in another PR?

@guihkx
Copy link
Collaborator

guihkx commented Dec 30, 2022

Sure. Sounds good to me.

Copy link
Collaborator

@guihkx guihkx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor things I noticed.

Btw, are you aware of something like clang-format for CMakeLists.txt? Just to help us keep the formatting consistent.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 30, 2022

Btw, are you aware of something like clang-format for CMakeLists.txt? Just to help us keep the formatting consistent.

I found this: https://github.com/cheshirekow/cmake_format. I'm adding a .cmake-format file to the repo, and I'm currently trying to get the vscode extension to work.

@zjeffer zjeffer force-pushed the qmake-to-cmake branch 5 times, most recently from eda87b5 to 72c47f5 Compare December 30, 2022 22:37
@zjeffer zjeffer merged commit 11028d0 into nuttyartist:dev Dec 30, 2022
@zjeffer zjeffer deleted the qmake-to-cmake branch December 30, 2022 23:16
@nuttyartist
Copy link
Owner

Thanks for this!

Btw, I just tested this PR using this binary (https://github.com/nuttyartist/notes/actions/runs/3809547762) on Windows, and the app icon doesn't show up (not on the desktop, task manager, install/uninstall). Is it related to this PR? Because it worked well on a previous PR (of the Qt6 Migration).

@guihkx
Copy link
Collaborator

guihkx commented Dec 31, 2022

I also noticed that the version is getting set incorrectly... Will open a PR shortly to see if it fixes both of our problems.

@zjeffer
Copy link
Collaborator Author

zjeffer commented Dec 31, 2022

@guihkx Thanks! Can you explain what you mean by the version getting set incorrecty?

Ah, I see, the verion inside the app is empty, and therefore it thinks there is an update.

@guihkx
Copy link
Collaborator

guihkx commented Dec 31, 2022

My guess is that $CMAKE_PROJECT_VERSION is undefined here:

https://github.com/nuttyartist/notes/blob/11028d0cd44e3db63a835e232269fd57fe0c7e17/CMakeLists.txt#LL126C11-L126C11

For that to work, I believe we should've set the version in project().

Nevertheless this might also not be optimal, because $CMAKE_PROJECT_VERSION was only introduced in CMake 3.12, but we still have to support 3.10 because of Ubuntu 18.04...

No worries, though. I'm preparing a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PSA: bash != sh !
4 participants