Modernize cmake files (part 1)#3167
Conversation
It now exports a target so we don't need to manually add variables to the Mudlet binary and uses pkg-config enhanced search functionality if the tool is available.
It now exports a target so we don't need to manually add variables to the Mudlet binary and uses pkg-config enhanced search functionality if the tool is available.
This makes handling the file lists nicer as we don't have to take care which lists to put what in. And cmake is much more efficient in the way it's using the meta-compiler things than if called manually.
This should be done by the lua find module. If that is not enough, we may have to write our own in the future.
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
|
I was unsure whether to leave the MSVC special code in or not. On the one hand, I'm hesitant to support another build system, but then I'm not sure if we remember that we had some setup if we decide to support it in the future. |
|
Let's remove it for now - |
|
There's still some C++ code that has the MSVC checks, but I'll leave that to you. |
|
Are these Find*.cmake files ours or third-party? |
|
I modified those that were already included here. The new ones were written by me (the lua one has a bit of code from the lua find module that cmake has included). |
|
Some of the MSVC stuff is also associated with the By the same token though - if it is being removed the corresponding bits ought to also be taken out of the QMake project file... |
|
Be careful with the boost options - IIRC specifying a specific module (e.g. |
|
Yep, sounds like a good idea for follow-up PRs. |
Good catch. I looked that up when I first started to play with this but forgot about it. Now it's using the correct target. |
* Modernize FindHUNSPELL It now exports a target so we don't need to manually add variables to the Mudlet binary and uses pkg-config enhanced search functionality if the tool is available. * Modernize FindPCRE It now exports a target so we don't need to manually add variables to the Mudlet binary and uses pkg-config enhanced search functionality if the tool is available. * Allow CI builds for this branch * Modernize FindPUGIXML * Fix and improve static finding of hunspell and PCRE libraries * Modernize FindYAJL * Use exported Qt targets instead of manually including variables * Use cmake AUTO* capbilities for Qt This makes handling the file lists nicer as we don't have to take care which lists to put what in. And cmake is much more efficient in the way it's using the meta-compiler things than if called manually. * Remove manual finding of lua This should be done by the lua find module. If that is not enough, we may have to write our own in the future. * Use exported target ZLIB instead of exported variables * Some reordering and cleanup * Modernize FindZIP.cmake * Use exported target instead of variables * Use own copy of FindLua51 to export targets * Use exported target for OpenGL * Add forgotten explicit target * Avoid hardcoding position independent code flags * Don't set the stdlibC++ manually * Move most compiler flags around to modify only the mudlet target * Undo: Allow travis builds for this branch * Remove MSVC references in our CMakeLists.txt * Use header-only boost target
There are files now in Mudlet that seem to have been forgotten from being added to these variables so they can be seen in Qt Creator, they are: * OTHER_FILES: * ./.devcontainer/Dockerfile (added by Mudlet#4087) * ./.devcontainer/devcontainer.json (added by Mudlet#4087) * ./.devcontainer/library-scripts/desktop-lite-debian.sh (added by Mudlet#4088) * ./.github/workflows/generate-changelog.yml (added by Mudlet#6006) * ./CI/appveyor.validate_deployment.ps1 (added by Mudlet#3493) * ./CI/generate-changelog.lua (renamed from ./CI/generate-ptb-changelog.lua by Mudlet#6002, that file created by Mudlet#3517) * ./CI/travis.validate_deployment.sh (added by Mudlet#3493) * ./CI/update-autocompletion.lua (added by Mudlet#3452) * ./dangerfile.js (added by Mudlet#5489) * ./docker/.env.template (added by Mudlet#5047) * DISTFILES: * ./.clang-tidy (added by Mudlet#4858) * ./cmake/FindLua51.cmake (added by Mudlet#3167) * ./cmake/FindSparkle.cmake (added Mudlet#3477) * ./cmake/FindZZIPLIB.cmake (added by Mudlet#3630) * ./cmake/IncludeOptionalModule.cmake (added by Mudlet#3174) * ./cmake/InitGitSubmodule.cmake (added by Mudlet#3171) The following files have gone away: * OTHER_FILES: * ./.github/workflows/whitespace-linter.yml (removed by Mudlet#4152) * ./.travis.yml (removed by Mudlet#5611) * ./README (renamed to ./dev_README by Mudlet#439, removed by Mudlet#1169) Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
…les (#6037) This PR had three commits: * The first commit just sorts in a case insensitive manner the files in the OTHER_FILES and DISTFILES QMake variables. This is a precursor to making changes to them. * The second swaps some files between QMake OTHER_FILES and DISTFILES variables. Technically the latter are for files that are needed to go into a source tarball that the traditional GNU 'make dist' operation would produce. As such it does not seem reasonable to include CI/CB control files in it. Conversely the run-time LUA files that Mudlet needs definitely should be included and so this commit moves them from the OTHER_FILES variable, whose contents are merely files that we want to show up in the Qt Creator IDE so they can be seen, searched and edited from there. * The third changes the contents of QMake OTHER_FILES and DISTFILES variables as there are files now in Mudlet that seem to have been forgotten from being added to these variables so they can be seen in Qt Creator, they are: * OTHER_FILES: * ./.devcontainer/Dockerfile (added by Setup Mudlet for C++ Github Codespace #4087) * ./.devcontainer/devcontainer.json (added by Setup Mudlet for C++ Github Codespace #4087) * ./.devcontainer/library-scripts/desktop-lite-debian.sh (added by Open Mudlet remotely using Github Codespaces #4088) * ./.github/workflows/generate-changelog.yml (added by Infrastructure: add workflow to create changelog from the web #6006) * ./CI/appveyor.validate_deployment.ps1 (added by Add updater validation to linux/macos/windows release builds #3493) * ./CI/generate-changelog.lua (renamed from ./CI/generate-ptb-changelog.lua by Infrastucture: update changelog generator to handle releases as well #6002, that file created by Add a changelog generator for PTB releases #3517) * ./CI/travis.validate_deployment.sh (added by Add updater validation to linux/macos/windows release builds #3493) * ./CI/update-autocompletion.lua (added by Add action for automatic updates of Mudlet's autocompletion #3452) * ./dangerfile.js (added by Infrastructure: danger checks in JS #5489) * ./docker/.env.template (added by Docker development support #5047) * DISTFILES: * ./.clang-tidy (added by Add automated check to verify improvements against Mudlet's C++ style guide #4858) * ./cmake/FindLua51.cmake (added by Modernize cmake files (part 1) #3167) * ./cmake/FindSparkle.cmake (added Improve cmake osx #3477) * ./cmake/FindZZIPLIB.cmake (added by Build Mudlet for macOS with Github Actions #3630) * ./cmake/IncludeOptionalModule.cmake (added by Cmake improve optional module check #3174) * ./cmake/InitGitSubmodule.cmake (added by Cmake improve git submodule initialization #3171) Also, the following files have gone away: * OTHER_FILES: * ./.github/workflows/whitespace-linter.yml (removed by Delete whitespace-linter action #4152) * ./.travis.yml (removed by Infrastructure: delete .travis.yml #5611) * ./README (renamed to ./dev_README by Release 3.0 merge into master #439, removed by Merge 3.3.0 development into master #1169) Signed-off-by: Stephen Lyons slysven@virginmedia.com
Brief overview of PR changes/additions
This PR modernizes our approach to CMake files and their content.
Motivation for adding to Mudlet
Use more idiomatic CMake code. This allows us to be briefer and more concise, as well as use more features of this modern build system.
Additionally, it restricts options to our own code without bleeding into other cmake setups (e.g. sub-projects).
Other info (issues closed, discussion etc)
Part of #1392, it's already handed in to avoid huge PRs as discussed in #3164.