LadybirdBrowser / ladybird

Truly independent web browser
https://ladybird.org
BSD 2-Clause "Simplified" License
22.26k stars 988 forks source link

Windows support #38

Open diegoiast opened 5 months ago

diegoiast commented 5 months ago

This is a meta issue to track all the issues needed for a Windows support.

Goals:

  1. We aim to support clang-cl. This is the first priority.
  2. Later on, cl, from 2022. This is a very low priority.
  3. If we manage to get some mingw toolchain to compile the program - I am happy. But this is not a goal.

Problems:

Known forks, branches:

Please do not comment on this issue unless you have something to contribute. This issue is one of the boss-issues - it will take time. Problems and goals will change, nothing is written in stone, provide code if you can.

asutoshvariar commented 4 months ago

Could std::chrono be used as a replacement for the POSIX-only sys/time.h, as it's present in the C++ 20 standard?

ADKaster commented 4 months ago

We have a patch hiding in one of those mentioned branches to make AK::Time and AK::Duration work well on windows, so that's not an issue at the moment.

seanmiddleditch commented 4 months ago

[[no_unique_address]] not supported (am I using a wrong compiler? I use MSVC 2022 and its clang-cl)

A separate msvc::no_unique_address attribute must currently be used instead for ABI reasons: https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi

This is true in clang-cl too, using a recent-enough version: https://github.com/llvm/llvm-project/pull/65675

R-Goc commented 3 months ago

Why find an alternative to fontconfig? It works on windows and even compiles with clang-cl. It needs to have config files shipped for it as windows doesn't provide any. It is used in GIMP for example.

niutech commented 3 months ago

Have anyone tried to build Ladybird in Cygwin/MSYS2? They provide some POSIX compatibility layer for Windows.

ADKaster commented 3 months ago

As stated in the first post of the issue, Cygwin and Mingw are not a goal. Native windows with clang-cl and wsl2 with wslg are the only two windows configurations we will support in this repository.

R-Goc commented 3 months ago

Maybe a github discussions tab, or other way of collaboration could be opened to avoid spamming this tracking issue. This will need more work. (Also how to get cmake to find ICU data?)

bojantorbica commented 3 months ago

@R-Goc I'm currently trying to prepare a native windows build, I've downloaded the icu4c library and have added an environment variable ICU_ROOT to point to the root folder of the ICU lib (where include, lib folders are located). This should be enough for CMake to find it.

Currently "stuck" on PkgConfig and JPEG.

R-Goc commented 3 months ago

pkgconfig looks like is only needed as a build tool so I guess the version distributed with MinGW (like in w64devkit) should work. How did you deal with skia?

diegoiast commented 3 months ago

Hi all,

This is not the place for such discussions. The project has a discord channel. Use that instead of this issue.

pheonixfirewingz commented 1 month ago

@diegoiast I have got the checks of 2 and 3 working in this pr if or when it is merged(✅) Platform Windows: Get CMake working to build Windows-native build #1695](https://github.com/LadybirdBrowser/ladybird/pull/1695) vcpkg can build font-config and other library's except FFMPEG this is disabled for this config. the PR sets up CMake to be able to construct the browser with ClangCL but was Working with MSVC first.

pheonixfirewingz commented 1 month ago

This is a meta issue to track all the issues needed for a Windows support.

Goals:

  1. We aim to support clang-cl. This is the first priority.
  2. Later on, cl, from 2022. This is a very low priority.
  3. If we manage to get some mingw toolchain to compile the program - I am happy. But this is not a goal.

Problems:

  • [x] ~Some compiler flags are not compatible with clang-cl.~ (Meta/Windows: fix compilation flags for clang-cl #77)
  • [ ] We need a package manager to handle building 3rd parties (ICU, fontconfig?, Skia, WABT, more?)
  • [ ] We need to find an alternative to fontconfig.
  • [ ] 'sys/time.h' not found
  • [ ] [[no_unique_address]] not supported (am I using a wrong compiler? I use MSVC 2022 and its clang-cl)
  • [ ] We need to pull code from previous attempts of this kind of work. (cherry-picks, rebase etc).
  • [ ] Need to understand how to run the commit linters on the local machine, as we don't want developers to spam the CI/CD with phantom builds, just to fix a typo on the commit log (yes, that is directed at me)

Known forks, branches:

Please do not comment on this issue unless you have something to contribute. This issue is one of the boss-issues - it will take time. Problems and goals will change, nothing is written in stone, provide code if you can.

updated list

  • [x] ~Some compiler flags are not compatible with clang-cl.~ (Meta/Windows: fix compilation flags for clang-cl #77)
  • [X] We need a package manager to handle building 3rd parties (ICU, fontconfig?, Skia, WABT, more?)
  • [X] We need to find an alternative to fontconfig.
  • [ ] 'sys/time.h' not found
  • [ ] [[no_unique_address]] not supported (am I using a wrong compiler? I use MSVC 2022 and its clang-cl)
  • [ ] We need to pull code from previous attempts of this kind of work. (cherry-picks, rebase etc).
  • [ ] Need to understand how to run the commit linters on the local machine, as we don't want developers to spam the CI/CD with phantom builds, just to fix a typo on the commit log (yes, that is directed at me)
R-Goc commented 1 month ago

[[no_unique_address]] is a known thing. In short because of compatibility it is a noop. On msvc and clang-cl which attempts to match cl, you need to use [[msvc::no_unique_address]]. See https://github.com/llvm/llvm-project/issues/49358 for reference. So to support it, realistically you need to do it C style with a macro that replaces the attribute depending on the compiler. Maybe some time in the future when MSVC decides to break ABI again this would be changed, but no clue when or even if that would happen.