-
Notifications
You must be signed in to change notification settings - Fork 125
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
build: Build system overhaul #1686
base: master
Are you sure you want to change the base?
Conversation
Thanks for providing the draft. I'll happily work on bringing the FreeBSD support in the new build system up to date. I don't have experience with the other two major BSDs, OpenBSD and NetBSD, but at least for FreeBSD we can get 99% of the work done by just building like the Linux target. I'll report back soon. I have already encountered a build failure trying to build your cmake branch:
That's because After the regex replacement we get the commit hash https://github.com/jcm93/ares/blob/1cae50b7a3b30f67a9c41acdeac7079765eae8da/CMakeLists.txt#L7 Probably document in And using |
The code expects to live on the ares-emulator/ares repo, and the version derivation seeks out tags, which my fork doesn't have. I can add a better failure mode for this case, but in the meantime you can fix this by adding |
Thanks, yes this solves my issue. I made some attempts to improve the FreeBSD support for the overhauled build system in my branch https://github.com/bsdcode/ares/tree/cmake, which is rebased on your cmake branch. The commit bsdcode@0b34c49 mostly puts missing Commit bsdcode@3a3477d enables the ALSA audio driver by default again (an Unfortunately there's still a problem with the FreeBSD build:
The library path for some modules aren't propagated to the build system. In the case of I do realize that this problem doesn't occur for modules for which you provide Finder Modules under I don't know what's the proper way to tackle the problem. Might additional finder modules help? For now I add I would expect the same problems in the Linux build, because I would be very surprised if the build behaviour differs in that regard between Linux and FreeBSD systems. |
Could you clear your build directory, then run generation with the options Assuming you have the development package for X11 installed (if this exists on BSD), the module that CMake found there should be sufficient to propagate all the necessary information and libraries back up to our targets, and I prefer not to write find modules unless it is required to. But if it isn't for any reason working out of the box then we will indeed move to a find module. |
And thanks very much for your work! |
Of course.
Packages aren't split into development and non-development packages on FreeBSD in general. So the relevant headers and libraries are installed. In fact, the build system does find the shared libraries in their correct places and propagates them, e.g.
No problem, I'm glad to help. |
I'm taking a look at this; I don't think that -lX11 and -lXext should actually be in there in the first place, since both libraries are already explicitly enumerated in the linker command. If we remove X11 from the target_link_libraries commands for both ruby and hiro, |
I think it's something in the Cleaning that up should be something of a priority; ideally we will not have any |
Turns out the problem was me all along; the |
Thanks for fixing this issue. I rebased my branch on your latest commits and applied a small fix to the PulseAudio find module (typo in I need to test the cmake build system a little bit more, but in general I'd say FreeBSD support is there again ;) |
Cool, and thanks for the fixes there. If you don't mind hanging tight, I still need to decide what I'm doing about the commit history, how many commits we want, etc. So I might make some more commits and squash and ask you to rebase, or I may just pull your changes in; I'll figure it out. In any case thanks again (and do let me know if you run into anything else in testing). |
Yes no problem, I'll continue rebasing until you figure it out. Feel free to squash, apply or commit my changes in any way you like. The configuration process had some warnings for the AO and librashader modules. So I cleaned the finder modules up a little bit. I also added the version info to the GTK finder module. This way we get some version infos for the dependencies in the configuration process, of course this is solely cosmetic. I squashed all changes to the finder modules into one commit, this includes the previous PulseAudio fix. I added a check for I also realized that the udev and uhid input drivers, and the pulseaudio_simple audio driver, aren't included yet. Is this on purpose or should they be added back? The
I think this is only cosmetic, but should it be only set in With the current librashader finder module the shared library And last but not least, the build process generates the tools |
I'm still not sure what |
I'll probably handle this by abstracting the location for the shaders into a variable; if ARES_ENABLE_LIBRASHADER is on, failing to install shaders is a legitimate install failure (edit: after thinking about this, maybe it isn't and there should be a bit more abstraction); in any case, having hardcoded their location into the I think that slang-shaders not having real distribution is an upstream issue, hence my willingness to try to pre-package them in
Kinda complicated; I would like to be able to know at build-time if librashader is going to be functional, and actually linking lets us verify we have the right ABI and architecture for the target platform, among other things; it makes the build more debuggable. I'll give it some thought though.
Not intentional, just slipped through; I'll re-add them (and figure out what pulse simple is vs. ordinary Pulse).
I think it's fine to have them built when building all targets, since they are indeed currently part of the project. |
Ah ok, I understand your thought. I looked at some Linux packaging for ares (Debian, OpenSuse, Arch and Flatpak). They all seem to install the vendored slang shaders from ares. On FreeBSD we have a seperate port and package for the slang shaders from the libretro project. Because we don't want to duplicate the shaders, the ares port doesn't package the vendored shaders from ares, but instead I apply a small patch in order to look for the location of the shaders from the libretro package as a last-resort fallback if ares can't find shaders in its own datadir. With this usecase in mind it's preferable to have librashader support with
That's fine.
|
desktop-ui building sourcery is correct because There isn't an out-of-the-box way to The idiomatic solution for only installing some things is to define install "components". I think this might be easy but I haven't looked at it yet. I will though.
In this case I might take a look at treating slang-shaders as a proper CMake target and searching for it like other libraries, because I'd like to make life easier for anyone packaging/distributing things properly. I don't know how weird this is for libraries that are "data-only"; and it's also possible it might require some upstreaming work, since it's a bit awkward if I'm looking for slang-shaders in a way that's specific only to BSD. I'll look at how that package is defined compared to the upstream (and the relevant CMake stuff) and report back. |
There's nothing special to it. The port just makes a package out of the contents of the slang-shaders repository. The FreeBSD port just installs the shaders into
I think such a cmake finder module could be similar to your And thanks for trying to make life easier for us packagers :) |
You'd probably expect that it would be enough to have a driver for libpulse or libpulse-simple and not both, but empirically I have found that one worked beautifully and the other had crackling, while other people reported the other way around. So, Near left them both in. |
A test hardness for Intel 8080 CPU emulation |
Ah, it's in the tests folder. How did I miss that? Anyway, I think in that case it shouldn't be getting compiled if I specify select cores (for example |
A few changes:
|
Rebased my branch. Additional fixes:
Thanks for the slang-shaders find module. Do you think we can use the I'm already working on a work-in-progress update of the FreeBSD ares port which uses cmake. It already simplifies and streamlines the port quite a bit and works really well. So thanks :) |
librashader always being linked is on purpose, and you should not override this behavior. if
Yes; the intention of the find module and #1688 was to enable this future work. Note that I would not attempt to pass that actual variable into ares, but rather just tell ares to look for shaders in standard paths once 1688 lands with the |
Woops. That was a VM copy-paste issue. It is indeed a good idea to link the libraries, thanks. I don't really foresee a scenario where we have libpulse-simple but not libpulse, or vice versa (unless this can happen, feel free to advise me on this point), so I just added the simple library to the existing find module. |
2510754
to
ff183b2
Compare
I'm not aware of any Pulseaudio packaging crazy enough to split them apart. I'd say we are safe here. It seems |
Yeah, it seems that CMAKE_INTERPROCEDURAL_OPTIMIZATION is not a property that supports generator expressions. Some properties do, but not this one. The solution is just to set CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> for each configuration manually (and probably guard it behind CheckIPOSupported, which isn't done yet either). Overall the build optimization settings will still be in flux; out-of-band, I'm dealing with an issue where clang-cl performance on Windows is significantly worse than with MSYS2/MinGW clang. Things might still change or break in that area until I get optimizations sorted out and organized. |
378f829
to
e607e00
Compare
The This is only relevant when rebasing against the master branch, where stringize.hpp was removed. |
a271186
to
925ce22
Compare
I anticipate that I will soon take this out of the draft stage. I plan to do more work on CI on my fork to make sure signing is working. I will squash this down into a couple of commits before taking it out of draft. Here is a current list of known issues:
|
Documentation for the build is now on the wiki and is considered to be in OK shape. Install instructions for Linux are naturally in flux because until this is merged and a release cut, no distribution channels use the new system yet. I do plan to investigate Ubuntu and Flatpak packaging when time permits. It is however currently deficient for BSD build instructions. I think that this page can be pretty much carbon-copied from the Linux page; I would have already done so, but I lost my package list for BSD and haven't had time to go back and figure them out again. |
Yes indeed, the build instructions are the same for Linux and BSD (well, at least for FreeBSD).
Don't worry, I've got you covered.
In a terminal window, install ares dependencies using
Compiling with Ninja and Ccache is optional, but generally recommended:
Next, install required ares dependencies:
Lastly, install optional dependencies:
|
Two additional cosmetic remarks:
|
…ents, update dependencies
Co-authored-by: Stefan Schlosser <[email protected]>
Co-authored-by: Stefan Schlosser <[email protected]>
Co-authored-by: Stefan Schlosser <[email protected]>
This PR introduces a new CMake-based build system for ares.
Broadly, the goals of this build system are to:
There are a few notable changes that this PR brings about. Briefly:
Other notes:
New Features
ares can now generate projects for Xcode and Visual Studio 17 2022. Xcode is the recommended generator on macOS, supporting universal binaries, advanced profiling and GPU debugging. Visual Studio projects can be configured with either Clang-CL or MSVC, and may be generated for either x86_64 or arm64.
On macOS and Windows, dynamic dependencies are now built by ares-deps and fetched at configure-time. This is to reduce build requirements for development, define explicit versioning for dependencies, reduce build times generally, and streamline CI workflows.
Builds can now be configured through the default Windows command line rather than requiring an MSYS2/MinGW shell.
Ccache is also now universally supported to improve build performance. Compile times should be further reduced with the addition of precompilation of certain headers.
A variety of other build system generators are now supported on all platforms, including multi-configuration Ninja and applicable types of Makefiles.
Compiler diagnostic flags with clang have been standardized across all platforms where possible1. Currently, diagnostic flags have rough parity with the old build system, but one goal of the new build system is to introduce more strict compiler settings, to eliminate certain classes of bugs and generally increase code quality.
Supported Platforms
ARM64 and x86_64 architectures are officially supported across macOS, Windows, Linux, and BSD1. clang, Clang-CL, gcc, and MSVC are all supported on applicable platforms. MSYS2/MinGW is supported along with configuration and builds via the default Windows shell.
32-bit builds have not been tested.
Current Status
Builds across all three of macOS, Windows, Linux, and BSD are generally expected to work. Detailed build instructions can be found on the new ares wiki. CI workflows are present and implemented but are still a work in progress. More complete documentation is also a work in progress.
macOS
-DCMAKE_OSX_ARCHITECTURES
as appropriate.install
rules are placeholders.Windows
install
commands.Linux / BSD
rundir
; ares only uses system libraries so this rundir should be fully relocatableinstall
will perform a standard installation as CMake deems appropriate for your distribution; you may pass the--prefix
argument as neededImportant
These tasks should be completed before this PR moves out of the draft state:
CI workflows- incompleteBSD supportWindows SDL added to ares-depsares-deps should probably be migrated to the ares-emulator organizationNevertheless, now that builds are functioning on all three platforms, I wanted to get this PR out there in a draft state to solicit testing and feedback, as well as to give Linux package maintainers a head start in terms of packaging.
Note
While the PR is in a draft state, there may be breaking changes, things may temporarily stop functioning, commits may be squashed, etc. Thank you for testing and please report any issues you encounter!
Miscellaneous changes/points
.gersemirc
fileFootnotes
Indicates something that might not be finished yet, or is subject to change ↩ ↩2