-
Notifications
You must be signed in to change notification settings - Fork 238
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
Buildscripts/cmake for GitHub actions #53
Buildscripts/cmake for GitHub actions #53
Conversation
cmake_minimum_required is 3.23 due to use of FILE_SET
Originally they were written in `configure.ac` for `darwin9`. Unfortunately, this doesn't work on Github workers: - clang: error: no such file or directory: 'ppc' - clang: error: no such file or directory: 'x86_64' Maybe that's because the target on macos-runner is `x86_64-apple-darwin21.6.0`.
Fun fact -- I had a draft branch with the same code as here. And my checks didn't fail at all. So #52 is like a Heizenbug. =) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - this is a way cleaner build config than before. Thanks for writing this!
Btw, I've seen people use cmake in this style
would that also work? |
One thought - we can update README.md to describe this (basically just copy-paste what you wrote in the PR) as the default build process. It's probably okay to keep the autoconf/automake files in place, but nudge people away from using them by making the cmake method the only one described in the readme. |
Sure! As for the manuals,
Yeah, that would be great! Should I prepare a new README.md section, or will you do it? |
It may be good to use hardened compiler options. Do you know which of these can be used for a library (without requiring the whole program to be compiled with the same options)? |
No, I've never dealt with hardening packages before. It could be a great research. |
This PR offers a opportunity to build library with CMake. The process is rather clear:
First you should configure your project by running:
cmake -S . -B .builddir
from the source directory.
Here you can specify the compiler, build type and several other features, that do fine tuning of your building process.
Remember, that in case of gcc and clang you cannot build both debug and release binaries into one directory. You should use separate directories for every build configuration.
On the other hand, msvc supports multi-config building, as it creates subfolders for each config. That's why YML-workflow on Windows slightly differs from those on Ubuntu and MacOS.
Then you should build the binaries:
cmake --build .builddir
Finally you can also install the binaries:
cmake --install .builddir --prefix .installdir
CMake creates the file tree:
PR also adds three separate workflows -- for Windows, Ubuntu and MacOS.
I've checked the building process on Windows and WSL. Unfortunately, I don't have a chance to check building on MacOS, except Github runners.
I also didn't manage to find out, how to build universal (fat) binaries on MacOS. Dumb specifying of compiler flags doesn't work on Github runners. However, these flags were specified in
configure.ac
fordarwin9
OS -- it's a bit deprecated now. =)If it's vital, I could find the way for cross-compiling to different targets. But it may be a bit difficult -- using CMakeToolchain files, for instance.
At the moment all workflows fail on unit-tests -- that's our good old issue #52.