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

Interest in build system upgrades and DevOps integrations #7

Open
tcumby opened this issue Oct 8, 2022 · 12 comments
Open

Interest in build system upgrades and DevOps integrations #7

tcumby opened this issue Oct 8, 2022 · 12 comments

Comments

@tcumby
Copy link

tcumby commented Oct 8, 2022

On my fork of this repo I've been working on converting this project over to a CMake build system as well as replacing the python packaging with scikit-build, which was created to drive a CMake build system as part as packaging a python *.whl. At this stage, if some user wants to install the rss_ringoccs python package from my fork the user only needs to run

cd rss_ringoccs/
pip install .

and the required build and installed dependencies will be installed (including cmake) and then CMake will be executed to build the various libraries as part of the python packaging.

With this python packaging, I was easily able to add Github CI integrations, namely a CMake build automation to test builds on Linux, macOS and Windows (I added Windows build support as I'm on Windows) in addition to python packaging (on Python 3.6 - 3.9). This Github CI python action also executes a number of pytest tests (I converted a number of smoke tests written in python to pytest) so that when ever a git push occurs to origin, these tests are executed as part of the Github CI python action. In essence, whenever a developer pushes code changes they are built an tested in a clean environment with any issues reported back to the developer (via email and notifications in github).

I'm curious if there is any interest in incorporating these changes via a pull request?

p.d. I added Windows/MSVC support following the approach of libcerf, namely avoid Microsoft's non-standard C complex libraries and instead use the C++ std::complex implementation, which is standard.

@RichardGFrench
Copy link
Collaborator

RichardGFrench commented Oct 8, 2022 via email

@ryanmaguire
Copy link
Collaborator

ryanmaguire commented Oct 9, 2022 via email

@ryanmaguire
Copy link
Collaborator

ryanmaguire commented Oct 9, 2022 via email

@tcumby
Copy link
Author

tcumby commented Oct 9, 2022

Hi Ryan,

Thanks for the feedback. Your method of supporting cross-platform development sounds far better; I merely went the C++ route after partially working through MSVC's non-standard complex number implementation only to find that libcerf supports only C++ on MSVC. I definitely worried that I'd violated one or more rules and certainly and certainly peppering source with #ifdef __cplusplus is no one's idea of pretty code.

Yes, CMake is a not for everyone, but it really has become the dominate build system generator for C++ development at least. Also, modern CMake (i.e. the new target-based way to defining your build) is far nicer than what it used to be, and allows you to offload a lot of complexity onto the build system. Given how common it has become, it does make the prospect of integrating other libraries/frameworks far easier.

Regarding the kernel download scripts, I merely rewrote them in python 3 (example), but they could likely be written in CMake as well. I wasn't entirely sure where they fit into the workflow (nor the frequency of use), so I just translated them to python and added sufficient logging. As these python scripts exist now, they could trivially added as a console script /entry points such that pip installs them to the <python root>/bin folder (pip itself is an example of this).

If the download scripts were folded into the CMake build system (generally one uses FetchContent to do these tasks), I'd define one or more CMake variables that could be set from the command-line before building. It would likely be a little less flexible, in terms of the user-experience, but if the download only needs to happen once then perhaps it's not a big deal.

Is there any other aspect that you'd like someone else to look at?

Best regards,
Ty

@ryanmaguire
Copy link
Collaborator

ryanmaguire commented Oct 10, 2022 via email

@tcumby
Copy link
Author

tcumby commented Oct 11, 2022

In my fork I was working off of master. Likely I can still use some of the higher-level CMakeLists.txt files, but obviously I'll need to modify those and add new ones.

Regarding conditionally swapping out *.c with asm, yes I think that is possible. From an initial bit of research, CMake treats asm as it would any other language (example). Conditionally adding sources to a target is a simple exercise (Cmake allows you to separately declare a library target and specify its source files (see here were I declare the target for librssringoccs and one of the many examples where I add sources to that target). So, conditionally adding source files based on the compiler, or whether the files are even present, should be doable.

There do seem to be some sites (example) discussing NASM with Visual Studio. Likely I would want to add NASM in through a package manager. I'm using vcpkg right now and they only have YASM, but Conan has nasm for macOS, Linux and Windows. I'm only using vcpkg for a few dependencies at the moment (GSL and a C++ unit testing framework), so switching to Conan shouldn't be too drastic of a change.

@ryanmaguire
Copy link
Collaborator

ryanmaguire commented Oct 11, 2022 via email

@tcumby
Copy link
Author

tcumby commented Oct 15, 2022

I've started adding a CMake build system to libtmpl and my fork of the 1.3-dev branch of rss_ringoccs. Right now they're pretty rudimentary and lacking the full interfaces of make.sh.

I've add the same github CI action that executes Cmake builds in the Github CI for macOS, Ubuntu and Windows. Github CI's runners (e.g. here's the Ubuntu 22.04 image details) install a couple of gcc /clang as well as XCode and/or MSVC. I'm going to try to expand the github cmake action for libtmpl to span multiple compiler versions and/or other compilers.

Also, it might make sense to convert some of the unit tests over to one of the standard frameworks (Google Test, Catch2, ...) so that they can emit output that the Github CI can easily consume as part of the cmake github action.

@ryanmaguire
Copy link
Collaborator

ryanmaguire commented Oct 16, 2022 via email

@tcumby
Copy link
Author

tcumby commented Oct 24, 2022

The build system for libtmpl is mostly in place, but I'm reworking how the source file exclusions work so it is easier to maintain. I still need to set up toolchain files and preset files so as to make cross-compiling and general use easier.

Thanks for pointing out the complexities of long doubles. Google Test seemed to have reasonable methods for comparing floating point values, but I will have to see that it abstracts away the implementation details of long double. Also, it only supports clang, gcc and msvc compilers, so I might have to look elsewhere, or find a library that can allow one to generate a JUnit XML file "by hand".

@tcumby
Copy link
Author

tcumby commented Nov 25, 2022

I have the CMake system essentially ready for libtmpl and I'll be issuing a PR tomorrow.

FYI MSVC is limited to OpenMP 2.0, which doesn't allow unsigned integers as for loop index variables.

@ryanmaguire
Copy link
Collaborator

ryanmaguire commented Nov 25, 2022 via email

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

No branches or pull requests

3 participants