-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 dependency libraries instead of bundling pre-built binaries. #3141
Conversation
c6e9d96
to
6ea310f
Compare
8a7cd44
to
33399f3
Compare
Another issue I am getting is that, when building
I get the following error
Not sure what the right way of solving this one is. |
562fb6d
to
5b6adc9
Compare
Likewise. Not sure what the fix is either. |
Oddly enough, I can fix that ImGui-SFML configuration error by adding the |
Have you looked into CPM.cmake and whether it would offer a simpler implementation? For example, CPM.cmake will let you specify options for fetched projects that you do stuff like build a dependency as a static library while not affecting the value of |
The initial version of this change used CPM.cmake and as much as I would have liked to keep using it it very quickly falls apart when trying to add dependencies that can't be bothered to adhere to standard CMake practices. The fact that we have to patch many dependencies should already be a red flag that CPM.cmake isn't going to have a good time with them. |
@binary1248 if have a bit of time, could you look at what's causing the error that is mentioned by Vittorio? I really like to include this for the next RC, so that we have more people than just the SFML Team to try out this change. In my opinion this is on the critical path. For one we've decided to move in this direction many years ago, but more importantly this will unlock a lot of new possibilities, such as HarfBuzz or Opus support. I don't think this should be held back for SFML 3.1 or similar, as it's quite a fundamental change in the dependency handling and will cause more issues, if users have to migrate between minor versions. |
If someone could add the appropriate tests for this scenario to CI it would be easier to ensure this change or any future changes don't break this functionality. It would also make it easier for me to fix the outstanding issue/issues without having to make sure my local test environment matches what is expected. |
I added those tests two years ago. #2206
The problem is that this error only occurs if you omit the SFML/test/install/CMakeLists.txt Line 16 in e21ba4d
|
Is it? Notice how all our CI build jobs still work without modification. What about users' workflows will change if we merge this? |
I narrowed it down to the difference between using Simple repo:
It works if you run instead CMakeLists.txt cmake_minimum_required(VERSION 3.28)
project(CMakeSFMLProject LANGUAGES CXX)
set(SFML_STATIC_LIBRARIES ON)
find_package(SFML REQUIRED COMPONENTS Graphics Audio)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE SFML::Graphics SFML::Audio) main.cpp #include <SFML/Graphics.hpp>
int main()
{
auto window = sf::RenderWindow({1920u, 1080u}, "CMake SFML Project");
window.setFramerateLimit(144);
while (window.isOpen())
{
for (auto event = sf::Event(); window.pollEvent(event);)
{
if (event.type == sf::Event::Closed)
{
window.close();
}
}
window.clear();
window.display();
}
} |
I don't know if there is a solution to allow Personally, I'm also fine to merge this as is and discourage usage of |
5b6adc9
to
444873d
Compare
https://github.com/SFML/SFML/actions/runs/11921570055/job/33225979792 I recreated the error in CI. |
Also, I asked on CMake's Discourse: https://discourse.cmake.org/t/problem-with-fetchcontent-dependencies-when-using-xyz-dir-xyz-root-works/12987 |
007c481
to
6827f7c
Compare
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.
Generally looks good. Some small comments and I still need to retest it.
Tested it successfully locally. It's awesome to know that we no longer depend on pre-built binaries. The build time also doesn't seem to drastically increase for me. We may want to consider updating some of the dependencies after this PR. |
6827f7c
to
bbad388
Compare
Remember when Bromeon opened an internal proposal for this in September 2015? 😄 Let's see what we broke with this change, but I'm excited to see all the possibilities ahead! |
I want to mention a few observations as I update some projects to the latest state of
|
Title.
In order to:
This change gets rid of the packaged pre-built dependencies and builds them alongside the SFML modules.
It would be nice to get this into SFML 3 so that we have a clean environment to start adding some bigger features in SFML 4.
Currently the focus was on getting this to build successfully on CI, however more widespread testing will be necessary especially on more exotic platforms that we don't currently cover in our CI. The goal is to support as many platforms as is feasible as long as they are still considered somewhat up-to-date.