-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
CMake support for Qt5 and Qt6 #100
Conversation
Thanks for the PR! I am very apprehensive about switching to cmake at this time. I personally have never had any good experiences with cmake...again just my personal opinion. I know its a widely-used, mature build system so I'm willing to keep an open mind. I know in the past couple of years QtCreator has had better cmake support (and Qt moving to cmake in general) So I think the plan for now can be to keep this PR open and slowly work on maturing cmake support to see if it is an adequate replacement for everything qmake does today. I worry all upstreams will not be willing to support cmake (could this project implement its own cmake files outside of those streams? similar to what is done with qmake and Lua currently?) Even then I don't foresee moving to cmake really soon, just because of some of the macOS and flatpak distributions might need some tweaking. But if it matures nicely and proves it can take qmake's place then I may be willing to ditch qmake. |
I agree. I think the best way is to maintain both build systems - until you got comfortable with CMake. For you - you just need to open this branch and open VisualStudio. The rest will be similar to you - the workflow will be the same. I can find time to setup Qt6 on Windows - but it will take time. You can test Qt5/Windows now. (and Qt5/OSX, whoever tests this). It "should work". Regarding upstreams: I have only 4 forks (you cannot add an out of source CMake, at least not trivially, yet):
The first two are not a problem. The problem is scintilla's upstream. Even if they do not accept the new build system. as I have not modified their sources - I can easily merge from them back. IMHO - its a win-win scenario. |
I use QtCreator, but think it would be similar.
But doesn't it technically already have out of source cmake since your cmake file builds the entire application fine? I would definitely want to avoid having to fork every repository that doesn't support cmake. Every external Qt-based repo that I've looked at using has qmake support so its at least a bit easier but not perfect. Plus out of source qmake is fine.
I honestly regret using submodules. They are nice if you want to use the code as-is and never want to modify it. But then its just annoying because its something you always have to be aware of. I definitely don't want Python to be a requirement for building Notepad Next since Scintilla needs it generate the two files that don't come by default with Scintilla. So I'm not sure how cmake would handle that situation. |
CMake is the recommended build method for Qt6+ |
I started this project years ago and qmake was the build system of choice for Qt based projects. Qt Creator also has much better cmake support, plus as you mentioned Qt using cmake now. At some point Notepad Next will only support Qt6. All this is why I'm willing to see how well cmake will work for this project. |
While the CMake stuff is nice... I could have chosen to keep the old monorepo workflow. However, I decided to use a multirepo approach. What does this give me? See the latest commits in this rebased branch, see how easy it is for me to update version. See this for example: (still WIP, need to add the CI stuff) |
@elcuco Is it independent of git submodules? EDIT: nvm I was confused for a sec. Wouldn't it be better to include the other repos as git submodules instead of using cmake as a dependency manager? |
I can easily convert this to using git submodules + One of the future enhancements I want to add, is migrating this to conan. Using submodules defeats this goal. |
Why is conan better? |
If you add a library by conan, you can get pre-compiled version (most of the artifacts are on VS and OSX). You can get a deep dependency chain - by asking the upper level package. For example here: https://github.com/elcuco/nana-ide/blob/master/conanfile.txt I asked for libpng, which in turn got me libz. I can handle also dependencies which are not packaged using cmake - for example boost, which in turn depends on openssl (both have non-cmake build systems). They get installed into a sandbox - and conan does magic to include the correct path for libs and includes. I heard of it as a "docker environment experience" (since nothing on the real system is modified). You can also have several applications (sub projects, for example) each depending on a different version of the same library (each sub-project will need to have a dedicated conan file). This is what npm/gradle/pods/pip/cargo does - but for C++. You expand the amount of libraries available to your app. |
Neat. I'll have to see it in action! btw if this is compiling for you locally, can you also make changes to the github workflow so we know if the CI can handle it? |
Awesome! |
Almost. The windows build is broken (scintilla's cmake is bad). PS: I don't own a mac, so building packages for it might become a trial an error with the CI. Help would be appreciated. |
I'm not good with CMake, but I have some experience with the CI. I'll take a look tomorrow and see if there's anything I can help with! |
I fixed the building of all libraries to be static, as cmake installs into I will give a try in the next week to fix the install targets, and after that (hopefully) AppImage would work. |
Notes how I got this to build with VS2022: scintilla-code-src\CMakeLists.txt scintilla-code-src\qt\ScintillaEditBase\ScintillaEditBase.h I hope these notes help you resolve the windows build issues. Update: |
Minor update:
@stevenhoving - just saw your comments, window did not refersh. Yeap, VS should be trivial. Nice. |
I think Qt6 is the right choice. I haven't decided yet when to move official distribution to Qt6 but it is definitely desired.
Is this required?
The only build system I will be using on Windows is VS and I want this to be the official build system. If MinGW works then great, but there's no way I can troubleshoot MinGW issues if they would ever arise. |
I managed to get the static linking issues fixed on MinGW, the CI confirmed this works also on CL/MSVC. EDIT - fixed CI as well |
Just a small comment: the CI is currently generating EXEs built with MSVC. It worked as soon as I fixed the MinGW build on my laptop. I think about adding another win64 build when this gets merged. I like the idea of using MinGW as another build (keeping with the FS on windows agenda). |
In my repo, you can see https://github.com/elcuco/NotepadNext/actions/runs/2318840719 - which has an artifact for Windows (a zip). I know the scripts build zip files for qt5, and qt6, and for qt6 I should also have an installer. Trying to identify whats borked. IMHO - a mingw build can also be produced. However, I build installer only for MSVC Qt6. Because, WTF not. |
Rebased against master. |
Maintaining both Qt5 and Qt6 would be nice but if it makes things easier then I'd say don't worry about Qt5 for now. At some point Qt5 will be dropped anyways. |
sorry for late response. I think - that the best solution I can provide is a set of config items - so instead of
To - new tasks:
|
1) updated CPM to v0.36.0 2) uchardet: the github mirror is no longer active. Instead use the official freedesktop gitlab mirror. 3) Updated sha1/versions of libraries 4) ADS is now at v4.1.1 5) LanguagePropertiesModel and frieds are removed from code
Works for me. |
Dear all, Any progress on it? |
* add missing files to the build system * cpm: trivial update from 0.38.6 to 0.40.2 * uchatdet: update from 2f5c24006ebc7f005040358f58f22a61a3c92522 to edae8e81cfb8092496f94da1a306c4c9f0ce32bb, also build in release mode, since upstream needs address sanatizer when building in debug * AdvancedDockingSystem: trivial update from 4.1.1 to 4.3.1 * EditorCondigCore: trival update from bf86460fe29b53731bba650d2a59d4c47eb25de9 to ee967262db4fdbd735f9971cc0c90cf4f3100d3a * QSimpleUpdater: using upstream's build system (!) 911727370d90001077f93ea94545099e197400a0 * lua: trivial update from 26be27459b11feabed52cf40aaa76f86c7edc977 to 50c7c915ee2fa239043d5456237f5145d064089b * Scintilla: trivial update from v5.3.3 to v5.5.3, also - use a shallow clone, as this is a big project * Lexilla: update from v5.2.1 to v5.4.1. Updated local build system as well (not used, will get removed soon). Compiles and runs on linux. I hope Windows does not break.
- Windows: ucharsel needs to be downgraded, as it does not compile under MSVC. - Lexilla: on my local machine the remote build system works, however on the CICD, it failed. Lets try the local build system.
Hi, I just updated the dependencies. Once its settled, I will add a few switches to use local packages. HOWEVER: the packages needed are not in Fedora. I can have a "not dealing with that have fun" switch, but you need a lot of work to make it happen.
|
It seems like Qt6.8 needs cups to build.
It is clear that I lost interest in this branch. Code compiles and works, but the missing parts are the installers creation: App image, flatpack, macOS. I hope someone finishes this work. It should be "trivial" :) |
This PR brings CMake support for the Qt5 build of NotepadNext.
To build use:
Benefits:
TODO:
build.yml
back to ninjaNice to have:
Status so far:
I am able to build a windows ZIP. From this - I should create the EXE using NSI. However - NSI dies, since it looks for the EXE version in order to create the version for the installer. I traced this down to the Windows RC compiler. QMake passes some arguments to it - and the versions are "preprocessor defines". I do not want to generate the RC on configure time, this seems like a hack to me, I want to do what QMake does. When this is done - IMHO, the installer for windows will be ready.
Installer for OSX? I have no idea whats borked there. I hope someone with a Mac can help me.
Linux should be ready.