ladybird/Meta/Lagom
2026-06-13 10:30:02 -04:00
..
.gitignore Lagom: Move this into Meta/ 2019-11-18 09:07:05 +01:00
get_linked_lagom_libraries.cmake Lagom: Skip IMPORTED targets in get_linked_lagom_libraries 2022-09-16 07:48:51 -04:00
ReadMe.md Meta: Hoist the Fuzzers directory up one level 2026-06-13 10:30:02 -04:00

Lagom

The Serenity C++ libraries, for other Operating Systems.

About

If you want to bring the comfortable Serenity classes with you to another system, look no further. This is basically a "port" of the AK and LibCore libraries to generic *nix systems.

Lagom is a Swedish word that means "just the right amount." (Wikipedia)

Lagom is used by the Serenity project in the following ways:

Using Lagom in an External Project

It is possible to use Lagom for your own projects outside of Serenity too!

An example of this in use can be found in the LibJS test262 runner.

To implement this yourself:

  • Download a copy of SerenityOS/libjs-test262/cmake/FetchLagom.cmake and place it wherever you wish
  • In your root CMakeLists.txt, add the following commands:
    include(FetchContent)
    include(cmake/FetchLagom.cmake) # If you've placed the file downloaded above differently, be sure to reflect that in this command :^)
    
  • In addition, you will need to also add some compile options that Serenity uses to ensure no warnings or errors:
    add_compile_options(-Wno-literal-suffix) # AK::StringView defines operator""sv, which GCC complains does not have an underscore.
    add_compile_options(-fno-gnu-keywords)   # JS::Value has a method named typeof, which also happens to be a GNU keyword.
    

Now, you can link against Lagom libraries.

Things to keep in mind:

  • You should prefer to use a library's Lagom:: alias when linking
    • Example: Lagom::Core vs LibCore
  • If your application has name clashes with any names in AK, you may have to define USING_AK_GLOBALLY=0 for the files that have visibility to both sets of headers.